summaryrefslogtreecommitdiff
path: root/funcs
diff options
context:
space:
mode:
authorDavid M. Lee <dlee@digium.com>2015-01-26 14:49:32 +0000
committerDavid M. Lee <dlee@digium.com>2015-01-26 14:49:32 +0000
commit702d79de2a2341954ef599f4c5a4c5f31c1b5edc (patch)
tree84e0fa7843ca364b485781655627e82fa021fea3 /funcs
parent1fc823c770461689d44a1a8bd14f57a6ddf92372 (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 'funcs')
-rw-r--r--funcs/func_presencestate.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/funcs/func_presencestate.c b/funcs/func_presencestate.c
index 8f02b942d..f1af8b4fd 100644
--- a/funcs/func_presencestate.c
+++ b/funcs/func_presencestate.c
@@ -41,7 +41,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/app.h"
#ifdef TEST_FRAMEWORK
#include "asterisk/test.h"
-#include <semaphore.h>
+#include "asterisk/sem.h"
#endif
/*** DOCUMENTATION
@@ -664,7 +664,7 @@ AST_TEST_DEFINE(test_invalid_parse_data)
struct test_cb_data {
struct ast_presence_state_message *presence_state;
/* That's right. I'm using a semaphore */
- sem_t sem;
+ struct ast_sem sem;
};
static struct test_cb_data *test_cb_data_alloc(void)
@@ -675,7 +675,7 @@ static struct test_cb_data *test_cb_data_alloc(void)
return NULL;
}
- if (sem_init(&cb_data->sem, 0, 0)) {
+ if (ast_sem_init(&cb_data->sem, 0, 0)) {
ast_free(cb_data);
return NULL;
}
@@ -686,7 +686,7 @@ static struct test_cb_data *test_cb_data_alloc(void)
static void test_cb_data_destroy(struct test_cb_data *cb_data)
{
ao2_cleanup(cb_data->presence_state);
- sem_destroy(&cb_data->sem);
+ ast_sem_destroy(&cb_data->sem);
ast_free(cb_data);
}
@@ -699,7 +699,7 @@ static void test_cb(void *userdata, struct stasis_subscription *sub, struct stas
cb_data->presence_state = stasis_message_data(msg);
ao2_ref(cb_data->presence_state, +1);
- sem_post(&cb_data->sem);
+ ast_sem_post(&cb_data->sem);
}
static enum ast_test_result_state presence_change_common(struct ast_test *test,
@@ -727,7 +727,7 @@ static enum ast_test_result_state presence_change_common(struct ast_test *test,
return AST_TEST_FAIL;
}
- sem_wait(&cb_data->sem);
+ ast_sem_wait(&cb_data->sem);
ast_copy_string(out_state, ast_presence_state2str(cb_data->presence_state->state), out_state_size);
ast_copy_string(out_subtype, cb_data->presence_state->subtype, out_subtype_size);