.. use a global variable instead of global parameter, obviously
-----Original Message-----
From: sr-dev <sr-dev-bounces(a)lists.kamailio.org> On Behalf Of Henning Westerholt
Sent: Thursday, August 26, 2021 10:14 AM
To: Kamailio (SER) - Development Mailing List <sr-dev(a)lists.kamailio.org>
Subject: Re: [sr-dev] Troubleshooting segfault in shared memory
Hello,
usually, the patter for using shared memory is this:
- allocate the shared memory in main (mod_init) process, use a global parameter
- use the shared memory in child processes, protected by a kamailio lock against
concurrent access if you write to it as well
Allocating shared memory in a child process and then accessing it from another child
process will not work out of the box.
Have a look to other modules with shared memory, e.g., carrierroute/cr_data.c or similar
for an idea.
Cheers,
Henning
--
Henning Westerholt -
https://skalatan.de/blog/ Kamailio services -
https://gilawa.com
-----Original Message-----
From: sr-dev <sr-dev-bounces(a)lists.kamailio.org> On Behalf Of Anthony Alba
Sent: Thursday, August 26, 2021 4:55 AM
To: sr-dev(a)lists.kamailio.org
Subject: [sr-dev] Troubleshooting segfault in shared memory
Hi sr-dev,
I have a pointer from one child process A that is available to another child process B
(this is a custom module I am developing). The object should have been allocated in shared
memory by A using ser_malloc and friends and thus accessible from B.
However B is encountering a segfault when accessing this object.
Given a pointer how can I tell whether the memory it is pointing to is valid in all
children, i.e, the target is in kamailio shared memory?
Thanks
Anthony Alba
_______________________________________________
Kamailio (SER) - Development Mailing List sr-dev(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
_______________________________________________
Kamailio (SER) - Development Mailing List sr-dev(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev