THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has been changed. The changes are listed below. For full information about what has changed, visit the URL and click the History tab.
FS#12 - check symbol conflicts
User who did this: Daniel-Constantin Mierla (miconda)
Severity: High -> Medium
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=12
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#22 - $shv problems
User who did this - Daniel-Constantin Mierla (miconda)
----------
Should be fixed now.Let me know if works.
Thanks to Andrei for addition of early shm initialisation.
----------
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=22#comment25
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
Module: sip-router
Branch: kamailio_3.0
Commit: 836406e324036760573dd5a79a0934fabd397f50
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=836406e…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Sun Jan 10 13:15:57 2010 +0100
NEWS: notes about the shm related changes
(cherry picked from commit 3d3d38e63a55e549e1707fce0fa1c2c189906338)
---
NEWS | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/NEWS b/NEWS
index 3cd2de4..225eedc 100644
--- a/NEWS
+++ b/NEWS
@@ -64,6 +64,8 @@ config script changes:
- while()
- include file support: include_file "somefile"
- event route support: event_route[module_name:eventid]
+ - user and shm_force_alloc must now appear prior to any modparam() or route
+ block.
build system:
- multiple modules directories are now supported (defined in Makefile.dirs)
@@ -79,6 +81,9 @@ new config variables:
compiled with DBG_QM_MALLOC or DBG_F_MALLOC).
Default: 1.
Can be changed at runtime.
+ - shm = number or shm_mem = number - size of shared memory in MB. It's
+ overwritten if a value is specified on the command line (-m val).
+ Default: 32 Mb. Must appear prior to any modparam() or route block.
new script commands:
add_local_rport() - adds the rport parameter to the added via header
Module: sip-router
Branch: kamailio_3.0
Commit: 9c657605b8b754b8d633aafb2b5ed771265b782c
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9c65760…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Sun Jan 10 12:50:15 2010 +0100
core: moved shm init into separate files
- shm init moved from main.c into shm_init.c and shm_init.h.
- added a function to check if shm was already intialized
(shm_intialized()).
- make sure the user is set before parsing the config, if present
on the command line (the user is needed to initialize the shared
memory when sysv semaphores are used as the locking method).
(cherry picked from commit 2c4ae148162c7a36f25d9a7b10fe64c7667ced31)
---
main.c | 14 ++++++++--
shm_init.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
shm_init.h | 35 ++++++++++++++++++++++++++
3 files changed, 125 insertions(+), 3 deletions(-)
diff --git a/main.c b/main.c
index fd4b642..31a4b65 100644
--- a/main.c
+++ b/main.c
@@ -121,7 +121,8 @@
#include "mem/mem.h"
#ifdef SHM_MEM
#include "mem/shm_mem.h"
-#endif
+#include "shm_init.h"
+#endif /* SHM_MEM */
#include "sr_module.h"
#include "timer.h"
#include "parser/msg_parser.h"
@@ -1720,6 +1721,10 @@ int main(int argc, char** argv)
goto error;
};
break;
+ case 'u':
+ /* user needed for possible shm. pre-init */
+ user=optarg;
+ break;
case 'b':
case 'l':
case 'n':
@@ -1732,7 +1737,6 @@ int main(int argc, char** argv)
case 'W':
case 'w':
case 't':
- case 'u':
case 'g':
case 'P':
case 'G':
@@ -2069,9 +2073,13 @@ try_again:
* -it must be also before init_timer and init_tcp
* -it must be after we know uid (so that in the SYSV sems case,
* the sems will have the correct euid)
+ * Note: shm can now be initialized when parsing the config script, that's
+ * why checking for a prior initialization is needed.
* --andrei */
- if (init_shm_mallocs(shm_force_alloc)==-1)
+#ifdef SHM_MEM
+ if (!shm_initialized() && init_shm()<0)
goto error;
+#endif /* SHM_MEM */
if (init_atomic_ops()==-1)
goto error;
if (init_basex() != 0){
diff --git a/shm_init.c b/shm_init.c
new file mode 100644
index 0000000..d981ae5
--- /dev/null
+++ b/shm_init.c
@@ -0,0 +1,79 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2010 iptelorg GmbH
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * shm_init.c
+ */
+/*
+ * History:
+ * --------
+ * 2010-01-10 initial version (andrei)
+*/
+
+#include "shm_init.h"
+#include "mem/mem.h"
+#include "globals.h"
+
+static int shm_init = 0;
+
+
+/** check if shm is initialized.
+ * @return 1 if initialized, 0 if not
+ */
+int shm_initialized()
+{
+ return shm_init;
+}
+
+
+
+#ifdef SHM_MEM
+/** init shm mem.
+ * @return 0 on success, < 0 on error
+ * it _must_ be called:
+ * - after the shm_mem_size is known
+ * - after shm_force_alloc is known (mlock_pages should happen at a later
+ * point so it's not yet needed here)
+ * - after the user is known (so that in the SYSV sems case the sems will
+ * have the correct euid)
+ * - before init_timer and init_tcp
+ * --andrei
+ *
+ * Global vars used: shm_mem_size, shm_force_alloc, user & uid.
+ * Side effects: it might set uid, gid and shm_mem_size.
+ */
+int init_shm()
+{
+ /* set uid if user is set */
+ if (user && uid == 0){
+ if (user2uid(&uid, &gid, user)<0){
+ fprintf(stderr, "bad user name/uid number: -u %s\n", user);
+ goto error;
+ }
+ }
+ if (shm_mem_size == 0)
+ shm_mem_size=SHM_MEM_SIZE * 1024 * 1024;
+ if (init_shm_mallocs(shm_force_alloc)==-1)
+ goto error;
+ shm_init=1;
+ return 0;
+error:
+ return -1;
+}
+#endif /* SHM_MEM */
+
+/* vi: set ts=4 sw=4 tw=79:ai:cindent: */
diff --git a/shm_init.h b/shm_init.h
new file mode 100644
index 0000000..b25ab43
--- /dev/null
+++ b/shm_init.h
@@ -0,0 +1,35 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2010 iptelorg GmbH
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * shm_init.h
+ */
+/*
+ * History:
+ * --------
+ * 2010-01-10 initial version (andrei)
+*/
+
+#ifndef __shm_init_h
+#define __shm_init_h
+
+int shm_initialized();
+int init_shm();
+
+#endif /*__shm_init_h*/
+
+/* vi: set ts=4 sw=4 tw=79:ai:cindent: */