Skip to content

Commit edb7206

Browse files
[libc] add epoll_wait functions (#79515)
The epoll_wait functions are syscall wrappers that were requested by upstream users. This patch adds them, as well as their header and types. The tests are currently incomplete since they require epoll_create to properly test epoll_wait. That will be added in a followup patch since this one is already very large.
1 parent 32334b9 commit edb7206

34 files changed

+604
-5
lines changed

libc/config/linux/aarch64/entrypoints.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ set(TARGET_LIBC_ENTRYPOINTS
172172
# sys/auxv.h entrypoints
173173
libc.src.sys.auxv.getauxval
174174

175+
# sys/epoll.h entrypoints
176+
libc.src.sys.epoll.epoll_wait
177+
libc.src.sys.epoll.epoll_pwait
178+
libc.src.sys.epoll.epoll_pwait2
179+
175180
# termios.h entrypoints
176181
libc.src.termios.cfgetispeed
177182
libc.src.termios.cfgetospeed

libc/config/linux/aarch64/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ set(TARGET_PUBLIC_HEADERS
2424
libc.include.unistd
2525

2626
libc.include.sys_ioctl
27+
libc.include.sys_epoll
2728
)

libc/config/linux/api.td

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
include "config/public_api.td"
22

3-
include "spec/bsd_ext.td"
4-
include "spec/gnu_ext.td"
3+
include "spec/stdc.td"
4+
include "spec/posix.td"
55
include "spec/linux.td"
6+
include "spec/gnu_ext.td"
7+
include "spec/bsd_ext.td"
68
include "spec/llvm_libc_ext.td"
7-
include "spec/posix.td"
8-
include "spec/stdc.td"
99

1010
def AssertMacro : MacroDef<"assert"> {
1111
let Defn = [{
@@ -242,6 +242,10 @@ def SysUtsNameAPI : PublicAPI<"sys/utsname.h"> {
242242
let Types = ["struct utsname"];
243243
}
244244

245+
def SysEpollAPI : PublicAPI<"sys/epoll.h"> {
246+
let Types = ["struct epoll_event", "struct epoll_data", "sigset_t", "struct timespec"];
247+
}
248+
245249
def SpawnAPI : PublicAPI<"spawn.h"> {
246250
let Types = ["mode_t", "pid_t", "posix_spawnattr_t", "posix_spawn_file_actions_t"];
247251
}

libc/config/linux/arm/entrypoints.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ set(TARGET_LIBC_ENTRYPOINTS
9595

9696
# sys/prctl.h entrypoints
9797
libc.src.sys.prctl.prctl
98+
99+
# sys/epoll.h entrypoints
100+
libc.src.sys.epoll.epoll_wait
101+
libc.src.sys.epoll.epoll_pwait
102+
libc.src.sys.epoll.epoll_pwait2
103+
98104
)
99105

100106
set(TARGET_LIBM_ENTRYPOINTS

libc/config/linux/arm/headers.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ set(TARGET_PUBLIC_HEADERS
99
libc.include.string
1010
libc.include.strings
1111
libc.include.search
12+
13+
libc.include.sys_epoll
1214
)

libc/config/linux/riscv/entrypoints.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,11 @@ set(TARGET_LIBC_ENTRYPOINTS
178178
# sys/auxv.h entrypoints
179179
libc.src.sys.auxv.getauxval
180180

181+
# sys/epoll.h entrypoints
182+
libc.src.sys.epoll.epoll_wait
183+
libc.src.sys.epoll.epoll_pwait
184+
libc.src.sys.epoll.epoll_pwait2
185+
181186
# termios.h entrypoints
182187
libc.src.termios.cfgetispeed
183188
libc.src.termios.cfgetospeed

libc/config/linux/riscv/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ set(TARGET_PUBLIC_HEADERS
2929
libc.include.arpa_inet
3030

3131
libc.include.sys_auxv
32+
libc.include.sys_epoll
3233
libc.include.sys_ioctl
3334
libc.include.sys_mman
3435
libc.include.sys_prctl

libc/config/linux/syscall_numbers.h.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@
258258
#define SYS_epoll_pwait __NR_epoll_pwait
259259
#endif
260260

261+
#ifdef __NR_epoll_pwait2
262+
#define SYS_epoll_pwait2 __NR_epoll_pwait2
263+
#endif
264+
261265
#ifdef __NR_epoll_wait
262266
#define SYS_epoll_wait __NR_epoll_wait
263267
#endif

libc/config/linux/x86_64/entrypoints.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ set(TARGET_LIBC_ENTRYPOINTS
136136
libc.src.stdio.scanf
137137
libc.src.stdio.fscanf
138138

139+
# sys/epoll.h entrypoints
140+
libc.src.sys.epoll.epoll_wait
141+
libc.src.sys.epoll.epoll_pwait
142+
libc.src.sys.epoll.epoll_pwait2
143+
139144
# sys/mman.h entrypoints
140145
libc.src.sys.mman.madvise
141146
libc.src.sys.mman.mmap

libc/config/linux/x86_64/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ set(TARGET_PUBLIC_HEADERS
2929
libc.include.arpa_inet
3030

3131
libc.include.sys_auxv
32+
libc.include.sys_epoll
3233
libc.include.sys_ioctl
3334
libc.include.sys_mman
3435
libc.include.sys_prctl

0 commit comments

Comments
 (0)