diff options
author | Ian Lance Taylor <iant@golang.org> | 2019-04-03 16:31:13 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2019-10-20 21:15:55 +0000 |
commit | 3b0aa546d289390027ee1bf1a5e41f37f6131fa7 (patch) | |
tree | 631fafe6c7e524f3c27b5c58581bad68b0334390 /src/runtime/sys_linux_amd64.s | |
parent | 504fce98ba3052135ec1f9564e06819f42cdbc86 (diff) | |
download | go-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_amd64.s')
-rw-r--r-- | src/runtime/sys_linux_amd64.s | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s index 7e8f5279ca..ae4d0ef060 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s @@ -21,6 +21,7 @@ #define SYS_rt_sigaction 13 #define SYS_rt_sigprocmask 14 #define SYS_rt_sigreturn 15 +#define SYS_pipe 22 #define SYS_sched_yield 24 #define SYS_mincore 27 #define SYS_madvise 28 @@ -46,6 +47,7 @@ #define SYS_faccessat 269 #define SYS_epoll_pwait 281 #define SYS_epoll_create1 291 +#define SYS_pipe2 293 TEXT runtime·exit(SB),NOSPLIT,$0-4 MOVL code+0(FP), DI @@ -113,6 +115,23 @@ TEXT runtime·read(SB),NOSPLIT,$0-28 MOVL AX, ret+24(FP) RET +// func pipe() (r, w int32, errno int32) +TEXT runtime·pipe(SB),NOSPLIT,$0-12 + LEAQ r+0(FP), DI + MOVL $SYS_pipe, AX + SYSCALL + MOVL AX, errno+8(FP) + RET + +// func pipe2(flags int32) (r, w int32, errno int32) +TEXT runtime·pipe2(SB),NOSPLIT,$0-20 + LEAQ r+8(FP), DI + MOVL flags+0(FP), SI + MOVL $SYS_pipe2, AX + SYSCALL + MOVL AX, errno+16(FP) + RET + TEXT runtime·usleep(SB),NOSPLIT,$16 MOVL $0, DX MOVL usec+0(FP), AX @@ -682,6 +701,20 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$0 SYSCALL RET +// func runtime·setNonblock(int32 fd) +TEXT runtime·setNonblock(SB),NOSPLIT,$0-4 + MOVL fd+0(FP), DI // fd + MOVQ $3, SI // F_GETFL + MOVQ $0, DX + MOVL $SYS_fcntl, AX + SYSCALL + MOVL fd+0(FP), DI // fd + MOVQ $4, SI // F_SETFL + MOVQ $0x800, DX // O_NONBLOCK + ORL AX, DX + MOVL $SYS_fcntl, AX + SYSCALL + RET // int access(const char *name, int mode) TEXT runtime·access(SB),NOSPLIT,$0 |