aboutsummaryrefslogtreecommitdiff
path: root/init/init.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* libbb.h: always include sys/resource.hDenys Vlasenko2018-04-081-1/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: stop using static dataDenys Vlasenko2018-01-101-16/+24
| | | | | | | | | | | | | function old new delta init_action_list 4 - -4 new_init_action 148 142 -6 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-10) Total: -10 bytes text data bss dec hex filename 927839 481 6832 935152 e44f0 busybox_old 927833 481 6824 935138 e44e2 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: reduce the window when init can lose reboot/poweroff signalsDenys Vlasenko2017-11-021-23/+8
| | | | | | | function old new delta init_main 695 712 +17 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* use %m printf specifier where appropriateDenys Vlasenko2017-09-291-3/+5
| | | | | | | | | | | | | | | function old new delta out 85 75 -10 udhcpd_main 1472 1461 -11 open_stdio_to_tty 98 85 -13 init_exec 245 232 -13 udhcpc_main 2763 2749 -14 do_cmd 4771 4755 -16 status_line_bold_errno 32 14 -18 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/7 up/down: 0/-95) Total: -95 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* regularize format of source file headers, no code changesDenys Vlasenko2017-09-181-1/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* config: deindent all help textsDenys Vlasenko2017-07-211-43/+43
| | | | | | Those two spaces after tab have no effect, and always a nuisance when editing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Update menuconfig items with approximate applet sizesDenys Vlasenko2017-07-181-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: dont send "Sent SIGTERM to all" msg to syslog: we just TERMed it!Denys Vlasenko2017-04-071-18/+22
| | | | | | While at it, explain FEATURE_INIT_SYSLOG Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: rename FEATURE_EXTRA_QUIET -> FEATURE_INIT_QUIETDenys Vlasenko2017-01-101-6/+4
| | | | | | The former name had no INIT anywhere in its name, sounded generic Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Big cleanup in config help and descriptionDenys Vlasenko2017-01-101-2/+2
| | | | | | | | | | | | | Redundant help texts (one which only repeats the description) are deleted. Descriptions and help texts are trimmed. Some config options are moved, even across menus. No config option _names_ are changed. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Tweak some config defaults; fix MODPROBE_SMALL ordering in "make config"Denys Vlasenko2016-12-221-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: fix for FreeBSD console opening. Closes 9031Denys Vlasenko2016-08-221-0/+5
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Rename FEATURE_INITRD to LINUXRC and make it separate, not an alias to initDenys Vlasenko2016-03-311-20/+21
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: make the command-line rewrite optionalNicolas Carrier2016-02-111-5/+22
| | | | | | | | | | | | | | | When launched as PID 1 and after parsing its arguments, init wipes all all of them except argv[0] and rewrites argv[0] to contain only "init", so that its command-line appears solely as "init" in tools such as ps. This patch adds the FEATURE_INIT_MODIFY_CMDLINE which, if set to n, will make init preserve all its arguments including argv[0], be they parsed or ignored. The original command-line used to launch init can then be retrieved in /proc/1/cmdline on Linux, for example. Signed-off-by: Nicolas Carrier <nicolas.carrier@parrot.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Fix compiling with musl's utmp stubsKylie McClain2016-02-011-1/+0
| | | | | | | | | | | | | | | | | | | This patch fixes compiling busybox with FEATURE_UTMP and _WTMP enabled. musl, while not really support utmp/wtmp, provides stub functions, as well as variables such as _PATH_UTMP, so that programs using utmp or wtmp can still compile fine. My reasoning for this patch is that on Exherbo, I'm currently trying to get us to be able to use the same busybox config file for both glibc and musl systems, using utmp/wtmp on systems that support it, and using the stubs on musl without needing two different configs. As of latest musl git, it provides all utmp functions needed; 1.1.12 doesn't, but I sent a patch to Rich to add the utmp{,x}name functions expected to exist, which was merged into musl upstream. Signed-off-by: Kylie McClain <somasissounds@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* remove global "jmp_buf die_jmp" from !FEATURE_PREFER_APPLETS buildsDenys Vlasenko2015-10-091-2/+7
| | | | | | | | | | | | | | | | | | | | | function old new delta xfunc_has_died - 21 +21 sleep_much - 12 +12 sleep10 - 9 +9 die_func - 4 +4 fflush_stdout_and_exit 35 36 +1 builtin_type 121 119 -2 die_sleep 4 - -4 xfunc_die 60 24 -36 hush_main 1128 1011 -117 die_jmp 156 - -156 ------------------------------------------------------------------------------ (add/remove: 4/2 grow/shrink: 1/3 up/down: 47/-315) Total: -268 bytes text data bss dec hex filename 939992 992 17652 958636 ea0ac busybox_old 939880 992 17496 958368 e9fa0 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: code shrink by factoring out common update_utmp_DEAD_PROCESSDenys Vlasenko2015-01-051-5/+1
| | | | | | | | | | function old new delta update_utmp_DEAD_PROCESS - 17 +17 telnetd_main 1685 1674 -11 mark_terminated 56 45 -11 handle_sigchld 74 63 -11 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: do not run shutdown/reexec actions from signal handlerDenys Vlasenko2014-11-211-20/+30
| | | | | | | | | | | | | | this is racy wrt various libc functions such as syslog() function old new delta check_delayed_sigs 182 352 +170 init_main 772 728 -44 restart_handler 74 - -74 halt_reboot_pwoff 79 - -79 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 1/1 up/down: 170/-197) Total: -27 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: do not fail build if SIGPWR is not definedMichael Tokarev2014-01-301-0/+2
| | | | | | | | | Apparently, some *BSD variants (and maybe some other OSes) does not define SIGPWR signal. So since commit 760fc6debcba8c, busybox fails to build on such platforms. Fix this. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: halt on SIGPWR tooBogdan Purcareata2013-11-261-3/+4
| | | | | | | | | | | | Most init processes implement a handler for SIGPWR that gracefully stops all child processes when shutting down a machine. Some other technologies rely on this signal - e.g. Busybox powered LXC containers. This patch makes busybox init halt when receiving SIGPWR. Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: move nuke_str() from passwd into libbbDenys Vlasenko2013-11-191-1/+1
| | | | | | | | | | | | function old new delta nuke_str - 15 +15 ask_and_check_password_extended 215 206 -9 init_main 781 771 -10 nuke_str 27 - -27 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 0/2 up/down: 15/-46) Total: -31 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: fix illegal memory access when max message length is reachedYuan-Hsiang Lee2013-11-031-2/+2
| | | | | Signed-off-by: Yuan-Hsiang Lee <yhlee@ubnt.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: better --help textDenys Vlasenko2013-10-121-6/+13
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: don't srop unterminated processes' entries during inittab reloadPaulius Zaleckas2013-08-161-3/+10
| | | | | | | | | | | | | This feature was removed in 72c99af It is useful when process is removed from inittab and later added back, but never terminated. It prevents init from spawning duplicate. function old new delta check_delayed_sigs 176 182 +6 Signed-off-by: Paulius Zaleckas <paulius.zaleckas@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: don't use fixed size buffer for commandDenys Vlasenko2013-08-161-9/+13
| | | | | | | | | | | | | | | We store init actions forever. 256 bytes per action means that a typical inittab of ~10 commands uses 2.5k just to remember command strings - which are usually _much_ shorter than 256 bytes. At a cost of a bit more code, it's possible to allocate only actually needed amount. function old new delta init_exec 224 248 +24 new_init_action 140 142 +2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: remove special-case code for machines with less tham 1 MB of RAM.Denys Vlasenko2013-05-211-15/+18
| | | | | | | function old new delta init_main 920 781 -139 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* examples/inittab: fix a few incorrect statements about initDenys Vlasenko2013-03-291-8/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* whitespace cleanup. no code changesDenys Vlasenko2013-01-141-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: add a segv debugging aid, disabled by defaultDenys Vlasenko2012-01-301-0/+51
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: code shrink -4 bytesDenys Vlasenko2011-12-051-4/+5
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: utmp update of DEAD_PROCESS was misplaced, and could be skipped. Fixing.Denys Vlasenko2011-12-051-3/+5
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: work around sysinfo.h versus linux/*.h problemsDenys Vlasenko2011-07-261-1/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: fix a case where execv's 1st arg was wrongDenys Vlasenko2011-03-211-0/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* move utmp.h include to libbb.hDenys Vlasenko2011-01-251-3/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* mass removal of underscores from _BB_DIR_foo and _BB_SUID_fooDenys Vlasenko2011-01-181-2/+2
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: simpler handling of leading dash in commandsDenys Vlasenko2010-12-251-9/+11
| | | | | | | function old new delta init_exec 233 219 -14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: if PID!=1, show clearer error message. move usage text closer to main()Denys Vlasenko2010-11-021-134/+137
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: do not sleep forever on usage errorsDenys Vlasenko2010-10-251-4/+13
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: do not clear CRTSCTS (fix from Debian bug 528560)Denys Vlasenko2010-10-241-3/+6
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init/*: move applet/kbuild/config/help bits into applet source filesDenys Vlasenko2010-10-121-0/+231
| | | | Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
* *: make GNU licensing statement forms more regularDenys Vlasenko2010-08-161-1/+1
| | | | | | | This change retains "or later" state! No licensing _changes_ here, only form is adjusted (article, space between "GPL" and "v2" and so on). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: make the initial $TERM value configurableJeremie Koenig2010-07-191-1/+1
| | | | | Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init,halt: portability improvementsJeremie Koenig2010-07-191-8/+8
| | | | | | | | | | | * make init and halt use the same RB_* constants for reboot() * conditionalize the Linux-specific code Inspired by init.init.diff from the Debian kFreeBSD patches at: http://svn.debian.org/viewsvn/d-i/people/slackydeb/kfreebsd/busybox/1.14/debian Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init,loginutils: termios portability fixesJeremie Koenig2010-07-191-1/+16
| | | | | Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: add skip_dev_pfx()Denys Vlasenko2010-04-061-3/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: clear utmp entries for dead processes, if they (entries) existDenys Vlasenko2010-04-061-0/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: fix logically inverted FEATURE_EXTRA_QUIET checkDenys Vlasenko2009-12-151-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: use applet_name instead of "init" - we can be linuxrcDenys Vlasenko2009-12-141-5/+5
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: for paranoid reasons, restore SIGCONT too.Denys Vlasenko2009-12-141-0/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: fix "while true; do reboot; done" bug. +15 bytes. Closes bug 781Denys Vlasenko2009-12-141-42/+59
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>