summaryrefslogtreecommitdiff
path: root/res/res_timing_kqueue.c
diff options
context:
space:
mode:
authorDavid M. Lee <dlee@digium.com>2015-01-26 14:50:40 +0000
committerDavid M. Lee <dlee@digium.com>2015-01-26 14:50:40 +0000
commit965777ccfc61067d1dc79f79c12d52f794fa3983 (patch)
treefc931f38e9acc6885ca0df5fdbc1e14bac437495 /res/res_timing_kqueue.c
parenta8ae5a7bcb3c102b1a196d109a1d06507dd3dd1e (diff)
Various fixes for OS X
This patch addresses compilation errors on OS X. It's been a while, so there's quite a few things. * Fixed __attribute__ decls in route.h to be portable. * Fixed htonll and ntohll to work when they are defined as macros. * Replaced sem_t usage with our ast_sem wrapper. * Added ast_sem_timedwait to our ast_sem wrapper. * Fixed some GCC 4.9 warnings using sig*set() functions. * Fixed some format strings for portability. * Fixed compilation issues with res_timing_kqueue (although tests still fail on OS X). * Fixed menuconfig /sbin/launchd detection, which disables res_timing_kqueue on OS X). ASTERISK-24539 #close Reported by: George Joseph ASTERISK-24544 #close Reported by: George Joseph Review: https://reviewboard.asterisk.org/r/4327/ ........ Merged revisions 431092 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@431093 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_timing_kqueue.c')
-rw-r--r--res/res_timing_kqueue.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/res/res_timing_kqueue.c b/res/res_timing_kqueue.c
index 3e2417779..0c98064ca 100644
--- a/res/res_timing_kqueue.c
+++ b/res/res_timing_kqueue.c
@@ -91,12 +91,12 @@ static void *kqueue_timer_open(void)
if (!(timer = ao2_alloc(sizeof(*timer), timer_destroy))) {
ast_log(LOG_ERROR, "Could not allocate memory for kqueue_timer structure\n");
- return -1;
+ return NULL;
}
if ((timer->handle = kqueue()) < 0) {
ast_log(LOG_ERROR, "Failed to create kqueue timer: %s\n", strerror(errno));
ao2_ref(timer, -1);
- return -1;
+ return NULL;
}
return timer;
@@ -201,6 +201,8 @@ static enum ast_timer_event kqueue_timer_get_event(void *data)
if (timer->unacked == 0) {
if (kevent(timer->handle, NULL, 0, &kev, 1, &sixty_seconds) > 0) {
timer->unacked += kev.data;
+ } else {
+ perror("kevent");
}
}
@@ -250,7 +252,7 @@ AST_TEST_DEFINE(test_kqueue_timing)
}
do {
- pfd.fd = ast_timer_fd(kt);
+ pfd.fd = kqueue_timer_fd(kt);
if (kqueue_timer_set_rate(kt, 1000)) {
ast_test_status_update(test, "Cannot set timer rate to 1000/s\n");
res = AST_TEST_FAIL;
@@ -271,13 +273,12 @@ AST_TEST_DEFINE(test_kqueue_timing)
res = AST_TEST_FAIL;
break;
}
-#if 0
if (kt->unacked == 0) {
ast_test_status_update(test, "Unacked events is 0, but there should be at least 1.\n");
res = AST_TEST_FAIL;
break;
}
-#endif
+
kqueue_timer_enable_continuous(kt);
start = ast_tvnow();
for (i = 0; i < 100; i++) {