summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/applets.src.h7
-rw-r--r--include/usage.src.h169
-rw-r--r--init/Config.src127
-rw-r--r--init/Kbuild.src4
-rw-r--r--init/bootchartd.c4
-rw-r--r--init/halt.c62
-rw-r--r--init/init.c231
-rw-r--r--init/mesg.c18
8 files changed, 315 insertions, 307 deletions
diff --git a/include/applets.src.h b/include/applets.src.h
index 6a14a65..545d3c5 100644
--- a/include/applets.src.h
+++ b/include/applets.src.h
@@ -72,7 +72,6 @@ IF_BASENAME(APPLET_NOFORK(basename, basename, _BB_DIR_USR_BIN, _BB_SUID_DROP, ba
IF_BBCONFIG(APPLET(bbconfig, _BB_DIR_BIN, _BB_SUID_DROP))
IF_BEEP(APPLET(beep, _BB_DIR_USR_BIN, _BB_SUID_DROP))
IF_BLKID(APPLET(blkid, _BB_DIR_SBIN, _BB_SUID_DROP))
-IF_BOOTCHARTD(APPLET(bootchartd, _BB_DIR_SBIN, _BB_SUID_DROP))
IF_BRCTL(APPLET(brctl, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
IF_BZIP2(APPLET(bzip2, _BB_DIR_USR_BIN, _BB_SUID_DROP))
IF_CAL(APPLET(cal, _BB_DIR_USR_BIN, _BB_SUID_DROP))
@@ -165,7 +164,6 @@ IF_GETSEBOOL(APPLET(getsebool, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
IF_GETTY(APPLET(getty, _BB_DIR_SBIN, _BB_SUID_DROP))
IF_GUNZIP(APPLET(gunzip, _BB_DIR_BIN, _BB_SUID_DROP))
IF_GZIP(APPLET(gzip, _BB_DIR_BIN, _BB_SUID_DROP))
-IF_HALT(APPLET(halt, _BB_DIR_SBIN, _BB_SUID_DROP))
IF_HD(APPLET_NOEXEC(hd, hexdump, _BB_DIR_USR_BIN, _BB_SUID_DROP, hd))
IF_HDPARM(APPLET(hdparm, _BB_DIR_SBIN, _BB_SUID_DROP))
IF_HEAD(APPLET_NOEXEC(head, head, _BB_DIR_USR_BIN, _BB_SUID_DROP, head))
@@ -181,7 +179,6 @@ IF_IFENSLAVE(APPLET(ifenslave, _BB_DIR_SBIN, _BB_SUID_DROP))
IF_IFPLUGD(APPLET(ifplugd, _BB_DIR_USR_BIN, _BB_SUID_DROP))
IF_IFUPDOWN(APPLET_ODDNAME(ifup, ifupdown, _BB_DIR_SBIN, _BB_SUID_DROP, ifup))
IF_INETD(APPLET(inetd, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
-IF_INIT(APPLET(init, _BB_DIR_SBIN, _BB_SUID_DROP))
IF_INOTIFYD(APPLET(inotifyd, _BB_DIR_SBIN, _BB_SUID_DROP))
IF_INSMOD(APPLET(insmod, _BB_DIR_SBIN, _BB_SUID_DROP))
IF_MODPROBE_SMALL(APPLET_ODDNAME(insmod, modprobe, _BB_DIR_SBIN, _BB_SUID_DROP, modprobe))
@@ -212,7 +209,6 @@ IF_LENGTH(APPLET_NOFORK(length, length, _BB_DIR_USR_BIN, _BB_SUID_DROP, length))
IF_LESS(APPLET(less, _BB_DIR_USR_BIN, _BB_SUID_DROP))
IF_SETARCH(APPLET_ODDNAME(linux32, setarch, _BB_DIR_BIN, _BB_SUID_DROP, linux32))
IF_SETARCH(APPLET_ODDNAME(linux64, setarch, _BB_DIR_BIN, _BB_SUID_DROP, linux64))
-IF_FEATURE_INITRD(APPLET_ODDNAME(linuxrc, init, _BB_DIR_ROOT, _BB_SUID_DROP, linuxrc))
IF_LN(APPLET_NOEXEC(ln, ln, _BB_DIR_BIN, _BB_SUID_DROP, ln))
IF_LOAD_POLICY(APPLET(load_policy, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
IF_LOADFONT(APPLET(loadfont, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
@@ -241,7 +237,6 @@ IF_MAN(APPLET(man, _BB_DIR_SBIN, _BB_SUID_DROP))
IF_MATCHPATHCON(APPLET(matchpathcon, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
IF_MD5SUM(APPLET_NOEXEC(md5sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_DROP, md5sum))
IF_MDEV(APPLET(mdev, _BB_DIR_SBIN, _BB_SUID_DROP))
-IF_MESG(APPLET(mesg, _BB_DIR_USR_BIN, _BB_SUID_DROP))
IF_MICROCOM(APPLET(microcom, _BB_DIR_USR_BIN, _BB_SUID_DROP))
IF_MKDIR(APPLET_NOFORK(mkdir, mkdir, _BB_DIR_BIN, _BB_SUID_DROP, mkdir))
IF_MKFS_VFAT(APPLET_ODDNAME(mkdosfs, mkfs_vfat, _BB_DIR_SBIN, _BB_SUID_DROP, mkfs_vfat))
@@ -284,7 +279,6 @@ IF_PIPE_PROGRESS(APPLET(pipe_progress, _BB_DIR_BIN, _BB_SUID_DROP))
IF_PIVOT_ROOT(APPLET(pivot_root, _BB_DIR_SBIN, _BB_SUID_DROP))
IF_PKILL(APPLET_ODDNAME(pkill, pgrep, _BB_DIR_USR_BIN, _BB_SUID_DROP, pkill))
IF_POPMAILDIR(APPLET(popmaildir, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
-IF_HALT(APPLET_ODDNAME(poweroff, halt, _BB_DIR_SBIN, _BB_SUID_DROP, poweroff))
IF_PRINTENV(APPLET_NOFORK(printenv, printenv, _BB_DIR_BIN, _BB_SUID_DROP, printenv))
IF_PRINTF(APPLET_NOFORK(printf, printf, _BB_DIR_USR_BIN, _BB_SUID_DROP, printf))
IF_PS(APPLET(ps, _BB_DIR_BIN, _BB_SUID_DROP))
@@ -297,7 +291,6 @@ IF_READAHEAD(APPLET(readahead, _BB_DIR_USR_BIN, _BB_SUID_DROP))
IF_READLINK(APPLET(readlink, _BB_DIR_USR_BIN, _BB_SUID_DROP))
IF_READPROFILE(APPLET(readprofile, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
IF_REALPATH(APPLET(realpath, _BB_DIR_USR_BIN, _BB_SUID_DROP))
-IF_HALT(APPLET_ODDNAME(reboot, halt, _BB_DIR_SBIN, _BB_SUID_DROP, reboot))
IF_REFORMIME(APPLET(reformime, _BB_DIR_BIN, _BB_SUID_DROP))
IF_RENICE(APPLET(renice, _BB_DIR_USR_BIN, _BB_SUID_DROP))
IF_RESET(APPLET(reset, _BB_DIR_USR_BIN, _BB_SUID_DROP))
diff --git a/include/usage.src.h b/include/usage.src.h
index 5552503..084427c 100644
--- a/include/usage.src.h
+++ b/include/usage.src.h
@@ -1515,36 +1515,6 @@ INSERT
"$ ls -la /tmp/busybox*\n" \
"-rw-rw-r-- 1 andersen andersen 554058 Apr 14 17:49 /tmp/busybox.tar.gz\n"
-#define halt_trivial_usage \
- "[-d DELAY] [-n] [-f]" IF_FEATURE_WTMP(" [-w]")
-#define halt_full_usage "\n\n" \
- "Halt the system\n" \
- "\nOptions:" \
- "\n -d SEC Delay interval" \
- "\n -n Do not sync" \
- "\n -f Force (don't go through init)" \
- IF_FEATURE_WTMP( \
- "\n -w Only write a wtmp record" \
- )
-
-#define poweroff_trivial_usage \
- "[-d DELAY] [-n] [-f]"
-#define poweroff_full_usage "\n\n" \
- "Halt and shut off power\n" \
- "\nOptions:" \
- "\n -d SEC Delay interval" \
- "\n -n Do not sync" \
- "\n -f Force (don't go through init)" \
-
-#define reboot_trivial_usage \
- "[-d DELAY] [-n] [-f]"
-#define reboot_full_usage "\n\n" \
- "Reboot the system\n" \
- "\nOptions:" \
- "\n -d SEC Delay interval" \
- "\n -n Do not sync" \
- "\n -f Force (don't go through init)" \
-
#define hdparm_trivial_usage \
"[OPTIONS] [DEVICE]"
#define hdparm_full_usage "\n\n" \
@@ -1863,138 +1833,6 @@ INSERT
"\n -R N Pause services after N connects/min" \
"\n (default: 0 - disabled)" \
-#define init_trivial_usage \
- ""
-#define init_full_usage "\n\n" \
- "Init is the parent of all processes"
-
-#define init_notes_usage \
-"This version of init is designed to be run only by the kernel.\n" \
-"\n" \
-"BusyBox init doesn't support multiple runlevels. The runlevels field of\n" \
-"the /etc/inittab file is completely ignored by BusyBox init. If you want\n" \
-"runlevels, use sysvinit.\n" \
-"\n" \
-"BusyBox init works just fine without an inittab. If no inittab is found,\n" \
-"it has the following default behavior:\n" \
-"\n" \
-" ::sysinit:/etc/init.d/rcS\n" \
-" ::askfirst:/bin/sh\n" \
-" ::ctrlaltdel:/sbin/reboot\n" \
-" ::shutdown:/sbin/swapoff -a\n" \
-" ::shutdown:/bin/umount -a -r\n" \
-" ::restart:/sbin/init\n" \
-"\n" \
-"if it detects that /dev/console is _not_ a serial console, it will also run:\n" \
-"\n" \
-" tty2::askfirst:/bin/sh\n" \
-" tty3::askfirst:/bin/sh\n" \
-" tty4::askfirst:/bin/sh\n" \
-"\n" \
-"If you choose to use an /etc/inittab file, the inittab entry format is as follows:\n" \
-"\n" \
-" <id>:<runlevels>:<action>:<process>\n" \
-"\n" \
-" <id>:\n" \
-"\n" \
-" WARNING: This field has a non-traditional meaning for BusyBox init!\n" \
-" The id field is used by BusyBox init to specify the controlling tty for\n" \
-" the specified process to run on. The contents of this field are\n" \
-" appended to \"/dev/\" and used as-is. There is no need for this field to\n" \
-" be unique, although if it isn't you may have strange results. If this\n" \
-" field is left blank, the controlling tty is set to the console. Also\n" \
-" note that if BusyBox detects that a serial console is in use, then only\n" \
-" entries whose controlling tty is either the serial console or /dev/null\n" \
-" will be run. BusyBox init does nothing with utmp. We don't need no\n" \
-" stinkin' utmp.\n" \
-"\n" \
-" <runlevels>:\n" \
-"\n" \
-" The runlevels field is completely ignored.\n" \
-"\n" \
-" <action>:\n" \
-"\n" \
-" Valid actions include: sysinit, respawn, askfirst, wait,\n" \
-" once, restart, ctrlaltdel, and shutdown.\n" \
-"\n" \
-" The available actions can be classified into two groups: actions\n" \
-" that are run only once, and actions that are re-run when the specified\n" \
-" process exits.\n" \
-"\n" \
-" Run only-once actions:\n" \
-"\n" \
-" 'sysinit' is the first item run on boot. init waits until all\n" \
-" sysinit actions are completed before continuing. Following the\n" \
-" completion of all sysinit actions, all 'wait' actions are run.\n" \
-" 'wait' actions, like 'sysinit' actions, cause init to wait until\n" \
-" the specified task completes. 'once' actions are asynchronous,\n" \
-" therefore, init does not wait for them to complete. 'restart' is\n" \
-" the action taken to restart the init process. By default this should\n" \
-" simply run /sbin/init, but can be a script which runs pivot_root or it\n" \
-" can do all sorts of other interesting things. The 'ctrlaltdel' init\n" \
-" actions are run when the system detects that someone on the system\n" \
-" console has pressed the CTRL-ALT-DEL key combination. Typically one\n" \
-" wants to run 'reboot' at this point to cause the system to reboot.\n" \
-" Finally the 'shutdown' action specifies the actions to taken when\n" \
-" init is told to reboot. Unmounting filesystems and disabling swap\n" \
-" is a very good here.\n" \
-"\n" \
-" Run repeatedly actions:\n" \
-"\n" \
-" 'respawn' actions are run after the 'once' actions. When a process\n" \
-" started with a 'respawn' action exits, init automatically restarts\n" \
-" it. Unlike sysvinit, BusyBox init does not stop processes from\n" \
-" respawning out of control. The 'askfirst' actions acts just like\n" \
-" respawn, except that before running the specified process it\n" \
-" displays the line \"Please press Enter to activate this console.\"\n" \
-" and then waits for the user to press enter before starting the\n" \
-" specified process.\n" \
-"\n" \
-" Unrecognized actions (like initdefault) will cause init to emit an\n" \
-" error message, and then go along with its business. All actions are\n" \
-" run in the order they appear in /etc/inittab.\n" \
-"\n" \
-" <process>:\n" \
-"\n" \
-" Specifies the process to be executed and its command line.\n" \
-"\n" \
-"Example /etc/inittab file:\n" \
-"\n" \
-" # This is run first except when booting in single-user mode\n" \
-" #\n" \
-" ::sysinit:/etc/init.d/rcS\n" \
-" \n" \
-" # /bin/sh invocations on selected ttys\n" \
-" #\n" \
-" # Start an \"askfirst\" shell on the console (whatever that may be)\n" \
-" ::askfirst:-/bin/sh\n" \
-" # Start an \"askfirst\" shell on /dev/tty2-4\n" \
-" tty2::askfirst:-/bin/sh\n" \
-" tty3::askfirst:-/bin/sh\n" \
-" tty4::askfirst:-/bin/sh\n" \
-" \n" \
-" # /sbin/getty invocations for selected ttys\n" \
-" #\n" \
-" tty4::respawn:/sbin/getty 38400 tty4\n" \
-" tty5::respawn:/sbin/getty 38400 tty5\n" \
-" \n" \
-" \n" \
-" # Example of how to put a getty on a serial line (for a terminal)\n" \
-" #\n" \
-" #::respawn:/sbin/getty -L ttyS0 9600 vt100\n" \
-" #::respawn:/sbin/getty -L ttyS1 9600 vt100\n" \
-" #\n" \
-" # Example how to put a getty on a modem line\n" \
-" #::respawn:/sbin/getty 57600 ttyS2\n" \
-" \n" \
-" # Stuff to do when restarting the init process\n" \
-" ::restart:/sbin/init\n" \
-" \n" \
-" # Stuff to do before rebooting\n" \
-" ::ctrlaltdel:/sbin/reboot\n" \
-" ::shutdown:/bin/umount -a -r\n" \
-" ::shutdown:/sbin/swapoff -a\n"
-
#define inotifyd_trivial_usage \
"PROG FILE1[:MASK]..."
#define inotifyd_full_usage "\n\n" \
@@ -2651,13 +2489,6 @@ INSERT
"the last line match .* to override this.)\n\n" \
)
-#define mesg_trivial_usage \
- "[y|n]"
-#define mesg_full_usage "\n\n" \
- "Control write access to your terminal\n" \
- " y Allow write access to your terminal\n" \
- " n Disallow write access to your terminal"
-
#define microcom_trivial_usage \
"[-d DELAY] [-t TIMEOUT] [-s SPEED] [-X] TTY"
#define microcom_full_usage "\n\n" \
diff --git a/init/Config.src b/init/Config.src
index 2cac357..5767c93 100644
--- a/init/Config.src
+++ b/init/Config.src
@@ -7,131 +7,4 @@ menu "Init Utilities"
INSERT
-config INIT
- bool "init"
- default y
- select FEATURE_SYSLOG
- help
- init is the first program run when the system boots.
-
-config FEATURE_USE_INITTAB
- bool "Support reading an inittab file"
- default y
- depends on INIT
- help
- Allow init to read an inittab file when the system boot.
-
-config FEATURE_KILL_REMOVED
- bool "Support killing processes that have been removed from inittab"
- default n
- depends on FEATURE_USE_INITTAB
- help
- When respawn entries are removed from inittab and a SIGHUP is
- sent to init, this option will make init kill the processes
- that have been removed.
-
-config FEATURE_KILL_DELAY
- int "How long to wait between TERM and KILL (0 - send TERM only)" if FEATURE_KILL_REMOVED
- range 0 1024
- default 0
- depends on FEATURE_KILL_REMOVED
- help
- With nonzero setting, init sends TERM, forks, child waits N
- seconds, sends KILL and exits. Setting it too high is unwise
- (child will hang around for too long and could actually kill
- the wrong process!)
-
-config FEATURE_INIT_SCTTY
- bool "Run commands with leading dash with controlling tty"
- default y
- depends on INIT
- help
- If this option is enabled, init will try to give a controlling
- tty to any command which has leading hyphen (often it's "-/bin/sh").
- More precisely, init will do "ioctl(STDIN_FILENO, TIOCSCTTY, 0)".
- If device attached to STDIN_FILENO can be a ctty but is not yet
- a ctty for other session, it will become this process' ctty.
- This is not the traditional init behavour, but is often what you want
- in an embedded system where the console is only accessed during
- development or for maintenance.
- NB: using cttyhack applet may work better.
-
-config FEATURE_INIT_SYSLOG
- bool "Enable init to write to syslog"
- default y
- depends on INIT
-
-config FEATURE_EXTRA_QUIET
- bool "Be _extra_ quiet on boot"
- default y
- depends on INIT
- help
- Prevent init from logging some messages to the console during boot.
-
-config FEATURE_INIT_COREDUMPS
- bool "Support dumping core for child processes (debugging only)"
- default y
- depends on INIT
- help
- If this option is enabled and the file /.init_enable_core
- exists, then init will call setrlimit() to allow unlimited
- core file sizes. If this option is disabled, processes
- will not generate any core files.
-
-config FEATURE_INITRD
- bool "Support running init from within an initrd (not initramfs)"
- default y
- depends on INIT
- help
- Legacy support for running init under the old-style initrd. Allows
- the name linuxrc to act as init, and it doesn't assume init is PID 1.
-
- This does not apply to initramfs, which runs /init as PID 1 and
- requires no special support.
-
-config INIT_TERMINAL_TYPE
- string "Initial terminal type"
- default "linux"
- depends on INIT
- help
- This is the initial value set by init for the TERM environment
- variable. This variable is used by programs which make use of
- extended terminal capabilities.
-
- Note that on Linux, init attempts to detect serial terminal and
- sets TERM to "vt102" if one is found.
-
-config HALT
- bool "poweroff, halt, and reboot"
- default y
- help
- Stop all processes and either halt, reboot, or power off the system.
-
-config FEATURE_CALL_TELINIT
- bool "Call telinit on shutdown and reboot"
- default y
- depends on HALT && !INIT
- help
- Call an external program (normally telinit) to facilitate
- a switch to a proper runlevel.
-
- This option is only available if you selected halt and friends,
- but did not select init.
-
-config TELINIT_PATH
- string "Path to telinit executable"
- default "/sbin/telinit"
- depends on FEATURE_CALL_TELINIT
- help
- When busybox halt and friends have to call external telinit
- to facilitate proper shutdown, this path is to be used when
- locating telinit executable.
-
-config MESG
- bool "mesg"
- default y
- help
- Mesg controls access to your terminal by others. It is typically
- used to allow or disallow other users to write to your terminal
-
endmenu
diff --git a/init/Kbuild.src b/init/Kbuild.src
index 32dd5a0..6b4fb74 100644
--- a/init/Kbuild.src
+++ b/init/Kbuild.src
@@ -7,7 +7,3 @@
lib-y:=
INSERT
-lib-$(CONFIG_HALT) += halt.o
-lib-$(CONFIG_INIT) += init.o
-lib-$(CONFIG_MESG) += mesg.o
-lib-$(CONFIG_BOOTCHARTD) += bootchartd.o
diff --git a/init/bootchartd.c b/init/bootchartd.c
index f14d5c0..5a1b3e8 100644
--- a/init/bootchartd.c
+++ b/init/bootchartd.c
@@ -3,6 +3,10 @@
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//applet:IF_BOOTCHARTD(APPLET(bootchartd, _BB_DIR_SBIN, _BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_BOOTCHARTD) += bootchartd.o
+
//config:config BOOTCHARTD
//config: bool "bootchartd"
//config: default y
diff --git a/init/halt.c b/init/halt.c
index 903953e..47f1ef7 100644
--- a/init/halt.c
+++ b/init/halt.c
@@ -7,6 +7,68 @@
* Licensed under GPLv2, see file LICENSE in this source tree.
*/
+//applet:IF_HALT(APPLET(halt, _BB_DIR_SBIN, _BB_SUID_DROP))
+//applet:IF_HALT(APPLET_ODDNAME(poweroff, halt, _BB_DIR_SBIN, _BB_SUID_DROP, poweroff))
+//applet:IF_HALT(APPLET_ODDNAME(reboot, halt, _BB_DIR_SBIN, _BB_SUID_DROP, reboot))
+
+//kbuild:lib-$(CONFIG_HALT) += halt.o
+
+//config:config HALT
+//config: bool "poweroff, halt, and reboot"
+//config: default y
+//config: help
+//config: Stop all processes and either halt, reboot, or power off the system.
+//config:
+//config:config FEATURE_CALL_TELINIT
+//config: bool "Call telinit on shutdown and reboot"
+//config: default y
+//config: depends on HALT && !INIT
+//config: help
+//config: Call an external program (normally telinit) to facilitate
+//config: a switch to a proper runlevel.
+//config:
+//config: This option is only available if you selected halt and friends,
+//config: but did not select init.
+//config:
+//config:config TELINIT_PATH
+//config: string "Path to telinit executable"
+//config: default "/sbin/telinit"
+//config: depends on FEATURE_CALL_TELINIT
+//config: help
+//config: When busybox halt and friends have to call external telinit
+//config: to facilitate proper shutdown, this path is to be used when
+//config: locating telinit executable.
+
+//usage:#define halt_trivial_usage
+//usage: "[-d DELAY] [-n] [-f]" IF_FEATURE_WTMP(" [-w]")
+//usage:#define halt_full_usage "\n\n"
+//usage: "Halt the system\n"
+//usage: "\nOptions:"
+//usage: "\n -d SEC Delay interval"
+//usage: "\n -n Do not sync"
+//usage: "\n -f Force (don't go through init)"
+//usage: IF_FEATURE_WTMP(
+//usage: "\n -w Only write a wtmp record"
+//usage: )
+//usage:
+//usage:#define poweroff_trivial_usage
+//usage: "[-d DELAY] [-n] [-f]"
+//usage:#define poweroff_full_usage "\n\n"
+//usage: "Halt and shut off power\n"
+//usage: "\nOptions:"
+//usage: "\n -d SEC Delay interval"
+//usage: "\n -n Do not sync"
+//usage: "\n -f Force (don't go through init)"
+//usage:
+//usage:#define reboot_trivial_usage
+//usage: "[-d DELAY] [-n] [-f]"
+//usage:#define reboot_full_usage "\n\n"
+//usage: "Reboot the system\n"
+//usage: "\nOptions:"
+//usage: "\n -d SEC Delay interval"
+//usage: "\n -n Do not sync"
+//usage: "\n -f Force (don't go through init)"
+
#include "libbb.h"
#include "reboot.h"
diff --git a/init/init.c b/init/init.c
index 5c0d114..340731b 100644
--- a/init/init.c
+++ b/init/init.c
@@ -9,6 +9,237 @@
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//applet:IF_INIT(APPLET(init, _BB_DIR_SBIN, _BB_SUID_DROP))
+//applet:IF_FEATURE_INITRD(APPLET_ODDNAME(linuxrc, init, _BB_DIR_ROOT, _BB_SUID_DROP, linuxrc))
+
+//kbuild:lib-$(CONFIG_INIT) += init.o
+
+//config:config INIT
+//config: bool "init"
+//config: default y
+//config: select FEATURE_SYSLOG
+//config: help
+//config: init is the first program run when the system boots.
+//config:
+//config:config FEATURE_USE_INITTAB
+//config: bool "Support reading an inittab file"
+//config: default y
+//config: depends on INIT
+//config: help
+//config: Allow init to read an inittab file when the system boot.
+//config:
+//config:config FEATURE_KILL_REMOVED
+//config: bool "Support killing processes that have been removed from inittab"
+//config: default n
+//config: depends on FEATURE_USE_INITTAB
+//config: help
+//config: When respawn entries are removed from inittab and a SIGHUP is
+//config: sent to init, this option will make init kill the processes
+//config: that have been removed.
+//config:
+//config:config FEATURE_KILL_DELAY
+//config: int "How long to wait between TERM and KILL (0 - send TERM only)" if FEATURE_KILL_REMOVED
+//config: range 0 1024
+//config: default 0
+//config: depends on FEATURE_KILL_REMOVED
+//config: help
+//config: With nonzero setting, init sends TERM, forks, child waits N
+//config: seconds, sends KILL and exits. Setting it too high is unwise
+//config: (child will hang around for too long and could actually kill
+//config: the wrong process!)
+//config:
+//config:config FEATURE_INIT_SCTTY
+//config: bool "Run commands with leading dash with controlling tty"
+//config: default y
+//config: depends on INIT
+//config: help
+//config: If this option is enabled, init will try to give a controlling
+//config: tty to any command which has leading hyphen (often it's "-/bin/sh").
+//config: More precisely, init will do "ioctl(STDIN_FILENO, TIOCSCTTY, 0)".
+//config: If device attached to STDIN_FILENO can be a ctty but is not yet
+//config: a ctty for other session, it will become this process' ctty.
+//config: This is not the traditional init behavour, but is often what you want
+//config: in an embedded system where the console is only accessed during
+//config: development or for maintenance.
+//config: NB: using cttyhack applet may work better.
+//config:
+//config:config FEATURE_INIT_SYSLOG
+//config: bool "Enable init to write to syslog"
+//config: default y
+//config: depends on INIT
+//config:
+//config:config FEATURE_EXTRA_QUIET
+//config: bool "Be _extra_ quiet on boot"
+//config: default y
+//config: depends on INIT
+//config: help
+//config: Prevent init from logging some messages to the console during boot.
+//config:
+//config:config FEATURE_INIT_COREDUMPS
+//config: bool "Support dumping core for child processes (debugging only)"
+//config: default y
+//config: depends on INIT
+//config: help
+//config: If this option is enabled and the file /.init_enable_core
+//config: exists, then init will call setrlimit() to allow unlimited
+//config: core file sizes. If this option is disabled, processes
+//config: will not generate any core files.
+//config:
+//config:config FEATURE_INITRD
+//config: bool "Support running init from within an initrd (not initramfs)"
+//config: default y
+//config: depends on INIT
+//config: help
+//config: Legacy support for running init under the old-style initrd. Allows
+//config: the name linuxrc to act as init, and it doesn't assume init is PID 1.
+//config:
+//config: This does not apply to initramfs, which runs /init as PID 1 and
+//config: requires no special support.
+//config:
+//config:config INIT_TERMINAL_TYPE
+//config: string "Initial terminal type"
+//config: default "linux"
+//config: depends on INIT
+//config: help
+//config: This is the initial value set by init for the TERM environment
+//config: variable. This variable is used by programs which make use of
+//config: extended terminal capabilities.
+//config:
+//config: Note that on Linux, init attempts to detect serial terminal and
+//config: sets TERM to "vt102" if one is found.
+
+//usage:#define init_trivial_usage
+//usage: ""
+//usage:#define init_full_usage "\n\n"
+//usage: "Init is the parent of all processes"
+//usage:
+//usage:#define init_notes_usage
+//usage: "This version of init is designed to be run only by the kernel.\n"
+//usage: "\n"
+//usage: "BusyBox init doesn't support multiple runlevels. The runlevels field of\n"
+//usage: "the /etc/inittab file is completely ignored by BusyBox init. If you want\n"
+//usage: "runlevels, use sysvinit.\n"
+//usage: "\n"
+//usage: "BusyBox init works just fine without an inittab. If no inittab is found,\n"
+//usage: "it has the following default behavior:\n"
+//usage: "\n"
+//usage: " ::sysinit:/etc/init.d/rcS\n"
+//usage: " ::askfirst:/bin/sh\n"
+//usage: " ::ctrlaltdel:/sbin/reboot\n"
+//usage: " ::shutdown:/sbin/swapoff -a\n"
+//usage: " ::shutdown:/bin/umount -a -r\n"
+//usage: " ::restart:/sbin/init\n"
+//usage: "\n"
+//usage: "if it detects that /dev/console is _not_ a serial console, it will also run:\n"
+//usage: "\n"
+//usage: " tty2::askfirst:/bin/sh\n"
+//usage: " tty3::askfirst:/bin/sh\n"
+//usage: " tty4::askfirst:/bin/sh\n"
+//usage: "\n"
+//usage: "If you choose to use an /etc/inittab file, the inittab entry format is as follows:\n"
+//usage: "\n"
+//usage: " <id>:<runlevels>:<action>:<process>\n"
+//usage: "\n"
+//usage: " <id>:\n"
+//usage: "\n"
+//usage: " WARNING: This field has a non-traditional meaning for BusyBox init!\n"
+//usage: " The id field is used by BusyBox init to specify the controlling tty for\n"
+//usage: " the specified process to run on. The contents of this field are\n"
+//usage: " appended to \"/dev/\" and used as-is. There is no need for this field to\n"
+//usage: " be unique, although if it isn't you may have strange results. If this\n"
+//usage: " field is left blank, the controlling tty is set to the console. Also\n"
+//usage: " note that if BusyBox detects that a serial console is in use, then only\n"
+//usage: " entries whose controlling tty is either the serial console or /dev/null\n"
+//usage: " will be run. BusyBox init does nothing with utmp. We don't need no\n"
+//usage: " stinkin' utmp.\n"
+//usage: "\n"
+//usage: " <runlevels>:\n"
+//usage: "\n"
+//usage: " The runlevels field is completely ignored.\n"
+//usage: "\n"
+//usage: " <action>:\n"
+//usage: "\n"
+//usage: " Valid actions include: sysinit, respawn, askfirst, wait,\n"
+//usage: " once, restart, ctrlaltdel, and shutdown.\n"
+//usage: "\n"
+//usage: " The available actions can be classified into two groups: actions\n"
+//usage: " that are run only once, and actions that are re-run when the specified\n"
+//usage: " process exits.\n"
+//usage: "\n"
+//usage: " Run only-once actions:\n"
+//usage: "\n"
+//usage: " 'sysinit' is the first item run on boot. init waits until all\n"
+//usage: " sysinit actions are completed before continuing. Following the\n"
+//usage: " completion of all sysinit actions, all 'wait' actions are run.\n"
+//usage: " 'wait' actions, like 'sysinit' actions, cause init to wait until\n"
+//usage: " the specified task completes. 'once' actions are asynchronous,\n"
+//usage: " therefore, init does not wait for them to complete. 'restart' is\n"
+//usage: " the action taken to restart the init process. By default this should\n"
+//usage: " simply run /sbin/init, but can be a script which runs pivot_root or it\n"
+//usage: " can do all sorts of other interesting things. The 'ctrlaltdel' init\n"
+//usage: " actions are run when the system detects that someone on the system\n"
+//usage: " console has pressed the CTRL-ALT-DEL key combination. Typically one\n"
+//usage: " wants to run 'reboot' at this point to cause the system to reboot.\n"
+//usage: " Finally the 'shutdown' action specifies the actions to taken when\n"
+//usage: " init is told to reboot. Unmounting filesystems and disabling swap\n"
+//usage: " is a very good here.\n"
+//usage: "\n"
+//usage: " Run repeatedly actions:\n"
+//usage: "\n"
+//usage: " 'respawn' actions are run after the 'once' actions. When a process\n"
+//usage: " started with a 'respawn' action exits, init automatically restarts\n"
+//usage: " it. Unlike sysvinit, BusyBox init does not stop processes from\n"
+//usage: " respawning out of control. The 'askfirst' actions acts just like\n"
+//usage: " respawn, except that before running the specified process it\n"
+//usage: " displays the line \"Please press Enter to activate this console.\"\n"
+//usage: " and then waits for the user to press enter before starting the\n"
+//usage: " specified process.\n"
+//usage: "\n"
+//usage: " Unrecognized actions (like initdefault) will cause init to emit an\n"
+//usage: " error message, and then go along with its business. All actions are\n"
+//usage: " run in the order they appear in /etc/inittab.\n"
+//usage: "\n"
+//usage: " <process>:\n"
+//usage: "\n"
+//usage: " Specifies the process to be executed and its command line.\n"
+//usage: "\n"
+//usage: "Example /etc/inittab file:\n"
+//usage: "\n"
+//usage: " # This is run first except when booting in single-user mode\n"
+//usage: " #\n"
+//usage: " ::sysinit:/etc/init.d/rcS\n"
+//usage: " \n"
+//usage: " # /bin/sh invocations on selected ttys\n"
+//usage: " #\n"
+//usage: " # Start an \"askfirst\" shell on the console (whatever that may be)\n"
+//usage: " ::askfirst:-/bin/sh\n"
+//usage: " # Start an \"askfirst\" shell on /dev/tty2-4\n"
+//usage: " tty2::askfirst:-/bin/sh\n"
+//usage: " tty3::askfirst:-/bin/sh\n"
+//usage: " tty4::askfirst:-/bin/sh\n"
+//usage: " \n"
+//usage: " # /sbin/getty invocations for selected ttys\n"
+//usage: " #\n"
+//usage: " tty4::respawn:/sbin/getty 38400 tty4\n"
+//usage: " tty5::respawn:/sbin/getty 38400 tty5\n"
+//usage: " \n"
+//usage: " \n"
+//usage: " # Example of how to put a getty on a serial line (for a terminal)\n"
+//usage: " #\n"
+//usage: " #::respawn:/sbin/getty -L ttyS0 9600 vt100\n"
+//usage: " #::respawn:/sbin/getty -L ttyS1 9600 vt100\n"
+//usage: " #\n"
+//usage: " # Example how to put a getty on a modem line\n"
+//usage: " #::respawn:/sbin/getty 57600 ttyS2\n"
+//usage: " \n"
+//usage: " # Stuff to do when restarting the init process\n"
+//usage: " ::restart:/sbin/init\n"
+//usage: " \n"
+//usage: " # Stuff to do before rebooting\n"
+//usage: " ::ctrlaltdel:/sbin/reboot\n"
+//usage: " ::shutdown:/bin/umount -a -r\n"
+//usage: " ::shutdown:/sbin/swapoff -a\n"
+
#include "libbb.h"
#include <syslog.h>
#include <paths.h>
diff --git a/init/mesg.c b/init/mesg.c
index ef5f0eb..b560df2 100644
--- a/init/mesg.c
+++ b/init/mesg.c
@@ -7,6 +7,24 @@
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//applet:IF_MESG(APPLET(mesg, _BB_DIR_USR_BIN, _BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_MESG) += mesg.o
+
+//config:config MESG
+//config: bool "mesg"
+//config: default y
+//config: help
+//config: Mesg controls access to your terminal by others. It is typically
+//config: used to allow or disallow other users to write to your terminal
+
+//usage:#define mesg_trivial_usage
+//usage: "[y|n]"
+//usage:#define mesg_full_usage "\n\n"
+//usage: "Control write access to your terminal\n"
+//usage: " y Allow write access to your terminal\n"
+//usage: " n Disallow write access to your terminal"
+
#include "libbb.h"
#ifdef USE_TTY_GROUP