From nobody Wed Mar 06 17:13:42 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TqfCq01vlz5Cxpk; Wed, 6 Mar 2024 17:13:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TqfCp6ScSz4mqr; Wed, 6 Mar 2024 17:13:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709745222; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JbrnzV8zO0KLDroJRP5sVGz3rZAdsct717m0Xnz5lbE=; b=u3E8m+cpDMC4bDryB4F127CTXAVD1sGAktDeryC2I6cZvngssu9Bi+PoZHTFZw4SiVv06G /hpblQzQV9TysOVNeDjthPU+XrWVHRNMFyk3LacTxRIJeyHMFvr/AuHxTgqEn+YP6zjX+Y 1iwiN2C1kkQTkFTPnjTAaRBCPJltHS4ls7vDK131i3jjSB2rEAriDqeNwU6RjdaSFem1ed ZFWaeQzu1p3jgv/p6KsjlBPXrriVqkkIgY9VZ0PLhbG6AT/+kmpIeuJK4vSmiGnenR4ZES qCgMvwSXSD8SAwW/HitEk2s/dtOfFrAlcr9e0nym+g1vojOp3xtcJYVusX1vew== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709745222; a=rsa-sha256; cv=none; b=rPfdsmePNPWNmL0M5I1Vxx/3i1RUEO+rfNVckU8a2B9Bfvf4OGhWlpbbir3Jw3MvIahrf7 zRd7nins0xHjZx72JA/AjcUre9cohTQOKpxw73acHd3jSmAULKNZ7JxQZ1b/4BroYAe4s0 NqCEkY4lrTQvohGkRDJUE72so/8L6CSAQhzE/KmVIo3uKST72uCjCsv2pSXqmT44VuDRS2 8mHJVvHJPea1EiXBCfYFSp8feCkckhgNx4jsA3U30dS9n2M5/K/YrBIGkHYer3L++IOWwq g1zqLlzhk4sH6J7Un0bUIsCKLh+zn03QdMr4n6mJ1SACiDKHCQtGGBDxyXsy7g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709745222; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JbrnzV8zO0KLDroJRP5sVGz3rZAdsct717m0Xnz5lbE=; b=MIC8cD8UJsjHo1UVU/4hphLdyvijfpeRLAhjSMsB837Chlvg3Cx3myfyINmyJxo8S3v3LB 55N452hSIEQt8LSrM9Au2s0ODpj/QwfbPtGlK+wwWHjD52KMdFXQExAcN3j8UsR0JwETBw pVWubFF/hnkM9Nw5THFr/8ivA6z8PiQ7nKp223YXlBy3KIcWNQPDB6filxhmRQjpQ5sPdC SDHXEQLl3uDP6aL2b0aw6UNsCEmH2B3DIGSMYwCTlRzY8tuYOYywH340QHj5HQwp98n8Qw ILDT1CEOTPNbwzVt9oIQLF0FKO6qotIiL6BYxVKUy8mbga7nd27oJM3T3M43bQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TqfCp647Qzykf; Wed, 6 Mar 2024 17:13:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 426HDgus009801; Wed, 6 Mar 2024 17:13:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 426HDg2D009798; Wed, 6 Mar 2024 17:13:42 GMT (envelope-from git) Date: Wed, 6 Mar 2024 17:13:42 GMT Message-Id: <202403061713.426HDg2D009798@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: cf742faa39a5 - main - timerfd_create: accept CLOCK_UPTIME/CLOCK_BOOTTIME List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cf742faa39a58a9b43b671c66097e6880459d4ae Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=cf742faa39a58a9b43b671c66097e6880459d4ae commit cf742faa39a58a9b43b671c66097e6880459d4ae Author: Baptiste Daroussin AuthorDate: 2024-03-06 14:11:32 +0000 Commit: Baptiste Daroussin CommitDate: 2024-03-06 17:13:33 +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 --- sys/kern/sys_timerfd.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/kern/sys_timerfd.c b/sys/kern/sys_timerfd.c index 30c3709e59a6..f74fb87bea75 100644 --- a/sys/kern/sys_timerfd.c +++ b/sys/kern/sys_timerfd.c @@ -26,6 +26,7 @@ * SUCH DAMAGE. */ +#include #include #include #include @@ -432,8 +433,18 @@ 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: + /* FALLTHROUGH */ + case CLOCK_BOOTTIME: + break; + default: return (EINVAL); + } if ((flags & ~(TFD_CLOEXEC | TFD_NONBLOCK)) != 0) return (EINVAL);