aboutsummaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
Diffstat (limited to 'init')
-rw-r--r--init/Config.in11
-rw-r--r--init/init.c7
2 files changed, 18 insertions, 0 deletions
diff --git a/init/Config.in b/init/Config.in
index 521f8fe1d..a3584aaf5 100644
--- a/init/Config.in
+++ b/init/Config.in
@@ -43,6 +43,17 @@ config CONFIG_FEATURE_INIT_SWAPON
43 If the system has less than one megabyte of total memory, init 43 If the system has less than one megabyte of total memory, init
44 will run '/sbin/swapon -a' to add swap memory. 44 will run '/sbin/swapon -a' to add swap memory.
45 45
46config CONFIG_FEATURE_INIT_SCTTY
47 bool " Support running commands with a controlling-tty?"
48 default n
49 depends on CONFIG_INIT
50 help
51 If this option is enabled a command starting with hyphen (-)
52 is run in its own session (setsid(2)) and possibly with a
53 controlling tty (TIOCSCTTY). This is not the traditional init
54 behavour, but is often what you want in an embedded system where
55 the console is only accessed during development or for maintenance.
56
46config CONFIG_FEATURE_EXTRA_QUIET 57config CONFIG_FEATURE_EXTRA_QUIET
47 bool " Should init be _extra_ quiet on boot?" 58 bool " Should init be _extra_ quiet on boot?"
48 default y 59 default y
diff --git a/init/init.c b/init/init.c
index 8687b106c..0f49a45d8 100644
--- a/init/init.c
+++ b/init/init.c
@@ -577,6 +577,13 @@ static pid_t run(const struct init_action *a)
577 cmd[0][0] = '-'; 577 cmd[0][0] = '-';
578 strcpy(cmd[0] + 1, s); 578 strcpy(cmd[0] + 1, s);
579 } 579 }
580#ifdef CONFIG_FEATURE_INIT_SCTTY
581 /* Establish this process as session leader and
582 * (attempt) to make the tty (if any) a controlling tty.
583 */
584 (void) setsid();
585 (void) ioctl(0, TIOCSCTTY, 0/*don't steal it*/);
586#endif
580 } 587 }
581 588
582#if !defined(__UCLIBC__) || defined(__ARCH_HAS_MMU__) 589#if !defined(__UCLIBC__) || defined(__ARCH_HAS_MMU__)