summaryrefslogtreecommitdiff
path: root/comms
diff options
context:
space:
mode:
authorryoon <ryoon@pkgsrc.org>2021-02-11 11:54:13 +0000
committerryoon <ryoon@pkgsrc.org>2021-02-11 11:54:13 +0000
commit883001ea9e7f86f9c0f41998e556305b609f1118 (patch)
tree2c570f6affc244ad1e08606434981acfcb56617b /comms
parent1c1f1db03b16105840ad2652b7ecaebb3222c890 (diff)
downloadpkgsrc-883001ea9e7f86f9c0f41998e556305b609f1118.tar.gz
asterisk16: Add forgotten patches
Diffstat (limited to 'comms')
-rw-r--r--comms/asterisk16/patches/patch-main_bridge__channel.c38
-rw-r--r--comms/asterisk16/patches/patch-main_taskprocessor.c38
-rw-r--r--comms/asterisk16/patches/patch-res_res__xmpp.c29
3 files changed, 105 insertions, 0 deletions
diff --git a/comms/asterisk16/patches/patch-main_bridge__channel.c b/comms/asterisk16/patches/patch-main_bridge__channel.c
new file mode 100644
index 00000000000..7dc7b1bf39e
--- /dev/null
+++ b/comms/asterisk16/patches/patch-main_bridge__channel.c
@@ -0,0 +1,38 @@
+$NetBSD: patch-main_bridge__channel.c,v 1.1 2021/02/11 11:54:13 ryoon Exp $
+
+* Fix segfault under NetBSD/aarch64 9.99.80.
+
+--- main/bridge_channel.c.orig 2021-01-21 16:28:04.000000000 +0000
++++ main/bridge_channel.c
+@@ -58,6 +58,13 @@
+ #include "asterisk/stream.h"
+ #include "asterisk/message.h"
+
++/* XXX, pthread_equal() is misused to compare non-valid thread pointers */
++static int
++pt_pthread_equal(pthread_t t1, pthread_t t2)
++{
++ return t1 == t2;
++}
++
+ /*!
+ * \brief Used to queue an action frame onto a bridge channel and write an action frame into a bridge.
+ * \since 12.0.0
+@@ -258,7 +265,7 @@ int ast_bridge_channel_notify_talking(st
+ */
+ static void bridge_channel_poke(struct ast_bridge_channel *bridge_channel)
+ {
+- if (!pthread_equal(pthread_self(), bridge_channel->thread)) {
++ if (!pt_pthread_equal(pthread_self(), bridge_channel->thread)) {
+ /* Wake up the bridge channel thread. */
+ ast_queue_frame(bridge_channel->chan, &ast_null_frame);
+ }
+@@ -971,7 +978,7 @@ static int bridge_channel_queue_action_d
+ };
+
+ /* Make sure we don't end up trying to wait on ourself to deliver the frame */
+- ast_assert(!pthread_equal(pthread_self(), bridge_channel->thread));
++ ast_assert(!pt_pthread_equal(pthread_self(), bridge_channel->thread));
+
+ sync_payload = ast_alloca(sync_payload_len);
+ sync_payload->id = ast_atomic_fetchadd_int(&sync_ids, +1);
diff --git a/comms/asterisk16/patches/patch-main_taskprocessor.c b/comms/asterisk16/patches/patch-main_taskprocessor.c
new file mode 100644
index 00000000000..adb3492e204
--- /dev/null
+++ b/comms/asterisk16/patches/patch-main_taskprocessor.c
@@ -0,0 +1,38 @@
+$NetBSD: patch-main_taskprocessor.c,v 1.1 2021/02/11 11:54:13 ryoon Exp $
+
+* Fix segfault under NetBSD/aarch64 9.99.80.
+
+--- main/taskprocessor.c.orig 2021-01-21 16:28:04.000000000 +0000
++++ main/taskprocessor.c
+@@ -37,6 +37,13 @@
+ #include "asterisk/taskprocessor.h"
+ #include "asterisk/sem.h"
+
++/* XXX, pthread_equal() is misused to compare non-valid thread pointers */
++static int
++pt_pthread_equal(pthread_t t1, pthread_t t2)
++{
++ return t1 == t2;
++}
++
+ /*!
+ * \brief tps_task structure is queued to a taskprocessor
+ *
+@@ -263,7 +270,7 @@ static void default_listener_shutdown(st
+
+ ast_assert(pvt->poll_thread != AST_PTHREADT_NULL);
+
+- if (pthread_equal(pthread_self(), pvt->poll_thread)) {
++ if (pt_pthread_equal(pthread_self(), pvt->poll_thread)) {
+ res = pthread_detach(pvt->poll_thread);
+ if (res != 0) {
+ ast_log(LOG_ERROR, "pthread_detach(): %s\n", strerror(errno));
+@@ -1268,7 +1275,7 @@ int ast_taskprocessor_is_task(struct ast
+ int is_task;
+
+ ao2_lock(tps);
+- is_task = pthread_equal(tps->thread, pthread_self());
++ is_task = pt_pthread_equal(tps->thread, pthread_self());
+ ao2_unlock(tps);
+ return is_task;
+ }
diff --git a/comms/asterisk16/patches/patch-res_res__xmpp.c b/comms/asterisk16/patches/patch-res_res__xmpp.c
new file mode 100644
index 00000000000..73237f118f6
--- /dev/null
+++ b/comms/asterisk16/patches/patch-res_res__xmpp.c
@@ -0,0 +1,29 @@
+$NetBSD: patch-res_res__xmpp.c,v 1.1 2021/02/11 11:54:13 ryoon Exp $
+
+* Fix segfault under NetBSD/aarch64 9.99.80.
+
+--- res/res_xmpp.c.orig 2021-01-21 16:28:04.000000000 +0000
++++ res/res_xmpp.c
+@@ -62,6 +62,13 @@
+ #include "asterisk/config_options.h"
+ #include "asterisk/json.h"
+
++/* XXX, pthread_equal() is misused to compare non-valid thread pointers */
++static int
++pt_pthread_equal(pthread_t t1, pthread_t t2)
++{
++ return t1 == t2;
++}
++
+ /*** DOCUMENTATION
+ <application name="JabberSend" language="en_US" module="res_xmpp">
+ <synopsis>
+@@ -3609,7 +3616,7 @@ static int xmpp_action_hook(void *data,
+
+ int ast_xmpp_client_disconnect(struct ast_xmpp_client *client)
+ {
+- if ((client->thread != AST_PTHREADT_NULL) && !pthread_equal(pthread_self(), client->thread)) {
++ if ((client->thread != AST_PTHREADT_NULL) && !pt_pthread_equal(pthread_self(), client->thread)) {
+ xmpp_client_change_state(client, XMPP_STATE_DISCONNECTING);
+ pthread_cancel(client->thread);
+ pthread_join(client->thread, NULL);