Skip to content

Commit 75f1bc6

Browse files
committed
Add native implementations of eventfd(2) and timerfd(2), compatible with
the Linux interfaces of the same name.
1 parent d606305 commit 75f1bc6

File tree

22 files changed

+3575
-30
lines changed

22 files changed

+3575
-30
lines changed

distrib/sets/lists/base/shl.mi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $NetBSD: shl.mi,v 1.925 2021/09/02 11:28:45 christos Exp $
1+
# $NetBSD: shl.mi,v 1.926 2021/09/19 15:51:27 thorpej Exp $
22
#
33
# Note: Don't delete entries from here - mark them as "obsolete" instead,
44
# unless otherwise stated below.
@@ -24,7 +24,7 @@
2424
./lib/libblocklist.so.0.0 base-sys-shlib dynamicroot
2525
./lib/libc.so base-sys-shlib dynamicroot
2626
./lib/libc.so.12 base-sys-shlib dynamicroot
27-
./lib/libc.so.12.218 base-sys-shlib dynamicroot
27+
./lib/libc.so.12.219 base-sys-shlib dynamicroot
2828
./lib/libcrypt.so base-sys-shlib dynamicroot
2929
./lib/libcrypt.so.1 base-sys-shlib dynamicroot
3030
./lib/libcrypt.so.1.0 base-sys-shlib dynamicroot
@@ -251,7 +251,7 @@
251251
./usr/lib/libc++.so.1.0 base-sys-shlib compatfile,libcxx
252252
./usr/lib/libc.so base-sys-shlib compatfile
253253
./usr/lib/libc.so.12 base-sys-shlib compatfile
254-
./usr/lib/libc.so.12.218 base-sys-shlib compatfile
254+
./usr/lib/libc.so.12.219 base-sys-shlib compatfile
255255
./usr/lib/libcbor.so base-sys-shlib compatfile
256256
./usr/lib/libcbor.so.0 base-sys-shlib compatfile
257257
./usr/lib/libcbor.so.0.5 base-sys-shlib compatfile

distrib/sets/lists/comp/mi

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $NetBSD: mi,v 1.2392 2021/09/16 23:32:49 christos Exp $
1+
# $NetBSD: mi,v 1.2393 2021/09/19 15:51:27 thorpej Exp $
22
#
33
# Note: don't delete entries from here - mark them as "obsolete" instead.
44
./etc/mtree/set.comp comp-sys-root
@@ -3279,6 +3279,7 @@
32793279
./usr/include/sys/errno.h comp-c-include
32803280
./usr/include/sys/evcnt.h comp-c-include
32813281
./usr/include/sys/event.h comp-c-include
3282+
./usr/include/sys/eventfd.h comp-c-include
32823283
./usr/include/sys/exec.h comp-c-include
32833284
./usr/include/sys/exec_aout.h comp-c-include
32843285
./usr/include/sys/exec_coff.h comp-c-include
@@ -3430,6 +3431,7 @@
34303431
./usr/include/sys/time.h comp-c-include
34313432
./usr/include/sys/timeb.h comp-c-include
34323433
./usr/include/sys/timepps.h comp-c-include
3434+
./usr/include/sys/timerfd.h comp-c-include
34333435
./usr/include/sys/times.h comp-c-include
34343436
./usr/include/sys/timespec.h comp-c-include
34353437
./usr/include/sys/timex.h comp-c-include
@@ -4659,6 +4661,9 @@
46594661
./usr/share/man/cat2/dup2.0 comp-c-catman .cat
46604662
./usr/share/man/cat2/dup3.0 comp-c-catman .cat
46614663
./usr/share/man/cat2/errno.0 comp-c-catman .cat
4664+
./usr/share/man/cat2/eventfd.0 comp-c-catman .cat
4665+
./usr/share/man/cat2/eventfd_read.0 comp-c-catman .cat
4666+
./usr/share/man/cat2/eventfd_write.0 comp-c-catman .cat
46624667
./usr/share/man/cat2/execve.0 comp-c-catman .cat
46634668
./usr/share/man/cat2/extattr_delete_fd.0 comp-c-catman .cat
46644669
./usr/share/man/cat2/extattr_delete_file.0 comp-c-catman .cat
@@ -4897,6 +4902,10 @@
48974902
./usr/share/man/cat2/timer_getoverrun.0 comp-c-catman .cat
48984903
./usr/share/man/cat2/timer_gettime.0 comp-c-catman .cat
48994904
./usr/share/man/cat2/timer_settime.0 comp-c-catman .cat
4905+
./usr/share/man/cat2/timerfd.0 comp-c-catman .cat
4906+
./usr/share/man/cat2/timerfd_create.0 comp-c-catman .cat
4907+
./usr/share/man/cat2/timerfd_gettime.0 comp-c-catman .cat
4908+
./usr/share/man/cat2/timerfd_settime.0 comp-c-catman .cat
49004909
./usr/share/man/cat2/truncate.0 comp-c-catman .cat
49014910
./usr/share/man/cat2/ucontext.0 comp-c-catman .cat
49024911
./usr/share/man/cat2/umask.0 comp-c-catman .cat
@@ -12994,6 +13003,9 @@
1299413003
./usr/share/man/html2/dup2.html comp-c-htmlman html
1299513004
./usr/share/man/html2/dup3.html comp-c-htmlman html
1299613005
./usr/share/man/html2/errno.html comp-c-htmlman html
13006+
./usr/share/man/html2/eventfd.html comp-c-htmlman html
13007+
./usr/share/man/html2/eventfd_read.html comp-c-htmlman html
13008+
./usr/share/man/html2/eventfd_write.html comp-c-htmlman html
1299713009
./usr/share/man/html2/execve.html comp-c-htmlman html
1299813010
./usr/share/man/html2/extattr_delete_fd.html comp-c-htmlman html
1299913011
./usr/share/man/html2/extattr_delete_file.html comp-c-htmlman html
@@ -13218,6 +13230,10 @@
1321813230
./usr/share/man/html2/timer_getoverrun.html comp-c-htmlman html
1321913231
./usr/share/man/html2/timer_gettime.html comp-c-htmlman html
1322013232
./usr/share/man/html2/timer_settime.html comp-c-htmlman html
13233+
./usr/share/man/html2/timerfd.html comp-c-htmlman html
13234+
./usr/share/man/html2/timerfd_create.html comp-c-htmlman html
13235+
./usr/share/man/html2/timerfd_gettime.html comp-c-htmlman html
13236+
./usr/share/man/html2/timerfd_settime.html comp-c-htmlman html
1322113237
./usr/share/man/html2/truncate.html comp-c-htmlman html
1322213238
./usr/share/man/html2/ucontext.html comp-c-htmlman html
1322313239
./usr/share/man/html2/umask.html comp-c-htmlman html
@@ -21146,6 +21162,9 @@
2114621162
./usr/share/man/man2/dup2.2 comp-c-man .man
2114721163
./usr/share/man/man2/dup3.2 comp-c-man .man
2114821164
./usr/share/man/man2/errno.2 comp-c-man .man
21165+
./usr/share/man/man2/eventfd.2 comp-c-man .man
21166+
./usr/share/man/man2/eventfd_read.2 comp-c-man .man
21167+
./usr/share/man/man2/eventfd_write.2 comp-c-man .man
2114921168
./usr/share/man/man2/execve.2 comp-c-man .man
2115021169
./usr/share/man/man2/extattr_delete_fd.2 comp-c-man .man
2115121170
./usr/share/man/man2/extattr_delete_file.2 comp-c-man .man
@@ -21382,6 +21401,10 @@
2138221401
./usr/share/man/man2/timer_getoverrun.2 comp-c-man .man
2138321402
./usr/share/man/man2/timer_gettime.2 comp-c-man .man
2138421403
./usr/share/man/man2/timer_settime.2 comp-c-man .man
21404+
./usr/share/man/man2/timerfd.2 comp-c-man .man
21405+
./usr/share/man/man2/timerfd_create.2 comp-c-man .man
21406+
./usr/share/man/man2/timerfd_gettime.2 comp-c-man .man
21407+
./usr/share/man/man2/timerfd_settime.2 comp-c-man .man
2138521408
./usr/share/man/man2/truncate.2 comp-c-man .man
2138621409
./usr/share/man/man2/ucontext.2 comp-c-man .man
2138721410
./usr/share/man/man2/umask.2 comp-c-man .man

distrib/sets/lists/debug/mi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $NetBSD: mi,v 1.360 2021/08/29 09:54:18 christos Exp $
1+
# $NetBSD: mi,v 1.361 2021/09/19 15:51:28 thorpej Exp $
22
./etc/mtree/set.debug comp-sys-root
33
./usr/lib comp-sys-usr compatdir
44
./usr/lib/i18n/libBIG5_g.a comp-c-debuglib debuglib,compatfile
@@ -2157,6 +2157,7 @@
21572157
./usr/libdata/debug/usr/tests/lib/libc/sys/t_connect.debug tests-lib-debug debug,atf,compattestfile
21582158
./usr/libdata/debug/usr/tests/lib/libc/sys/t_context.debug tests-obsolete obsolete,compattestfile
21592159
./usr/libdata/debug/usr/tests/lib/libc/sys/t_dup.debug tests-lib-debug debug,atf,compattestfile
2160+
./usr/libdata/debug/usr/tests/lib/libc/sys/t_eventfd.debug tests-lib-debug debug,atf,compattestfile
21602161
./usr/libdata/debug/usr/tests/lib/libc/sys/t_fork.debug tests-lib-debug debug,atf,compattestfile
21612162
./usr/libdata/debug/usr/tests/lib/libc/sys/t_fsync.debug tests-lib-debug debug,atf,compattestfile
21622163
./usr/libdata/debug/usr/tests/lib/libc/sys/t_futex_ops.debug tests-lib-tests debug,atf,compattestfile
@@ -2224,6 +2225,7 @@
22242225
./usr/libdata/debug/usr/tests/lib/libc/sys/t_swapcontext.debug tests-lib-debug debug,atf,compattestfile
22252226
./usr/libdata/debug/usr/tests/lib/libc/sys/t_syscall.debug tests-lib-debug debug,atf,compattestfile
22262227
./usr/libdata/debug/usr/tests/lib/libc/sys/t_timer_create.debug tests-lib-debug debug,atf,compattestfile
2228+
./usr/libdata/debug/usr/tests/lib/libc/sys/t_timerfd.debug tests-lib-debug debug,atf,compattestfile
22272229
./usr/libdata/debug/usr/tests/lib/libc/sys/t_truncate.debug tests-lib-debug debug,atf,compattestfile
22282230
./usr/libdata/debug/usr/tests/lib/libc/sys/t_ucontext.debug tests-lib-debug debug,atf,compattestfile
22292231
./usr/libdata/debug/usr/tests/lib/libc/sys/t_umask.debug tests-lib-debug debug,atf,compattestfile

distrib/sets/lists/debug/shl.mi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# $NetBSD: shl.mi,v 1.282 2021/09/02 11:28:45 christos Exp $
1+
# $NetBSD: shl.mi,v 1.283 2021/09/19 15:51:28 thorpej Exp $
22
./usr/lib/libbfd_g.a comp-c-debuglib debuglib,compatfile,binutils
33
./usr/libdata/debug/lib base-sys-usr debug,dynamicroot,compatdir
44
./usr/libdata/debug/lib/libavl.so.0.0.debug comp-zfs-debug debug,dynamicroot,zfs
55
./usr/libdata/debug/lib/libblacklist.so.0.0.debug comp-obsolete obsolete,compatfile
66
./usr/libdata/debug/lib/libblocklist.so.0.0.debug comp-sys-debug debug,dynamicroot
7-
./usr/libdata/debug/lib/libc.so.12.218.debug comp-sys-debug debug,dynamicroot
7+
./usr/libdata/debug/lib/libc.so.12.219.debug comp-sys-debug debug,dynamicroot
88
./usr/libdata/debug/lib/libcrypt.so.1.0.debug comp-sys-debug debug,dynamicroot
99
./usr/libdata/debug/lib/libcrypto.so.12.0.debug comp-sys-debug debug,dynamicroot,openssl=10
1010
./usr/libdata/debug/lib/libcrypto.so.14.0.debug comp-sys-debug debug,dynamicroot,openssl=11
@@ -84,7 +84,7 @@
8484
./usr/libdata/debug/usr/lib/libbsdmalloc.so.0.0.debug comp-sys-debug debug,compatfile
8585
./usr/libdata/debug/usr/lib/libbz2.so.1.1.debug comp-sys-debug debug,compatfile
8686
./usr/libdata/debug/usr/lib/libc++.so.1.0.debug comp-sys-debug debug,compatfile,libcxx
87-
./usr/libdata/debug/usr/lib/libc.so.12.218.debug comp-sys-debug debug,compatfile
87+
./usr/libdata/debug/usr/lib/libc.so.12.219.debug comp-sys-debug debug,compatfile
8888
./usr/libdata/debug/usr/lib/libcbor.so.0.5.debug comp-sys-debug debug,compatfile
8989
./usr/libdata/debug/usr/lib/libcom_err.so.8.0.debug comp-krb5-debug debug,compatfile,kerberos
9090
./usr/libdata/debug/usr/lib/libcrypt.so.1.0.debug comp-sys-debug debug,compatfile

distrib/sets/lists/tests/mi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $NetBSD: mi,v 1.1125 2021/09/13 22:09:06 rillig Exp $
1+
# $NetBSD: mi,v 1.1126 2021/09/19 15:51:28 thorpej Exp $
22
#
33
# Note: don't delete entries from here - mark them as "obsolete" instead.
44
#
@@ -3145,6 +3145,7 @@
31453145
./usr/tests/lib/libc/sys/t_connect tests-lib-tests compattestfile,atf
31463146
./usr/tests/lib/libc/sys/t_context tests-obsolete obsolete
31473147
./usr/tests/lib/libc/sys/t_dup tests-lib-tests compattestfile,atf
3148+
./usr/tests/lib/libc/sys/t_eventfd tests-lib-tests compattestfile,atf
31483149
./usr/tests/lib/libc/sys/t_fork tests-lib-tests compattestfile,atf
31493150
./usr/tests/lib/libc/sys/t_fsync tests-lib-tests compattestfile,atf
31503151
./usr/tests/lib/libc/sys/t_futex_ops tests-lib-tests compattestfile,atf
@@ -3212,6 +3213,7 @@
32123213
./usr/tests/lib/libc/sys/t_swapcontext tests-lib-tests compattestfile,atf
32133214
./usr/tests/lib/libc/sys/t_syscall tests-lib-tests compattestfile,atf
32143215
./usr/tests/lib/libc/sys/t_timer_create tests-lib-tests compattestfile,atf
3216+
./usr/tests/lib/libc/sys/t_timerfd tests-lib-tests compattestfile,atf
32153217
./usr/tests/lib/libc/sys/t_truncate tests-lib-tests compattestfile,atf
32163218
./usr/tests/lib/libc/sys/t_ucontext tests-lib-tests compattestfile,atf
32173219
./usr/tests/lib/libc/sys/t_umask tests-lib-tests compattestfile,atf

lib/libc/shlib_version

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $NetBSD: shlib_version,v 1.291 2020/10/09 18:38:48 christos Exp $
1+
# $NetBSD: shlib_version,v 1.292 2021/09/19 15:51:28 thorpej Exp $
22
# Remember to update distrib/sets/lists/base/shl.* when changing
33
#
44
# things we wish to do on next major version bump:
@@ -54,4 +54,4 @@
5454
# - the syscall stubs for the (obsolete) lfs syscalls should be removed
5555
# - remove tzsetwall(3), upstream has removed it
5656
major=12
57-
minor=218
57+
minor=219

lib/libc/sys/Makefile.inc

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $NetBSD: Makefile.inc,v 1.245 2020/08/14 00:53:16 riastradh Exp $
1+
# $NetBSD: Makefile.inc,v 1.246 2021/09/19 15:51:28 thorpej Exp $
22
# @(#)Makefile.inc 8.3 (Berkeley) 10/24/94
33

44
# sys sources
@@ -7,9 +7,10 @@
77
# other sources shared with the kernel, used in syscalls
88
SRCS+= cpuset.c
99
# glue to offer userland wrappers for some syscalls
10-
SRCS+= accept4.c clock_getcpuclockid.c posix_fadvise.c posix_madvise.c \
11-
ppoll.c sched.c sigqueue.c sigtimedwait.c sigwait.c sigwaitinfo.c \
12-
statvfs.c swapon.c semctl.c vadvise.c
10+
SRCS+= accept4.c clock_getcpuclockid.c eventfd_read.c eventfd_write.c \
11+
posix_fadvise.c posix_madvise.c ppoll.c sched.c sigqueue.c \
12+
sigtimedwait.c sigwait.c sigwaitinfo.c statvfs.c swapon.c semctl.c \
13+
vadvise.c
1314

1415
.if ${RUMPRUN} != "yes"
1516
# modules with non-default implementations on at least one architecture:
@@ -100,6 +101,7 @@ ASM=\
100101
clock_getcpuclockid2.S \
101102
__clock_getres50.S __clock_gettime50.S \
102103
dup.S dup2.S dup3.S \
104+
eventfd.S \
103105
extattrctl.S \
104106
extattr_delete_fd.S extattr_delete_file.S \
105107
extattr_delete_link.S extattr_get_fd.S extattr_get_file.S \
@@ -154,6 +156,7 @@ ASM=\
154156
__statvfs190.S swapctl.S symlink.S symlinkat.S __sysctl.S \
155157
timer_create.S timer_delete.S __timer_gettime50.S timer_getoverrun.S \
156158
____semctl50.S __timer_settime50.S \
159+
timerfd_create.S timerfd_gettime.S timerfd_settime.S \
157160
umask.S undelete.S unlink.S unlinkat.S unmount.S __utimes50.S \
158161
utimensat.S utrace.S uuidgen.S
159162

@@ -251,7 +254,7 @@ LintSysPseudoNoerr.c: ${LIBCDIR}/sys/makelintstub \
251254
MAN+= accept.2 access.2 acct.2 adjtime.2 bind.2 brk.2 chdir.2 \
252255
chflags.2 chmod.2 chown.2 chroot.2 clock_getcpuclockid2.2 \
253256
clock_settime.2 clone.2 close.2 \
254-
connect.2 dup.2 execve.2 _exit.2 extattr_get_file.2 \
257+
connect.2 dup.2 eventfd.2 execve.2 _exit.2 extattr_get_file.2 \
255258
fcntl.2 fdatasync.2 fdiscard.2 fhopen.2 \
256259
flock.2 fork.2 fsync.2 getcontext.2 getdents.2 \
257260
getfh.2 getvfsstat.2 getgid.2 getgroups.2 \
@@ -284,7 +287,7 @@ MAN+= accept.2 access.2 acct.2 adjtime.2 bind.2 brk.2 chdir.2 \
284287
socket.2 \
285288
socketpair.2 stat.2 statvfs.2 swapctl.2 swapon.3 symlink.2 \
286289
sync.2 sysarch.2 syscall.2 timer_create.2 timer_delete.2 \
287-
timer_settime.2 truncate.2 umask.2 undelete.2 \
290+
timer_settime.2 timerfd.2 truncate.2 umask.2 undelete.2 \
288291
unlink.2 utimes.2 utrace.2 uuidgen.2 vfork.2 wait.2 write.2
289292

290293
MLINKS+=_exit.2 _Exit.2
@@ -299,6 +302,8 @@ MLINKS+=chown.2 fchown.2 chown.2 lchown.2
299302
MLINKS+=chroot.2 fchroot.2
300303
MLINKS+=clock_settime.2 clock_gettime.2
301304
MLINKS+=clock_settime.2 clock_getres.2
305+
MLINKS+=eventfd.2 eventfd_read.2 \
306+
eventfd.2 eventfd_write.2
302307
MLINKS+=extattr_get_file.2 extattr_set_file.2 \
303308
extattr_get_file.2 extattr_delete_file.2 \
304309
extattr_get_file.2 extattr_list_file.2 \
@@ -380,6 +385,9 @@ MLINKS+=statvfs.2 fstatvfs.2
380385
MLINKS+=statvfs.2 statvfs1.2
381386
MLINKS+=statvfs.2 fstatvfs1.2
382387
MLINKS+=syscall.2 __syscall.2
388+
MLINKS+=timerfd.2 timerfd_create.2 \
389+
timerfd.2 timerfd_gettime.2 \
390+
timerfd.2 timerfd_settime.2
383391
MLINKS+=truncate.2 ftruncate.2
384392
MLINKS+=unlink.2 unlinkat.2
385393
MLINKS+=utimes.2 futimes.2 utimes.2 lutimes.2

0 commit comments

Comments
 (0)