diff options
author | pgf <pgf@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2005-08-01 16:43:13 +0000 |
---|---|---|
committer | pgf <pgf@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2005-08-01 16:43:13 +0000 |
commit | d93ca99dc0e395285e93d9b3a8417af5d5f52c89 (patch) | |
tree | e051b9b4fceba69fb263e28a7275b3feb480d6e7 /init | |
parent | c0b300d5e2c6bfb5484d7beb0400a280d4d77ea4 (diff) | |
download | busybox-w32-d93ca99dc0e395285e93d9b3a8417af5d5f52c89.tar.gz busybox-w32-d93ca99dc0e395285e93d9b3a8417af5d5f52c89.tar.bz2 busybox-w32-d93ca99dc0e395285e93d9b3a8417af5d5f52c89.zip |
applying patch from bug 24:
0000024 03-16-05 patch: allow init to set controlling tty
git-svn-id: svn://busybox.net/trunk/busybox@11007 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'init')
-rw-r--r-- | init/Config.in | 11 | ||||
-rw-r--r-- | init/init.c | 7 |
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 | ||
46 | config 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 | |||
46 | config CONFIG_FEATURE_EXTRA_QUIET | 57 | config 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__) |