aboutsummaryrefslogtreecommitdiff
path: root/init (follow)
Commit message (Collapse)AuthorAgeFilesLines
* init: improve handling of signals racing with each otherDenys Vlasenko2019-12-031-159/+119
| | | | | | | | | | | | | | | | | Before this change, a request to reboot could be "overwritten" by e.g. SIGHUP. function old new delta init_main 709 793 +84 packed_usage 33273 33337 +64 run_actions 109 117 +8 stop_handler 87 88 +1 check_delayed_sigs 340 335 -5 run 214 198 -16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/2 up/down: 157/-21) Total: 136 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: if tcgetattr() fails, don't even try to tcsetattr()Denys Vlasenko2019-12-021-9/+8
| | | | | | | function old new delta set_sane_term 111 114 +3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne2019-07-022-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower overhead call to bb_perror_msg() when only a string was being printed with no parameters. This saves space for some CPU architectures because it avoids the overhead of a call to a variadic function. However there has never been a simple version of bb_error_msg(), and since 2007 many new calls to bb_perror_msg() have been added that only take a single parameter and so could have been using bb_simple_perror_message(). This changeset introduces 'simple' versions of bb_info_msg(), bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and bb_herror_msg_and_die(), and replaces all calls that only take a single parameter, or use something like ("%s", arg), with calls to the corresponding 'simple' version. Since it is likely that single parameter calls to the variadic functions may be accidentally reintroduced in the future a new debugging config option WARN_SIMPLE_MSG has been introduced. This uses some macro magic which will cause any such calls to generate a warning, but this is turned off by default to avoid use of the unpleasant macros in normal circumstances. This is a large changeset due to the number of calls that have been replaced. The only files that contain changes other than simple substitution of function calls are libbb.h, libbb/herror_msg.c, libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c, networking/udhcp/common.h and util-linux/mdev.c additonal macros have been added for logging so that single parameter and multiple parameter logging variants exist. The amount of space saved varies considerably by architecture, and was found to be as follows (for 'defconfig' using GCC 7.4): Arm: -92 bytes MIPS: -52 bytes PPC: -1836 bytes x86_64: -938 bytes Note that for the MIPS architecture only an exception had to be made disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h) because it made these files larger on MIPS. Signed-off-by: James Byrne <james.byrne@origamienergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* config: more tweaksDenys Vlasenko2018-12-281-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* config: update size informationDenys Vlasenko2018-12-282-4/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* init: hopefully fix "rebooting" in containersDenys Vlasenko2018-09-221-2/+7
| | | | | | | function old new delta pause_and_low_level_reboot 48 57 +9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* restore documentation on the build config languageKartik Agaram2018-06-061-1/+1
| | | | | | | | | | Kconfig-language.txt was deleted in commit 4fa499a17b52b back in 2006. Move to docs/ as suggested by Xabier Oneca: http://lists.busybox.net/pipermail/busybox/2014-May/080914.html Also update references to it everywhere. Signed-off-by: Kartik Agaram <akkartik@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb.h: always include sys/resource.hDenys Vlasenko2018-04-081-1/+0
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* poweroff: add a config option for people needing VERY early poweroffDenys Vlasenko2018-02-191-0/+54
| | | | 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-183-7/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* config: deindent all help textsDenys Vlasenko2017-07-213-74/+74
| | | | | | Those two spaces after tab have no effect, and always a nuisance when editing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* bootchartd: fix typo in commentDenys Vlasenko2017-07-201-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* bootchartd: prevent premature stop by device mapperUwe Geuder2017-07-201-1/+3
| | | | | | | | Kernel thread kdmflush was recognized as display manager kdm, check for string length. Signed-off-by: Uwe Geuder <busybox2017-ugeuder@snkmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Update menuconfig items with approximate applet sizesDenys Vlasenko2017-07-183-5/+5
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Sort more misplaced applets into coreutils or util-linuxDenys Vlasenko2017-04-121-76/+0
| | | | | | | | No code changes Surprisingly, nice and renice are coming from different packages :) 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>
* *: add comment about APPLET_ODDNAME formatDenys Vlasenko2017-01-291-1/+2
| | | | | | It confused me more than once 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>
* Make halt/poweroff/reboot independently selectableDenys Vlasenko2016-11-141-9/+32
| | | | 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>
* getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LISTDenys Vlasenko2016-07-061-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In many cases, this aqllows to drop use of opt_complementary. Approximately -400 bytes: function old new delta getopt32 1423 1502 +79 opt_string 17 18 +1 OPT_STR 24 25 +1 uniq_main 416 406 -10 timeout_main 279 269 -10 sulogin_main 270 260 -10 readprofile_main 1825 1815 -10 ps_main 543 533 -10 pidof_main 245 235 -10 pgrep_main 611 601 -10 od_main 2600 2590 -10 mkfs_minix_main 2684 2674 -10 mkfs_ext2_main 2603 2593 -10 microcom_main 712 702 -10 makemime_main 315 305 -10 ionice_main 282 272 -10 inetd_main 2074 2064 -10 ifplugd_main 1144 1134 -10 halt_main 353 343 -10 getopt_main 636 626 -10 fdisk_main 2854 2844 -10 env_main 206 196 -10 dmesg_main 319 309 -10 conspy_main 1214 1204 -10 awk_main 981 971 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/22 up/down: 81/-220) Total: -139 bytes text data bss dec hex filename 919373 906 14060 934339 e41c3 busybox_old 918969 906 14060 933935 e402f busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: slap on a few ALIGN1/2s where appropriateDenys Vlasenko2016-04-221-1/+1
| | | | | | | | | | The result of looking at "grep -F -B2 '*fill*' busybox_unstripped.map" text data bss dec hex filename 829901 4086 1904 835891 cc133 busybox_before 829665 4086 1904 835655 cc047 busybox Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: add most of the required setup_common_bufsiz() callsDenys Vlasenko2016-04-211-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libbb: make bb_common_bufsiz1 1 kbyte, add capability to use bss tail for itDenys Vlasenko2016-04-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The config item is FEATURE_USE_BSS_TAIL. When it is off (default): function old new delta read_config 210 228 +18 doCommands 2279 2294 +15 ipneigh_list_or_flush 763 772 +9 ipaddr_list_or_flush 1256 1261 +5 display_process_list 1301 1306 +5 conspy_main 1378 1383 +5 do_lzo_compress 352 355 +3 do_lzo_decompress 565 567 +2 push 46 44 -2 inetd_main 2136 2134 -2 uevent_main 421 418 -3 addLines 97 92 -5 bb_common_bufsiz1 8193 1024 -7169 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 8/5 up/down: 62/-7181) Total: -7119 bytes text data bss dec hex filename 829850 4086 9080 843016 cdd08 busybox_old 829901 4086 1904 835891 cc133 busybox_unstripped FEATURE_USE_BSS_TAIL=y: read_config 210 228 +18 doCommands 2279 2294 +15 ipneigh_list_or_flush 763 772 +9 ipaddr_list_or_flush 1256 1261 +5 display_process_list 1301 1306 +5 conspy_main 1378 1383 +5 do_lzo_compress 352 355 +3 do_lzo_decompress 565 567 +2 inetd_main 2136 2134 -2 bb_common_bufsiz1 8193 - -8193 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 8/1 up/down: 62/-8195) Total: -8133 bytes text data bss dec hex filename 829850 4086 9080 843016 cdd08 busybox_old 829911 4086 880 834877 cbd3d busybox_unstripped FIXME: setup_common_bufsiz() calls are missing. 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-312-21/+22
| | | | 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>
* *: Switch to POSIX utmpx APIBernhard Reutner-Fischer2015-04-021-2/+2
| | | | | | | | | | 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>
* 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>
* bootchartd: warn if .config looks wrongDenys Vlasenko2013-11-031-0/+6
| | | | 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>
* bootchartd: add process accounting featureQuentin Casasnovas2012-01-181-15/+24
| | | | | | | | | | | | 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>
* init: code shrink -4 bytesDenys Vlasenko2011-12-051-4/+5
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>