Patchwork sysvinit: allow stack size configuration from rcS

login
register
mail settings
Submitter Ben Shelton
Date Aug. 4, 2014, 3:40 p.m.
Message ID <1407166830-3981-1-git-send-email-ben.shelton@ni.com>
Download mbox | patch
Permalink /patch/77199/
State Accepted
Commit 2d77fbf7e84288cdb0d93111c6eb91440597e9c3
Headers show

Comments

Ben Shelton - Aug. 4, 2014, 3:40 p.m.
From: Scot Salmon <scot.salmon@ni.com>

For certain swap/overcommit settings (e.g. when overcommit is disabled
on a real-time system), we need to limit the stack size used by
initscripts.  When the STACK_SIZE environment variable is set (usually
in /etc/default/rcS), ulimit the stack size to the value specified.

Make the stack size ulimit a soft limit, which allows the user to
increase the stack size where required without having to run the
respective application as root.

Signed-off-by: Scot Salmon <scot.salmon@ni.com>
Signed-off-by: Gratian Crisan <gratian.crisan@ni.com>
Signed-off-by: Ben Shelton <ben.shelton@ni.com>
Acked-by: Rich Tollerton <rich.tollerton@ni.com>
Acked-by: Brad Mouring <brad.mouring@ni.com>
Acked-by: Bill Pittman <bill.pittman@ni.com>
---
 meta/recipes-core/sysvinit/sysvinit/rc | 3 +++
 1 file changed, 3 insertions(+)

Patch

diff --git a/meta/recipes-core/sysvinit/sysvinit/rc b/meta/recipes-core/sysvinit/sysvinit/rc
index 1f400d9..7ca41ae 100755
--- a/meta/recipes-core/sysvinit/sysvinit/rc
+++ b/meta/recipes-core/sysvinit/sysvinit/rc
@@ -65,6 +65,9 @@  startup() {
   # Set onlcr to avoid staircase effect.
   stty onlcr 0>&1
 
+  # Limit stack size for startup scripts
+  [ "$STACK_SIZE" == "" ] || ulimit -S -s $STACK_SIZE
+
   # Now find out what the current and what the previous runlevel are.
 
   runlevel=$RUNLEVEL