summaryrefslogtreecommitdiff
path: root/res/res_timing_timerfd.c
diff options
context:
space:
mode:
authorSean Bright <sean@malleable.com>2010-01-14 20:30:03 +0000
committerSean Bright <sean@malleable.com>2010-01-14 20:30:03 +0000
commitcd2ba30e9eb37b022aa543b42baeee4a6bc411c9 (patch)
tree7325e5a49919c2964927bddcf863b1c34817b4bc /res/res_timing_timerfd.c
parent9228fba7d7e68a1ce8f4fe92203030d15e78aaad (diff)
If we aren't running on a machine that support CLOCK_MONOTONIC, don't load.
Group developed and tested by seanbright, Corydon76, Kobaz, and Amorsen. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@240226 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_timing_timerfd.c')
-rw-r--r--res/res_timing_timerfd.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/res/res_timing_timerfd.c b/res/res_timing_timerfd.c
index b2ff89c75..a62453e4d 100644
--- a/res/res_timing_timerfd.c
+++ b/res/res_timing_timerfd.c
@@ -262,6 +262,16 @@ static unsigned int timerfd_timer_get_max_rate(int handle)
static int load_module(void)
{
+ int fd;
+
+ /* Make sure we support the necessary clock type */
+ if ((fd = timerfd_create(CLOCK_MONOTONIC, 0)) < 0) {
+ ast_log(LOG_ERROR, "CLOCK_MONOTONIC not supported. Not loading.\n");
+ return AST_MODULE_LOAD_DECLINE;
+ }
+
+ close(fd);
+
if (!(timerfd_timers = ao2_container_alloc(TIMERFD_TIMER_BUCKETS, timerfd_timer_hash, timerfd_timer_cmp))) {
return AST_MODULE_LOAD_DECLINE;
}