aboutsummaryrefslogtreecommitdiff
path: root/src/syscall/exec_unix_test.go
diff options
context:
space:
mode:
authorDmitri Goutnik <dgoutnik@gmail.com>2023-02-20 06:55:42 -0500
committerGopher Robot <gobot@golang.org>2023-02-21 23:33:24 +0000
commitfeb355c427590df3aee7f3c0ee4adc0290c577a4 (patch)
tree9b9391487f81d92d8b0810a1cda421725151cd71 /src/syscall/exec_unix_test.go
parented33ae10a011c85f51be2c970f52d769722b0ec7 (diff)
downloadgo-feb355c427590df3aee7f3c0ee4adc0290c577a4.tar.xz
syscall: introduce IoctlPtr for exec_unix tests
Avoid passing Go pointers as uintptr in exec_unix_test.go by introducing syscall.IoctlPtr() which accepts arg as unsafe.Pointer. For #44834 Fixes #58609 Change-Id: I6d0ded023e5f3c9989783aee7075bb88100d9ec2 Reviewed-on: https://go-review.googlesource.com/c/go/+/469675 Run-TryBot: Dmitri Goutnik <dgoutnik@gmail.com> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/syscall/exec_unix_test.go')
-rw-r--r--src/syscall/exec_unix_test.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/syscall/exec_unix_test.go b/src/syscall/exec_unix_test.go
index 4253cda5cb..942a254cb9 100644
--- a/src/syscall/exec_unix_test.go
+++ b/src/syscall/exec_unix_test.go
@@ -177,7 +177,7 @@ func TestForeground(t *testing.T) {
// equivalent.
fpgrp := int32(0)
- errno := syscall.Ioctl(tty.Fd(), syscall.TIOCGPGRP, uintptr(unsafe.Pointer(&fpgrp)))
+ errno := syscall.IoctlPtr(tty.Fd(), syscall.TIOCGPGRP, unsafe.Pointer(&fpgrp))
if errno != 0 {
t.Fatalf("TIOCGPGRP failed with error code: %s", errno)
}
@@ -214,7 +214,7 @@ func TestForeground(t *testing.T) {
// This call fails on darwin/arm64. The failure doesn't matter, though.
// This is just best effort.
- syscall.Ioctl(tty.Fd(), syscall.TIOCSPGRP, uintptr(unsafe.Pointer(&fpgrp)))
+ syscall.IoctlPtr(tty.Fd(), syscall.TIOCSPGRP, unsafe.Pointer(&fpgrp))
}
func TestForegroundSignal(t *testing.T) {
@@ -228,7 +228,7 @@ func TestForegroundSignal(t *testing.T) {
// equivalent.
fpgrp := int32(0)
- errno := syscall.Ioctl(tty.Fd(), syscall.TIOCGPGRP, uintptr(unsafe.Pointer(&fpgrp)))
+ errno := syscall.IoctlPtr(tty.Fd(), syscall.TIOCGPGRP, unsafe.Pointer(&fpgrp))
if errno != 0 {
t.Fatalf("TIOCGPGRP failed with error code: %s", errno)
}
@@ -239,7 +239,7 @@ func TestForegroundSignal(t *testing.T) {
defer func() {
signal.Ignore(syscall.SIGTTIN, syscall.SIGTTOU)
- syscall.Ioctl(tty.Fd(), syscall.TIOCSPGRP, uintptr(unsafe.Pointer(&fpgrp)))
+ syscall.IoctlPtr(tty.Fd(), syscall.TIOCSPGRP, unsafe.Pointer(&fpgrp))
signal.Reset()
}()