elvish/sys/ioctl.go
Shengjing Zhu 6331c1515b fix overflows on req arg in ioctl
Signed-off-by: Shengjing Zhu <i@zhsj.me>
2018-01-16 15:18:46 +01:00

20 lines
308 B
Go

// +build !windows,!plan9
package sys
import (
"os"
"golang.org/x/sys/unix"
)
// Ioctl wraps the ioctl syscall.
func Ioctl(fd int, req uintptr, arg uintptr) error {
_, _, e := unix.Syscall(
unix.SYS_IOCTL, uintptr(fd), req, arg)
if e != 0 {
return os.NewSyscallError("ioctl", e)
}
return nil
}