diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s index 5a94bda7c2..017e7dcaef 100644 --- a/src/runtime/sys_linux_amd64.s +++ b/src/runtime/sys_linux_amd64.s @@ -12,7 +12,6 @@ #define SYS_read 0 #define SYS_write 1 -#define SYS_open 2 #define SYS_close 3 #define SYS_mmap 9 #define SYS_munmap 11 @@ -41,9 +40,10 @@ #define SYS_sched_getaffinity 204 #define SYS_epoll_create 213 #define SYS_exit_group 231 -#define SYS_epoll_wait 232 #define SYS_epoll_ctl 233 +#define SYS_openat 257 #define SYS_pselect6 270 +#define SYS_epoll_pwait 281 #define SYS_epoll_create1 291 TEXT runtime·exit(SB),NOSPLIT,$0-4 @@ -65,10 +65,12 @@ TEXT runtime·exitThread(SB),NOSPLIT,$0-8 JMP 0(PC) TEXT runtime·open(SB),NOSPLIT,$0-20 - MOVQ name+0(FP), DI - MOVL mode+8(FP), SI - MOVL perm+12(FP), DX - MOVL $SYS_open, AX + // This uses openat instead of open, because Android O blocks open. + MOVL $-100, DI // AT_FDCWD, so this acts like open + MOVQ name+0(FP), SI + MOVL mode+8(FP), DX + MOVL perm+12(FP), R10 + MOVL $SYS_openat, AX SYSCALL CMPQ AX, $0xfffffffffffff001 JLS 2(PC) @@ -655,11 +657,13 @@ TEXT runtime·epollctl(SB),NOSPLIT,$0 // int32 runtime·epollwait(int32 epfd, EpollEvent *ev, int32 nev, int32 timeout); TEXT runtime·epollwait(SB),NOSPLIT,$0 + // This uses pwait instead of wait, because Android O blocks wait. MOVL epfd+0(FP), DI MOVQ ev+8(FP), SI MOVL nev+16(FP), DX MOVL timeout+20(FP), R10 - MOVL $SYS_epoll_wait, AX + MOVQ $0, R8 + MOVL $SYS_epoll_pwait, AX SYSCALL MOVL AX, ret+24(FP) RET diff --git a/src/runtime/sys_linux_mips64x.s b/src/runtime/sys_linux_mips64x.s index 784e187e73..50e103bb63 100644 --- a/src/runtime/sys_linux_mips64x.s +++ b/src/runtime/sys_linux_mips64x.s @@ -16,7 +16,7 @@ #define SYS_exit 5058 #define SYS_read 5000 #define SYS_write 5001 -#define SYS_open 5002 +#define SYS_openat 5247 #define SYS_close 5003 #define SYS_getpid 5038 #define SYS_kill 5060 @@ -42,7 +42,7 @@ #define SYS_exit_group 5205 #define SYS_epoll_create 5207 #define SYS_epoll_ctl 5208 -#define SYS_epoll_wait 5209 +#define SYS_epoll_pwait 5272 #define SYS_clock_gettime 5222 #define SYS_epoll_create1 5285 #define SYS_brk 5012 @@ -67,10 +67,12 @@ TEXT runtime·exitThread(SB),NOSPLIT|NOFRAME,$0-8 JMP 0(PC) TEXT runtime·open(SB),NOSPLIT|NOFRAME,$0-20 - MOVV name+0(FP), R4 - MOVW mode+8(FP), R5 - MOVW perm+12(FP), R6 - MOVV $SYS_open, R2 + // This uses openat instead of open, because Android O blocks open. + MOVW $-100, R4 // AT_FDCWD, so this acts like open + MOVV name+0(FP), R5 + MOVW mode+8(FP), R6 + MOVW perm+12(FP), R7 + MOVV $SYS_openat, R2 SYSCALL BEQ R7, 2(PC) MOVW $-1, R2 @@ -423,11 +425,13 @@ TEXT runtime·epollctl(SB),NOSPLIT|NOFRAME,$0 // int32 runtime·epollwait(int32 epfd, EpollEvent *ev, int32 nev, int32 timeout); TEXT runtime·epollwait(SB),NOSPLIT|NOFRAME,$0 + // This uses pwait instead of wait, because Android O blocks wait. MOVW epfd+0(FP), R4 MOVV ev+8(FP), R5 MOVW nev+16(FP), R6 MOVW timeout+20(FP), R7 - MOVV $SYS_epoll_wait, R2 + MOVV $0, R8 + MOVV $SYS_epoll_pwait, R2 SYSCALL MOVW R2, ret+24(FP) RET