aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_linux_386.s
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2015-03-02 20:16:48 -0800
committerKeith Randall <khr@golang.org>2015-03-03 17:46:36 +0000
commitf584c05fcc38fef1582681a7e2841b725f0a827d (patch)
tree5a96b88327f816c5e32b57090382df4b10793153 /src/runtime/sys_linux_386.s
parent74e88dfdeebef392d52d3f792e2071b058c1e231 (diff)
downloadgo-f584c05fcc38fef1582681a7e2841b725f0a827d.tar.xz
runtime: Update open/close/read/write to return -1 on error.
Error detection code copied from syscall, where presumably we actually do it right. Note that we throw the errno away. The runtime doesn't use it. Fixes #10052 Change-Id: I8de77dda6bf287276b137646c26b84fa61554ec8 Reviewed-on: https://go-review.googlesource.com/6571 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/runtime/sys_linux_386.s')
-rw-r--r--src/runtime/sys_linux_386.s12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/runtime/sys_linux_386.s b/src/runtime/sys_linux_386.s
index 2acce484cc..7d53aad59a 100644
--- a/src/runtime/sys_linux_386.s
+++ b/src/runtime/sys_linux_386.s
@@ -30,6 +30,9 @@ TEXT runtime·open(SB),NOSPLIT,$0
MOVL mode+4(FP), CX
MOVL perm+8(FP), DX
CALL *runtime·_vdso(SB)
+ CMPL AX, $0xfffff001
+ JLS 2(PC)
+ MOVL $-1, AX
MOVL AX, ret+12(FP)
RET
@@ -37,6 +40,9 @@ TEXT runtime·close(SB),NOSPLIT,$0
MOVL $6, AX // syscall - close
MOVL fd+0(FP), BX
CALL *runtime·_vdso(SB)
+ CMPL AX, $0xfffff001
+ JLS 2(PC)
+ MOVL $-1, AX
MOVL AX, ret+4(FP)
RET
@@ -46,6 +52,9 @@ TEXT runtime·write(SB),NOSPLIT,$0
MOVL p+4(FP), CX
MOVL n+8(FP), DX
CALL *runtime·_vdso(SB)
+ CMPL AX, $0xfffff001
+ JLS 2(PC)
+ MOVL $-1, AX
MOVL AX, ret+12(FP)
RET
@@ -55,6 +64,9 @@ TEXT runtime·read(SB),NOSPLIT,$0
MOVL p+4(FP), CX
MOVL n+8(FP), DX
CALL *runtime·_vdso(SB)
+ CMPL AX, $0xfffff001
+ JLS 2(PC)
+ MOVL $-1, AX
MOVL AX, ret+12(FP)
RET