aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_linux_386.s
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2019-04-03 16:31:13 -0700
committerIan Lance Taylor <iant@golang.org>2019-10-20 21:15:55 +0000
commit3b0aa546d289390027ee1bf1a5e41f37f6131fa7 (patch)
tree631fafe6c7e524f3c27b5c58581bad68b0334390 /src/runtime/sys_linux_386.s
parent504fce98ba3052135ec1f9564e06819f42cdbc86 (diff)
downloadgo-3b0aa546d289390027ee1bf1a5e41f37f6131fa7.tar.gz
go-3b0aa546d289390027ee1bf1a5e41f37f6131fa7.zip
runtime: define nonblockingPipe
This requires defining pipe, pipe2, and setNonblock for various platforms. The new function is currently only used on AIX. It will be used by later CLs in this series. Updates #27707 Change-Id: Id2f987b66b4c66a3ef40c22484ff1d14f58e9b31 Reviewed-on: https://go-review.googlesource.com/c/go/+/171822 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/sys_linux_386.s')
-rw-r--r--src/runtime/sys_linux_386.s34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/runtime/sys_linux_386.s b/src/runtime/sys_linux_386.s
index 882f31cd64..2e4f66c55a 100644
--- a/src/runtime/sys_linux_386.s
+++ b/src/runtime/sys_linux_386.s
@@ -32,6 +32,7 @@
#define SYS_getpid 20
#define SYS_access 33
#define SYS_kill 37
+#define SYS_pipe 42
#define SYS_brk 45
#define SYS_fcntl 55
#define SYS_munmap 91
@@ -58,6 +59,7 @@
#define SYS_clock_gettime 265
#define SYS_tgkill 270
#define SYS_epoll_create1 329
+#define SYS_pipe2 331
TEXT runtime·exit(SB),NOSPLIT,$0
MOVL $SYS_exit_group, AX
@@ -131,6 +133,23 @@ TEXT runtime·read(SB),NOSPLIT,$0
MOVL AX, ret+12(FP)
RET
+// func pipe() (r, w int32, errno int32)
+TEXT runtime·pipe(SB),NOSPLIT,$0-12
+ MOVL $SYS_pipe, AX
+ LEAL r+0(FP), BX
+ INVOKE_SYSCALL
+ MOVL AX, errno+8(FP)
+ RET
+
+// func pipe2(flags int32) (r, w int32, errno int32)
+TEXT runtime·pipe2(SB),NOSPLIT,$0-16
+ MOVL $SYS_pipe2, AX
+ LEAL r+4(FP), BX
+ MOVL flags+0(FP), CX
+ INVOKE_SYSCALL
+ MOVL AX, errno+12(FP)
+ RET
+
TEXT runtime·usleep(SB),NOSPLIT,$8
MOVL $0, DX
MOVL usec+0(FP), AX
@@ -695,6 +714,21 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$0
INVOKE_SYSCALL
RET
+// func runtime·setNonblock(fd int32)
+TEXT runtime·setNonblock(SB),NOSPLIT,$0-4
+ MOVL $SYS_fcntl, AX
+ MOVL fd+0(FP), BX // fd
+ MOVL $3, CX // F_GETFL
+ MOVL $0, DX
+ INVOKE_SYSCALL
+ MOVL fd+0(FP), BX // fd
+ MOVL $4, CX // F_SETFL
+ MOVL $0x800, DX // O_NONBLOCK
+ ORL AX, DX
+ MOVL $SYS_fcntl, AX
+ INVOKE_SYSCALL
+ RET
+
// int access(const char *name, int mode)
TEXT runtime·access(SB),NOSPLIT,$0
MOVL $SYS_access, AX