summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2016-03-23 18:49:30 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2016-03-23 18:49:30 +0000
commitc11422a43e3c04c55f76ea9544fd8650f35c3309 (patch)
tree2983a015a4c6e0d7aa281992220221158bab231a
parent873e369fff594d83eb146b65cef6d9f14974894c (diff)
downloadillumos-joyent-c11422a43e3c04c55f76ea9544fd8650f35c3309.tar.gz
OS-5266 timerfd_create should only accept CLOCK_MONOTONIC and CLOCK_REALTIME
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
-rw-r--r--usr/src/lib/brand/lx/lx_brand/common/clock.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr/src/lib/brand/lx/lx_brand/common/clock.c b/usr/src/lib/brand/lx/lx_brand/common/clock.c
index 5ef8c78e4e..130f55e04e 100644
--- a/usr/src/lib/brand/lx/lx_brand/common/clock.c
+++ b/usr/src/lib/brand/lx/lx_brand/common/clock.c
@@ -72,6 +72,9 @@
#define CLOCK_RT_SLOT 0
+#define LX_CLOCK_REALTIME 0
+#define LX_CLOCK_MONOTONIC 1
+
static int ltos_clock[] = {
CLOCK_REALTIME, /* LX_CLOCK_REALTIME */
CLOCK_HIGHRES, /* LX_CLOCK_MONOTONIC */
@@ -328,8 +331,13 @@ lx_timer_delete(timer_t tid)
long
lx_timerfd_create(int clockid, int flags)
{
- int r = timerfd_create(ltos_timer[clockid], flags);
+ int r;
+
+ /* These are the only two valid values. LTP tests for this. */
+ if (clockid != LX_CLOCK_REALTIME && clockid != LX_CLOCK_MONOTONIC)
+ return (-EINVAL);
+ r = timerfd_create(ltos_timer[clockid], flags);
/*
* As with the eventfd case, we return a slightly less jarring
* error condition if we cannot open /dev/timerfd.