Commit Graph

511 Commits

Author SHA1 Message Date
Denys Vlasenko
82dcc3bff9 bootchartd: fix typo in comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-20 13:42:19 +02:00
Uwe Geuder
9e2e0ff4ba bootchartd: prevent premature stop by device mapper
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>
2017-07-20 13:39:41 +02:00
Denys Vlasenko
4eed2c6c50 Update menuconfig items with approximate applet sizes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18 22:01:24 +02:00
Denys Vlasenko
0cecbe7d5d Sort more misplaced applets into coreutils or util-linux
No code changes

Surprisingly, nice and renice are coming from different packages :)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-12 14:16:29 +02:00
Denys Vlasenko
42776708f2 init: dont send "Sent SIGTERM to all" msg to syslog: we just TERMed it!
While at it, explain FEATURE_INIT_SYSLOG

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-07 19:13:09 +02:00
Denys Vlasenko
205d48e948 *: add comment about APPLET_ODDNAME format
It confused me more than once

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-29 14:57:33 +01:00
Denys Vlasenko
f35ad3bd12 init: rename FEATURE_EXTRA_QUIET -> FEATURE_INIT_QUIET
The former name had no INIT anywhere in its name, sounded generic

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-10 15:24:13 +01:00
Denys Vlasenko
f560422fa0 Big cleanup in config help and description
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>
2017-01-10 14:58:54 +01:00
Denys Vlasenko
326edc3e37 Tweak some config defaults; fix MODPROBE_SMALL ordering in "make config"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-22 14:36:49 +01:00
Denys Vlasenko
97e9a72c71 Make halt/poweroff/reboot independently selectable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-14 04:55:04 +01:00
Denys Vlasenko
d035528261 init: fix for FreeBSD console opening. Closes 9031
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-22 20:56:58 +02:00
Denys Vlasenko
237bedd499 getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LIST
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>
2016-07-06 21:58:02 +02:00
Denys Vlasenko
3e134ebf6a *: slap on a few ALIGN1/2s where appropriate
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>
2016-04-22 18:09:21 +02:00
Denys Vlasenko
47cfbf32fd *: add most of the required setup_common_bufsiz() calls
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21 18:18:48 +02:00
Denys Vlasenko
e6a2f4cc5a libbb: make bb_common_bufsiz1 1 kbyte, add capability to use bss tail for it
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>
2016-04-21 17:39:11 +02:00
Denys Vlasenko
52977a7d60 Rename FEATURE_INITRD to LINUXRC and make it separate, not an alias to init
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-31 00:42:57 +02:00
Nicolas Carrier
29eae728e9 init: make the command-line rewrite optional
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-11 14:23:33 +01:00
Kylie McClain
40eea690c7 Fix compiling with musl's utmp stubs
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>
2016-02-01 01:36:05 +01:00
Denys Vlasenko
550bf5b4a4 remove global "jmp_buf die_jmp" from !FEATURE_PREFER_APPLETS builds
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-10-09 16:42:57 +02:00
Bernhard Reutner-Fischer
86a7f18f21 *: Switch to POSIX utmpx API
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-04-02 23:03:46 +02:00
Denys Vlasenko
da9212667c libbb: code shrink by factoring out common update_utmp_DEAD_PROCESS
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>
2015-01-05 15:37:58 +01:00
Denys Vlasenko
2bba9ad67a init: do not run shutdown/reexec actions from signal handler
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-11-21 20:10:57 +01:00
Michael Tokarev
922fdf6527 init: do not fail build if SIGPWR is not defined
Apparently, some *BSD variants (and maybe some other OSes) does not define
SIGPWR signal.  So since commit 760fc6debc, 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>
2014-01-30 13:22:04 +01:00
Bogdan Purcareata
760fc6debc init: halt on SIGPWR too
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-26 13:54:48 +01:00
Denys Vlasenko
8b59b2c13e libbb: move nuke_str() from passwd into libbb
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-19 13:36:45 +01:00
Yuan-Hsiang Lee
b21bc80c76 init: fix illegal memory access when max message length is reached
Signed-off-by: Yuan-Hsiang Lee <yhlee@ubnt.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-03 00:13:16 +01:00
Denys Vlasenko
18b461925c bootchartd: warn if .config looks wrong
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-03 00:07:31 +01:00
Denys Vlasenko
730e4d8b52 init: better --help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-12 04:52:22 +02:00
Paulius Zaleckas
9f07af6156 init: don't srop unterminated processes' entries during inittab reload
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-16 12:01:58 +02:00
Denys Vlasenko
d2e07bc16c init: don't use fixed size buffer for command
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-08-16 11:48:48 +02:00
Denys Vlasenko
f958425451 init: remove special-case code for machines with less tham 1 MB of RAM.
function                                             old     new   delta
init_main                                            920     781    -139

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-05-21 16:36:51 +02:00
Denys Vlasenko
2c0508b4fa examples/inittab: fix a few incorrect statements about init
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-29 14:35:44 +01:00
Denys Vlasenko
60cb48ca50 whitespace cleanup. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 15:57:44 +01:00
Denys Vlasenko
da2b2da6a7 init: add a segv debugging aid, disabled by default
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-01-30 12:15:22 +01:00
Quentin Casasnovas
c158601d50 bootchartd: add process accounting feature
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>
2012-01-18 02:12:13 +01:00
Denys Vlasenko
ef7aa46bc4 init: code shrink -4 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-05 03:54:28 +01:00
Denys Vlasenko
beb860ac75 init: utmp update of DEAD_PROCESS was misplaced, and could be skipped. Fixing.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-05 03:31:05 +01:00
Denys Vlasenko
d2277e262f nommu: fix cases where we mangle argv[0][0]
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-22 17:19:26 +01:00
Denys Vlasenko
67905e2d7c *: work around sysinfo.h versus linux/*.h problems
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-26 13:42:12 +02:00
Denys Vlasenko
db43d3d418 halt: perror_msg_and_die needs bb_ prefix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-08 06:23:08 +02:00
Denys Vlasenko
104e01409d halt/reboot: better message if /sbin/telinit is not found
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-03 01:46:02 +02:00
Denys Vlasenko
66426760be *: remove "Options:" string from help texts
function                                             old     new   delta
packed_usage                                       28706   28623     -83

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05 03:58:28 +02:00
Denys Vlasenko
4a2aecb53a mesg: operate on stdin, not on stderr (compat)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-28 00:59:16 +02:00
Denys Vlasenko
beea5a70c3 mesg: make group/all writability configurable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-22 06:54:36 +01:00
Denys Vlasenko
32176ccec4 init: fix a case where execv's 1st arg was wrong
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-21 05:07:43 +01:00
Denys Vlasenko
8d0e0cdadf move utmp.h include to libbb.h
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-25 23:21:46 +01:00
Denys Vlasenko
b9f2d9f7d9 mass removal of underscores from _BB_DIR_foo and _BB_SUID_foo
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18 13:58:01 +01:00
Denys Vlasenko
6088e138e1 init: simpler handling of leading dash in commands
function                                             old     new   delta
init_exec                                            233     219     -14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-25 23:58:42 +01:00
Denys Vlasenko
1c31e9e82b use BB_EXECVP_or_die where appropriate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-28 04:34:09 +01:00
Denys Vlasenko
db5fe62b6d init: if PID!=1, show clearer error message. move usage text closer to main()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-02 20:13:03 +01:00