Commit Graph

178 Commits

Author SHA1 Message Date
Denys Vlasenko
548620c18b randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-08 12:24:48 +01:00
Denys Vlasenko
4051a99f5f svc: new applet (daemontools-compatible version of "sv")
function                                             old     new   delta
sv                                                     -    1199   +1199
svc_main                                               -     145    +145
packed_usage                                       30255   30364    +109
applet_names                                        2437    2441      +4
applet_main                                         1420    1424      +4
find_applet_by_name                                  125     126      +1
sv_main                                             1201       9   -1192
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 4/1 up/down: 1462/-1192)        Total: 270 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-12-05 13:56:40 +01:00
Denys Vlasenko
1d3a04a3a4 Code style fixes, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-28 01:22:57 +01:00
Francis Rounds
d2c5de0130 svlogd: strip leading '!' from processor lines
When using svlogd's processor functionality to run arbitrary commands
on log rotation, the line in the config is executed verbatim, i.e. the
exclamation mark is included.

For example, if the config file contains:

    s100
    !cat

then when it's time to rotate the log files after each 100 bytes, sh -c
"!cat" will be run, instead of sh -c "cat" as intended. The result is
svlogd logging

    /bin/bash: !cat: command not found
    svlogd: warning: processor failed, restart: /tmp/svlogd/

over and over again as it keeps attempting to execute the processor and
failing (unless you happen to have a "!cat" binary around :)).

Skipping the exclamation mark when performing the wstrdup() fixes the
issue.

Signed-off-by: Francis Rounds <francis.rounds@4bridgeworks.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-15 14:05:04 +02:00
Denys Vlasenko
ef15970d7e *: placate some compile warnings on OSX
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-01 11:16:22 +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
9de2e5a222 *: hopefully all setup_common_bufsiz() are in place
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21 18:38:51 +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
c4199f22d0 libbb: two new functions: wait_for_exitstatus(pid), xfchdir(fd)
Bartosz Golaszewski proposed xfchdir()

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-01 22:12:44 +02:00
Denys Vlasenko
0863e1a576 runit/*: convert to new-style "one file" applets
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-19 00:41:28 +02:00
Denys Vlasenko
ab3964db4e libbb: introduce kernel-style BUILD_BUG_ON()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-13 14:50:20 +02:00
Denys Vlasenko
7f3a2a2256 join some common strings, -400 bytes
function                                             old     new   delta
print_intel_cstates                                  499     511     +12
file_insert                                          355     364      +9
dpkg_main                                           2944    2940      -4
ifenslave_main                                       645     640      -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 21/-9)              Total: 12 bytes
   text	   data	    bss	    dec	    hex	filename
 937564	    932	  17676	 956172	  e970c	busybox_old
 937164	    932	  17676	 955772	  e957c	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-08 11:24:44 +02:00
Denys Vlasenko
7db2a7c20e runsvdir: if pid==1, also intercept SIGINT for -s SCRIPT
function                                             old     new   delta
runsvdir_main                                       1057    1064      +7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-02 17:39:13 +01:00
Denys Vlasenko
dac8d80f77 runsvdir: do not block SIGCHLD around poll/sleep
There is no reason to do so. We do not even have SIGCHLD handler.

function                                             old     new   delta
runsvdir_main                                       1077    1057     -20

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-02 17:38:55 +01:00
Denys Vlasenko
fa535f3e48 runsvdir: (almost) close a signal race
We could lose a signal while processing previous one

function                                             old     new   delta
runsvdir_main                                       1088    1077     -11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-02 17:37:31 +01:00
Denys Vlasenko
1a7256ac38 chpst: fix a bug where -U USER was using wrong USER (one from -u USER)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-29 16:39:28 +01:00
Thomas Petazzoni
af4f0e48ec libbb: use <poll.h> instead of <sys/poll.h>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-16 19:59:45 +02:00
Denys Vlasenko
c72b43c2f0 Commonalize typical [b,]k,m suffix struct
function                                             old     new   delta
bkm_suffixes                                           -      32     +32
static.km_suffixes                                    24       -     -24
suffixes                                              32       -     -32
static.bkm                                            32       -     -32
head_tail_suffixes                                    32       -     -32
------------------------------------------------------------------------------
(add/remove: 2/6 grow/shrink: 0/0 up/down: 72/-160)           Total: -88 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-13 23:49:45 +02: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
Mike Frysinger
c5fe9f7b72 include sys/resource.h where needed
We use functions from sys/resource.h in misc applets, but don't include
the header.  This breaks building with newer glibc versions, so add the
include where needed.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-07-05 23:19:09 -04:00
Denys Vlasenko
0687a5b496 libbb: make xchroot do a chdir("/") after chroot
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-08 00:28:24 +01:00
Denys Vlasenko
16714245f9 add INIT_G()'s. No code changes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-21 01:59:15 +02:00
Denys Vlasenko
c74a79f288 chpst: move misplaced comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-16 11:54:13 +02:00
Denys Vlasenko
d18ef6c9f6 chpst: simple code shrink
function                                             old     new   delta
chpst_main                                           733     718     -15

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-16 11:52:43 +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
60a9414cad fix "variable 'foo' set but not used" warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-13 20:57:01 +02:00
Pere Orga
5bc8c005a8 move remaining help text from include/usage.src.h
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-11 03:29:49 +02:00
Denys Vlasenko
681efe20d3 use user's shell instead of hardwired "/bin/sh" (android needs this)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-08 21:00:36 +01:00
Dan Fandrich
dc50676cce Move stpcpy replacement function into libbb
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-13 18:37:12 +01:00
Denys Vlasenko
3a0f690dcd svlogd: extend usage text. +70 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-22 00:38:24 +01:00
Eric Lammerts
31905f9477 runsvdir: do not miss closely spaced service dir changes
Signed-off-by: Eric Lammerts <busybox@lists.lammerts.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-06 01:26:26 +01:00
Denys Vlasenko
e4dcba1c10 *: whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-28 18:57:19 +02:00
Denys Vlasenko
05e8605ab8 remove runit/runit_lib.c
function                                             old     new   delta
runsv_main                                          1770    1786     +16
svstatus_get                                         176     188     +12
sv_main                                             1180    1186      +6
runsvdir_main                                        683     689      +6
processorstart                                       385     391      +6
control                                              126     132      +6
logdir_open                                         1184    1187      +3
lock_exnb                                             14       -     -14
lock_ex                                               14       -     -14
open_write                                            17       -     -17
open_read                                             17       -     -17
------------------------------------------------------------------------------
(add/remove: 0/5 grow/shrink: 7/0 up/down: 55/-62)             Total: -7 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-13 12:53:27 +02:00
Denys Vlasenko
e09bff3341 runit_lib: remove/inline a few more things
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-05 19:28:29 +02:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
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-08-16 20:14:46 +02:00
Denys Vlasenko
7783248eaa *: s/xatoi_u/xatoi_positive/g - I got bored of mistyping xatoi_u as xatou_i
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-12 14:14:45 +02:00
Pascal Bellard
21e8e8da64 libbb: introduce and use BB_EXECVP_or_die()
function                                             old     new   delta
BB_EXECVP_or_die                                       -      47     +47
time_main                                           1042    1043      +1
chrt_main                                            371     364      -7
ionice_main                                          292     282     -10
setsid_main                                           69      56     -13
nohup_main                                           236     223     -13
cttyhack_main                                        266     253     -13
chroot_main                                           94      81     -13
chpst_main                                           746     733     -13
timeout_main                                         297     279     -18
taskset_main                                         541     522     -19
vfork_child                                           67      45     -22
parse                                                975     953     -22
lpd_main                                             770     748     -22
launch_helper                                        192     170     -22
tcpudpsvd_main                                      1810    1782     -28
nice_main                                            190     156     -34
env_main                                             242     206     -36
run_command                                          221     174     -47
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/17 up/down: 48/-352)         Total: -304 bytes

Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-04 00:57:03 +02:00
Ladislav Michl
a73b87e934 *: s/"/bin/sh"/DEFAULT_SHELL, run_shell() API fix, remove unneeded strdup
function                                             old     new   delta
run_shell                                            157     166      +9
su_main                                              477     470      -7
sulogin_main                                         515     503     -12

Signed-off-by: Ladislav Michl <Ladislav.Michl@seznam.cz>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-27 03:23:31 +02:00
Denys Vlasenko
41ddd9f606 *: make exec failure message more consistent
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-25 01:46:53 +02:00
Denys Vlasenko
d70e0e995e *: add INSERTs to *.src files where appropriate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-08 12:15:11 +02:00
Denys Vlasenko
2f32bf8be6 remove defconfig. Now "make defconfig" simply uses defaults from Config.in
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06 04:14:28 +02:00
Denys Vlasenko
da929a95aa mass renaming Kbuild -> Kbuild.src, Config.in -> Config.src
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-04 20:10:51 +02:00
Denys Vlasenko
98a4c7cf3d *: suppress ~60% of "aliased warnings" on gcc-4.4.1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-04 15:00:15 +01:00
Denys Vlasenko
dc698bb038 *: make it easier to distinquish "struct tm", pointer to one, etc
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-09 19:10:49 +01:00
Denys Vlasenko
695fa51c80 hwclock: fix sizeof bug (used it on pointer, not array); make --systohc exact
function                                             old     new   delta
hwclock_main                                         329     428     +99
rtc_adjtime_is_utc                                   138     134      -4
edir                                                 365     354     -11
read_rtc                                              39      23     -16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 99/-31)             Total: 68 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-06 18:16:39 +01:00
Denys Vlasenko
e992bae6f9 *: remove a few more cases of argc usage. -89 bytes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-28 15:18:53 +01:00
Denys Vlasenko
a7ccdeef39 libbb: added xfdopen_for_read/write
function                                             old     new   delta
xfdopen_helper                                         -      40     +40
logdir_open                                         1163    1184     +21
process_stdin                                        433     443     +10
xfdopen_for_write                                      -       9      +9
doCommands                                          2465    2474      +9
patch_main                                          1214    1222      +8
bbunpack                                             457     465      +8
xfdopen_for_read                                       -       7      +7
scan_tree                                            258     262      +4
xstrtoul_range_sfx                                   230     231      +1
sendmail_main                                        957     955      -2
passwd_main                                         1027    1023      -4
parse                                                969     964      -5
test_main                                            253     247      -6
sed_main                                             655     649      -6
dos2unix_main                                        437     429      -8
fbsplash_main                                        950     938     -12
handle_dir_common                                    371     354     -17
expand_vars_to_list                                 2197    2169     -28
update_passwd                                       1275    1246     -29
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 7/10 up/down: 117/-117)           Total: 0 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-15 23:28:11 +01:00
Denys Vlasenko
6331cf059c *: use "can't" instead of "cannot"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-13 09:08:27 +01:00
Denys Vlasenko
8131eea3dc *: introduce and use ffulsh_all()
function                                             old     new   delta
buffer_fill_and_print                                179     196     +17
fflush_all                                             -       9      +9
spawn                                                 87      92      +5
rtcwake_main                                         455     453      -2
...
alarm_intr                                            93      84      -9
readcmd                                             1072    1062     -10
bb_ask                                               345     333     -12
more_main                                            845     832     -13
flush_stdout_stderr                                   42      23     -19
xfflush_stdout                                        27       -     -27
flush_stderr                                          30       -     -30
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 2/50 up/down: 31/-397)         Total: -366 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-02 14:19:51 +01:00