git: ba5b331aef2b - stable/15 - lib/libthr: add helper to check valid clockid to use with _umtx_op(2)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 17 Nov 2026 01:09:43 UTC
The branch stable/15 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=ba5b331aef2bfc61131de86d21cf040b394ec3ee
commit ba5b331aef2bfc61131de86d21cf040b394ec3ee
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-11-05 20:39:40 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-11-17 00:25:00 +0000
lib/libthr: add helper to check valid clockid to use with _umtx_op(2)
(cherry picked from commit 62e53516f73247d2ed80d8dc452f02d9a92575a0)
---
lib/libthr/thread/thr_private.h | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h
index 2edf09d761ae..d06f9b98098c 100644
--- a/lib/libthr/thread/thr_private.h
+++ b/lib/libthr/thread/thr_private.h
@@ -968,6 +968,34 @@ _sleepq_first(struct sleepqueue *sq)
return TAILQ_FIRST(&sq->sq_blocked);
}
+/*
+ * Must accept the same clocks as umtx_check_clockid() in
+ * sys/kern/kern_umtx.c.
+ */
+static inline int
+_thr_check_clockid(clockid_t clockid)
+{
+ switch (clockid) {
+ case CLOCK_REALTIME:
+ case CLOCK_REALTIME_PRECISE:
+ case CLOCK_REALTIME_FAST:
+ case CLOCK_MONOTONIC:
+ case CLOCK_MONOTONIC_PRECISE:
+ case CLOCK_MONOTONIC_FAST:
+ case CLOCK_UPTIME:
+ case CLOCK_UPTIME_PRECISE:
+ case CLOCK_UPTIME_FAST:
+ case CLOCK_SECOND:
+ case CLOCK_VIRTUAL:
+ case CLOCK_PROF:
+ case CLOCK_PROCESS_CPUTIME_ID:
+ case CLOCK_TAI:
+ return (0);
+ default:
+ return (EINVAL);
+ }
+}
+
void _sleepq_init(void) __hidden;
struct sleepqueue *_sleepq_alloc(void) __hidden;
void _sleepq_free(struct sleepqueue *) __hidden;