]> git.pld-linux.org Git - packages/rc-scripts.git/blame - rc-scripts-ulimits.patch
- fixed my sed->awk modifications (now tested and work)
[packages/rc-scripts.git] / rc-scripts-ulimits.patch
CommitLineData
5b827075
JB
1diff -Nur rc-scripts-0.4.0.2.orig/rc.d/init.d/functions rc-scripts-0.4.0.2/rc.d/init.d/functions
2--- rc-scripts-0.4.0.2.orig/rc.d/init.d/functions 2003-10-02 20:46:49.000000000 +0200
3+++ rc-scripts-0.4.0.2/rc.d/init.d/functions 2003-10-12 15:50:17.035580952 +0200
4@@ -263,13 +263,18 @@
131b21f1
JB
5 return $exit_code
6 }
7
8-# A function to start a program (now it's usefull on read-only filesystem too)
9+# A function to start a program (now it's useful on read-only filesystem too)
5b827075 10 daemon()
131b21f1
JB
11 {
12- typeset errors="" prog=""
038ea68f 13+ typeset errors="" prog="" limits=""
131b21f1
JB
14 typeset -i exit_code=0
15 [ -z "$DEFAULT_SERVICE_RUN_NICE_LEVEL" ] && DEFAULT_SERVICE_RUN_NICE_LEVEL=0
16- # Test syntax. Don't use -o instead || here - this will broke ksh --misiek
17+ # "-u unlimited" (-p for ksh) to make sure daemons will be able to fork.
18+ # "-c 0" to make sure it doesn't core dump anywhere; while this could mask
19+ # problems with the daemon, it also closes some security problems.
20+ # Users' limits are set via pam_limits.
038ea68f 21+ [ -z "$DEFAULT_SERVICE_LIMITS" ] && DEFAULT_SERVICE_LIMITS_HARD="-u unlimited -c 0"
131b21f1
JB
22+ # Test syntax. Don't use -o instead || here - this will break ksh --misiek
23 while [ "$1" != "${1##-}" ] || [ "$1" != "${1##+}" ]; do
24 case $1 in
5b827075
JB
25 '')
26@@ -299,20 +304,18 @@
131b21f1
JB
27 prog="$prog $*"
28 fi
29
30- # make sure it doesn't core dump anywhere; while this could mask
31- # problems with the daemon, it also closes some security problems
32- ulimit -c 0
33-
34- # Make sure daemons will be able to fork.
35- # Limits are set via pam_limits.
36 if [ -n "$KSH_VERSION" ]; then
37- ulimit -p unlimited
038ea68f 38+ limits="`echo ${SERVICE_LIMITS:-$DEFAULT_SERVICE_LIMITS} | sed -e 's/-\([SH]\?\)u/-\1p/'`"
131b21f1
JB
39 elif [ -n "$ZSH_VERSION" ]; then
40- ulimit -u unlimited
038ea68f 41+ limits="${SERVICE_LIMITS:-$DEFAULT_SERVICE_LIMITS}"
131b21f1
JB
42 elif [ -n "$BASH_VERSION" ]; then
43- ulimit -u unlimited
038ea68f 44+ limits="${SERVICE_LIMITS:-$DEFAULT_SERVICE_LIMITS}"
131b21f1
JB
45 # elif [ -n "`$SH -c 'echo ${.sh.version}' 2>/dev/null`" ]; then
46 fi
038ea68f
JB
47+ while echo "$limits" | grep -q '[^ ]'; do
48+ ulimit `echo ${limits} | sed -e 's/^ *\(-[^-]*\)\(-.*\)\?$/\1/'`
49+ limits="`echo ${limits} | sed -e 's/^ *\(-[^-]*\)\(-.*\)\?$/\2/'`"
131b21f1
JB
50+ done
51
52 # And start it up.
53 busy
5b827075
JB
54diff -Nur rc-scripts-0.4.0.2.orig/sysconfig/system rc-scripts-0.4.0.2/sysconfig/system
55--- rc-scripts-0.4.0.2.orig/sysconfig/system 2003-10-02 20:46:49.000000000 +0200
56+++ rc-scripts-0.4.0.2/sysconfig/system 2003-10-12 15:50:53.502037208 +0200
038ea68f 57@@ -17,6 +17,17 @@
131b21f1
JB
58 # $SERVICE_RUN_NICE_LEVEL is not defined in /etc/sysconfig/<service>
59 DEFAULT_SERVICE_RUN_NICE_LEVEL=0
60
61+# Default limits set before running demons (hard and soft) if
038ea68f 62+# $SERVICE_LIMITS are not defined in /etc/sysconfig/<service>
131b21f1 63+# Use "-u" for process limits (automatically translated to "-p" for ksh).
038ea68f 64+# Use "-Sx" or "-Hx" to set only soft or hard "x" limit.
131b21f1
JB
65+# Advised limits are:
66+# "-u unlimited" to make sure daemons will be able to fork;
67+# "-c 0" to make sure it doesn't core dump anywhere; while this could mask
68+# problems with the daemon, it also closes some security problems;
69+# users' limits are set via pam_limits.
038ea68f 70+DEFAULT_SERVICE_LIMITS="-u unlimited -c 0"
131b21f1 71+
5b827075
JB
72 # Setup PNP using userspace tools?
73 RUN_USERPNP=yes
74 # Setup kernel space PNP (2.4.x)
This page took 0.092908 seconds and 4 git commands to generate.