From d654f43d1a364201cce2d2c89f4819b8d72278c9 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 16 Sep 2020 11:08:18 +0200 Subject: [PATCH] Use IoctlSetPointerInt from golang.org/x/sys/unix Use unix.IoctlSetPointerInt instead of manually implementing it. This fixes the build on darwin where direct syscalls, i.e. unix.Syscall(SYS_IOCTL, ...) are no longer allowed and exported as of golang/sys@6fcdbc0 --- tc_darwin.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/tc_darwin.go b/tc_darwin.go index b0128ab..7871545 100644 --- a/tc_darwin.go +++ b/tc_darwin.go @@ -19,7 +19,6 @@ package console import ( "fmt" "os" - "unsafe" "golang.org/x/sys/unix" ) @@ -29,18 +28,10 @@ const ( cmdTcSet = unix.TIOCSETA ) -func ioctl(fd, flag, data uintptr) error { - if _, _, err := unix.Syscall(unix.SYS_IOCTL, fd, flag, data); err != 0 { - return err - } - return nil -} - // unlockpt unlocks the slave pseudoterminal device corresponding to the master pseudoterminal referred to by f. // unlockpt should be called before opening the slave side of a pty. func unlockpt(f *os.File) error { - var u int32 - return ioctl(f.Fd(), unix.TIOCPTYUNLK, uintptr(unsafe.Pointer(&u))) + return unix.IoctlSetPointerInt(int(f.Fd()), unix.TIOCPTYUNLK, 0) } // ptsname retrieves the name of the first available pts for the given master.