diff options
| author | Kir Kolyshkin <kolyshkin@gmail.com> | 2023-09-13 00:58:20 -0700 |
|---|---|---|
| committer | Michael Knyszek <mknyszek@google.com> | 2023-11-21 22:23:07 +0000 |
| commit | ff05cdbd2bdc28ab545a5964f7f772e2ea4c5fd1 (patch) | |
| tree | 59117b27db216ec5b35ee56e6aeac7a69560a05f /src/syscall/exec_linux_test.go | |
| parent | 5a6f1b35d42dca8e3e7646ee36fa1344ce5bc775 (diff) | |
| download | go-ff05cdbd2bdc28ab545a5964f7f772e2ea4c5fd1.tar.xz | |
internal/syscall/unix: add PidFDSendSignal for Linux
CL 520266 added pidfd_send_signal linux syscall numbers to the
syscall package for the sake of a unit test.
As pidfd_send_signal will be used from the os package, let's revert the
changes to syscall package, add the pidfd_send_signal syscall numbers
and the implementation to internal/syscall/unix, and change the above
test to use it.
Updates #51246.
For #62654.
Change-Id: I862174c3c1a64baf1080792bdb3a1c1d1b417bb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/528436
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/syscall/exec_linux_test.go')
| -rw-r--r-- | src/syscall/exec_linux_test.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/syscall/exec_linux_test.go b/src/syscall/exec_linux_test.go index 976275e1dc..68ec6fe3f8 100644 --- a/src/syscall/exec_linux_test.go +++ b/src/syscall/exec_linux_test.go @@ -12,6 +12,7 @@ import ( "flag" "fmt" "internal/platform" + "internal/syscall/unix" "internal/testenv" "io" "os" @@ -560,11 +561,11 @@ func testPidFD(t *testing.T, userns bool) error { // Use pidfd to send a signal to the child. sig := syscall.SIGINT - if _, _, e := syscall.Syscall(syscall.Sys_pidfd_send_signal, uintptr(pidfd), uintptr(sig), 0); e != 0 { - if e != syscall.EINVAL && testenv.SyscallIsNotSupported(e) { - t.Skip("pidfd_send_signal syscall not supported:", e) + if err := unix.PidFDSendSignal(uintptr(pidfd), sig); err != nil { + if err != syscall.EINVAL && testenv.SyscallIsNotSupported(err) { + t.Skip("pidfd_send_signal syscall not supported:", err) } - t.Fatal("pidfd_send_signal syscall failed:", e) + t.Fatal("pidfd_send_signal syscall failed:", err) } // Check if the child received our signal. err = cmd.Wait() |
