Date: Mon, 18 Mar 2024 14:40:10 GMT From: Baptiste Daroussin <bapt@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 104328e63034 - stable/14 - timerfd_create: accept CLOCK_UPTIME/CLOCK_BOOTTIME Message-ID: <202403181440.42IEeAZT071072@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=104328e63034f34a7961c0ebfb2dfdf78717982d commit 104328e63034f34a7961c0ebfb2dfdf78717982d Author: Baptiste Daroussin <bapt@FreeBSD.org> AuthorDate: 2024-03-06 14:11:32 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> CommitDate: 2024-03-18 14:39:52 +0000 timerfd_create: accept CLOCK_UPTIME/CLOCK_BOOTTIME This is a common use case when using timerfd_create to actually use it with CLOCK_BOOTTIME on linux which is CLOCK_UPTIME for us. Note that currently on freebsd CLOCK_BOOTTIME is CLOCK_UPTIME, but the semantic is supposed to be different, this has to be fixed later. Tested with the fnott notification software Reviewed by: des, imp Differential Revision: https://reviews.freebsd.org/D44253 (cherry picked from commit cf742faa39a58a9b43b671c66097e6880459d4ae) (cherry picked from commit 0ecf0b26a750582b804e238e6446db55188d7fdc) --- sys/kern/sys_timerfd.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/kern/sys_timerfd.c b/sys/kern/sys_timerfd.c index d9c0e189baf2..80d1e9f4bfb2 100644 --- a/sys/kern/sys_timerfd.c +++ b/sys/kern/sys_timerfd.c @@ -431,8 +431,20 @@ kern_timerfd_create(struct thread *td, int clockid, int flags) AUDIT_ARG_VALUE(clockid); AUDIT_ARG_FFLAGS(flags); - if (clockid != CLOCK_REALTIME && clockid != CLOCK_MONOTONIC) + switch (clockid) { + case CLOCK_REALTIME: + /* FALLTHROUGH */ + case CLOCK_MONOTONIC: + /* FALLTHROUGH */ + case CLOCK_UPTIME: + /* + * CLOCK_BOOTTIME should be added once different from + * CLOCK_UPTIME + */ + break; + default: return (EINVAL); + } if ((flags & ~(TFD_CLOEXEC | TFD_NONBLOCK)) != 0) return (EINVAL);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202403181440.42IEeAZT071072>