From c7cc2b94c63af610a29b1b48cfbfb87cb8abf05b Mon Sep 17 00:00:00 2001 From: Andrew Pogrebnoy Date: Fri, 7 Oct 2022 10:12:54 +0300 Subject: runtime: move epoll syscalls to runtime/internal/syscall This change moves Linux epoll's syscalls implementation to the "runtime/internal/syscall" package. The intention in this CL was to minimise behavioural changes but make the code more generalised. This also will allow adding new syscalls (like epoll_pwait2) without the need to implement assembly stubs for each arch. It also drops epoll_create as not all architectures provide this call. epoll_create1 was added to the kernel in version 2.6.27 and Go requires Linux kernel version 2.6.32 or later since Go 1.18. So it is safe to always use epoll_create1. This is a resubmit as the previous CL 421994 was reverted due to test failures after the merge with the master. The issue was fixed in CL 438615 For #53824 For #51087 Change-Id: I1bd0f23a85b4f9b80178c5dd36fd3e95ff4f9648 Reviewed-on: https://go-review.googlesource.com/c/go/+/440115 Reviewed-by: Dmitri Shuralyov TryBot-Result: Gopher Robot Auto-Submit: Michael Pratt Reviewed-by: Michael Pratt Run-TryBot: Michael Pratt --- src/runtime/sys_linux_s390x.s | 52 ------------------------------------------- 1 file changed, 52 deletions(-) (limited to 'src/runtime/sys_linux_s390x.s') diff --git a/src/runtime/sys_linux_s390x.s b/src/runtime/sys_linux_s390x.s index c82cb9b4aa..777a4747d4 100644 --- a/src/runtime/sys_linux_s390x.s +++ b/src/runtime/sys_linux_s390x.s @@ -17,7 +17,6 @@ #define SYS_getpid 20 #define SYS_kill 37 #define SYS_brk 45 -#define SYS_fcntl 55 #define SYS_mmap 90 #define SYS_munmap 91 #define SYS_setitimer 104 @@ -35,15 +34,11 @@ #define SYS_sched_getaffinity 240 #define SYS_tgkill 241 #define SYS_exit_group 248 -#define SYS_epoll_create 249 -#define SYS_epoll_ctl 250 -#define SYS_epoll_wait 251 #define SYS_timer_create 254 #define SYS_timer_settime 255 #define SYS_timer_delete 258 #define SYS_clock_gettime 260 #define SYS_pipe2 325 -#define SYS_epoll_create1 327 TEXT runtime·exit(SB),NOSPLIT|NOFRAME,$0-4 MOVW code+0(FP), R2 @@ -589,53 +584,6 @@ TEXT runtime·sched_getaffinity(SB),NOSPLIT|NOFRAME,$0 MOVW R2, ret+24(FP) RET -// int32 runtime·epollcreate(int32 size); -TEXT runtime·epollcreate(SB),NOSPLIT|NOFRAME,$0 - MOVW size+0(FP), R2 - MOVW $SYS_epoll_create, R1 - SYSCALL - MOVW R2, ret+8(FP) - RET - -// int32 runtime·epollcreate1(int32 flags); -TEXT runtime·epollcreate1(SB),NOSPLIT|NOFRAME,$0 - MOVW flags+0(FP), R2 - MOVW $SYS_epoll_create1, R1 - SYSCALL - MOVW R2, ret+8(FP) - RET - -// func epollctl(epfd, op, fd int32, ev *epollEvent) int -TEXT runtime·epollctl(SB),NOSPLIT|NOFRAME,$0 - MOVW epfd+0(FP), R2 - MOVW op+4(FP), R3 - MOVW fd+8(FP), R4 - MOVD ev+16(FP), R5 - MOVW $SYS_epoll_ctl, R1 - SYSCALL - MOVW R2, ret+24(FP) - RET - -// int32 runtime·epollwait(int32 epfd, EpollEvent *ev, int32 nev, int32 timeout); -TEXT runtime·epollwait(SB),NOSPLIT|NOFRAME,$0 - MOVW epfd+0(FP), R2 - MOVD ev+8(FP), R3 - MOVW nev+16(FP), R4 - MOVW timeout+20(FP), R5 - MOVW $SYS_epoll_wait, R1 - SYSCALL - MOVW R2, ret+24(FP) - RET - -// void runtime·closeonexec(int32 fd); -TEXT runtime·closeonexec(SB),NOSPLIT|NOFRAME,$0 - MOVW fd+0(FP), R2 // fd - MOVD $2, R3 // F_SETFD - MOVD $1, R4 // FD_CLOEXEC - MOVW $SYS_fcntl, R1 - SYSCALL - RET - // func sbrk0() uintptr TEXT runtime·sbrk0(SB),NOSPLIT|NOFRAME,$0-8 // Implemented as brk(NULL). -- cgit v1.3