Commit d8cf1514 authored by Tobias Klauser's avatar Tobias Klauser Committed by Tobias Klauser

internal/syscall/unix: don't use linkname to refer to syscall.fcntl

Just open-code the fcntl syscall instead of relying on the obscurity of
go:linkname.

Change-Id: I3e4ec9db6539e016f56667d7b8b87aa37671d0e7
Reviewed-on: https://go-review.googlesource.com/130736
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 9cfa41c8
...@@ -6,18 +6,12 @@ ...@@ -6,18 +6,12 @@
package unix package unix
import ( import "syscall"
"syscall"
_ "unsafe" // for go:linkname
)
//go:linkname syscall_fcntl syscall.fcntl
func syscall_fcntl(fd int, cmd int, arg int) (val int, err error)
func IsNonblock(fd int) (nonblocking bool, err error) { func IsNonblock(fd int) (nonblocking bool, err error) {
flag, err := syscall_fcntl(fd, syscall.F_GETFL, 0) flag, _, e1 := syscall.Syscall(syscall.SYS_FCNTL, uintptr(fd), uintptr(syscall.F_GETFL), 0)
if err != nil { if e1 != 0 {
return false, err return false, e1
} }
return flag&syscall.O_NONBLOCK != 0, nil return flag&syscall.O_NONBLOCK != 0, nil
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment