Browse Source

debian: /etc/default/kamailio now includes SHM_MEMORY and PKG_MEMORY variables (rather than just MEMORY).
The init script takes those values for -m (shared memory) and -M (private memory) command options.
check_kamailio_config() function within the init script also uses "-M $PKG_MEMORY" (so very long
configuration files can be parsed by increasing PKG_MEMORY).

Iñaki Baz Castillo 14 years ago
parent
commit
0d91623616

+ 5 - 2
pkg/kamailio/deb/debian/kamailio.default

@@ -11,8 +11,11 @@ USER=kamailio
 # Group to run as
 # Group to run as
 GROUP=kamailio
 GROUP=kamailio
 
 
-# Amount of memory to allocate for the running Kamailio server (in Mb)
-MEMORY=64
+# Amount of shared memory to allocate for the running Kamailio server (in Mb)
+SHM_MEMORY=64
+
+# Amount of private memory for each Kamailio process (in Mb)
+PKG_MEMORY=4
 
 
 # Switch to USER and GROUP by start-stop-daemon or by kamailio itself
 # Switch to USER and GROUP by start-stop-daemon or by kamailio itself
 # - with recent kernels, changing user ID inside applicaton prevents
 # - with recent kernels, changing user ID inside applicaton prevents

+ 7 - 5
pkg/kamailio/deb/debian/kamailio.init

@@ -39,7 +39,7 @@ check_kamailio_config ()
 {
 {
   # Check if kamailio configuration is valid before starting the server.
   # Check if kamailio configuration is valid before starting the server.
   set +e
   set +e
-  out=$($DAEMON -c 2>&1 > /dev/null)
+  out=$($DAEMON -M $PKG_MEMORY -c 2>&1 > /dev/null)
   retcode=$?
   retcode=$?
   set -e
   set -e
   if [ "$retcode" != '0' ]; then
   if [ "$retcode" != '0' ]; then
@@ -114,10 +114,12 @@ fi
 set -e
 set -e
 
 
 
 
-MEMORY=$((`echo $MEMORY | sed -e 's/[^0-9]//g'`))
+SHM_MEMORY=$((`echo $SHM_MEMORY | sed -e 's/[^0-9]//g'`))
+PKG_MEMORY=$((`echo $PKG_MEMORY | sed -e 's/[^0-9]//g'`))
+[ $SHM_MEMORY -le 0 ] && SHM_MEMORY=64
+[ $PKG_MEMORY -le 0 ] && PKG_MEMORY=4
 [ -z "$USER" ]  && USER=kamailio
 [ -z "$USER" ]  && USER=kamailio
 [ -z "$GROUP" ] && GROUP=kamailio
 [ -z "$GROUP" ] && GROUP=kamailio
-[ $MEMORY -le 0 ] && MEMORY=32
 
 
 
 
 if test "$DUMP_CORE" = "yes" ; then
 if test "$DUMP_CORE" = "yes" ; then
@@ -133,10 +135,10 @@ fi
 
 
 
 
 if [ "$SSD_SUID" != "yes" ]; then
 if [ "$SSD_SUID" != "yes" ]; then
-  OPTIONS="-f $CFGFILE -P $PIDFILE -m $MEMORY -u $USER -g $GROUP"
+  OPTIONS="-f $CFGFILE -P $PIDFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP"
   SSDOPTS=""
   SSDOPTS=""
 else
 else
-  OPTIONS="-f $CFGFILE -P $PIDFILE -m $MEMORY"
+  OPTIONS="-f $CFGFILE -P $PIDFILE -m $MEMORY -M $PKG_MEMORY"
   SSDOPTS="--chuid $USER:$GROUP"
   SSDOPTS="--chuid $USER:$GROUP"
 fi
 fi
 
 

+ 11 - 2
pkg/kamailio/deb/lenny/kamailio.default

@@ -11,8 +11,17 @@ USER=kamailio
 # Group to run as
 # Group to run as
 GROUP=kamailio
 GROUP=kamailio
 
 
-# Amount of memory to allocate for the running Kamailio server (in Mb)
-MEMORY=64
+# Amount of shared memory to allocate for the running Kamailio server (in Mb)
+SHM_MEMORY=64
+
+# Amount of private memory for each Kamailio process (in Mb)
+PKG_MEMORY=4
+
+# Switch to USER and GROUP by start-stop-daemon or by kamailio itself
+# - with recent kernels, changing user ID inside applicaton prevents
+#   dumping core files. If the value is 'yes', the suid is done by
+#   start-stop-daemon, otherwise it is done by kamailio itself
+SSD_SUID=no
 
 
 # Enable the server to leave a core file when it crashes.
 # Enable the server to leave a core file when it crashes.
 # Set this to 'yes' to enable Kamailio to leave a core file when it crashes
 # Set this to 'yes' to enable Kamailio to leave a core file when it crashes

+ 7 - 5
pkg/kamailio/deb/lenny/kamailio.init

@@ -39,7 +39,7 @@ check_kamailio_config ()
 {
 {
   # Check if kamailio configuration is valid before starting the server.
   # Check if kamailio configuration is valid before starting the server.
   set +e
   set +e
-  out=$($DAEMON -c 2>&1 > /dev/null)
+  out=$($DAEMON -M $PKG_MEMORY -c 2>&1 > /dev/null)
   retcode=$?
   retcode=$?
   set -e
   set -e
   if [ "$retcode" != '0' ]; then
   if [ "$retcode" != '0' ]; then
@@ -114,10 +114,12 @@ fi
 set -e
 set -e
 
 
 
 
-MEMORY=$((`echo $MEMORY | sed -e 's/[^0-9]//g'`))
+SHM_MEMORY=$((`echo $SHM_MEMORY | sed -e 's/[^0-9]//g'`))
+PKG_MEMORY=$((`echo $PKG_MEMORY | sed -e 's/[^0-9]//g'`))
+[ $SHM_MEMORY -le 0 ] && SHM_MEMORY=64
+[ $PKG_MEMORY -le 0 ] && PKG_MEMORY=4
 [ -z "$USER" ]  && USER=kamailio
 [ -z "$USER" ]  && USER=kamailio
 [ -z "$GROUP" ] && GROUP=kamailio
 [ -z "$GROUP" ] && GROUP=kamailio
-[ $MEMORY -le 0 ] && MEMORY=32
 
 
 
 
 if test "$DUMP_CORE" = "yes" ; then
 if test "$DUMP_CORE" = "yes" ; then
@@ -133,10 +135,10 @@ fi
 
 
 
 
 if [ "$SSD_SUID" != "yes" ]; then
 if [ "$SSD_SUID" != "yes" ]; then
-  OPTIONS="-f $CFGFILE -P $PIDFILE -m $MEMORY -u $USER -g $GROUP"
+  OPTIONS="-f $CFGFILE -P $PIDFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP"
   SSDOPTS=""
   SSDOPTS=""
 else
 else
-  OPTIONS="-f $CFGFILE -P $PIDFILE -m $MEMORY"
+  OPTIONS="-f $CFGFILE -P $PIDFILE -m $MEMORY -M $PKG_MEMORY"
   SSDOPTS="--chuid $USER:$GROUP"
   SSDOPTS="--chuid $USER:$GROUP"
 fi
 fi
 
 

+ 11 - 2
pkg/kamailio/deb/lucid/kamailio.default

@@ -11,8 +11,17 @@ USER=kamailio
 # Group to run as
 # Group to run as
 GROUP=kamailio
 GROUP=kamailio
 
 
-# Amount of memory to allocate for the running Kamailio server (in Mb)
-MEMORY=64
+# Amount of shared memory to allocate for the running Kamailio server (in Mb)
+SHM_MEMORY=64
+
+# Amount of private memory for each Kamailio process (in Mb)
+PKG_MEMORY=4
+
+# Switch to USER and GROUP by start-stop-daemon or by kamailio itself
+# - with recent kernels, changing user ID inside applicaton prevents
+#   dumping core files. If the value is 'yes', the suid is done by
+#   start-stop-daemon, otherwise it is done by kamailio itself
+SSD_SUID=no
 
 
 # Enable the server to leave a core file when it crashes.
 # Enable the server to leave a core file when it crashes.
 # Set this to 'yes' to enable Kamailio to leave a core file when it crashes
 # Set this to 'yes' to enable Kamailio to leave a core file when it crashes

+ 7 - 5
pkg/kamailio/deb/lucid/kamailio.init

@@ -39,7 +39,7 @@ check_kamailio_config ()
 {
 {
   # Check if kamailio configuration is valid before starting the server.
   # Check if kamailio configuration is valid before starting the server.
   set +e
   set +e
-  out=$($DAEMON -c 2>&1 > /dev/null)
+  out=$($DAEMON -M $PKG_MEMORY -c 2>&1 > /dev/null)
   retcode=$?
   retcode=$?
   set -e
   set -e
   if [ "$retcode" != '0' ]; then
   if [ "$retcode" != '0' ]; then
@@ -114,10 +114,12 @@ fi
 set -e
 set -e
 
 
 
 
-MEMORY=$((`echo $MEMORY | sed -e 's/[^0-9]//g'`))
+SHM_MEMORY=$((`echo $SHM_MEMORY | sed -e 's/[^0-9]//g'`))
+PKG_MEMORY=$((`echo $PKG_MEMORY | sed -e 's/[^0-9]//g'`))
+[ $SHM_MEMORY -le 0 ] && SHM_MEMORY=64
+[ $PKG_MEMORY -le 0 ] && PKG_MEMORY=4
 [ -z "$USER" ]  && USER=kamailio
 [ -z "$USER" ]  && USER=kamailio
 [ -z "$GROUP" ] && GROUP=kamailio
 [ -z "$GROUP" ] && GROUP=kamailio
-[ $MEMORY -le 0 ] && MEMORY=32
 
 
 
 
 if test "$DUMP_CORE" = "yes" ; then
 if test "$DUMP_CORE" = "yes" ; then
@@ -133,10 +135,10 @@ fi
 
 
 
 
 if [ "$SSD_SUID" != "yes" ]; then
 if [ "$SSD_SUID" != "yes" ]; then
-  OPTIONS="-f $CFGFILE -P $PIDFILE -m $MEMORY -u $USER -g $GROUP"
+  OPTIONS="-f $CFGFILE -P $PIDFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP"
   SSDOPTS=""
   SSDOPTS=""
 else
 else
-  OPTIONS="-f $CFGFILE -P $PIDFILE -m $MEMORY"
+  OPTIONS="-f $CFGFILE -P $PIDFILE -m $MEMORY -M $PKG_MEMORY"
   SSDOPTS="--chuid $USER:$GROUP"
   SSDOPTS="--chuid $USER:$GROUP"
 fi
 fi
 
 

+ 11 - 2
pkg/kamailio/deb/squeeze/kamailio.default

@@ -11,8 +11,17 @@ USER=kamailio
 # Group to run as
 # Group to run as
 GROUP=kamailio
 GROUP=kamailio
 
 
-# Amount of memory to allocate for the running Kamailio server (in Mb)
-MEMORY=64
+# Amount of shared memory to allocate for the running Kamailio server (in Mb)
+SHM_MEMORY=64
+
+# Amount of private memory for each Kamailio process (in Mb)
+PKG_MEMORY=4
+
+# Switch to USER and GROUP by start-stop-daemon or by kamailio itself
+# - with recent kernels, changing user ID inside applicaton prevents
+#   dumping core files. If the value is 'yes', the suid is done by
+#   start-stop-daemon, otherwise it is done by kamailio itself
+SSD_SUID=no
 
 
 # Enable the server to leave a core file when it crashes.
 # Enable the server to leave a core file when it crashes.
 # Set this to 'yes' to enable Kamailio to leave a core file when it crashes
 # Set this to 'yes' to enable Kamailio to leave a core file when it crashes

+ 7 - 5
pkg/kamailio/deb/squeeze/kamailio.init

@@ -39,7 +39,7 @@ check_kamailio_config ()
 {
 {
   # Check if kamailio configuration is valid before starting the server.
   # Check if kamailio configuration is valid before starting the server.
   set +e
   set +e
-  out=$($DAEMON -c 2>&1 > /dev/null)
+  out=$($DAEMON -M $PKG_MEMORY -c 2>&1 > /dev/null)
   retcode=$?
   retcode=$?
   set -e
   set -e
   if [ "$retcode" != '0' ]; then
   if [ "$retcode" != '0' ]; then
@@ -114,10 +114,12 @@ fi
 set -e
 set -e
 
 
 
 
-MEMORY=$((`echo $MEMORY | sed -e 's/[^0-9]//g'`))
+SHM_MEMORY=$((`echo $SHM_MEMORY | sed -e 's/[^0-9]//g'`))
+PKG_MEMORY=$((`echo $PKG_MEMORY | sed -e 's/[^0-9]//g'`))
+[ $SHM_MEMORY -le 0 ] && SHM_MEMORY=64
+[ $PKG_MEMORY -le 0 ] && PKG_MEMORY=4
 [ -z "$USER" ]  && USER=kamailio
 [ -z "$USER" ]  && USER=kamailio
 [ -z "$GROUP" ] && GROUP=kamailio
 [ -z "$GROUP" ] && GROUP=kamailio
-[ $MEMORY -le 0 ] && MEMORY=32
 
 
 
 
 if test "$DUMP_CORE" = "yes" ; then
 if test "$DUMP_CORE" = "yes" ; then
@@ -133,10 +135,10 @@ fi
 
 
 
 
 if [ "$SSD_SUID" != "yes" ]; then
 if [ "$SSD_SUID" != "yes" ]; then
-  OPTIONS="-f $CFGFILE -P $PIDFILE -m $MEMORY -u $USER -g $GROUP"
+  OPTIONS="-f $CFGFILE -P $PIDFILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP"
   SSDOPTS=""
   SSDOPTS=""
 else
 else
-  OPTIONS="-f $CFGFILE -P $PIDFILE -m $MEMORY"
+  OPTIONS="-f $CFGFILE -P $PIDFILE -m $MEMORY -M $PKG_MEMORY"
   SSDOPTS="--chuid $USER:$GROUP"
   SSDOPTS="--chuid $USER:$GROUP"
 fi
 fi