summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McDonald <danmcd@joyent.com>2020-02-18 13:54:32 -0500
committerDan McDonald <danmcd@joyent.com>2021-06-22 11:15:38 -0400
commit5d6ae526fc40daf98a23f74bdc170d4810640820 (patch)
treea766428ebff53bef42d402826d873891d60136be
parentd2efcfc81ce15b9a53a68d28a4eb440687ac3f22 (diff)
downloadillumos-joyent-OS-5804-cheesy.tar.gz
OS-5804 lxbrand needs support for CLOCK_*_CPUTIME_ID timersOS-5804-cheesy
-rw-r--r--usr/src/uts/common/brand/lx/syscall/lx_timer.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/usr/src/uts/common/brand/lx/syscall/lx_timer.c b/usr/src/uts/common/brand/lx/syscall/lx_timer.c
index 279bdbddc7..ba94c50ecf 100644
--- a/usr/src/uts/common/brand/lx/syscall/lx_timer.c
+++ b/usr/src/uts/common/brand/lx/syscall/lx_timer.c
@@ -10,7 +10,7 @@
*/
/*
- * Copyright 2016 Joyent, Inc.
+ * Copyright 2020 Joyent, Inc.
*/
/*
@@ -20,9 +20,16 @@
* contrast, the Linux kernel is furnished with an overabundance of narrowly
* differentiated clock types.
*
- * Fortunately, most of the commonly used Linux clock types are either similar
- * enough to the native clock backends that they can be directly mapped, or
- * represent queries to the per-process and per-LWP microstate counters.
+ * Fortunately, most of the commonly used Linux clock types are similar
+ * enough to the native clock backends that they can be directly mapped.
+ *
+ * Unfortunately, while CLOCK_{THREAD,PROCESS}_CPUTIME_ID are *somewhat*
+ * implemented in the main illumos kernel as itimers (see setitimer(2)), we
+ * would need to entirely bringup of CLOCK_{THREAD,PROCESS}_CPUTIME_ID to
+ * implement timer_create() and friends. For now, we opt to map it to
+ * CLOCK_HIGHRES for timer_create() and friends, but continue to emulate
+ * more-accurate queries to per-process or per-LWP microstate accounting for
+ * getres, gettime, or settime.
*
* CLOCK_BOOTTIME is identical to CLOCK_MONOTONIC, except that it takes into
* account time that the system is suspended. Since that is uninteresting to
@@ -83,8 +90,8 @@ struct lx_timezone {
static lx_clock_backend_t lx_clock_backends[] = {
NATIVE(CLOCK_REALTIME), /* LX_CLOCK_REALTIME */
NATIVE(CLOCK_HIGHRES), /* LX_CLOCK_MONOTONIC */
- EMUL(CLOCK_PROCESS_CPUTIME_ID), /* LX_CLOCK_PROCESS_CPUTIME_ID */
- EMUL(CLOCK_THREAD_CPUTIME_ID), /* LX_CLOCK_THREAD_CPUTIME_ID */
+ EMUL(CLOCK_HIGHRES), /* LX_CLOCK_PROCESS_CPUTIME_ID */
+ EMUL(CLOCK_HIGHRES), /* LX_CLOCK_THREAD_CPUTIME_ID */
NATIVE(CLOCK_HIGHRES), /* LX_CLOCK_MONOTONIC_RAW */
NATIVE(CLOCK_REALTIME), /* LX_CLOCK_REALTIME_COARSE */
NATIVE(CLOCK_HIGHRES), /* LX_CLOCK_MONOTONIC_COARSE */