Commit Graph

530 Commits

Author SHA1 Message Date
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
Denys Vlasenko
e4dcba1c10 *: whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-28 18:57:19 +02:00
Denys Vlasenko
3b060528a2 init: do not sleep forever on usage errors
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-25 00:40:32 +02:00
Denys Vlasenko
f2657a9968 init: do not clear CRTSCTS (fix from Debian bug 528560)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-24 02:04:10 +02:00
Denys Vlasenko
b1db09be5a init/*: move applet/kbuild/config/help bits into applet source files
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-12 13:47:15 +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
Jeremie Koenig
e7a0632b7b bootchartd: mounting tmpfs is Linux-specific
Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-30 01:16:00 +02:00
Denys Vlasenko
ba2dcccd79 *: trailing empty lines removed
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-26 01:49:12 +02:00
Jeremie Koenig
1c05303fdc init: make the initial $TERM value configurable
Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-19 00:46:00 +02:00
Jeremie Koenig
714674e4da init,halt: portability improvements
* 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-19 00:45:51 +02:00
Jeremie Koenig
f812eace18 init,loginutils: termios portability fixes
Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-19 00:45:42 +02:00
Jeremie Koenig
1d7266d3b5 mark Linux-specific configuration options
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-19 00:44:56 +02:00
Denys Vlasenko
7a2aa87c75 bootchartd: fix labels in config system. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-06 15:49:01 +02:00
Pascal Bellard
926031b764 *: introduce and use xfork() and xvfork()
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-07-04 15:32:38 +02:00
Keisuke Yasui
c03fb3cd7d bootchartd: fix sample period calculations
Signed-off-by: Keisuke Yasui <keisuke.yasui@toshiba.co.jp>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-28 16:05:54 +02:00
Pascal Bellard
ff37799dfe conspy: code shrink
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-28 15:51:01 +02:00
Denys Vlasenko
64606c6d01 typo fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-22 18:33:15 +02:00
Denys Vlasenko
6d9c88ad98 fix config help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-21 07:25:36 +02:00
Denys Vlasenko
adbbee46ad bootchartd: added optional compat features
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-21 07:17:23 +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
82dd14a510 ash: use CONFIG_FEATURE_EDITING_MAX_LEN
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-17 10:10:01 +02:00
Denys Vlasenko
b8ba6b66f5 bootchartd: better wording in comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-05 00:40:15 +02:00
Denys Vlasenko
e7f1e5ca1d bootchartd: add missing parenthesis
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-04 17:34:37 +02:00
Denys Vlasenko
ff027d6f50 bootchartd: new applet
Usage: bootchartd start [PROG ARGS]|init|stop

Create /var/log/bootchart.tgz with boot chart data

Options:
start: start background logging; with PROG, run PROG, then kill
logging with USR1
stop: send USR1 to all bootchartd processes
init: start background logging; stop when getty/gdm is seen (for init scripts)
Under PID 1: as init, then exec $bootchart_init, /init, /sbin/init

function                                             old     new   delta
bootchartd_main                                        -     907    +907
dump_procs                                             -     353    +353
packed_usage                                       26566   26735    +169
dump_file                                              -      91     +91
static.dirs                                            -      23     +23
applet_names                                        2176    2187     +11
applet_main                                         1284    1288      +4
applet_nameofs                                       642     644      +2
------------------------------------------------------------------------------
(add/remove: 5/0 grow/shrink: 4/0 up/down: 1560/0)           Total: 1560 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-04 15:45:25 +02:00
Denys Vlasenko
f8d8aa1cea libbb: add skip_dev_pfx()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-06 18:50:05 +02:00
Denys Vlasenko
87fb72032e init: clear utmp entries for dead processes, if they (entries) exist
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-06 18:49:28 +02:00
Denys Vlasenko
3a41611bc5 telnetd: write LOGIN/DEAD_PROCESS utmp records. Closes bug 1363
function                                             old     new   delta
write_new_utmp                                         -     253    +253
skip_dev_pfx                                           -      30     +30
handle_sigchld                                        42      72     +30
telnetd_main                                        1650    1673     +23
make_new_session                                     415     438     +23
...
login_main                                          1140    1148      +8
update_utmp                                          337     313     -24
write_wtmp                                           220     154     -66
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 11/6 up/down: 406/-115)         Total: ~291 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-05 22:10:38 +02:00
Denys Vlasenko
37f5bef63c libbb: split update_utmp from login/getty in preparation to use it for telnetd
function                                             old     new   delta
update_utent                                           -     339    +339
login_main                                          1498    1128    -370
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 339/-370)          Total: -31 bytes

function                                             old     new   delta
update_utmp                                          246     337     +91
login_main                                          1128    1140     +12
getty_main                                          1908    1918     +10
...
update_utent                                         339       -    -339
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 5/6 up/down: 119/-368)         Total: -249 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-05 03:18:40 +02:00
Denys Vlasenko
2ec91aead5 *: remove some uses of argc
function                                             old     new   delta
whoami_main                                           34      37      +3
logname_main                                          60      63      +3
hostid_main                                           35      38      +3
ttysize_main                                         136     135      -1
nmeter_main                                          673     672      -1
logger_main                                          387     386      -1
uuencode_main                                        330     328      -2
ifupdown_main                                       2125    2123      -2
mesg_main                                            158     155      -3
free_main                                            333     330      -3
cal_main                                             902     899      -3
acpid_main                                           443     440      -3
ar_main                                              196     189      -7
find_main                                            476     467      -9
ifconfig_main                                       1235    1221     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/12 up/down: 9/-49)            Total: -40 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-04 14:15:38 +01:00
Denys Vlasenko
d7171c1140 init: fix logically inverted FEATURE_EXTRA_QUIET check
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-15 00:34:59 +01:00
Denys Vlasenko
1a8de6f8a2 init: use applet_name instead of "init" - we can be linuxrc
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-14 03:16:28 +01:00
Denys Vlasenko
18f89128e5 init: for paranoid reasons, restore SIGCONT too.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-14 03:08:30 +01:00
Denys Vlasenko
bcc6ec9b7e init: fix "while true; do reboot; done" bug. +15 bytes. Closes bug 781
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-14 03:03:29 +01:00
Denys Vlasenko
6be918d0ae init: make FEATURE_EXTRA_QUIET more consistent. +1 byte
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-14 01:32:11 +01:00
Denys Vlasenko
6e54249e05 init: restore possibility to reload inittab even before we finish initialization
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-15 03:07:19 +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
9d57a8073a libbb.h: tidy it up a bit. no code changes (verified)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-23 14:24:44 +02:00
Denys Vlasenko
90a9904e9e remove some GNUisms. by Dan Fandrich (dan AT coneharvesters.com)
function                                             old     new   delta
logdirs_reopen                                      1310    1308      -2
read_line_input                                     4757    4753      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-6)               Total: -6 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-06 02:36:23 +02:00
Alexander Shishkin
97af2ff8ca halt/reboot/poweroff: add a CONFIG_xxx to act SysV compatibly
Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-27 02:55:02 +02:00
Denys Vlasenko
3ed181b7ac init: make comment more understandable. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-19 14:29:18 +02:00
Denis Vlasenko
e12c90217b halt/reboot/powerdown: accept and ignore -i 2009-04-12 15:59:35 +00:00
Denis Vlasenko
5981ba5843 init: test for vt terminal with VT_OPENQRY,
assume that anything else is TERM=vt102, not TERM=linux.
 (Serial console test is less correct)
 Tentatively closes bug 195.

function                                             old     new   delta
init_main                                            946     919     -27
2009-03-19 02:35:44 +00:00
Denis Vlasenko
4774179cb9 mail.c: more robust handling of SIGCHLD
init: more robust signal handling
2009-03-10 16:01:57 +00:00
Denis Vlasenko
fb1a23d73b halt/reboot/poweroff: improve error reporting
function                                             old     new   delta
halt_main                                            207     185     -22
2009-03-07 01:54:24 +00:00
Denis Vlasenko
93b38208d1 init: fix compile breakage with '# CONFIG_FEATURE_KILL_REMOVED is not set'
runsvdir.c: fix typo in comment
2009-02-14 20:58:13 +00:00
Bernhard Reutner-Fischer
51d943d761 - improve helptext 2009-02-14 12:58:48 +00:00
Denis Vlasenko
9ec0ecbfdd init: remove wait() loop on restart, it may be dangerous 2009-01-31 19:26:12 +00:00
Denis Vlasenko
4ae8a05b13 init: fix a bug where on reload order of entries might be wrong
function                                             old     new   delta
run_shutdown_and_kill_processes                        -      97     +97
pause_and_low_level_reboot                             -      48     +48
run_actions                                           81     107     +26
restart_handler                                       56      81     +25
new_init_action                                      137     150     +13
run                                                  576     579      +3
open_stdio_to_tty                                    110      98     -12
check_delayed_sigs                                   195     170     -25
waitfor                                              354     318     -36
low_level_reboot                                      53       -     -53
kill_all_processes                                   115       -    -115
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 4/3 up/down: 212/-241)          Total: -29 bytes
2009-01-31 18:55:54 +00:00
Denis Vlasenko
e35af56790 modutils-24: use xasprintf and xzalloc where appropriate,
remove unreachanble code
build system: correct some dependencies in config system
init: convert one #if into if() - for Rob.

function                                             old     new   delta
obj_string_patch                                     136     129      -7
bb_init_module_24                                   4759    4615    -144
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-151)           Total: -151 bytes
2009-01-31 14:22:24 +00:00
Denis Vlasenko
fc2a4fc2ba init: small correction in a comment 2009-01-31 01:07:05 +00:00
Denis Vlasenko
72c99af0b4 init: major improvement in documentation and signal handling.
Lots of nasty, but hard to trip, races are fixed.

   text    data     bss     dec     hex filename
1038828     924   10932 1050684  10083c busybox_old
1038787     924   10932 1050643  100813 busybox_unstripped
2009-01-31 01:03:45 +00:00
Denis Vlasenko
cab28aa7de init: preparatory patch, no code changes 2009-01-31 01:02:07 +00:00
Denis Vlasenko
6c62246a35 init: reinstate proper handling of !ENABLE_FEATURE_USE_INITTAB 2009-01-29 02:01:04 +00:00
Denis Vlasenko
b2b2c404b5 init: reduce ifdef forest (specially for Rob's happiness) 2009-01-28 23:56:31 +00:00
Denis Vlasenko
4e12b1a2a9 libbb: introduce and use xmalloc_ttyname (-32 in bss).
ash: small code shrink

   text    data     bss     dec     hex filename
 793669     504    7524  801697   c3ba1 busybox_old
 793659     504    7492  801655   c3b77 busybox_unstripped
2008-12-23 23:36:47 +00:00
Denis Vlasenko
1bcdcd2ef0 init: do not eat last char in messages;
do not print duplicate "init:" prefix to syslog
2008-12-09 21:23:31 +00:00
Denis Vlasenko
a34b8a4d30 init: O_NONBLOCK needs more thought. reverted for now 2008-11-29 23:14:37 +00:00
Denis Vlasenko
3fa36e2350 *: a bit of code shrink
function                                             old     new   delta
stop_handler                                          41      38      -3
sulogin_main                                         508     504      -4
got_cont                                               4       -      -4
cont_handler                                          11       -     -11
startservice                                         309     297     -12
processorstart                                       423     409     -14
tcpudpsvd_main                                      1861    1843     -18
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 0/5 up/down: 0/-66)             Total: -66 bytes
2008-11-09 00:15:11 +00:00
Denis Vlasenko
202ac504e1 *: code shrink by adding a wrapper around very common tcsetattr(0, TCSANOW, xx) op
function                                             old     new   delta
tcsetattr_stdin_TCSANOW                                -      14     +14
set_sane_term                                        116     113      -3
top_main                                            1277    1273      -4
make_new_session                                     421     415      -6
rawmode                                              133     126      -7
reset_term                                            18      10      -8
die                                                   43      35      -8
cookmode                                              62      54      -8
vlock_main                                           425     415     -10
read_line_input                                     3165    3155     -10
bb_askpass                                           357     347     -10
fsck_minix_main                                     3079    3065     -14
getty_main                                          2375    2332     -43
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/12 up/down: 14/-131)         Total: -117 bytes
2008-11-05 13:20:58 +00:00
Denis Vlasenko
5cb54b5adc init: downgrade ENABLE_DEBUG_INIT to just a #define to prevent people
from selecting it in error. It has to be used ONLY for debugging
 init, never in production, as resulting init has serious differences.
2008-10-21 17:14:26 +00:00
Denis Vlasenko
ea7c9b3366 whitespace fixes 2008-09-25 10:39:10 +00:00
Denis Vlasenko
b8d1a4cd5f init: set stderr to NONBLOCK
*: s/setenv(a,b,1)/xsetenv(a,b)/

function                                             old     new   delta
init_main                                            856     895     +39
message                                              146     144      -2
crond_main                                          1418    1416      -2
run                                                  661     658      -3
zcip_main                                           1409    1403      -6
edit_file                                            910     901      -9
environment                                           20       -     -20
2008-09-20 16:28:59 +00:00
Denis Vlasenko
9725daa03a halt: reinstate -w even if !FEATURE_WTMP; beautify code in halt.c 2008-09-11 09:54:23 +00:00
Bernhard Reutner-Fischer
2bdc99f600 - remove excess whitespace (Vladimir Dronnikov) 2008-09-01 15:26:12 +00:00
Bernhard Reutner-Fischer
d93179fd5b - halt's -w depends on FEATURE_WTMP (Vladimir Dronnikov) 2008-09-01 15:24:52 +00:00
Denis Vlasenko
1e28f6171f halt: signal init regardless of ENABLE_INIT 2008-08-03 18:43:45 +00:00
Denis Vlasenko
084266ed52 fix several problems with config parser:
a bug where it underflows the string
 a bug where it never frees parser_t struct
make read_config() return 0 if parser is NULL,
 make config_close() accept and ignore NULL parser -
 eliminates many if() blocks
reverse the sense of parser bit flags - negative flags
 are harder to grok.
hexdump: revert the change to use config parser, it is BIGGER
 and also requires additional quirks in parser
*: explicitly use PARSER_NORMAL instead of 0

function                                             old     new   delta
login_main                                          1575    1596     +21
config_close                                          18      29     +11
bbunpack                                             383     391      +8
qgravechar                                           106     109      +3
rtnl_tab_initialize                                  121     117      -4
expand                                              1697    1693      -4
man_main                                             717     712      -5
nameif_main                                          674     668      -6
hexdump_main                                         597     591      -6
read_config                                          217     209      -8
dnsd_main                                           1478    1470      -8
sysctl_main                                          203     189     -14
config_open2                                          44      25     -19
make_device                                         1177    1141     -36
config_read                                          597     549     -48
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/11 up/down: 43/-158)         Total: -115 bytes
2008-07-26 23:08:31 +00:00
Bernhard Reutner-Fischer
3e8669f359 - wrap overlong lines (Cristian Ionescu-Idbohrn)
- s/\.  /. /g;# (me)
2008-07-22 18:27:53 +00:00
Denis Vlasenko
5415c856ea libbb: [x]fopen_for_{read,write} introduced and used.
(by Valdimir)

function                                             old     new   delta
config_open2                                           -      41     +41
config_read                                          507     542     +35
find_pair                                            169     187     +18
fopen_for_write                                        -      14     +14
fopen_for_read                                         -      14     +14
find_main                                            406     418     +12
xfopen_for_write                                       -      10     +10
xfopen_for_read                                        -      10     +10
popstring                                            134     140      +6
parse_inittab                                        396     401      +5
next_token                                           923     928      +5
pack_gzip                                           1659    1661      +2
bb__parsespent                                       117     119      +2
fallbackSort                                        1719    1717      -2
evalvar                                             1376    1374      -2
qrealloc                                              36      33      -3
...
...
...
...
singlemount                                         4579    4569     -10
process_stdin                                        443     433     -10
patch_main                                          1111    1101     -10
ifupdown_main                                       2175    2165     -10
file_action_grep                                      90      80     -10
uuidcache_init                                       649     637     -12
hush_main                                            797     785     -12
read_config                                          230     217     -13
dpkg_main                                           3835    3820     -15
read_line_input                                     3134    3110     -24
sysctl_main                                          232     203     -29
config_open                                           40      10     -30
WARN_BAD_LINE                                         44       -     -44
login_main                                          1714    1575    -139
------------------------------------------------------------------------------
(add/remove: 5/1 grow/shrink: 8/74 up/down: 174/-737)        Total: -563 bytes
2008-07-21 23:05:26 +00:00
Denis Vlasenko
b74a2dba57 whitespace fixes, no code changed 2008-07-21 21:34:51 +00:00
Bernhard Reutner-Fischer
a53de7f7c2 - fix spelling 2008-07-21 13:46:54 +00:00
Bernhard Reutner-Fischer
5259361957 - remove superfluous forward declaration 2008-07-21 11:53:04 +00:00
Bernhard Reutner-Fischer
ef9876a40e - document -f 2008-07-21 11:30:51 +00:00
Bernhard Reutner-Fischer
ad2fa65fc0 - no obj-code changes. Fix indentation, use existing defines. 2008-07-21 11:16:39 +00:00
Denis Vlasenko
2e157ddf9e libbb: updated config_parse() from Vladimir
function                                             old     new   delta
config_read                                          385     460     +75
runsvdir_main                                       1701    1716     +15
readit                                               331     338      +7
passwd_main                                         1049    1053      +4
parse_command                                       1504    1507      +3
decode_format_string                                 822     824      +2
bb__parsespent                                       117     119      +2
udhcp_get_option                                     221     222      +1
changepath                                           196     194      -2
parse_inittab                                        400     396      -4
nameif_main                                          683     679      -4
make_device                                         1176    1172      -4
config_open                                           48      40      -8
expand_main                                          698     689      -9
readcmd                                             1012    1002     -10
config_free_data                                      37      21     -16
SynchronizeFile                                      683     643     -40
sleep_main                                           474     362    -112
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 8/10 up/down: 109/-209)        Total: -100 bytes
2008-07-19 09:27:19 +00:00
Denis Vlasenko
a474b68991 init: fix compile-time error; fix exiting on broken config file
parse_config: cosmetics
2008-07-17 17:58:44 +00:00
Bernhard Reutner-Fischer
54d50a0b47 - fix "noreduce" flag of config_read (didn't work at all, at least for me).
- convert init's inittab parsing to the new config parser:
function                                             old     new   delta
config_read                                          393     386      -7
static.actions                                        72      64      -8
.rodata                                           121772  121764      -8
parse_inittab                                        554     393    -161
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-184)           Total: -184 bytes
2008-07-17 14:00:42 +00:00
Denis Vlasenko
d48e81f0cd mdev: do not follow symlinks in /sys (as was intended prior to rev 18811).
If this breaks things, please document why!
mdev,init: use shared code for fd sanitization

function                                             old     new   delta
bb_daemonize_or_rexec                                155     172     +17
mdev_main                                            500     505      +5
init_main                                            907     856     -51
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 22/-51)            Total: -29 bytes
2008-07-06 07:00:11 +00:00
Denis Vlasenko
a60f84ebf0 *: rename ATTRIBUTE_XXX to just XXX. 2008-07-05 09:18:54 +00:00
Bernhard Reutner-Fischer
62d8503589 - use ut_user rather than ut_name (Cristian Ionescu-Idbohrn)
- use ut_tv.tv_sec rather than ut_time (me)
- shrink halt a little bit (me):
halt_main                                            464     433     -31
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-31)             Total: -31 bytes
2008-06-01 10:10:22 +00:00