<p>neels has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/16164">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">msgb_put: more elaborate logging of head/tailroom failure<br><br>Change-Id: I55b68098e1037c74ebe5faa86e34bd4494f5b726<br>---<br>M include/osmocom/core/msgb.h<br>1 file changed, 12 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/64/16164/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/core/msgb.h b/include/osmocom/core/msgb.h</span><br><span>index 1833a6c..cc76e3a 100644</span><br><span>--- a/include/osmocom/core/msgb.h</span><br><span>+++ b/include/osmocom/core/msgb.h</span><br><span>@@ -239,7 +239,11 @@</span><br><span> {</span><br><span>  unsigned char *tmp = msgb->tail;</span><br><span>  if (msgb_tailroom(msgb) < (int) len)</span><br><span style="color: hsl(0, 100%, 40%);">-         MSGB_ABORT(msgb, "Not enough tailroom msgb_put (%u < %u)\n",</span><br><span style="color: hsl(120, 100%, 40%);">+             MSGB_ABORT(msgb, "Not enough tailroom msgb_put"</span><br><span style="color: hsl(120, 100%, 40%);">+                        " (allocated %u, head at %u, len %u, tailroom %u < want tailroom %u)\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                         msgb->data_len - sizeof(struct msgb),</span><br><span style="color: hsl(120, 100%, 40%);">+                      msgb->head - msgb->_data,</span><br><span style="color: hsl(120, 100%, 40%);">+                       msgb->len,</span><br><span>                        msgb_tailroom(msgb), len);</span><br><span>        msgb->tail += len;</span><br><span>        msgb->len += len;</span><br><span>@@ -335,8 +339,13 @@</span><br><span> static inline unsigned char *msgb_push(struct msgb *msgb, unsigned int len)</span><br><span> {</span><br><span>      if (msgb_headroom(msgb) < (int) len)</span><br><span style="color: hsl(0, 100%, 40%);">-         MSGB_ABORT(msgb, "Not enough headroom msgb_push (%u < %u)\n",</span><br><span style="color: hsl(0, 100%, 40%);">-                         msgb_headroom(msgb), len);</span><br><span style="color: hsl(120, 100%, 40%);">+         MSGB_ABORT(msgb, "Not enough headroom msgb_push"</span><br><span style="color: hsl(120, 100%, 40%);">+                       " (allocated %u, head at %u < want headroom %u, len %u, tailroom %u)\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                         msgb->data_len - sizeof(struct msgb),</span><br><span style="color: hsl(120, 100%, 40%);">+                      msgb->head - msgb->_data,</span><br><span style="color: hsl(120, 100%, 40%);">+                       len,</span><br><span style="color: hsl(120, 100%, 40%);">+                          msgb->len,</span><br><span style="color: hsl(120, 100%, 40%);">+                         msgb_tailroom(msgb));</span><br><span>     msgb->data -= len;</span><br><span>        msgb->len += len;</span><br><span>         return msgb->data;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/16164">change 16164</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.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.osmocom.org/c/libosmocore/+/16164"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I55b68098e1037c74ebe5faa86e34bd4494f5b726 </div>
<div style="display:none"> Gerrit-Change-Number: 16164 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>