<p>Sorry for the late reply, was yesterday pretty busy as well.</p>
<p>Generally speaking, these are the different approaches that modules use for data access in kamailio child processes:</p>
<ul>
<li>
<p>all children needs to access to a one shared data structure<br>
Create one global structure in mod_init in shm_memory, and then access it from different children.<br>
Protect the (possible) concurrent access with locks, if you support run-time modification of this data.<br>
You find examples in the carrierroute module, mod_init() -> init_route_data() and its reload<br>
functions and other modules.</p>
</li>
<li>
<p>All children needs access to a individual local data set<br>
Just allocate it in pkg_memory and access it from the children individually.<br>
You can find an example in the auth_diameter module, auth_diameter.c mod_child_init() function.</p>
</li>
<li>
<p>All children needs access to all local sets<br>
Then you need to implement a solution like you choose with a shared data structure, e.g. in a hash<br>
table that you write in child_init to. I did not fully understand why you need this here, maybe you can<br>
elaborate a bit on the requirements of the HSM child_init.</p>
</li>
</ul>
<p>I have another remark about the hash table you' added. The hash table uses system malloc() to allocate memory. Please change this to pkg_memory, if you need per-process individual memory, or shm_memory for shared memory. If you have more detailed questions, feel free to contact me per e-mail as well (hw at kamailio dot org).</p>
<p><a class="user-mention" href="https://github.com/miconda">@miconda</a> - as you currently traveling, I can do the further processing of this patch, no need to hurry from your side.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/pull/1484#issuecomment-375566763">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZQ9Wlm-Yr_NTE-eEF6puQgsFCnCyks5thKPIgaJpZM4SsL5H">mute the thread</a>.<img src="https://github.com/notifications/beacon/AF36ZTGQaISn-i2hx_zYkaY7F70bSncWks5thKPIgaJpZM4SsL5H.gif" height="1" width="1" alt="" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/kamailio/kamailio/pull/1484#issuecomment-375566763"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@henningw in #1484: Sorry for the late reply, was yesterday pretty busy as well.\r\n\r\nGenerally speaking, these are the different approaches that modules use for data access in kamailio child processes:\r\n\r\n* all children needs to access to a one shared data structure\r\n  Create one global structure in mod_init in shm_memory, and then access it from different children.\r\n  Protect the (possible) concurrent access with locks, if you support run-time modification of this data.\r\n  You find examples in the carrierroute module, mod_init() -\u003e init_route_data() and its reload \r\n  functions and other modules.\r\n\r\n* All children needs access to a individual local data set\r\n  Just allocate it in pkg_memory and access it from the children individually.\r\n  You can find an example in the auth_diameter module, auth_diameter.c mod_child_init() function.\r\n\r\n* All children needs access to all local sets\r\n  Then you need to implement a solution like you choose with a shared data structure, e.g. in a hash \r\n  table that you write in child_init to. I did not fully understand why you need this here, maybe you can \r\n  elaborate a bit on the requirements of the HSM child_init.\r\n\r\nI have another remark about the hash table you' added. The hash table uses system malloc() to allocate memory. Please change this to pkg_memory, if you need per-process individual memory, or shm_memory for shared memory. If you have more detailed questions, feel free to contact me per e-mail as well (hw at kamailio dot org).\r\n\r\n@miconda - as you currently traveling, I can do the further processing of this patch, no need to hurry from your side."}],"action":{"name":"View Pull Request","url":"https://github.com/kamailio/kamailio/pull/1484#issuecomment-375566763"}}}</script>