Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add native implementations of eventfd(2) and timerfd(2), com...
details: https://anonhg.NetBSD.org/src/rev/e3a758ecae27
branches: trunk
changeset: 986316:e3a758ecae27
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sun Sep 19 15:51:27 2021 +0000
description:
Add native implementations of eventfd(2) and timerfd(2), compatible with
the Linux interfaces of the same name.
diffstat:
distrib/sets/lists/base/shl.mi | 6 +-
distrib/sets/lists/comp/mi | 25 +-
distrib/sets/lists/debug/mi | 4 +-
distrib/sets/lists/debug/shl.mi | 6 +-
distrib/sets/lists/tests/mi | 4 +-
lib/libc/shlib_version | 4 +-
lib/libc/sys/Makefile.inc | 20 +-
lib/libc/sys/eventfd.2 | 271 +++++++++++++
lib/libc/sys/eventfd_read.c | 60 +++
lib/libc/sys/eventfd_write.c | 58 ++
lib/libc/sys/timerfd.2 | 321 ++++++++++++++++
sys/kern/files.kern | 4 +-
sys/kern/sys_eventfd.c | 579 +++++++++++++++++++++++++++++
sys/kern/sys_timerfd.c | 691 ++++++++++++++++++++++++++++++++++
sys/kern/syscalls.master | 14 +-
sys/sys/Makefile | 6 +-
sys/sys/eventfd.h | 57 ++
sys/sys/file.h | 10 +-
sys/sys/timerfd.h | 65 +++
tests/lib/libc/sys/Makefile | 8 +-
tests/lib/libc/sys/t_eventfd.c | 790 ++++++++++++++++++++++++++++++++++++++++
tests/lib/libc/sys/t_timerfd.c | 602 ++++++++++++++++++++++++++++++
22 files changed, 3575 insertions(+), 30 deletions(-)
diffs (truncated from 3979 to 300 lines):
diff -r e0790a24eb7d -r e3a758ecae27 distrib/sets/lists/base/shl.mi
--- a/distrib/sets/lists/base/shl.mi Sun Sep 19 11:43:54 2021 +0000
+++ b/distrib/sets/lists/base/shl.mi Sun Sep 19 15:51:27 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.925 2021/09/02 11:28:45 christos Exp $
+# $NetBSD: shl.mi,v 1.926 2021/09/19 15:51:27 thorpej Exp $
#
# Note: Don't delete entries from here - mark them as "obsolete" instead,
# unless otherwise stated below.
@@ -24,7 +24,7 @@
./lib/libblocklist.so.0.0 base-sys-shlib dynamicroot
./lib/libc.so base-sys-shlib dynamicroot
./lib/libc.so.12 base-sys-shlib dynamicroot
-./lib/libc.so.12.218 base-sys-shlib dynamicroot
+./lib/libc.so.12.219 base-sys-shlib dynamicroot
./lib/libcrypt.so base-sys-shlib dynamicroot
./lib/libcrypt.so.1 base-sys-shlib dynamicroot
./lib/libcrypt.so.1.0 base-sys-shlib dynamicroot
@@ -251,7 +251,7 @@
./usr/lib/libc++.so.1.0 base-sys-shlib compatfile,libcxx
./usr/lib/libc.so base-sys-shlib compatfile
./usr/lib/libc.so.12 base-sys-shlib compatfile
-./usr/lib/libc.so.12.218 base-sys-shlib compatfile
+./usr/lib/libc.so.12.219 base-sys-shlib compatfile
./usr/lib/libcbor.so base-sys-shlib compatfile
./usr/lib/libcbor.so.0 base-sys-shlib compatfile
./usr/lib/libcbor.so.0.5 base-sys-shlib compatfile
diff -r e0790a24eb7d -r e3a758ecae27 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi Sun Sep 19 11:43:54 2021 +0000
+++ b/distrib/sets/lists/comp/mi Sun Sep 19 15:51:27 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.2392 2021/09/16 23:32:49 christos Exp $
+# $NetBSD: mi,v 1.2393 2021/09/19 15:51:27 thorpej Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
./etc/mtree/set.comp comp-sys-root
@@ -3279,6 +3279,7 @@
./usr/include/sys/errno.h comp-c-include
./usr/include/sys/evcnt.h comp-c-include
./usr/include/sys/event.h comp-c-include
+./usr/include/sys/eventfd.h comp-c-include
./usr/include/sys/exec.h comp-c-include
./usr/include/sys/exec_aout.h comp-c-include
./usr/include/sys/exec_coff.h comp-c-include
@@ -3430,6 +3431,7 @@
./usr/include/sys/time.h comp-c-include
./usr/include/sys/timeb.h comp-c-include
./usr/include/sys/timepps.h comp-c-include
+./usr/include/sys/timerfd.h comp-c-include
./usr/include/sys/times.h comp-c-include
./usr/include/sys/timespec.h comp-c-include
./usr/include/sys/timex.h comp-c-include
@@ -4659,6 +4661,9 @@
./usr/share/man/cat2/dup2.0 comp-c-catman .cat
./usr/share/man/cat2/dup3.0 comp-c-catman .cat
./usr/share/man/cat2/errno.0 comp-c-catman .cat
+./usr/share/man/cat2/eventfd.0 comp-c-catman .cat
+./usr/share/man/cat2/eventfd_read.0 comp-c-catman .cat
+./usr/share/man/cat2/eventfd_write.0 comp-c-catman .cat
./usr/share/man/cat2/execve.0 comp-c-catman .cat
./usr/share/man/cat2/extattr_delete_fd.0 comp-c-catman .cat
./usr/share/man/cat2/extattr_delete_file.0 comp-c-catman .cat
@@ -4897,6 +4902,10 @@
./usr/share/man/cat2/timer_getoverrun.0 comp-c-catman .cat
./usr/share/man/cat2/timer_gettime.0 comp-c-catman .cat
./usr/share/man/cat2/timer_settime.0 comp-c-catman .cat
+./usr/share/man/cat2/timerfd.0 comp-c-catman .cat
+./usr/share/man/cat2/timerfd_create.0 comp-c-catman .cat
+./usr/share/man/cat2/timerfd_gettime.0 comp-c-catman .cat
+./usr/share/man/cat2/timerfd_settime.0 comp-c-catman .cat
./usr/share/man/cat2/truncate.0 comp-c-catman .cat
./usr/share/man/cat2/ucontext.0 comp-c-catman .cat
./usr/share/man/cat2/umask.0 comp-c-catman .cat
@@ -12994,6 +13003,9 @@
./usr/share/man/html2/dup2.html comp-c-htmlman html
./usr/share/man/html2/dup3.html comp-c-htmlman html
./usr/share/man/html2/errno.html comp-c-htmlman html
+./usr/share/man/html2/eventfd.html comp-c-htmlman html
+./usr/share/man/html2/eventfd_read.html comp-c-htmlman html
+./usr/share/man/html2/eventfd_write.html comp-c-htmlman html
./usr/share/man/html2/execve.html comp-c-htmlman html
./usr/share/man/html2/extattr_delete_fd.html comp-c-htmlman html
./usr/share/man/html2/extattr_delete_file.html comp-c-htmlman html
@@ -13218,6 +13230,10 @@
./usr/share/man/html2/timer_getoverrun.html comp-c-htmlman html
./usr/share/man/html2/timer_gettime.html comp-c-htmlman html
./usr/share/man/html2/timer_settime.html comp-c-htmlman html
+./usr/share/man/html2/timerfd.html comp-c-htmlman html
+./usr/share/man/html2/timerfd_create.html comp-c-htmlman html
+./usr/share/man/html2/timerfd_gettime.html comp-c-htmlman html
+./usr/share/man/html2/timerfd_settime.html comp-c-htmlman html
./usr/share/man/html2/truncate.html comp-c-htmlman html
./usr/share/man/html2/ucontext.html comp-c-htmlman html
./usr/share/man/html2/umask.html comp-c-htmlman html
@@ -21146,6 +21162,9 @@
./usr/share/man/man2/dup2.2 comp-c-man .man
./usr/share/man/man2/dup3.2 comp-c-man .man
./usr/share/man/man2/errno.2 comp-c-man .man
+./usr/share/man/man2/eventfd.2 comp-c-man .man
+./usr/share/man/man2/eventfd_read.2 comp-c-man .man
+./usr/share/man/man2/eventfd_write.2 comp-c-man .man
./usr/share/man/man2/execve.2 comp-c-man .man
./usr/share/man/man2/extattr_delete_fd.2 comp-c-man .man
./usr/share/man/man2/extattr_delete_file.2 comp-c-man .man
@@ -21382,6 +21401,10 @@
./usr/share/man/man2/timer_getoverrun.2 comp-c-man .man
./usr/share/man/man2/timer_gettime.2 comp-c-man .man
./usr/share/man/man2/timer_settime.2 comp-c-man .man
+./usr/share/man/man2/timerfd.2 comp-c-man .man
+./usr/share/man/man2/timerfd_create.2 comp-c-man .man
+./usr/share/man/man2/timerfd_gettime.2 comp-c-man .man
+./usr/share/man/man2/timerfd_settime.2 comp-c-man .man
./usr/share/man/man2/truncate.2 comp-c-man .man
./usr/share/man/man2/ucontext.2 comp-c-man .man
./usr/share/man/man2/umask.2 comp-c-man .man
diff -r e0790a24eb7d -r e3a758ecae27 distrib/sets/lists/debug/mi
--- a/distrib/sets/lists/debug/mi Sun Sep 19 11:43:54 2021 +0000
+++ b/distrib/sets/lists/debug/mi Sun Sep 19 15:51:27 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.360 2021/08/29 09:54:18 christos Exp $
+# $NetBSD: mi,v 1.361 2021/09/19 15:51:28 thorpej Exp $
./etc/mtree/set.debug comp-sys-root
./usr/lib comp-sys-usr compatdir
./usr/lib/i18n/libBIG5_g.a comp-c-debuglib debuglib,compatfile
@@ -2157,6 +2157,7 @@
./usr/libdata/debug/usr/tests/lib/libc/sys/t_connect.debug tests-lib-debug debug,atf,compattestfile
./usr/libdata/debug/usr/tests/lib/libc/sys/t_context.debug tests-obsolete obsolete,compattestfile
./usr/libdata/debug/usr/tests/lib/libc/sys/t_dup.debug tests-lib-debug debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/lib/libc/sys/t_eventfd.debug tests-lib-debug debug,atf,compattestfile
./usr/libdata/debug/usr/tests/lib/libc/sys/t_fork.debug tests-lib-debug debug,atf,compattestfile
./usr/libdata/debug/usr/tests/lib/libc/sys/t_fsync.debug tests-lib-debug debug,atf,compattestfile
./usr/libdata/debug/usr/tests/lib/libc/sys/t_futex_ops.debug tests-lib-tests debug,atf,compattestfile
@@ -2224,6 +2225,7 @@
./usr/libdata/debug/usr/tests/lib/libc/sys/t_swapcontext.debug tests-lib-debug debug,atf,compattestfile
./usr/libdata/debug/usr/tests/lib/libc/sys/t_syscall.debug tests-lib-debug debug,atf,compattestfile
./usr/libdata/debug/usr/tests/lib/libc/sys/t_timer_create.debug tests-lib-debug debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/lib/libc/sys/t_timerfd.debug tests-lib-debug debug,atf,compattestfile
./usr/libdata/debug/usr/tests/lib/libc/sys/t_truncate.debug tests-lib-debug debug,atf,compattestfile
./usr/libdata/debug/usr/tests/lib/libc/sys/t_ucontext.debug tests-lib-debug debug,atf,compattestfile
./usr/libdata/debug/usr/tests/lib/libc/sys/t_umask.debug tests-lib-debug debug,atf,compattestfile
diff -r e0790a24eb7d -r e3a758ecae27 distrib/sets/lists/debug/shl.mi
--- a/distrib/sets/lists/debug/shl.mi Sun Sep 19 11:43:54 2021 +0000
+++ b/distrib/sets/lists/debug/shl.mi Sun Sep 19 15:51:27 2021 +0000
@@ -1,10 +1,10 @@
-# $NetBSD: shl.mi,v 1.282 2021/09/02 11:28:45 christos Exp $
+# $NetBSD: shl.mi,v 1.283 2021/09/19 15:51:28 thorpej Exp $
./usr/lib/libbfd_g.a comp-c-debuglib debuglib,compatfile,binutils
./usr/libdata/debug/lib base-sys-usr debug,dynamicroot,compatdir
./usr/libdata/debug/lib/libavl.so.0.0.debug comp-zfs-debug debug,dynamicroot,zfs
./usr/libdata/debug/lib/libblacklist.so.0.0.debug comp-obsolete obsolete,compatfile
./usr/libdata/debug/lib/libblocklist.so.0.0.debug comp-sys-debug debug,dynamicroot
-./usr/libdata/debug/lib/libc.so.12.218.debug comp-sys-debug debug,dynamicroot
+./usr/libdata/debug/lib/libc.so.12.219.debug comp-sys-debug debug,dynamicroot
./usr/libdata/debug/lib/libcrypt.so.1.0.debug comp-sys-debug debug,dynamicroot
./usr/libdata/debug/lib/libcrypto.so.12.0.debug comp-sys-debug debug,dynamicroot,openssl=10
./usr/libdata/debug/lib/libcrypto.so.14.0.debug comp-sys-debug debug,dynamicroot,openssl=11
@@ -84,7 +84,7 @@
./usr/libdata/debug/usr/lib/libbsdmalloc.so.0.0.debug comp-sys-debug debug,compatfile
./usr/libdata/debug/usr/lib/libbz2.so.1.1.debug comp-sys-debug debug,compatfile
./usr/libdata/debug/usr/lib/libc++.so.1.0.debug comp-sys-debug debug,compatfile,libcxx
-./usr/libdata/debug/usr/lib/libc.so.12.218.debug comp-sys-debug debug,compatfile
+./usr/libdata/debug/usr/lib/libc.so.12.219.debug comp-sys-debug debug,compatfile
./usr/libdata/debug/usr/lib/libcbor.so.0.5.debug comp-sys-debug debug,compatfile
./usr/libdata/debug/usr/lib/libcom_err.so.8.0.debug comp-krb5-debug debug,compatfile,kerberos
./usr/libdata/debug/usr/lib/libcrypt.so.1.0.debug comp-sys-debug debug,compatfile
diff -r e0790a24eb7d -r e3a758ecae27 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Sun Sep 19 11:43:54 2021 +0000
+++ b/distrib/sets/lists/tests/mi Sun Sep 19 15:51:27 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1125 2021/09/13 22:09:06 rillig Exp $
+# $NetBSD: mi,v 1.1126 2021/09/19 15:51:28 thorpej Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -3145,6 +3145,7 @@
./usr/tests/lib/libc/sys/t_connect tests-lib-tests compattestfile,atf
./usr/tests/lib/libc/sys/t_context tests-obsolete obsolete
./usr/tests/lib/libc/sys/t_dup tests-lib-tests compattestfile,atf
+./usr/tests/lib/libc/sys/t_eventfd tests-lib-tests compattestfile,atf
./usr/tests/lib/libc/sys/t_fork tests-lib-tests compattestfile,atf
./usr/tests/lib/libc/sys/t_fsync tests-lib-tests compattestfile,atf
./usr/tests/lib/libc/sys/t_futex_ops tests-lib-tests compattestfile,atf
@@ -3212,6 +3213,7 @@
./usr/tests/lib/libc/sys/t_swapcontext tests-lib-tests compattestfile,atf
./usr/tests/lib/libc/sys/t_syscall tests-lib-tests compattestfile,atf
./usr/tests/lib/libc/sys/t_timer_create tests-lib-tests compattestfile,atf
+./usr/tests/lib/libc/sys/t_timerfd tests-lib-tests compattestfile,atf
./usr/tests/lib/libc/sys/t_truncate tests-lib-tests compattestfile,atf
./usr/tests/lib/libc/sys/t_ucontext tests-lib-tests compattestfile,atf
./usr/tests/lib/libc/sys/t_umask tests-lib-tests compattestfile,atf
diff -r e0790a24eb7d -r e3a758ecae27 lib/libc/shlib_version
--- a/lib/libc/shlib_version Sun Sep 19 11:43:54 2021 +0000
+++ b/lib/libc/shlib_version Sun Sep 19 15:51:27 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: shlib_version,v 1.291 2020/10/09 18:38:48 christos Exp $
+# $NetBSD: shlib_version,v 1.292 2021/09/19 15:51:28 thorpej Exp $
# Remember to update distrib/sets/lists/base/shl.* when changing
#
# things we wish to do on next major version bump:
@@ -54,4 +54,4 @@
# - the syscall stubs for the (obsolete) lfs syscalls should be removed
# - remove tzsetwall(3), upstream has removed it
major=12
-minor=218
+minor=219
diff -r e0790a24eb7d -r e3a758ecae27 lib/libc/sys/Makefile.inc
--- a/lib/libc/sys/Makefile.inc Sun Sep 19 11:43:54 2021 +0000
+++ b/lib/libc/sys/Makefile.inc Sun Sep 19 15:51:27 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.245 2020/08/14 00:53:16 riastradh Exp $
+# $NetBSD: Makefile.inc,v 1.246 2021/09/19 15:51:28 thorpej Exp $
# @(#)Makefile.inc 8.3 (Berkeley) 10/24/94
# sys sources
@@ -7,9 +7,10 @@
# other sources shared with the kernel, used in syscalls
SRCS+= cpuset.c
# glue to offer userland wrappers for some syscalls
-SRCS+= accept4.c clock_getcpuclockid.c posix_fadvise.c posix_madvise.c \
- ppoll.c sched.c sigqueue.c sigtimedwait.c sigwait.c sigwaitinfo.c \
- statvfs.c swapon.c semctl.c vadvise.c
+SRCS+= accept4.c clock_getcpuclockid.c eventfd_read.c eventfd_write.c \
+ posix_fadvise.c posix_madvise.c ppoll.c sched.c sigqueue.c \
+ sigtimedwait.c sigwait.c sigwaitinfo.c statvfs.c swapon.c semctl.c \
+ vadvise.c
.if ${RUMPRUN} != "yes"
# modules with non-default implementations on at least one architecture:
@@ -100,6 +101,7 @@
clock_getcpuclockid2.S \
__clock_getres50.S __clock_gettime50.S \
dup.S dup2.S dup3.S \
+ eventfd.S \
extattrctl.S \
extattr_delete_fd.S extattr_delete_file.S \
extattr_delete_link.S extattr_get_fd.S extattr_get_file.S \
@@ -154,6 +156,7 @@
__statvfs190.S swapctl.S symlink.S symlinkat.S __sysctl.S \
timer_create.S timer_delete.S __timer_gettime50.S timer_getoverrun.S \
____semctl50.S __timer_settime50.S \
+ timerfd_create.S timerfd_gettime.S timerfd_settime.S \
umask.S undelete.S unlink.S unlinkat.S unmount.S __utimes50.S \
utimensat.S utrace.S uuidgen.S
@@ -251,7 +254,7 @@
MAN+= accept.2 access.2 acct.2 adjtime.2 bind.2 brk.2 chdir.2 \
chflags.2 chmod.2 chown.2 chroot.2 clock_getcpuclockid2.2 \
clock_settime.2 clone.2 close.2 \
- connect.2 dup.2 execve.2 _exit.2 extattr_get_file.2 \
+ connect.2 dup.2 eventfd.2 execve.2 _exit.2 extattr_get_file.2 \
fcntl.2 fdatasync.2 fdiscard.2 fhopen.2 \
flock.2 fork.2 fsync.2 getcontext.2 getdents.2 \
getfh.2 getvfsstat.2 getgid.2 getgroups.2 \
@@ -284,7 +287,7 @@
socket.2 \
socketpair.2 stat.2 statvfs.2 swapctl.2 swapon.3 symlink.2 \
sync.2 sysarch.2 syscall.2 timer_create.2 timer_delete.2 \
- timer_settime.2 truncate.2 umask.2 undelete.2 \
+ timer_settime.2 timerfd.2 truncate.2 umask.2 undelete.2 \
unlink.2 utimes.2 utrace.2 uuidgen.2 vfork.2 wait.2 write.2
MLINKS+=_exit.2 _Exit.2
@@ -299,6 +302,8 @@
MLINKS+=chroot.2 fchroot.2
MLINKS+=clock_settime.2 clock_gettime.2
MLINKS+=clock_settime.2 clock_getres.2
+MLINKS+=eventfd.2 eventfd_read.2 \
+ eventfd.2 eventfd_write.2
MLINKS+=extattr_get_file.2 extattr_set_file.2 \
extattr_get_file.2 extattr_delete_file.2 \
extattr_get_file.2 extattr_list_file.2 \
@@ -380,6 +385,9 @@
MLINKS+=statvfs.2 statvfs1.2
MLINKS+=statvfs.2 fstatvfs1.2
MLINKS+=syscall.2 __syscall.2
+MLINKS+=timerfd.2 timerfd_create.2 \
+ timerfd.2 timerfd_gettime.2 \
+ timerfd.2 timerfd_settime.2
MLINKS+=truncate.2 ftruncate.2
MLINKS+=unlink.2 unlinkat.2
MLINKS+=utimes.2 futimes.2 utimes.2 lutimes.2
diff -r e0790a24eb7d -r e3a758ecae27 lib/libc/sys/eventfd.2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/sys/eventfd.2 Sun Sep 19 15:51:27 2021 +0000
@@ -0,0 +1,271 @@
+.\" $NetBSD: eventfd.2,v 1.1 2021/09/19 15:51:28 thorpej Exp $
+.\"
+.\" Copyright (c) 2021 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Jason R. Thorpe.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
Home |
Main Index |
Thread Index |
Old Index