diff options
author | David M. Lee <dlee@digium.com> | 2015-01-26 14:49:32 +0000 |
---|---|---|
committer | David M. Lee <dlee@digium.com> | 2015-01-26 14:49:32 +0000 |
commit | 702d79de2a2341954ef599f4c5a4c5f31c1b5edc (patch) | |
tree | 84e0fa7843ca364b485781655627e82fa021fea3 /res/res_timing_kqueue.c | |
parent | 1fc823c770461689d44a1a8bd14f57a6ddf92372 (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/
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@431092 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_timing_kqueue.c')
-rw-r--r-- | res/res_timing_kqueue.c | 11 |
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++) { |