Skip to content

syscall: use SYS_EPOLL_WAIT on linux/amd64 for compatibility #73338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/internal/runtime/syscall/defs_linux_386.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ const (
SYS_PRCTL = 172
SYS_EPOLL_CTL = 255
SYS_EPOLL_PWAIT = 319
SYS_EPOLL_WAIT = -1
SYS_EPOLL_CREATE1 = 329
SYS_EPOLL_PWAIT2 = 441
SYS_EVENTFD2 = 328

EFD_NONBLOCK = 0x800
NOSYS = -1
)

type EpollEvent struct {
Expand Down
2 changes: 2 additions & 0 deletions src/internal/runtime/syscall/defs_linux_amd64.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ const (
SYS_PRCTL = 157
SYS_EPOLL_CTL = 233
SYS_EPOLL_PWAIT = 281
SYS_EPOLL_WAIT = 232
SYS_EPOLL_CREATE1 = 291
SYS_EPOLL_PWAIT2 = 441
SYS_EVENTFD2 = 290

EFD_NONBLOCK = 0x800
NOSYS = -1
)

type EpollEvent struct {
Expand Down
2 changes: 2 additions & 0 deletions src/internal/runtime/syscall/defs_linux_arm.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ const (
SYS_PRCTL = 172
SYS_EPOLL_CTL = 251
SYS_EPOLL_PWAIT = 346
SYS_EPOLL_WAIT = -1
SYS_EPOLL_CREATE1 = 357
SYS_EPOLL_PWAIT2 = 441
SYS_EVENTFD2 = 356

EFD_NONBLOCK = 0x800
NOSYS = -1
)

type EpollEvent struct {
Expand Down
2 changes: 2 additions & 0 deletions src/internal/runtime/syscall/defs_linux_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ const (
SYS_EPOLL_CREATE1 = 20
SYS_EPOLL_CTL = 21
SYS_EPOLL_PWAIT = 22
SYS_EPOLL_WAIT = -1
SYS_FCNTL = 25
SYS_PRCTL = 167
SYS_MPROTECT = 226
SYS_EPOLL_PWAIT2 = 441
SYS_EVENTFD2 = 19

EFD_NONBLOCK = 0x800
NOSYS = -1
)

type EpollEvent struct {
Expand Down
2 changes: 2 additions & 0 deletions src/internal/runtime/syscall/defs_linux_loong64.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ const (
SYS_EPOLL_CREATE1 = 20
SYS_EPOLL_CTL = 21
SYS_EPOLL_PWAIT = 22
SYS_EPOLL_WAIT = -1
SYS_FCNTL = 25
SYS_PRCTL = 167
SYS_MPROTECT = 226
SYS_EPOLL_PWAIT2 = 441
SYS_EVENTFD2 = 19

EFD_NONBLOCK = 0x800
NOSYS = -1
)

type EpollEvent struct {
Expand Down
2 changes: 2 additions & 0 deletions src/internal/runtime/syscall/defs_linux_mips64x.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ const (
SYS_PRCTL = 5153
SYS_EPOLL_CTL = 5208
SYS_EPOLL_PWAIT = 5272
SYS_EPOLL_WAIT = -1
SYS_EPOLL_CREATE1 = 5285
SYS_EPOLL_PWAIT2 = 5441
SYS_EVENTFD2 = 5284

EFD_NONBLOCK = 0x80
NOSYS = -1
)

type EpollEvent struct {
Expand Down
2 changes: 2 additions & 0 deletions src/internal/runtime/syscall/defs_linux_mipsx.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ const (
SYS_PRCTL = 4192
SYS_EPOLL_CTL = 4249
SYS_EPOLL_PWAIT = 4313
SYS_EPOLL_WAIT = -1
SYS_EPOLL_CREATE1 = 4326
SYS_EPOLL_PWAIT2 = 4441
SYS_EVENTFD2 = 4325

EFD_NONBLOCK = 0x80
NOSYS = -1
)

type EpollEvent struct {
Expand Down
2 changes: 2 additions & 0 deletions src/internal/runtime/syscall/defs_linux_ppc64x.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ const (
SYS_PRCTL = 171
SYS_EPOLL_CTL = 237
SYS_EPOLL_PWAIT = 303
SYS_EPOLL_WAIT = -1
SYS_EPOLL_CREATE1 = 315
SYS_EPOLL_PWAIT2 = 441
SYS_EVENTFD2 = 314

EFD_NONBLOCK = 0x800
NOSYS = -1
)

type EpollEvent struct {
Expand Down
2 changes: 2 additions & 0 deletions src/internal/runtime/syscall/defs_linux_riscv64.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ const (
SYS_EPOLL_CREATE1 = 20
SYS_EPOLL_CTL = 21
SYS_EPOLL_PWAIT = 22
SYS_EPOLL_WAIT = -1
SYS_FCNTL = 25
SYS_PRCTL = 167
SYS_MPROTECT = 226
SYS_EPOLL_PWAIT2 = 441
SYS_EVENTFD2 = 19

EFD_NONBLOCK = 0x800
NOSYS = -1
)

type EpollEvent struct {
Expand Down
2 changes: 2 additions & 0 deletions src/internal/runtime/syscall/defs_linux_s390x.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ const (
SYS_PRCTL = 172
SYS_EPOLL_CTL = 250
SYS_EPOLL_PWAIT = 312
SYS_EPOLL_WAIT = -1
SYS_EPOLL_CREATE1 = 327
SYS_EPOLL_PWAIT2 = 441
SYS_EVENTFD2 = 323

EFD_NONBLOCK = 0x800
NOSYS = -1
)

type EpollEvent struct {
Expand Down
10 changes: 8 additions & 2 deletions src/internal/runtime/syscall/syscall_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ func EpollWait(epfd int32, events []EpollEvent, maxev, waitms int32) (n int32, e
} else {
ev = unsafe.Pointer(&_zero)
}
r1, _, e := Syscall6(SYS_EPOLL_PWAIT, uintptr(epfd), uintptr(ev), uintptr(maxev), uintptr(waitms), 0, 0)
return int32(r1), e

if SYS_EPOLL_WAIT != NOSYS {
r1, _, e := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(ev), uintptr(maxev), uintptr(waitms), 0, 0)
return int32(r1), e
} else {
r1, _, e := Syscall6(SYS_EPOLL_PWAIT, uintptr(epfd), uintptr(ev), uintptr(maxev), uintptr(waitms), 0, 0)
return int32(r1), e
}
}

func EpollCtl(epfd, op, fd int32, event *EpollEvent) (errno uintptr) {
Expand Down