diff options
Diffstat (limited to 'comms/asterisk/patches')
19 files changed, 769 insertions, 36 deletions
diff --git a/comms/asterisk/patches/patch-channels_chan__unistim.c b/comms/asterisk/patches/patch-channels_chan__unistim.c new file mode 100644 index 00000000000..507a0b6c6f7 --- /dev/null +++ b/comms/asterisk/patches/patch-channels_chan__unistim.c @@ -0,0 +1,13 @@ +$NetBSD: patch-channels_chan__unistim.c,v 1.1 2015/10/27 08:49:01 jnemeth Exp $ + +--- channels/chan_unistim.c.orig 2015-10-09 22:23:39.000000000 +0000 ++++ channels/chan_unistim.c +@@ -984,7 +984,7 @@ static int get_to_address(int fd, struct + memcpy(&toAddr->sin_addr, &ip_msg.address, sizeof(struct in_addr)); + return err; + #else +- memcpy(&toAddr, &public_ip, sizeof(&toAddr)); ++ memcpy(toAddr, &public_ip, sizeof(struct sockaddr_in)); + return 0; + #endif + } diff --git a/comms/asterisk/patches/patch-channels_sip_sdp__crypto.c b/comms/asterisk/patches/patch-channels_sip_sdp__crypto.c new file mode 100644 index 00000000000..3122b5d1b5a --- /dev/null +++ b/comms/asterisk/patches/patch-channels_sip_sdp__crypto.c @@ -0,0 +1,25 @@ +$NetBSD: patch-channels_sip_sdp__crypto.c,v 1.1 2015/10/27 08:49:01 jnemeth Exp $ + +--- channels/sip/sdp_crypto.c.orig 2015-10-09 22:23:39.000000000 +0000 ++++ channels/sip/sdp_crypto.c +@@ -187,6 +187,7 @@ err: + + int sdp_crypto_process(struct sdp_crypto *p, const char *attr, struct ast_rtp_instance *rtp, struct sip_srtp *srtp) + { ++ char buf[10]; + char *str = NULL; + char *tag = NULL; + char *suite = NULL; +@@ -220,8 +221,10 @@ int sdp_crypto_process(struct sdp_crypto + return -1; + } + +- /* RFC4568 9.1 - tag is 1-9 digits, greater than zero */ +- if (sscanf(tag, "%30d", &p->tag) != 1 || p->tag <= 0 || p->tag > 999999999) { ++ /* RFC4568 9.1 - tag is 1-9 digits */ ++ p->tag = atoi(tag); ++ snprintf(buf, sizeof(buf), "%d", p->tag); ++ if (strcmp(buf, tag) || p->tag < 0 || p->tag > 999999999) { + ast_log(LOG_WARNING, "Unacceptable a=crypto tag: %s\n", tag); + return -1; + } diff --git a/comms/asterisk/patches/patch-codecs_codec__dahdi.c b/comms/asterisk/patches/patch-codecs_codec__dahdi.c new file mode 100644 index 00000000000..484ecb07b2a --- /dev/null +++ b/comms/asterisk/patches/patch-codecs_codec__dahdi.c @@ -0,0 +1,15 @@ +$NetBSD: patch-codecs_codec__dahdi.c,v 1.1 2015/10/27 08:49:01 jnemeth Exp $ + +--- codecs/codec_dahdi.c.orig 2015-10-09 22:23:39.000000000 +0000 ++++ codecs/codec_dahdi.c +@@ -37,9 +37,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revisi + + #include <fcntl.h> + #include <netinet/in.h> ++#include <poll.h> + #include <sys/ioctl.h> + #include <sys/mman.h> +-#include <sys/poll.h> + #include <dahdi/user.h> + + #include "asterisk/lock.h" diff --git a/comms/asterisk/patches/patch-configure b/comms/asterisk/patches/patch-configure index 3e961b42765..1d794a364a0 100644 --- a/comms/asterisk/patches/patch-configure +++ b/comms/asterisk/patches/patch-configure @@ -1,8 +1,17 @@ -$NetBSD: patch-configure,v 1.4 2013/06/14 04:26:55 jnemeth Exp $ +$NetBSD: patch-configure,v 1.5 2015/10/27 08:49:01 jnemeth Exp $ ---- configure.orig 2013-02-27 12:22:30.000000000 +0000 +--- configure.orig 2015-10-09 22:23:39.000000000 +0000 +++ configure -@@ -14200,7 +14200,7 @@ fi +@@ -12409,7 +12409,7 @@ fi + done + + +-ac_fn_c_check_header_mongrel "$LINENO" "sys/poll.h" "ac_cv_header_sys_poll_h" "$ac_includes_default" ++ac_fn_c_check_header_mongrel "$LINENO" "poll.h" "ac_cv_header_sys_poll_h" "$ac_includes_default" + if test "x$ac_cv_header_sys_poll_h" = xyes; then : + + else +@@ -14464,7 +14464,7 @@ fi done @@ -11,7 +20,16 @@ $NetBSD: patch-configure,v 1.4 2013/06/14 04:26:55 jnemeth Exp $ do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -@@ -16195,16 +16195,16 @@ if $(${CC} -march=native -S -o /dev/null +@@ -14645,7 +14645,7 @@ rm -f core conftest.err conftest.$ac_obj + LDFLAGS=${old_LDFLAGS} + rm -f conftest.dynamics + +-ac_fn_c_check_header_mongrel "$LINENO" "sys/poll.h" "ac_cv_header_sys_poll_h" "$ac_includes_default" ++ac_fn_c_check_header_mongrel "$LINENO" "poll.h" "ac_cv_header_sys_poll_h" "$ac_includes_default" + if test "x$ac_cv_header_sys_poll_h" = xyes; then : + HAS_POLL=1 + +@@ -16459,16 +16459,16 @@ if $(${CC} -march=native -S -o /dev/null if test "${CONFIG_CFLAGS}" = ""; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -31,7 +49,7 @@ $NetBSD: patch-configure,v 1.4 2013/06/14 04:26:55 jnemeth Exp $ fi -@@ -16729,6 +16729,148 @@ fi +@@ -16968,6 +16968,148 @@ fi @@ -180,7 +198,7 @@ $NetBSD: patch-configure,v 1.4 2013/06/14 04:26:55 jnemeth Exp $ # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -@@ -17871,6 +18013,8 @@ $as_echo_n "checking if \"struct ifaddrs +@@ -18218,6 +18360,8 @@ $as_echo_n "checking if \"struct ifaddrs cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ diff --git a/comms/asterisk/patches/patch-configure.ac b/comms/asterisk/patches/patch-configure.ac index f47a0e313c4..de95ab0947e 100644 --- a/comms/asterisk/patches/patch-configure.ac +++ b/comms/asterisk/patches/patch-configure.ac @@ -1,8 +1,17 @@ -$NetBSD: patch-configure.ac,v 1.2 2013/06/14 04:26:55 jnemeth Exp $ +$NetBSD: patch-configure.ac,v 1.3 2015/10/27 08:49:01 jnemeth Exp $ ---- configure.ac.orig 2013-02-26 19:45:09.000000000 +0000 +--- configure.ac.orig 2015-10-09 22:23:39.000000000 +0000 +++ configure.ac -@@ -584,7 +584,7 @@ AC_FUNC_STRNLEN +@@ -543,7 +543,7 @@ AC_CHECK_HEADERS([xlocale.h]) + + AC_CHECK_HEADERS([winsock.h winsock2.h]) + +-AC_CHECK_HEADER([sys/poll.h], ++AC_CHECK_HEADER([poll.h], + [], + AC_DEFINE([AST_POLL_COMPAT], 1, [Define to 1 if internal poll should be used.])) + +@@ -597,7 +597,7 @@ AC_FUNC_STRNLEN AC_FUNC_STRTOD AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF @@ -11,7 +20,19 @@ $NetBSD: patch-configure.ac,v 1.2 2013/06/14 04:26:55 jnemeth Exp $ # NOTE: we use AC_CHECK_LIB to get -lm into the arguments for later checks, # so that AC_CHECK_FUNCS can detect functions in that library. -@@ -1036,7 +1036,7 @@ if $(${CC} -march=native -S -o /dev/null +@@ -648,9 +648,9 @@ AC_SUBST(PBX_DYNAMIC_LIST) + LDFLAGS=${old_LDFLAGS} + rm -f conftest.dynamics + +-AC_CHECK_HEADER([sys/poll.h], ++AC_CHECK_HEADER([poll.h], + [HAS_POLL=1] +- AC_DEFINE([HAVE_SYS_POLL_H], 1, [Define to 1 if your system has working sys/poll.h]), ++ AC_DEFINE([HAVE_SYS_POLL_H], 1, [Define to 1 if your system has working poll.h]), + ) + + AC_ARG_ENABLE([internal-poll], +@@ -1049,7 +1049,7 @@ if $(${CC} -march=native -S -o /dev/null fi else AC_MSG_RESULT(no) @@ -20,7 +41,7 @@ $NetBSD: patch-configure.ac,v 1.2 2013/06/14 04:26:55 jnemeth Exp $ fi AC_SUBST(AST_NATIVE_ARCH) -@@ -1160,6 +1160,9 @@ AST_C_DEFINE_CHECK([IP_MTU_DISCOVER], [I +@@ -1162,6 +1162,9 @@ AST_C_DEFINE_CHECK([IP_MTU_DISCOVER], [I AC_CHECK_HEADER([libkern/OSAtomic.h], [AC_DEFINE_UNQUOTED([HAVE_OSX_ATOMICS], 1, [Define to 1 if OSX atomic operations are supported.])]) diff --git a/comms/asterisk/patches/patch-funcs_func__env.c b/comms/asterisk/patches/patch-funcs_func__env.c new file mode 100644 index 00000000000..653ddfbaef8 --- /dev/null +++ b/comms/asterisk/patches/patch-funcs_func__env.c @@ -0,0 +1,13 @@ +$NetBSD: patch-funcs_func__env.c,v 1.1 2015/10/27 08:49:01 jnemeth Exp $ + +--- funcs/func_env.c.orig 2015-10-09 22:23:39.000000000 +0000 ++++ funcs/func_env.c +@@ -309,7 +309,7 @@ static int stat_read(struct ast_channel + snprintf(buf, len, "%d", (int) s.st_ctime); + break; + case 'm': +- snprintf(buf, len, "%o", s.st_mode); ++ snprintf(buf, len, "%o", (unsigned int) s.st_mode); + break; + } + } diff --git a/comms/asterisk/patches/patch-include_asterisk_compat.h b/comms/asterisk/patches/patch-include_asterisk_compat.h new file mode 100644 index 00000000000..72330224bab --- /dev/null +++ b/comms/asterisk/patches/patch-include_asterisk_compat.h @@ -0,0 +1,13 @@ +$NetBSD: patch-include_asterisk_compat.h,v 1.1 2015/10/27 08:49:01 jnemeth Exp $ + +--- include/asterisk/compat.h.orig 2015-10-09 22:23:39.000000000 +0000 ++++ include/asterisk/compat.h +@@ -68,7 +68,7 @@ + #endif + + #ifndef AST_POLL_COMPAT +-#include <sys/poll.h> ++#include <poll.h> + #else + #include "asterisk/poll-compat.h" + #endif diff --git a/comms/asterisk/patches/patch-include_asterisk_poll-compat.h b/comms/asterisk/patches/patch-include_asterisk_poll-compat.h new file mode 100644 index 00000000000..3146b11cd50 --- /dev/null +++ b/comms/asterisk/patches/patch-include_asterisk_poll-compat.h @@ -0,0 +1,13 @@ +$NetBSD: patch-include_asterisk_poll-compat.h,v 1.1 2015/10/27 08:49:01 jnemeth Exp $ + +--- include/asterisk/poll-compat.h.orig 2015-10-09 22:23:39.000000000 +0000 ++++ include/asterisk/poll-compat.h +@@ -83,7 +83,7 @@ + + #ifndef AST_POLL_COMPAT + +-#include <sys/poll.h> ++#include <poll.h> + + #define ast_poll(a, b, c) poll(a, b, c) + diff --git a/comms/asterisk/patches/patch-main_cdr.c b/comms/asterisk/patches/patch-main_cdr.c index 1802cc8f7c5..d56691a6c2f 100644 --- a/comms/asterisk/patches/patch-main_cdr.c +++ b/comms/asterisk/patches/patch-main_cdr.c @@ -1,6 +1,6 @@ -$NetBSD: patch-main_cdr.c,v 1.1 2015/05/19 07:52:14 jnemeth Exp $ +$NetBSD: patch-main_cdr.c,v 1.2 2015/10/27 08:49:01 jnemeth Exp $ ---- main/cdr.c.orig 2013-08-06 08:19:42.000000000 +0000 +--- main/cdr.c.orig 2015-10-09 22:23:39.000000000 +0000 +++ main/cdr.c @@ -260,7 +260,7 @@ static const char *ast_cdr_getvar_intern static void cdr_get_tv(struct timeval when, const char *fmt, char *buf, int bufsize) @@ -23,7 +23,7 @@ $NetBSD: patch-main_cdr.c,v 1.1 2015/05/19 07:52:14 jnemeth Exp $ } else if (!strcasecmp(name, "disposition")) { if (raw) { - snprintf(workspace, workspacelen, "%ld", cdr->disposition); -+ snprintf(workspace, workspacelen, "%jd", cdr->disposition); ++ snprintf(workspace, workspacelen, "%jd", (intmax_t)cdr->disposition); } else { ast_copy_string(workspace, ast_cdr_disp2str(cdr->disposition), workspacelen); } diff --git a/comms/asterisk/patches/patch-main_channel.c b/comms/asterisk/patches/patch-main_channel.c new file mode 100644 index 00000000000..19313fc41b9 --- /dev/null +++ b/comms/asterisk/patches/patch-main_channel.c @@ -0,0 +1,22 @@ +$NetBSD: patch-main_channel.c,v 1.1 2015/10/27 08:49:01 jnemeth Exp $ + +--- main/channel.c.orig 2015-10-24 19:56:31.000000000 +0000 ++++ main/channel.c +@@ -5907,15 +5907,8 @@ static int set_security_requirements(con + ast_channel_unlock(r); + + for (i = 0; i < 2; i++) { +- if (ops[i][1]) { +- if (ast_channel_setoption(out, ops[i][0], &ops[i][1], sizeof(ops[i][1]), 0)) { +- /* We require a security feature, but the channel won't provide it */ +- return -1; +- } +- } else { +- /* We don't care if we can't clear the option on a channel that doesn't support it */ +- ast_channel_setoption(out, ops[i][0], &ops[i][1], sizeof(ops[i][1]), 0); +- } ++ /* We don't care if we can't clear the option on a channel that doesn't support it */ ++ ast_channel_setoption(out, ops[i][0], &ops[i][1], sizeof(ops[i][1]), 0); + } + + return 0; diff --git a/comms/asterisk/patches/patch-main_pbx.c b/comms/asterisk/patches/patch-main_pbx.c index c74c661aebb..3f439d0ec63 100644 --- a/comms/asterisk/patches/patch-main_pbx.c +++ b/comms/asterisk/patches/patch-main_pbx.c @@ -1,8 +1,8 @@ -$NetBSD: patch-main_pbx.c,v 1.1 2015/05/19 07:52:14 jnemeth Exp $ +$NetBSD: patch-main_pbx.c,v 1.2 2015/10/27 08:49:01 jnemeth Exp $ ---- main/pbx.c.orig 2015-01-30 16:55:39.000000000 +0000 +--- main/pbx.c.orig 2015-10-09 22:23:39.000000000 +0000 +++ main/pbx.c -@@ -11201,7 +11201,7 @@ static int testtime_write(struct ast_cha +@@ -11427,7 +11427,7 @@ static int testtime_write(struct ast_cha sscanf(remainder, "%79s", timezone); tv = ast_mktime(&tm, S_OR(timezone, NULL)); @@ -11,7 +11,16 @@ $NetBSD: patch-main_pbx.c,v 1.1 2015/05/19 07:52:14 jnemeth Exp $ pbx_builtin_setvar_helper(chan, "__TESTTIME", result); return 0; } -@@ -11235,7 +11235,7 @@ static int pbx_builtin_gotoiftime(struct +@@ -11446,7 +11446,7 @@ static int pbx_builtin_gotoiftime(struct + struct ast_timing timing; + const char *ctime; + struct timeval tv = ast_tvnow(); +- long timesecs; ++ intmax_t timesecs; + + if (!chan) { + ast_log(LOG_WARNING, "GotoIfTime requires a channel on which to operate\n"); +@@ -11461,7 +11461,7 @@ static int pbx_builtin_gotoiftime(struct ts = s = ast_strdupa(data); ast_channel_lock(chan); diff --git a/comms/asterisk/patches/patch-main_sched.c b/comms/asterisk/patches/patch-main_sched.c index 87feedad59e..23b332da647 100644 --- a/comms/asterisk/patches/patch-main_sched.c +++ b/comms/asterisk/patches/patch-main_sched.c @@ -1,8 +1,8 @@ -$NetBSD: patch-main_sched.c,v 1.1 2012/12/11 08:22:49 jnemeth Exp $ +$NetBSD: patch-main_sched.c,v 1.2 2015/10/27 08:49:01 jnemeth Exp $ ---- main/sched.c.orig 2012-06-15 16:20:16.000000000 +0000 +--- main/sched.c.orig 2015-10-09 22:23:39.000000000 +0000 +++ main/sched.c -@@ -349,7 +349,7 @@ static int sched_settime(struct timeval +@@ -474,7 +474,7 @@ static int sched_settime(struct timeval { struct timeval now = ast_tvnow(); @@ -11,19 +11,17 @@ $NetBSD: patch-main_sched.c,v 1.1 2012/12/11 08:22:49 jnemeth Exp $ if (ast_tvzero(*t)) /* not supplied, default to now */ *t = now; *t = ast_tvadd(*t, ast_samp2tv(when, 1000)); -@@ -557,12 +557,12 @@ void ast_sched_dump(struct ast_sched_con +@@ -688,11 +688,11 @@ void ast_sched_dump(struct ast_sched_con struct timeval delta; q = ast_heap_peek(con->sched_heap, x); delta = ast_tvsub(q->when, when); - ast_debug(1, "|%.4d | %-15p | %-15p | %.6ld : %.6ld |\n", -+ ast_debug(1, "|%.4d | %-15p | %-15p | %.6jd : %.6jd |\n", - q->id, ++ ast_debug(1, "|%.4d | %-15p | %-15p | %.6jd : %.6ld |\n", + q->sched_id->id, q->callback, q->data, - (long)delta.tv_sec, -- (long int)delta.tv_usec); + (intmax_t)delta.tv_sec, -+ (intmax_t)delta.tv_usec); + (long int)delta.tv_usec); } ast_mutex_unlock(&con->lock); - ast_debug(1, "=============================================================\n"); diff --git a/comms/asterisk/patches/patch-main_stdtime_localtime.c b/comms/asterisk/patches/patch-main_stdtime_localtime.c index cd51555d3ba..159851498ea 100644 --- a/comms/asterisk/patches/patch-main_stdtime_localtime.c +++ b/comms/asterisk/patches/patch-main_stdtime_localtime.c @@ -1,8 +1,19 @@ -$NetBSD: patch-main_stdtime_localtime.c,v 1.2 2015/05/19 07:52:14 jnemeth Exp $ +$NetBSD: patch-main_stdtime_localtime.c,v 1.3 2015/10/27 08:49:01 jnemeth Exp $ ---- main/stdtime/localtime.c.orig 2015-03-10 17:42:57.000000000 +0000 +--- main/stdtime/localtime.c.orig 2015-10-09 22:23:39.000000000 +0000 +++ main/stdtime/localtime.c -@@ -733,7 +733,7 @@ static void *notify_daemon(void *data) +@@ -67,6 +67,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revisi + #include <sys/stat.h> + #include <fcntl.h> + #endif ++#ifdef __sun ++#include <time.h> ++#include <xlocale.h> ++#endif + + #include "private.h" + #include "tzfile.h" +@@ -733,7 +737,7 @@ static void *notify_daemon(void *data) if (st.st_mtime > cur->mtime[0] || lst.st_mtime > cur->mtime[1]) { #ifdef TEST_FRAMEWORK if (test) { @@ -11,7 +22,7 @@ $NetBSD: patch-main_stdtime_localtime.c,v 1.2 2015/05/19 07:52:14 jnemeth Exp $ } else #endif { -@@ -2417,6 +2417,23 @@ static struct locale_entry *find_by_name +@@ -2417,6 +2421,23 @@ static struct locale_entry *find_by_name return NULL; } @@ -35,7 +46,7 @@ $NetBSD: patch-main_stdtime_localtime.c,v 1.2 2015/05/19 07:52:14 jnemeth Exp $ static const char *store_by_locale(locale_t prevlocale) { struct locale_entry *cur; -@@ -2474,6 +2491,7 @@ const char *ast_setlocale(const char *lo +@@ -2474,6 +2495,7 @@ const char *ast_setlocale(const char *lo AST_LIST_UNLOCK(&localelist); return store_by_locale(prevlocale); } @@ -43,7 +54,7 @@ $NetBSD: patch-main_stdtime_localtime.c,v 1.2 2015/05/19 07:52:14 jnemeth Exp $ #else const char *ast_setlocale(const char *unused) { -@@ -2487,7 +2505,9 @@ int ast_strftime_locale(char *buf, size_ +@@ -2487,7 +2509,9 @@ int ast_strftime_locale(char *buf, size_ char *format = ast_calloc(1, fmtlen), *fptr = format, *newfmt; int decimals = -1, i, res; long fraction; @@ -53,7 +64,7 @@ $NetBSD: patch-main_stdtime_localtime.c,v 1.2 2015/05/19 07:52:14 jnemeth Exp $ buf[0] = '\0';/* Ensure the buffer is initialized. */ if (!format) { -@@ -2542,6 +2562,14 @@ defcase: *fptr++ = *tmp; +@@ -2542,6 +2566,14 @@ defcase: *fptr++ = *tmp; } *fptr = '\0'; #undef strftime @@ -68,7 +79,7 @@ $NetBSD: patch-main_stdtime_localtime.c,v 1.2 2015/05/19 07:52:14 jnemeth Exp $ if (locale) { prevlocale = ast_setlocale(locale); } -@@ -2549,6 +2577,7 @@ defcase: *fptr++ = *tmp; +@@ -2549,6 +2581,7 @@ defcase: *fptr++ = *tmp; if (locale) { ast_setlocale(prevlocale); } @@ -76,7 +87,7 @@ $NetBSD: patch-main_stdtime_localtime.c,v 1.2 2015/05/19 07:52:14 jnemeth Exp $ ast_free(format); return res; } -@@ -2562,11 +2591,22 @@ char *ast_strptime_locale(const char *s, +@@ -2562,11 +2595,22 @@ char *ast_strptime_locale(const char *s, { struct tm tm2 = { 0, }; char *res; diff --git a/comms/asterisk/patches/patch-res_pjproject_pjlib_include_pj_config.h b/comms/asterisk/patches/patch-res_pjproject_pjlib_include_pj_config.h new file mode 100644 index 00000000000..411b78a895c --- /dev/null +++ b/comms/asterisk/patches/patch-res_pjproject_pjlib_include_pj_config.h @@ -0,0 +1,32 @@ +$NetBSD: patch-res_pjproject_pjlib_include_pj_config.h,v 1.1 2015/10/27 08:49:01 jnemeth Exp $ + +--- res/pjproject/pjlib/include/pj/config.h.orig 2015-10-09 22:23:39.000000000 +0000 ++++ res/pjproject/pjlib/include/pj/config.h +@@ -555,7 +555,7 @@ + * the underlying implementation changes. + */ + #ifndef PJ_IOQUEUE_MAX_HANDLES +-# define PJ_IOQUEUE_MAX_HANDLES (64) ++# define PJ_IOQUEUE_MAX_HANDLES (1024) + #endif + + +@@ -622,16 +622,10 @@ + + /** + * Determine if FD_SETSIZE is changeable/set-able. If so, then we will +- * set it to PJ_IOQUEUE_MAX_HANDLES. Currently we detect this by checking +- * for Winsock. ++ * set it to PJ_IOQUEUE_MAX_HANDLES. Assumed to be supported by default. + */ + #ifndef PJ_FD_SETSIZE_SETABLE +-# if (defined(PJ_HAS_WINSOCK_H) && PJ_HAS_WINSOCK_H!=0) || \ +- (defined(PJ_HAS_WINSOCK2_H) && PJ_HAS_WINSOCK2_H!=0) +-# define PJ_FD_SETSIZE_SETABLE 1 +-# else +-# define PJ_FD_SETSIZE_SETABLE 0 +-# endif ++# define PJ_FD_SETSIZE_SETABLE 1 + #endif + + /** diff --git a/comms/asterisk/patches/patch-res_pjproject_pjlib_include_pj_sock__select.h b/comms/asterisk/patches/patch-res_pjproject_pjlib_include_pj_sock__select.h new file mode 100644 index 00000000000..49ec691674c --- /dev/null +++ b/comms/asterisk/patches/patch-res_pjproject_pjlib_include_pj_sock__select.h @@ -0,0 +1,21 @@ +$NetBSD: patch-res_pjproject_pjlib_include_pj_sock__select.h,v 1.1 2015/10/27 08:49:01 jnemeth Exp $ + +--- res/pjproject/pjlib/include/pj/sock_select.h.orig 2015-10-09 22:23:39.000000000 +0000 ++++ res/pjproject/pjlib/include/pj/sock_select.h +@@ -25,6 +25,7 @@ + * @brief Socket select(). + */ + ++#include <limits.h> + #include <pj/types.h> + + PJ_BEGIN_DECL +@@ -55,7 +56,7 @@ PJ_BEGIN_DECL + */ + typedef struct pj_fd_set_t + { +- pj_sock_t data[PJ_IOQUEUE_MAX_HANDLES+ 4]; /**< Opaque buffer for fd_set */ ++ pj_sock_t data[PJ_IOQUEUE_MAX_HANDLES / sizeof(pj_sock_t) / CHAR_BIT + 4]; /**< Opaque buffer for fd_set */ + } pj_fd_set_t; + + diff --git a/comms/asterisk/patches/patch-res_pjproject_pjlib_src_pj_sock__select.c b/comms/asterisk/patches/patch-res_pjproject_pjlib_src_pj_sock__select.c new file mode 100644 index 00000000000..9659c81bec1 --- /dev/null +++ b/comms/asterisk/patches/patch-res_pjproject_pjlib_src_pj_sock__select.c @@ -0,0 +1,52 @@ +$NetBSD: patch-res_pjproject_pjlib_src_pj_sock__select.c,v 1.1 2015/10/27 08:49:01 jnemeth Exp $ + +--- res/pjproject/pjlib/src/pj/sock_select.c.orig 2015-10-09 22:23:39.000000000 +0000 ++++ res/pjproject/pjlib/src/pj/sock_select.c +@@ -40,10 +40,11 @@ + #define PART_FDSET_OR_NULL(ps) (ps ? PART_FDSET(ps) : NULL) + #define PART_COUNT(ps) (ps->data[0]) + ++typedef char pj_assert_fd_set_t[(sizeof(pj_fd_set_t)-sizeof(pj_sock_t) >= sizeof(fd_set)) ? 1 : -1]; ++ + PJ_DEF(void) PJ_FD_ZERO(pj_fd_set_t *fdsetp) + { + PJ_CHECK_STACK(); +- pj_assert(sizeof(pj_fd_set_t)-sizeof(pj_sock_t) >= sizeof(fd_set)); + + FD_ZERO(PART_FDSET(fdsetp)); + PART_COUNT(fdsetp) = 0; +@@ -53,7 +54,6 @@ PJ_DEF(void) PJ_FD_ZERO(pj_fd_set_t *fds + PJ_DEF(void) PJ_FD_SET(pj_sock_t fd, pj_fd_set_t *fdsetp) + { + PJ_CHECK_STACK(); +- pj_assert(sizeof(pj_fd_set_t)-sizeof(pj_sock_t) >= sizeof(fd_set)); + + if (!PJ_FD_ISSET(fd, fdsetp)) + ++PART_COUNT(fdsetp); +@@ -64,7 +64,6 @@ PJ_DEF(void) PJ_FD_SET(pj_sock_t fd, pj_ + PJ_DEF(void) PJ_FD_CLR(pj_sock_t fd, pj_fd_set_t *fdsetp) + { + PJ_CHECK_STACK(); +- pj_assert(sizeof(pj_fd_set_t)-sizeof(pj_sock_t) >= sizeof(fd_set)); + + if (PJ_FD_ISSET(fd, fdsetp)) + --PART_COUNT(fdsetp); +@@ -75,8 +74,6 @@ PJ_DEF(void) PJ_FD_CLR(pj_sock_t fd, pj_ + PJ_DEF(pj_bool_t) PJ_FD_ISSET(pj_sock_t fd, const pj_fd_set_t *fdsetp) + { + PJ_CHECK_STACK(); +- PJ_ASSERT_RETURN(sizeof(pj_fd_set_t)-sizeof(pj_sock_t) >= sizeof(fd_set), +- 0); + + return FD_ISSET(fd, PART_FDSET(fdsetp)); + } +@@ -96,9 +93,6 @@ PJ_DEF(int) pj_sock_select( int n, + + PJ_CHECK_STACK(); + +- PJ_ASSERT_RETURN(sizeof(pj_fd_set_t)-sizeof(pj_sock_t) >= sizeof(fd_set), +- PJ_EBUG); +- + if (timeout) { + os_timeout.tv_sec = timeout->sec; + os_timeout.tv_usec = timeout->msec * 1000; diff --git a/comms/asterisk/patches/patch-res_pjproject_third__party_portaudio_src_hostapi_alsa_pa__linux__alsa.c b/comms/asterisk/patches/patch-res_pjproject_third__party_portaudio_src_hostapi_alsa_pa__linux__alsa.c new file mode 100644 index 00000000000..a64486c6a2c --- /dev/null +++ b/comms/asterisk/patches/patch-res_pjproject_third__party_portaudio_src_hostapi_alsa_pa__linux__alsa.c @@ -0,0 +1,13 @@ +$NetBSD: patch-res_pjproject_third__party_portaudio_src_hostapi_alsa_pa__linux__alsa.c,v 1.1 2015/10/27 08:49:01 jnemeth Exp $ + +--- res/pjproject/third_party/portaudio/src/hostapi/alsa/pa_linux_alsa.c.orig 2015-10-09 22:23:39.000000000 +0000 ++++ res/pjproject/third_party/portaudio/src/hostapi/alsa/pa_linux_alsa.c +@@ -53,7 +53,7 @@ + #undef ALSA_PCM_NEW_HW_PARAMS_API + #undef ALSA_PCM_NEW_SW_PARAMS_API + +-#include <sys/poll.h> ++#include <poll.h> + #include <string.h> /* strlen() */ + #include <limits.h> + #include <math.h> diff --git a/comms/asterisk/patches/patch-res_pjproject_third__party_portaudio_src_hostapi_oss_pa__unix__oss.c b/comms/asterisk/patches/patch-res_pjproject_third__party_portaudio_src_hostapi_oss_pa__unix__oss.c new file mode 100644 index 00000000000..3583ca16af6 --- /dev/null +++ b/comms/asterisk/patches/patch-res_pjproject_third__party_portaudio_src_hostapi_oss_pa__unix__oss.c @@ -0,0 +1,13 @@ +$NetBSD: patch-res_pjproject_third__party_portaudio_src_hostapi_oss_pa__unix__oss.c,v 1.1 2015/10/27 08:49:01 jnemeth Exp $ + +--- res/pjproject/third_party/portaudio/src/hostapi/oss/pa_unix_oss.c.orig 2015-10-09 22:23:39.000000000 +0000 ++++ res/pjproject/third_party/portaudio/src/hostapi/oss/pa_unix_oss.c +@@ -59,7 +59,7 @@ + #include <errno.h> + #include <sys/types.h> + #include <sys/stat.h> +-#include <sys/poll.h> ++#include <poll.h> + #include <limits.h> + #include <semaphore.h> + diff --git a/comms/asterisk/patches/patch-res_res__timing__kqueue.c b/comms/asterisk/patches/patch-res_res__timing__kqueue.c new file mode 100644 index 00000000000..8258b31c773 --- /dev/null +++ b/comms/asterisk/patches/patch-res_res__timing__kqueue.c @@ -0,0 +1,431 @@ +$NetBSD: patch-res_res__timing__kqueue.c,v 1.1 2015/10/27 08:49:01 jnemeth Exp $ + +--- res/res_timing_kqueue.c.orig 2015-10-09 22:23:39.000000000 +0000 ++++ res/res_timing_kqueue.c +@@ -71,9 +71,12 @@ static struct ast_timing_interface kqueu + static struct ao2_container *kqueue_timers; + + struct kqueue_timer { ++ intptr_t period; + int handle; +- uint64_t nsecs; +- uint64_t unacked; ++#ifndef EVFILT_USER ++ int continuous_fd; ++ unsigned int continuous_fd_valid:1; ++#endif + unsigned int is_continuous:1; + }; + +@@ -90,6 +93,78 @@ static int kqueue_timer_cmp(void *obj, v + return timer1->handle == timer2->handle ? CMP_MATCH | CMP_STOP : 0; + } + ++#ifdef EVFILT_USER ++#define CONTINUOUS_EVFILT_TYPE EVFILT_USER ++static int kqueue_timer_init_continuous_event(struct kqueue_timer *timer) ++{ ++ return 0; ++} ++ ++static int kqueue_timer_enable_continuous_event(struct kqueue_timer *timer) ++{ ++ struct kevent kev[2]; ++ ++ EV_SET(&kev[0], (uintptr_t)timer, EVFILT_USER, EV_ADD | EV_ENABLE, ++ 0, 0, NULL); ++ EV_SET(&kev[1], (uintptr_t)timer, EVFILT_USER, 0, NOTE_TRIGGER, ++ 0, NULL); ++ return kevent(timer->handle, kev, 2, NULL, 0, NULL); ++} ++ ++static int kqueue_timer_disable_continuous_event(struct kqueue_timer *timer) ++{ ++ struct kevent kev; ++ ++ EV_SET(&kev, (uintptr_t)timer, EVFILT_USER, EV_DELETE, 0, 0, NULL); ++ return kevent(timer->handle, &kev, 1, NULL, 0, NULL); ++} ++ ++static void kqueue_timer_fini_continuous_event(struct kqueue_timer *timer) ++{ ++} ++ ++#else /* EVFILT_USER */ ++ ++#define CONTINUOUS_EVFILT_TYPE EVFILT_READ ++static int kqueue_timer_init_continuous_event(struct kqueue_timer *timer) ++{ ++ int pipefds[2]; ++ int retval; ++ ++ retval = pipe(pipefds); ++ if (retval == 0) { ++ timer->continuous_fd = pipefds[0]; ++ timer->continuous_fd_valid = 1; ++ close(pipefds[1]); ++ } ++ return retval; ++} ++ ++static void kqueue_timer_fini_continuous_event(struct kqueue_timer *timer) ++{ ++ if (timer->continuous_fd_valid) { ++ close(timer->continuous_fd); ++ } ++} ++ ++static int kqueue_timer_enable_continuous_event(struct kqueue_timer *timer) ++{ ++ struct kevent kev; ++ ++ EV_SET(&kev, timer->continuous_fd, EVFILT_READ, EV_ADD | EV_ENABLE, ++ 0, 0, NULL); ++ return kevent(timer->handle, &kev, 1, NULL, 0, NULL); ++} ++ ++static int kqueue_timer_disable_continuous_event(struct kqueue_timer *timer) ++{ ++ struct kevent kev; ++ ++ EV_SET(&kev, timer->continuous_fd, EVFILT_READ, EV_DELETE, 0, 0, NULL); ++ return kevent(timer->handle, &kev, 1, NULL, 0, NULL); ++} ++#endif ++ + static void timer_destroy(void *obj) + { + struct kqueue_timer *timer = obj; +@@ -120,15 +195,25 @@ static int kqueue_timer_open(void) + int handle; + + if (!(timer = ao2_alloc(sizeof(*timer), timer_destroy))) { +- ast_log(LOG_ERROR, "Could not allocate memory for kqueue_timer structure\n"); ++ ast_log(LOG_ERROR, "Alloc failed for kqueue_timer structure\n"); + return -1; + } ++ + if ((timer->handle = handle = kqueue()) < 0) { +- ast_log(LOG_ERROR, "Failed to create kqueue timer: %s\n", strerror(errno)); ++ ast_log(LOG_ERROR, "Failed to create kqueue fd: %s\n", ++ strerror(errno)); + ao2_ref(timer, -1); + return -1; + } + ++ if (kqueue_timer_init_continuous_event(timer) != 0) { ++ ast_log(LOG_ERROR, "Failed to create continuous event: %s\n", ++ strerror(errno)); ++ ao2_ref(timer, -1); ++ return -1; ++ } ++ ast_debug(5, "[%d]: Create timer\n", timer->handle); ++ + ao2_link(kqueue_timers, timer); + /* Get rid of the reference from the allocation */ + ao2_ref(timer, -1); +@@ -143,54 +228,86 @@ static void kqueue_timer_close(int handl + return; + } + ++ ast_debug(5, "[%d]: Timer close\n", our_timer->handle); + ao2_unlink(kqueue_timers, our_timer); + ao2_ref(our_timer, -1); + } + +-static void kqueue_set_nsecs(struct kqueue_timer *our_timer, uint64_t nsecs) ++/* ++ * Use the highest precision available that does not overflow ++ * the datatype kevent is using for time. ++ */ ++static intptr_t kqueue_scale_period(unsigned int period_ns, int *units) + { +- struct timespec nowait = { 0, 1 }; +-#ifdef HAVE_KEVENT64 +- struct kevent64_s kev; +- +- EV_SET64(&kev, our_timer->handle, EVFILT_TIMER, EV_ADD | EV_ENABLE, NOTE_NSECONDS, +- nsecs, 0, 0, 0); +- kevent64(our_timer->handle, &kev, 1, NULL, 0, 0, &nowait); +-#else +- struct kevent kev; +- +- EV_SET(&kev, our_timer->handle, EVFILT_TIMER, EV_ADD | EV_ENABLE, +-#ifdef NOTE_NSECONDS +- nsecs <= 0xFFffFFff ? NOTE_NSECONDS : +-#endif +-#ifdef NOTE_USECONDS +- NOTE_USECONDS +-#else /* Milliseconds, if no constants are defined */ +- 0 +-#endif +- , ++ uint64_t period = period_ns; ++ *units = 0; + #ifdef NOTE_NSECONDS +- nsecs <= 0xFFffFFff ? nsecs : +-#endif ++ if (period < INTPTR_MAX) { ++ *units = NOTE_NSECONDS; ++ } else { + #ifdef NOTE_USECONDS +- nsecs / 1000 +-#else /* Milliseconds, if nothing else is defined */ +- nsecs / 1000000 +-#endif +- , NULL); +- kevent(our_timer->handle, &kev, 1, NULL, 0, &nowait); ++ period /= 1000; ++ if (period < INTPTR_MAX) { ++ *units = NOTE_USECONDS; ++ } else { ++ period /= 1000; ++#ifdef NOTE_MSECONDS ++ *units = NOTE_MSECONDS; ++#endif /* NOTE_MSECONDS */ ++ } ++#else /* NOTE_USECONDS */ ++ period /= 1000000; ++#ifdef NOTE_MSECONDS ++ *units = NOTE_MSECONDS; ++#endif /* NOTE_MSECONDS */ ++#endif /* NOTE_USECONDS */ ++ } ++#else /* NOTE_NSECONDS */ ++ period /= 1000000; + #endif ++ if (period > INTPTR_MAX) { ++ period = INTPTR_MAX; ++ } ++ return period; + } + + static int kqueue_timer_set_rate(int handle, unsigned int rate) + { ++ struct kevent kev; + struct kqueue_timer *our_timer; ++ uint64_t period_ns; ++ int flags; ++ int units; ++ int retval; + + if (!(our_timer = lookup_timer(handle))) { + return -1; + } + +- kqueue_set_nsecs(our_timer, (our_timer->nsecs = rate ? (long) (1000000000 / rate) : 0L)); ++ if (rate == 0) { ++ if (our_timer->period == 0) { ++ ao2_ref(our_timer, -1); ++ return 0; ++ } ++ flags = EV_DELETE; ++ our_timer->period = 0; ++ units = 0; ++ } else { ++ flags = EV_ADD | EV_ENABLE; ++ period_ns = (uint64_t)1000000000 / rate; ++ our_timer->period = kqueue_scale_period(period_ns, &units); ++ } ++ ast_debug(5, "[%d]: Set rate %u:%ju\n", ++ our_timer->handle, units, (uintmax_t)our_timer->period); ++ EV_SET(&kev, our_timer->handle, EVFILT_TIMER, flags, units, ++ our_timer->period, NULL); ++ retval = kevent(our_timer->handle, &kev, 1, NULL, 0, NULL); ++ ++ if (retval == -1) { ++ ast_log(LOG_ERROR, "[%d]: Error queueing timer: %s\n", ++ our_timer->handle, strerror(errno)); ++ } ++ + ao2_ref(our_timer, -1); + + return 0; +@@ -198,75 +315,113 @@ static int kqueue_timer_set_rate(int han + + static int kqueue_timer_ack(int handle, unsigned int quantity) + { ++ static struct timespec ts_nowait = { 0, 0 }; + struct kqueue_timer *our_timer; ++ struct kevent kev[2]; ++ int i, retval; + + if (!(our_timer = lookup_timer(handle))) { + return -1; + } + +- if (our_timer->unacked < quantity) { +- ast_debug(1, "Acking more events than have expired?!!\n"); +- our_timer->unacked = 0; ++ retval = kevent(our_timer->handle, NULL, 0, kev, 2, &ts_nowait); ++ if (retval == -1) { ++ ast_log(LOG_ERROR, "[%d]: Error sampling kqueue: %s\n", ++ our_timer->handle, strerror(errno)); + ao2_ref(our_timer, -1); + return -1; +- } else { +- our_timer->unacked -= quantity; ++ } ++ ++ for (i = 0; i < retval; i++) { ++ switch (kev[i].filter) { ++ case EVFILT_TIMER: ++ if (kev[i].data > quantity) { ++ ast_log(LOG_ERROR, "[%d]: Missed %ju\n", ++ our_timer->handle, ++ (uintmax_t)kev[i].data - quantity); ++ } ++ break; ++ case CONTINUOUS_EVFILT_TYPE: ++ if (!our_timer->is_continuous) { ++ ast_log(LOG_ERROR, ++ "[%d]: Spurious user event\n", ++ our_timer->handle); ++ } ++ break; ++ default: ++ ast_log(LOG_ERROR, "[%d]: Spurious kevent type %d.\n", ++ our_timer->handle, kev[i].filter); ++ } + } + + ao2_ref(our_timer, -1); ++ + return 0; + } + + static int kqueue_timer_enable_continuous(int handle) + { + struct kqueue_timer *our_timer; ++ int retval; + + if (!(our_timer = lookup_timer(handle))) { + return -1; + } + +- kqueue_set_nsecs(our_timer, 1); +- our_timer->is_continuous = 1; +- our_timer->unacked = 0; ++ if (!our_timer->is_continuous) { ++ ast_debug(5, "[%d]: Enable continuous\n", our_timer->handle); ++ retval = kqueue_timer_enable_continuous_event(our_timer); ++ if (retval == -1) { ++ ast_log(LOG_ERROR, ++ "[%d]: Error signalling continuous event: %s\n", ++ our_timer->handle, strerror(errno)); ++ } ++ our_timer->is_continuous = 1; ++ } ++ + ao2_ref(our_timer, -1); ++ + return 0; + } + + static int kqueue_timer_disable_continuous(int handle) + { + struct kqueue_timer *our_timer; ++ int retval; + + if (!(our_timer = lookup_timer(handle))) { + return -1; + } + +- kqueue_set_nsecs(our_timer, our_timer->nsecs); +- our_timer->is_continuous = 0; +- our_timer->unacked = 0; ++ if (our_timer->is_continuous) { ++ ast_debug(5, "[%d]: Disable Continuous\n", our_timer->handle); ++ retval = kqueue_timer_disable_continuous_event(our_timer); ++ if (retval == -1) { ++ ast_log(LOG_ERROR, ++ "[%d]: Error clearing continuous event: %s\n", ++ our_timer->handle, strerror(errno)); ++ } ++ our_timer->is_continuous = 0; ++ } ++ + ao2_ref(our_timer, -1); ++ + return 0; + } + + static enum ast_timer_event kqueue_timer_get_event(int handle) + { +- enum ast_timer_event res = -1; + struct kqueue_timer *our_timer; +- struct timespec sixty_seconds = { 60, 0 }; +- struct kevent kev; ++ enum ast_timer_event res; + + if (!(our_timer = lookup_timer(handle))) { +- return -1; ++ return AST_TIMING_EVENT_EXPIRED; + } + +- /* If we have non-ACKed events, just return immediately */ +- if (our_timer->unacked == 0) { +- if (kevent(handle, NULL, 0, &kev, 1, &sixty_seconds) > 0) { +- our_timer->unacked += kev.data; +- } +- } +- +- if (our_timer->unacked > 0) { +- res = our_timer->is_continuous ? AST_TIMING_EVENT_CONTINUOUS : AST_TIMING_EVENT_EXPIRED; ++ if (our_timer->is_continuous) { ++ res = AST_TIMING_EVENT_CONTINUOUS; ++ } else { ++ res = AST_TIMING_EVENT_EXPIRED; + } + + ao2_ref(our_timer, -1); +@@ -275,8 +430,7 @@ static enum ast_timer_event kqueue_timer + + static unsigned int kqueue_timer_get_max_rate(int handle) + { +- /* Actually, the max rate is 2^64-1 seconds, but that's not representable in a 32-bit integer. */ +- return UINT_MAX; ++ return INTPTR_MAX > UINT_MAX ? UINT_MAX : INTPTR_MAX; + } + + #ifdef TEST_FRAMEWORK +@@ -331,13 +485,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; ++ if (kqueue_timer_ack(handle, 1) != 0) { ++ ast_test_status_update(test, "Acking event failed.\n"); ++ res = AST_TEST_FAiL; + break; + } +-#endif ++ + kqueue_timer_enable_continuous(handle); + start = ast_tvnow(); + for (i = 0; i < 100; i++) { +@@ -351,15 +504,15 @@ AST_TEST_DEFINE(test_kqueue_timing) + res = AST_TEST_FAIL; + break; + } ++ if (kqueue_timer_ack(handle, 1) != 0) { ++ ast_test_status_update(test, "Acking event failed.\n"); ++ res = AST_TEST_FAIL; ++ } ++ + } ++ + diff = ast_tvdiff_us(ast_tvnow(), start); + ast_test_status_update(test, "diff is %llu\n", diff); +- /* +- if (abs(diff - kt->unacked) == 0) { +- ast_test_status_update(test, "Unacked events should be around 1000, not %llu\n", kt->unacked); +- res = AST_TEST_FAIL; +- } +- */ + } while (0); + kqueue_timer_close(handle); + return res; |