Skip to content

Commit e786a00

Browse files
committed
Support for older Linux kernels
This change applies a change that allows golang binaries to run on older Linux kernels. This fix allows for binaries to work on VMkernel for the ESXi 7.0 hypervisor
1 parent bbf4d57 commit e786a00

11 files changed

+28
-2
lines changed

src/internal/runtime/syscall/defs_linux_386.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ const (
1010
SYS_PRCTL = 172
1111
SYS_EPOLL_CTL = 255
1212
SYS_EPOLL_PWAIT = 319
13+
SYS_EPOLL_WAIT = -1
1314
SYS_EPOLL_CREATE1 = 329
1415
SYS_EPOLL_PWAIT2 = 441
1516
SYS_EVENTFD2 = 328
1617

1718
EFD_NONBLOCK = 0x800
19+
NONE = -1
1820
)
1921

2022
type EpollEvent struct {

src/internal/runtime/syscall/defs_linux_amd64.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ const (
1010
SYS_PRCTL = 157
1111
SYS_EPOLL_CTL = 233
1212
SYS_EPOLL_PWAIT = 281
13+
SYS_EPOLL_WAIT = 232
1314
SYS_EPOLL_CREATE1 = 291
1415
SYS_EPOLL_PWAIT2 = 441
1516
SYS_EVENTFD2 = 290
1617

1718
EFD_NONBLOCK = 0x800
19+
NONE = -1
1820
)
1921

2022
type EpollEvent struct {

src/internal/runtime/syscall/defs_linux_arm.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ const (
1010
SYS_PRCTL = 172
1111
SYS_EPOLL_CTL = 251
1212
SYS_EPOLL_PWAIT = 346
13+
SYS_EPOLL_WAIT = -1
1314
SYS_EPOLL_CREATE1 = 357
1415
SYS_EPOLL_PWAIT2 = 441
1516
SYS_EVENTFD2 = 356
1617

1718
EFD_NONBLOCK = 0x800
19+
NONE = -1
1820
)
1921

2022
type EpollEvent struct {

src/internal/runtime/syscall/defs_linux_arm64.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ const (
88
SYS_EPOLL_CREATE1 = 20
99
SYS_EPOLL_CTL = 21
1010
SYS_EPOLL_PWAIT = 22
11+
SYS_EPOLL_WAIT = -1
1112
SYS_FCNTL = 25
1213
SYS_PRCTL = 167
1314
SYS_MPROTECT = 226
1415
SYS_EPOLL_PWAIT2 = 441
1516
SYS_EVENTFD2 = 19
1617

1718
EFD_NONBLOCK = 0x800
19+
NONE = -1
1820
)
1921

2022
type EpollEvent struct {

src/internal/runtime/syscall/defs_linux_loong64.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ const (
88
SYS_EPOLL_CREATE1 = 20
99
SYS_EPOLL_CTL = 21
1010
SYS_EPOLL_PWAIT = 22
11+
SYS_EPOLL_WAIT = -1
1112
SYS_FCNTL = 25
1213
SYS_PRCTL = 167
1314
SYS_MPROTECT = 226
1415
SYS_EPOLL_PWAIT2 = 441
1516
SYS_EVENTFD2 = 19
1617

1718
EFD_NONBLOCK = 0x800
19+
NONE = -1
1820
)
1921

2022
type EpollEvent struct {

src/internal/runtime/syscall/defs_linux_mips64x.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ const (
1212
SYS_PRCTL = 5153
1313
SYS_EPOLL_CTL = 5208
1414
SYS_EPOLL_PWAIT = 5272
15+
SYS_EPOLL_WAIT = -1
1516
SYS_EPOLL_CREATE1 = 5285
1617
SYS_EPOLL_PWAIT2 = 5441
1718
SYS_EVENTFD2 = 5284
1819

1920
EFD_NONBLOCK = 0x80
21+
NONE = -1
2022
)
2123

2224
type EpollEvent struct {

src/internal/runtime/syscall/defs_linux_mipsx.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ const (
1212
SYS_PRCTL = 4192
1313
SYS_EPOLL_CTL = 4249
1414
SYS_EPOLL_PWAIT = 4313
15+
SYS_EPOLL_WAIT = -1
1516
SYS_EPOLL_CREATE1 = 4326
1617
SYS_EPOLL_PWAIT2 = 4441
1718
SYS_EVENTFD2 = 4325
1819

1920
EFD_NONBLOCK = 0x80
21+
NONE = -1
2022
)
2123

2224
type EpollEvent struct {

src/internal/runtime/syscall/defs_linux_ppc64x.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ const (
1212
SYS_PRCTL = 171
1313
SYS_EPOLL_CTL = 237
1414
SYS_EPOLL_PWAIT = 303
15+
SYS_EPOLL_WAIT = -1
1516
SYS_EPOLL_CREATE1 = 315
1617
SYS_EPOLL_PWAIT2 = 441
1718
SYS_EVENTFD2 = 314
1819

1920
EFD_NONBLOCK = 0x800
21+
NONE = -1
2022
)
2123

2224
type EpollEvent struct {

src/internal/runtime/syscall/defs_linux_riscv64.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ const (
88
SYS_EPOLL_CREATE1 = 20
99
SYS_EPOLL_CTL = 21
1010
SYS_EPOLL_PWAIT = 22
11+
SYS_EPOLL_WAIT = -1
1112
SYS_FCNTL = 25
1213
SYS_PRCTL = 167
1314
SYS_MPROTECT = 226
1415
SYS_EPOLL_PWAIT2 = 441
1516
SYS_EVENTFD2 = 19
1617

1718
EFD_NONBLOCK = 0x800
19+
NONE = -1
1820
)
1921

2022
type EpollEvent struct {

src/internal/runtime/syscall/defs_linux_s390x.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ const (
1010
SYS_PRCTL = 172
1111
SYS_EPOLL_CTL = 250
1212
SYS_EPOLL_PWAIT = 312
13+
SYS_EPOLL_WAIT = -1
1314
SYS_EPOLL_CREATE1 = 327
1415
SYS_EPOLL_PWAIT2 = 441
1516
SYS_EVENTFD2 = 323
1617

1718
EFD_NONBLOCK = 0x800
19+
NONE = -1
1820
)
1921

2022
type EpollEvent struct {

src/internal/runtime/syscall/syscall_linux.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,14 @@ func EpollWait(epfd int32, events []EpollEvent, maxev, waitms int32) (n int32, e
2929
} else {
3030
ev = unsafe.Pointer(&_zero)
3131
}
32-
r1, _, e := Syscall6(SYS_EPOLL_PWAIT, uintptr(epfd), uintptr(ev), uintptr(maxev), uintptr(waitms), 0, 0)
33-
return int32(r1), e
32+
33+
if SYS_EPOLL_WAIT != NONE {
34+
r1, _, e := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(ev), uintptr(maxev), uintptr(waitms), 0, 0)
35+
return int32(r1), e
36+
} else {
37+
r1, _, e := Syscall6(SYS_EPOLL_PWAIT, uintptr(epfd), uintptr(ev), uintptr(maxev), uintptr(waitms), 0, 0)
38+
return int32(r1), e
39+
}
3440
}
3541

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

0 commit comments

Comments
 (0)