github.com/noriah/catnip@v1.8.5/input/stdinput/unix.go (about) 1 package stdinput 2 3 import ( 4 "syscall" 5 _ "unsafe" 6 ) 7 8 //go:linkname fcntl runtime.fcntl 9 func fcntl(fd int32, cmd int32, arg int32) (int32, int32) 10 11 func Fcntl(fd int, cmd int, arg int) (int, error) { 12 val, errno := fcntl(int32(fd), int32(cmd), int32(arg)) 13 if val == -1 { 14 return int(val), syscall.Errno(errno) 15 } 16 return int(val), nil 17 }