aboutsummaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
Diffstat (limited to 'init')
-rw-r--r--init/bootchartd.c50
-rw-r--r--init/halt.c26
-rw-r--r--init/init.c88
3 files changed, 83 insertions, 81 deletions
diff --git a/init/bootchartd.c b/init/bootchartd.c
index 92aaade0f..b5dd17439 100644
--- a/init/bootchartd.c
+++ b/init/bootchartd.c
@@ -8,43 +8,43 @@
8//kbuild:lib-$(CONFIG_BOOTCHARTD) += bootchartd.o 8//kbuild:lib-$(CONFIG_BOOTCHARTD) += bootchartd.o
9 9
10//config:config BOOTCHARTD 10//config:config BOOTCHARTD
11//config: bool "bootchartd" 11//config: bool "bootchartd (10 kb)"
12//config: default y 12//config: default y
13//config: help 13//config: help
14//config: bootchartd is commonly used to profile the boot process 14//config: bootchartd is commonly used to profile the boot process
15//config: for the purpose of speeding it up. In this case, it is started 15//config: for the purpose of speeding it up. In this case, it is started
16//config: by the kernel as the init process. This is configured by adding 16//config: by the kernel as the init process. This is configured by adding
17//config: the init=/sbin/bootchartd option to the kernel command line. 17//config: the init=/sbin/bootchartd option to the kernel command line.
18//config: 18//config:
19//config: It can also be used to monitor the resource usage of a specific 19//config: It can also be used to monitor the resource usage of a specific
20//config: application or the running system in general. In this case, 20//config: application or the running system in general. In this case,
21//config: bootchartd is started interactively by running bootchartd start 21//config: bootchartd is started interactively by running bootchartd start
22//config: and stopped using bootchartd stop. 22//config: and stopped using bootchartd stop.
23//config: 23//config:
24//config:config FEATURE_BOOTCHARTD_BLOATED_HEADER 24//config:config FEATURE_BOOTCHARTD_BLOATED_HEADER
25//config: bool "Compatible, bloated header" 25//config: bool "Compatible, bloated header"
26//config: default y 26//config: default y
27//config: depends on BOOTCHARTD 27//config: depends on BOOTCHARTD
28//config: help 28//config: help
29//config: Create extended header file compatible with "big" bootchartd. 29//config: Create extended header file compatible with "big" bootchartd.
30//config: "Big" bootchartd is a shell script and it dumps some 30//config: "Big" bootchartd is a shell script and it dumps some
31//config: "convenient" info int the header, such as: 31//config: "convenient" info int the header, such as:
32//config: title = Boot chart for `hostname` (`date`) 32//config: title = Boot chart for `hostname` (`date`)
33//config: system.uname = `uname -srvm` 33//config: system.uname = `uname -srvm`
34//config: system.release = `cat /etc/DISTRO-release` 34//config: system.release = `cat /etc/DISTRO-release`
35//config: system.cpu = `grep '^model name' /proc/cpuinfo | head -1` ($cpucount) 35//config: system.cpu = `grep '^model name' /proc/cpuinfo | head -1` ($cpucount)
36//config: system.kernel.options = `cat /proc/cmdline` 36//config: system.kernel.options = `cat /proc/cmdline`
37//config: This data is not mandatory for bootchart graph generation, 37//config: This data is not mandatory for bootchart graph generation,
38//config: and is considered bloat. Nevertheless, this option 38//config: and is considered bloat. Nevertheless, this option
39//config: makes bootchartd applet to dump a subset of it. 39//config: makes bootchartd applet to dump a subset of it.
40//config: 40//config:
41//config:config FEATURE_BOOTCHARTD_CONFIG_FILE 41//config:config FEATURE_BOOTCHARTD_CONFIG_FILE
42//config: bool "Support bootchartd.conf" 42//config: bool "Support bootchartd.conf"
43//config: default y 43//config: default y
44//config: depends on BOOTCHARTD 44//config: depends on BOOTCHARTD
45//config: help 45//config: help
46//config: Enable reading and parsing of $PWD/bootchartd.conf 46//config: Enable reading and parsing of $PWD/bootchartd.conf
47//config: and /etc/bootchartd.conf files. 47//config: and /etc/bootchartd.conf files.
48 48
49#include "libbb.h" 49#include "libbb.h"
50#include "common_bufsiz.h" 50#include "common_bufsiz.h"
@@ -171,7 +171,9 @@ static int dump_procs(FILE *fp, int look_for_login_process)
171 p++; 171 p++;
172 strchrnul(p, ')')[0] = '\0'; 172 strchrnul(p, ')')[0] = '\0';
173 /* Is it gdm, kdm or a getty? */ 173 /* Is it gdm, kdm or a getty? */
174 if (((p[0] == 'g' || p[0] == 'k' || p[0] == 'x') && p[1] == 'd' && p[2] == 'm') 174 if (((p[0] == 'g' || p[0] == 'k' || p[0] == 'x')
175 && p[1] == 'd' && p[2] == 'm' && p[3] == '\0'
176 )
175 || strstr(p, "getty") 177 || strstr(p, "getty")
176 ) { 178 ) {
177 found_login_process = 1; 179 found_login_process = 1;
@@ -190,7 +192,7 @@ static char *make_tempdir(void)
190 if (!tempdir) { 192 if (!tempdir) {
191#ifdef __linux__ 193#ifdef __linux__
192 /* /tmp is not writable (happens when we are used as init). 194 /* /tmp is not writable (happens when we are used as init).
193 * Try to mount a tmpfs, them cd and lazily unmount it. 195 * Try to mount a tmpfs, then cd and lazily unmount it.
194 * Since we unmount it at once, we can mount it anywhere. 196 * Since we unmount it at once, we can mount it anywhere.
195 * Try a few locations which are likely ti exist. 197 * Try a few locations which are likely ti exist.
196 */ 198 */
diff --git a/init/halt.c b/init/halt.c
index f69b89772..632c6cc56 100644
--- a/init/halt.c
+++ b/init/halt.c
@@ -8,42 +8,42 @@
8 */ 8 */
9 9
10//config:config HALT 10//config:config HALT
11//config: bool "halt" 11//config: bool "halt (3.7 kb)"
12//config: default y 12//config: default y
13//config: help 13//config: help
14//config: Stop all processes and halt the system. 14//config: Stop all processes and halt the system.
15//config: 15//config:
16//config:config POWEROFF 16//config:config POWEROFF
17//config: bool "poweroff" 17//config: bool "poweroff (3.7 kb)"
18//config: default y 18//config: default y
19//config: help 19//config: help
20//config: Stop all processes and power off the system. 20//config: Stop all processes and power off the system.
21//config: 21//config:
22//config:config REBOOT 22//config:config REBOOT
23//config: bool "reboot" 23//config: bool "reboot (3.7 kb)"
24//config: default y 24//config: default y
25//config: help 25//config: help
26//config: Stop all processes and reboot the system. 26//config: Stop all processes and reboot the system.
27//config: 27//config:
28//config:config FEATURE_CALL_TELINIT 28//config:config FEATURE_CALL_TELINIT
29//config: bool "Call telinit on shutdown and reboot" 29//config: bool "Call telinit on shutdown and reboot"
30//config: default y 30//config: default y
31//config: depends on (HALT || POWEROFF || REBOOT) && !INIT 31//config: depends on (HALT || POWEROFF || REBOOT) && !INIT
32//config: help 32//config: help
33//config: Call an external program (normally telinit) to facilitate 33//config: Call an external program (normally telinit) to facilitate
34//config: a switch to a proper runlevel. 34//config: a switch to a proper runlevel.
35//config: 35//config:
36//config: This option is only available if you selected halt and friends, 36//config: This option is only available if you selected halt and friends,
37//config: but did not select init. 37//config: but did not select init.
38//config: 38//config:
39//config:config TELINIT_PATH 39//config:config TELINIT_PATH
40//config: string "Path to telinit executable" 40//config: string "Path to telinit executable"
41//config: default "/sbin/telinit" 41//config: default "/sbin/telinit"
42//config: depends on FEATURE_CALL_TELINIT 42//config: depends on FEATURE_CALL_TELINIT
43//config: help 43//config: help
44//config: When busybox halt and friends have to call external telinit 44//config: When busybox halt and friends have to call external telinit
45//config: to facilitate proper shutdown, this path is to be used when 45//config: to facilitate proper shutdown, this path is to be used when
46//config: locating telinit executable. 46//config: locating telinit executable.
47 47
48//applet:IF_HALT(APPLET(halt, BB_DIR_SBIN, BB_SUID_DROP)) 48//applet:IF_HALT(APPLET(halt, BB_DIR_SBIN, BB_SUID_DROP))
49// APPLET_ODDNAME:name main location suid_type help 49// APPLET_ODDNAME:name main location suid_type help
diff --git a/init/init.c b/init/init.c
index 4d6355167..ab137a981 100644
--- a/init/init.c
+++ b/init/init.c
@@ -10,38 +10,38 @@
10 */ 10 */
11 11
12//config:config INIT 12//config:config INIT
13//config: bool "init" 13//config: bool "init (9.3 kb)"
14//config: default y 14//config: default y
15//config: select FEATURE_SYSLOG 15//config: select FEATURE_SYSLOG
16//config: help 16//config: help
17//config: init is the first program run when the system boots. 17//config: init is the first program run when the system boots.
18//config: 18//config:
19//config:config LINUXRC 19//config:config LINUXRC
20//config: bool "linuxrc: support running init from initrd (not initramfs)" 20//config: bool "linuxrc: support running init from initrd (not initramfs)"
21//config: default y 21//config: default y
22//config: select FEATURE_SYSLOG 22//config: select FEATURE_SYSLOG
23//config: help 23//config: help
24//config: Legacy support for running init under the old-style initrd. Allows 24//config: Legacy support for running init under the old-style initrd. Allows
25//config: the name linuxrc to act as init, and it doesn't assume init is PID 1. 25//config: the name linuxrc to act as init, and it doesn't assume init is PID 1.
26//config: 26//config:
27//config: This does not apply to initramfs, which runs /init as PID 1 and 27//config: This does not apply to initramfs, which runs /init as PID 1 and
28//config: requires no special support. 28//config: requires no special support.
29//config: 29//config:
30//config:config FEATURE_USE_INITTAB 30//config:config FEATURE_USE_INITTAB
31//config: bool "Support reading an inittab file" 31//config: bool "Support reading an inittab file"
32//config: default y 32//config: default y
33//config: depends on INIT || LINUXRC 33//config: depends on INIT || LINUXRC
34//config: help 34//config: help
35//config: Allow init to read an inittab file when the system boot. 35//config: Allow init to read an inittab file when the system boot.
36//config: 36//config:
37//config:config FEATURE_KILL_REMOVED 37//config:config FEATURE_KILL_REMOVED
38//config: bool "Support killing processes that have been removed from inittab" 38//config: bool "Support killing processes that have been removed from inittab"
39//config: default n 39//config: default n
40//config: depends on FEATURE_USE_INITTAB 40//config: depends on FEATURE_USE_INITTAB
41//config: help 41//config: help
42//config: When respawn entries are removed from inittab and a SIGHUP is 42//config: When respawn entries are removed from inittab and a SIGHUP is
43//config: sent to init, this option will make init kill the processes 43//config: sent to init, this option will make init kill the processes
44//config: that have been removed. 44//config: that have been removed.
45//config: 45//config:
46//config:config FEATURE_KILL_DELAY 46//config:config FEATURE_KILL_DELAY
47//config: int "How long to wait between TERM and KILL (0 - send TERM only)" if FEATURE_KILL_REMOVED 47//config: int "How long to wait between TERM and KILL (0 - send TERM only)" if FEATURE_KILL_REMOVED
@@ -49,34 +49,34 @@
49//config: default 0 49//config: default 0
50//config: depends on FEATURE_KILL_REMOVED 50//config: depends on FEATURE_KILL_REMOVED
51//config: help 51//config: help
52//config: With nonzero setting, init sends TERM, forks, child waits N 52//config: With nonzero setting, init sends TERM, forks, child waits N
53//config: seconds, sends KILL and exits. Setting it too high is unwise 53//config: seconds, sends KILL and exits. Setting it too high is unwise
54//config: (child will hang around for too long and could actually kill 54//config: (child will hang around for too long and could actually kill
55//config: the wrong process!) 55//config: the wrong process!)
56//config: 56//config:
57//config:config FEATURE_INIT_SCTTY 57//config:config FEATURE_INIT_SCTTY
58//config: bool "Run commands with leading dash with controlling tty" 58//config: bool "Run commands with leading dash with controlling tty"
59//config: default y 59//config: default y
60//config: depends on INIT || LINUXRC 60//config: depends on INIT || LINUXRC
61//config: help 61//config: help
62//config: If this option is enabled, init will try to give a controlling 62//config: If this option is enabled, init will try to give a controlling
63//config: tty to any command which has leading hyphen (often it's "-/bin/sh"). 63//config: tty to any command which has leading hyphen (often it's "-/bin/sh").
64//config: More precisely, init will do "ioctl(STDIN_FILENO, TIOCSCTTY, 0)". 64//config: More precisely, init will do "ioctl(STDIN_FILENO, TIOCSCTTY, 0)".
65//config: If device attached to STDIN_FILENO can be a ctty but is not yet 65//config: If device attached to STDIN_FILENO can be a ctty but is not yet
66//config: a ctty for other session, it will become this process' ctty. 66//config: a ctty for other session, it will become this process' ctty.
67//config: This is not the traditional init behavour, but is often what you want 67//config: This is not the traditional init behavour, but is often what you want
68//config: in an embedded system where the console is only accessed during 68//config: in an embedded system where the console is only accessed during
69//config: development or for maintenance. 69//config: development or for maintenance.
70//config: NB: using cttyhack applet may work better. 70//config: NB: using cttyhack applet may work better.
71//config: 71//config:
72//config:config FEATURE_INIT_SYSLOG 72//config:config FEATURE_INIT_SYSLOG
73//config: bool "Enable init to write to syslog" 73//config: bool "Enable init to write to syslog"
74//config: default y 74//config: default y
75//config: depends on INIT || LINUXRC 75//config: depends on INIT || LINUXRC
76//config: help 76//config: help
77//config: If selected, some init messages are sent to syslog. 77//config: If selected, some init messages are sent to syslog.
78//config: Otherwise, they are sent to VT #5 if linux virtual tty is detected 78//config: Otherwise, they are sent to VT #5 if linux virtual tty is detected
79//config: (if not, no separate logging is done). 79//config: (if not, no separate logging is done).
80//config: 80//config:
81//config:config FEATURE_INIT_QUIET 81//config:config FEATURE_INIT_QUIET
82//config: bool "Be quiet on boot (no 'init started:' message)" 82//config: bool "Be quiet on boot (no 'init started:' message)"
@@ -88,37 +88,37 @@
88//config: default n # not Y because this is a debug option 88//config: default n # not Y because this is a debug option
89//config: depends on INIT || LINUXRC 89//config: depends on INIT || LINUXRC
90//config: help 90//config: help
91//config: If this option is enabled and the file /.init_enable_core 91//config: If this option is enabled and the file /.init_enable_core
92//config: exists, then init will call setrlimit() to allow unlimited 92//config: exists, then init will call setrlimit() to allow unlimited
93//config: core file sizes. If this option is disabled, processes 93//config: core file sizes. If this option is disabled, processes
94//config: will not generate any core files. 94//config: will not generate any core files.
95//config: 95//config:
96//config:config INIT_TERMINAL_TYPE 96//config:config INIT_TERMINAL_TYPE
97//config: string "Initial terminal type" 97//config: string "Initial terminal type"
98//config: default "linux" 98//config: default "linux"
99//config: depends on INIT || LINUXRC 99//config: depends on INIT || LINUXRC
100//config: help 100//config: help
101//config: This is the initial value set by init for the TERM environment 101//config: This is the initial value set by init for the TERM environment
102//config: variable. This variable is used by programs which make use of 102//config: variable. This variable is used by programs which make use of
103//config: extended terminal capabilities. 103//config: extended terminal capabilities.
104//config: 104//config:
105//config: Note that on Linux, init attempts to detect serial terminal and 105//config: Note that on Linux, init attempts to detect serial terminal and
106//config: sets TERM to "vt102" if one is found. 106//config: sets TERM to "vt102" if one is found.
107//config: 107//config:
108//config:config FEATURE_INIT_MODIFY_CMDLINE 108//config:config FEATURE_INIT_MODIFY_CMDLINE
109//config: bool "Clear init's command line" 109//config: bool "Clear init's command line"
110//config: default y 110//config: default y
111//config: depends on INIT || LINUXRC 111//config: depends on INIT || LINUXRC
112//config: help 112//config: help
113//config: When launched as PID 1 and after parsing its arguments, init 113//config: When launched as PID 1 and after parsing its arguments, init
114//config: wipes all the arguments but argv[0] and rewrites argv[0] to 114//config: wipes all the arguments but argv[0] and rewrites argv[0] to
115//config: contain only "init", so that its command line appears solely as 115//config: contain only "init", so that its command line appears solely as
116//config: "init" in tools such as ps. 116//config: "init" in tools such as ps.
117//config: If this option is set to Y, init will keep its original behavior, 117//config: If this option is set to Y, init will keep its original behavior,
118//config: otherwise, all the arguments including argv[0] will be preserved, 118//config: otherwise, all the arguments including argv[0] will be preserved,
119//config: be they parsed or ignored by init. 119//config: be they parsed or ignored by init.
120//config: The original command-line used to launch init can then be 120//config: The original command-line used to launch init can then be
121//config: retrieved in /proc/1/cmdline on Linux, for example. 121//config: retrieved in /proc/1/cmdline on Linux, for example.
122 122
123//applet:IF_INIT(APPLET(init, BB_DIR_SBIN, BB_SUID_DROP)) 123//applet:IF_INIT(APPLET(init, BB_DIR_SBIN, BB_SUID_DROP))
124//applet:IF_LINUXRC(APPLET_ODDNAME(linuxrc, init, BB_DIR_ROOT, BB_SUID_DROP, linuxrc)) 124//applet:IF_LINUXRC(APPLET_ODDNAME(linuxrc, init, BB_DIR_ROOT, BB_SUID_DROP, linuxrc))