diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2018-08-22 14:01:52 +0200 |
---|---|---|
committer | Tobias Klauser <tobias.klauser@gmail.com> | 2018-08-24 07:28:54 +0000 |
commit | d8cf1514cadb512de6972e760ccef76452e3a67c (patch) | |
tree | fa79dccf6c59ab23ffa6f140dd9dc36cbdc2bed2 /src/internal/syscall/unix/nonblocking.go | |
parent | 9cfa41c826ba358dc6f911f72dfbfda8c13d27fe (diff) | |
download | go-git-d8cf1514cadb512de6972e760ccef76452e3a67c.tar.gz |
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: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/internal/syscall/unix/nonblocking.go')
-rw-r--r-- | src/internal/syscall/unix/nonblocking.go | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/internal/syscall/unix/nonblocking.go b/src/internal/syscall/unix/nonblocking.go index 818e9c91a5..1db3394432 100644 --- a/src/internal/syscall/unix/nonblocking.go +++ b/src/internal/syscall/unix/nonblocking.go @@ -6,18 +6,12 @@ package unix -import ( - "syscall" - _ "unsafe" // for go:linkname -) - -//go:linkname syscall_fcntl syscall.fcntl -func syscall_fcntl(fd int, cmd int, arg int) (val int, err error) +import "syscall" func IsNonblock(fd int) (nonblocking bool, err error) { - flag, err := syscall_fcntl(fd, syscall.F_GETFL, 0) - if err != nil { - return false, err + flag, _, e1 := syscall.Syscall(syscall.SYS_FCNTL, uintptr(fd), uintptr(syscall.F_GETFL), 0) + if e1 != 0 { + return false, e1 } return flag&syscall.O_NONBLOCK != 0, nil } |