<p>Friendly Automation <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/12943">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Richard Mudgett: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">core: Fix ABI mismatch of ao2_global_obj.<br><br>astobj2.c declares DEBUG_THREADS_LOOSE_ABI to avoid overhead of debug<br>threads tracking information in the internal structures of astobj2.<br>Unfortunately this means that ao2_global_obj contains the statically<br>allocated debug threads tracking fields which are used by initialization<br>and cleanup but main/astobj2.c believed those fields and associated<br>space did not exist.<br><br>Change-Id: Icef41ad97d88a8c1d1515e034ec8133cab3b1527<br>---<br>M main/astobj2.c<br>A main/astobj2_global.c<br>2 files changed, 97 insertions(+), 66 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/astobj2.c b/main/astobj2.c</span><br><span>index ebc0720..25fc37c 100644</span><br><span>--- a/main/astobj2.c</span><br><span>+++ b/main/astobj2.c</span><br><span>@@ -786,72 +786,6 @@</span><br><span> return orig_obj->priv_data.options;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-void *__ao2_global_obj_replace(struct ao2_global_obj *holder, void *obj, const char *tag, const char *file, int line, const char *func, const char *name)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- void *obj_old;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (!holder) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* For sanity */</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "Must be called with a global object!\n");</span><br><span style="color: hsl(0, 100%, 40%);">- ast_assert(0);</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- if (__ast_rwlock_wrlock(file, line, func, &holder->lock, name)) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Could not get the write lock. */</span><br><span style="color: hsl(0, 100%, 40%);">- ast_assert(0);</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (obj) {</span><br><span style="color: hsl(0, 100%, 40%);">- __ao2_ref(obj, +1, tag, file, line, func);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- obj_old = holder->obj;</span><br><span style="color: hsl(0, 100%, 40%);">- holder->obj = obj;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- __ast_rwlock_unlock(file, line, func, &holder->lock, name);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return obj_old;</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-int __ao2_global_obj_replace_unref(struct ao2_global_obj *holder, void *obj, const char *tag, const char *file, int line, const char *func, const char *name)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- void *obj_old;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- obj_old = __ao2_global_obj_replace(holder, obj, tag, file, line, func, name);</span><br><span style="color: hsl(0, 100%, 40%);">- if (obj_old) {</span><br><span style="color: hsl(0, 100%, 40%);">- __ao2_ref(obj_old, -1, tag, file, line, func);</span><br><span style="color: hsl(0, 100%, 40%);">- return 1;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- return 0;</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-void *__ao2_global_obj_ref(struct ao2_global_obj *holder, const char *tag, const char *file, int line, const char *func, const char *name)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- void *obj;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (!holder) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* For sanity */</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "Must be called with a global object!\n");</span><br><span style="color: hsl(0, 100%, 40%);">- ast_assert(0);</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- if (__ast_rwlock_rdlock(file, line, func, &holder->lock, name)) {</span><br><span style="color: hsl(0, 100%, 40%);">- /* Could not get the read lock. */</span><br><span style="color: hsl(0, 100%, 40%);">- ast_assert(0);</span><br><span style="color: hsl(0, 100%, 40%);">- return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- obj = holder->obj;</span><br><span style="color: hsl(0, 100%, 40%);">- if (obj) {</span><br><span style="color: hsl(0, 100%, 40%);">- __ao2_ref(obj, +1, tag, file, line, func);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- __ast_rwlock_unlock(file, line, func, &holder->lock, name);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return obj;</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> </span><br><span> void *__ao2_weakproxy_alloc(size_t data_size, ao2_destructor_fn destructor_fn,</span><br><span> const char *tag, const char *file, int line, const char *func)</span><br><span>diff --git a/main/astobj2_global.c b/main/astobj2_global.c</span><br><span>new file mode 100644</span><br><span>index 0000000..9d6d7f3</span><br><span>--- /dev/null</span><br><span>+++ b/main/astobj2_global.c</span><br><span>@@ -0,0 +1,97 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * astobj2_global - global containers for AO2 objects.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (C) 2006 Marta Carbone, Luigi Rizzo - Univ. di Pisa, Italy</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * See http://www.asterisk.org for more information about</span><br><span style="color: hsl(120, 100%, 40%);">+ * the Asterisk project. Please do not directly contact</span><br><span style="color: hsl(120, 100%, 40%);">+ * any of the maintainers of this project for assistance;</span><br><span style="color: hsl(120, 100%, 40%);">+ * the project provides a web site, mailing lists and IRC</span><br><span style="color: hsl(120, 100%, 40%);">+ * channels for your use.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is free software, distributed under the terms of</span><br><span style="color: hsl(120, 100%, 40%);">+ * the GNU General Public License Version 2. See the LICENSE file</span><br><span style="color: hsl(120, 100%, 40%);">+ * at the top of the source tree.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*! \file</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Functions implementing ao2_global_obj routines.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \author Richard Mudgett <rmudgett@digium.com></span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*** MODULEINFO</span><br><span style="color: hsl(120, 100%, 40%);">+ <support_level>core</support_level></span><br><span style="color: hsl(120, 100%, 40%);">+ ***/</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include "asterisk.h"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include "asterisk/astobj2.h"</span><br><span style="color: hsl(120, 100%, 40%);">+#include "asterisk/utils.h"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+void *__ao2_global_obj_replace(struct ao2_global_obj *holder, void *obj, const char *tag, const char *file, int line, const char *func, const char *name)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ void *obj_old;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!holder) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* For sanity */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_ERROR, "Must be called with a global object!\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_assert(0);</span><br><span style="color: hsl(120, 100%, 40%);">+ return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ if (__ast_rwlock_wrlock(file, line, func, &holder->lock, name)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Could not get the write lock. */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_assert(0);</span><br><span style="color: hsl(120, 100%, 40%);">+ return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (obj) {</span><br><span style="color: hsl(120, 100%, 40%);">+ __ao2_ref(obj, +1, tag, file, line, func);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ obj_old = holder->obj;</span><br><span style="color: hsl(120, 100%, 40%);">+ holder->obj = obj;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ __ast_rwlock_unlock(file, line, func, &holder->lock, name);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ return obj_old;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+int __ao2_global_obj_replace_unref(struct ao2_global_obj *holder, void *obj, const char *tag, const char *file, int line, const char *func, const char *name)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ void *obj_old;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ obj_old = __ao2_global_obj_replace(holder, obj, tag, file, line, func, name);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (obj_old) {</span><br><span style="color: hsl(120, 100%, 40%);">+ __ao2_ref(obj_old, -1, tag, file, line, func);</span><br><span style="color: hsl(120, 100%, 40%);">+ return 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+void *__ao2_global_obj_ref(struct ao2_global_obj *holder, const char *tag, const char *file, int line, const char *func, const char *name)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ void *obj;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!holder) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* For sanity */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_ERROR, "Must be called with a global object!\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_assert(0);</span><br><span style="color: hsl(120, 100%, 40%);">+ return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (__ast_rwlock_rdlock(file, line, func, &holder->lock, name)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Could not get the read lock. */</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_assert(0);</span><br><span style="color: hsl(120, 100%, 40%);">+ return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ obj = holder->obj;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (obj) {</span><br><span style="color: hsl(120, 100%, 40%);">+ __ao2_ref(obj, +1, tag, file, line, func);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ __ast_rwlock_unlock(file, line, func, &holder->lock, name);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ return obj;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/12943">change 12943</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/12943"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: Icef41ad97d88a8c1d1515e034ec8133cab3b1527 </div>
<div style="display:none"> Gerrit-Change-Number: 12943 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>