diff options
| author | Ian Lance Taylor <iant@golang.org> | 2023-05-18 21:13:03 -0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-05-20 20:32:54 +0000 |
| commit | 10532fdb141ae80140cd0f14637b9fe82f379688 (patch) | |
| tree | 6b956772c6e385d09180aec6c99be64f05f40c84 /src/runtime/os_linux.go | |
| parent | 9c447b7cf630cb158fe5059bee3cf03d5ce56f97 (diff) | |
| download | go-10532fdb141ae80140cd0f14637b9fe82f379688.tar.xz | |
runtime: change fcntl to return two values
Separate the result and the errno value, rather than assuming
that the result can never be negative.
Change-Id: Ib01a70a3d46285aa77e95371cdde74e1504e7c12
Reviewed-on: https://go-review.googlesource.com/c/go/+/496416
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/runtime/os_linux.go')
| -rw-r--r-- | src/runtime/os_linux.go | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go index f407e6a707..e6833509cc 100644 --- a/src/runtime/os_linux.go +++ b/src/runtime/os_linux.go @@ -467,13 +467,9 @@ func osyield_no_g() { func pipe2(flags int32) (r, w int32, errno int32) //go:nosplit -func fcntl(fd, cmd, arg int32) int32 { - r, _, errno := syscall.Syscall6(syscall.SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg), 0, 0, 0) - ri := int32(r) - if ri < 0 { - return -int32(errno) - } - return ri +func fcntl(fd, cmd, arg int32) (ret int32, errno int32) { + r, _, err := syscall.Syscall6(syscall.SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg), 0, 0, 0) + return int32(r), int32(err) } const ( |
