summaryrefslogtreecommitdiff
path: root/include/asterisk
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 /include/asterisk
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 'include/asterisk')
-rw-r--r--include/asterisk/autoconfig.h.in9
-rw-r--r--include/asterisk/sem.h19
2 files changed, 26 insertions, 2 deletions
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index 2832c0027..a8293a2fe 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -324,7 +324,7 @@
/* Define to 1 if you have the Hoard Memory Allocator library. */
#undef HAVE_HOARD
-/* Define to 1 if you have the `htonll' function. */
+/* Define to 1 if arpa/inet.h includes a htonll definition. */
#undef HAVE_HTONLL
/* Define to 1 if you have the iCal library. */
@@ -524,7 +524,7 @@
/* Define to 1 if you have the newt library. */
#undef HAVE_NEWT
-/* Define to 1 if you have the `ntohll' function. */
+/* Define to 1 if arpa/inet.h includes a ntohll definition. */
#undef HAVE_NTOHLL
/* Define to 1 if your C library can safely print NULL to string formats. */
@@ -1299,6 +1299,11 @@
/* Define to 1 if running on Darwin. */
#undef _DARWIN_UNLIMITED_SELECT
+/* Enable large inode numbers on Mac OS X 10.5. */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
diff --git a/include/asterisk/sem.h b/include/asterisk/sem.h
index 8f6356c01..6d655d63e 100644
--- a/include/asterisk/sem.h
+++ b/include/asterisk/sem.h
@@ -59,6 +59,11 @@ static force_inline int ast_sem_wait(struct ast_sem *sem)
return sem_wait(&sem->real_sem);
}
+static force_inline int ast_sem_timedwait(struct ast_sem *sem, const struct timespec *abs_timeout)
+{
+ return sem_timedwait(&sem->real_sem, abs_timeout);
+}
+
static force_inline int ast_sem_getvalue(struct ast_sem *sem, int *sval)
{
return sem_getvalue(&sem->real_sem, sval);
@@ -137,6 +142,20 @@ int ast_sem_post(struct ast_sem *sem);
int ast_sem_wait(struct ast_sem *sem);
/*!
+ * \brief Decrements the semaphore, waiting until abs_timeout.
+ *
+ * If the semaphore's current value is zero, this function blocks until another
+ * thread posts (ast_sem_post()) to the semaphore (or is interrupted by a signal
+ * handler, which sets errno to EINTR).
+ *
+ * \param sem Semaphore to decrement.
+ *
+ * \return 0 on success.
+ * \return -1 on error, errno set to indicate error.
+ */
+int ast_sem_timedwait(struct ast_sem *sem, const struct timespec *abs_timeout);
+
+/*!
* \brief Gets the current value of the semaphore.
*
* If threads are blocked on this semaphore, POSIX allows the return value to be