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
This commit is contained in:
David M. Lee
2015-01-26 14:49:32 +00:00
parent 1fc823c770
commit 702d79de2a
12 changed files with 1380 additions and 1311 deletions

View File

@@ -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++) {