aboutsummaryrefslogtreecommitdiff
path: root/init
AgeCommit message (Collapse)Author
2016-02-11init: make the command-line rewrite optionalNicolas Carrier
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>
2016-02-01Fix compiling with musl's utmp stubsKylie McClain
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>
2015-10-09remove global "jmp_buf die_jmp" from !FEATURE_PREFER_APPLETS buildsDenys Vlasenko
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>
2015-04-02*: Switch to POSIX utmpx APIBernhard Reutner-Fischer
UTMP is SVID legacy, UTMPX is mandated by POSIX. Glibc and uClibc have identical layout of UTMP and UTMPX, both of these libc treat _PATH_UTMPX as _PATH_UTMP so from a user-perspective nothing changes except the names of the API entrypoints. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-01-05libbb: code shrink by factoring out common update_utmp_DEAD_PROCESSDenys Vlasenko
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>
2014-11-21init: do not run shutdown/reexec actions from signal handlerDenys Vlasenko
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>
2014-01-30init: do not fail build if SIGPWR is not definedMichael Tokarev
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>
2013-11-26init: halt on SIGPWR tooBogdan Purcareata
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>
2013-11-19libbb: move nuke_str() from passwd into libbbDenys Vlasenko
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>
2013-11-03init: fix illegal memory access when max message length is reachedYuan-Hsiang Lee
Signed-off-by: Yuan-Hsiang Lee <yhlee@ubnt.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-03bootchartd: warn if .config looks wrongDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-12init: better --help textDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-16init: don't srop unterminated processes' entries during inittab reloadPaulius Zaleckas
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>
2013-08-16init: don't use fixed size buffer for commandDenys Vlasenko
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>
2013-05-21init: remove special-case code for machines with less tham 1 MB of RAM.Denys Vlasenko
function old new delta init_main 920 781 -139 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-29examples/inittab: fix a few incorrect statements about initDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14whitespace cleanup. no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-30init: add a segv debugging aid, disabled by defaultDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-18bootchartd: add process accounting featureQuentin Casasnovas
function old new delta bootchartd_main 962 1088 +126 finalize 294 357 +63 acct - 33 +33 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 2/0 up/down: 222/0) Total: 222 bytes Signed-off-by: Quentin Casasnovas <quentin.casasnovas@mathembedded.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-05init: code shrink -4 bytesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-05init: utmp update of DEAD_PROCESS was misplaced, and could be skipped. Fixing.Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-22nommu: fix cases where we mangle argv[0][0]Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-26*: work around sysinfo.h versus linux/*.h problemsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-08halt: perror_msg_and_die needs bb_ prefixDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-03halt/reboot: better message if /sbin/telinit is not foundDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05*: remove "Options:" string from help textsDenys Vlasenko
function old new delta packed_usage 28706 28623 -83 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-28mesg: operate on stdin, not on stderr (compat)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-22mesg: make group/all writability configurableDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-21init: fix a case where execv's 1st arg was wrongDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-25move utmp.h include to libbb.hDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18mass removal of underscores from _BB_DIR_foo and _BB_SUID_fooDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-25init: simpler handling of leading dash in commandsDenys Vlasenko
function old new delta init_exec 233 219 -14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-28use BB_EXECVP_or_die where appropriateDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-02init: if PID!=1, show clearer error message. move usage text closer to main()Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-28*: whitespace fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-25init: do not sleep forever on usage errorsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-24init: do not clear CRTSCTS (fix from Debian bug 528560)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-12init/*: move applet/kbuild/config/help bits into applet source filesDenys Vlasenko
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-08-16*: make GNU licensing statement forms more regularDenys Vlasenko
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>
2010-07-30bootchartd: mounting tmpfs is Linux-specificJeremie Koenig
Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-26*: trailing empty lines removedDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-19init: make the initial $TERM value configurableJeremie Koenig
Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-19init,halt: portability improvementsJeremie Koenig
* 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>
2010-07-19init,loginutils: termios portability fixesJeremie Koenig
Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-19mark Linux-specific configuration optionsJeremie Koenig
PLATFORM_LINUX is used as a dependency for applets or features which require Linux-specific interfaces. Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-06bootchartd: fix labels in config system. no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-04*: introduce and use xfork() and xvfork()Pascal Bellard
function old new delta launch_helper 170 169 -1 setup_heredoc 312 302 -10 handle_dir_common 367 354 -13 expand_vars_to_list 2456 2443 -13 open_transformer 89 74 -15 data_extract_to_command 439 423 -16 do_ipaddr 1406 1389 -17 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/7 up/down: 0/-85) Total: -85 bytes Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-28bootchartd: fix sample period calculationsKeisuke Yasui
Signed-off-by: Keisuke Yasui <keisuke.yasui@toshiba.co.jp> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-28conspy: code shrinkPascal Bellard
function old new delta conspy_main 1446 1444 -2 screen_read_close 114 108 -6 screen_char 299 293 -6 Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-22typo fixDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>