From nobody Mon Mar 18 14:40:10 2024 X-Original-To: dev-commits-src-branches@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 4TyyF63ym2z5DrWr; Mon, 18 Mar 2024 14:40:10 +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 4TyyF63TDrz4TXt; Mon, 18 Mar 2024 14:40:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710772810; 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=AfP0Trp4M8I9WT7sFzIgZzLZe9bnSUKap6tcmMP1C8M=; b=kgtXbBMjrD8D3M/Md65Uc0MuAl4dcrd7JCydMlXSeiMvXVIjjTNkVeMsXyfnCWmdCt+aiA JJa3TRC3zGP7Qw3lNq1yOwtQKe8zYcAp+9p79k9JGARxwvNQFfBrvRxNd82lMJCYmrQlhO xLSVMSytKcSqA1fV6iYMWrIpAm9nFcX5iqsNR4bEMNUMpXQYcc9mngrsCNBFa/uWpKFEdj 5Kx4532FbFyxCoizDmz4vw12JAtQtW9/rnvRAL9U3Q19jv5FJd7bqYARHG9ijgJDsd8sXh iY5KV+zUpeYBYIYJG30d54/7AfTVVQYHlMVcIvPYcXpgnV2TGB6ZycDRzppp5A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1710772810; a=rsa-sha256; cv=none; b=p8GX2vhzGswiMwT9cUsWpetxbrYoL27TkWz8OrPvtdWsOVJtmIblbUKYN4EEyCx0368R4/ flMRY1/PuqcsvC8U4tgnCNAJDurkYiT5xPZ+DQF2Bd8zcj9jeNLlzsJjtVDcOc0H3wmCaJ pSFTSeP6ZEZd/F/G7m3+dlvo1kOEAgipmDdXbnSdO7YQzKOsNUUNK6ArkJoSA/S2pZFE3r nTnsqHuS6im9FBRuKVp6j8CEDBy18uKenh5fFV78VxSLAf+i08U5xNJRvFAWinud0KUR4R /oTiTHTLwz4M4G94Ox1yyKh1egT/48BSDSv+GK+u2e5got2IQWE4zI1TOoFS+w== 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=1710772810; 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=AfP0Trp4M8I9WT7sFzIgZzLZe9bnSUKap6tcmMP1C8M=; b=VWC1tg6IXKNZ6FHDcAPBFlpr6aOExGHIfqbfnnXDnlM9e2gUWeUB9iFQlEH37pgOlhjFs5 gKeUBPoM3uoASkeB5Pv/2yFVoFQZTcMFsu/4tg3M4eLooWs5sqJCRQLmNon4rU7zS7RPZ8 VD13t0yIYcEh6VA7SBPny9eCY0PlDZ5pWv9Dyg9cBpUMiwvdXZyM2aaAwzeCKqfwqZ3oP6 JHQAdQhGNN1Uon2+UU5h3noetVk+ZdALgt0toSX+ID8L/S0/zdPF5fLr01QPupHz9HI2qc oWhelSqCX5E3A+YgqM6LbXmIHkVKAFeIsN2xxwcPpYjhyUQH5dhBP21kq+fC1w== 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 4TyyF62z1dzRbl; Mon, 18 Mar 2024 14:40:10 +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 42IEeAnv071082; Mon, 18 Mar 2024 14:40:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42IEeAZT071072; Mon, 18 Mar 2024 14:40:10 GMT (envelope-from git) Date: Mon, 18 Mar 2024 14:40:10 GMT Message-Id: <202403181440.42IEeAZT071072@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 104328e63034 - stable/14 - timerfd_create: accept CLOCK_UPTIME/CLOCK_BOOTTIME List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 104328e63034f34a7961c0ebfb2dfdf78717982d Auto-Submitted: auto-generated The branch stable/14 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=104328e63034f34a7961c0ebfb2dfdf78717982d commit 104328e63034f34a7961c0ebfb2dfdf78717982d Author: Baptiste Daroussin AuthorDate: 2024-03-06 14:11:32 +0000 Commit: Baptiste Daroussin 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);