From ff05cdbd2bdc28ab545a5964f7f772e2ea4c5fd1 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 13 Sep 2023 00:58:20 -0700 Subject: 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 Reviewed-by: Cherry Mui Reviewed-by: Michael Knyszek LUCI-TryBot-Result: Go LUCI TryBot-Result: Gopher Robot Reviewed-by: Michael Pratt --- src/syscall/exec_linux_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/syscall/exec_linux_test.go') 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() -- cgit v1.3