// 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)
}
// 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) {
// 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)
}
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()
}()
package syscall
-func Ioctl(fd, req, arg uintptr) Errno {
- err := ioctl(int(fd), int(req), int(arg))
+import "unsafe"
+
+func IoctlPtr(fd, req uintptr, arg unsafe.Pointer) Errno {
+ err := ioctlPtr(int(fd), uint(req), arg)
if err != nil {
return err.(Errno)
}
package syscall
-func Ioctl(fd, req, arg uintptr) (err Errno) {
- _, _, err = Syscall(SYS_IOCTL, fd, req, arg)
+import "unsafe"
+
+func IoctlPtr(fd, req uintptr, arg unsafe.Pointer) (err Errno) {
+ _, _, err = Syscall(SYS_IOCTL, fd, req, uintptr(arg))
return err
}