Commit Graph

671 Commits

Author SHA1 Message Date
Denys Vlasenko
071ede1e5d xmalloc_[open_]read[_close]: do not ignore xrealloc return value
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-15 23:23:23 +02:00
Denys Vlasenko
c15f40c3e7 lineedit: use read_key to recognize ESC sequence.
This fixes several vi mode bugs and prepares for further fixes.

function                                             old     new   delta
read_line_input                                     3287    5511   +2224
remember_in_history                                    -     499    +499
lineedit_read_key                                      -      70     +70
read_key                                             321     332     +11
input_tab                                           2823       -   -2823
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 2/0 up/down: 2804/-2823)        Total: -19 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-15 03:27:53 +02:00
Denis Vlasenko
1cf4a0eb81 httpd: simplify insane conf file parser
function                                             old     new   delta
bb_simplify_abs_path_inplace                           -      98     +98
parse_expr                                           824     832      +8
passwd_main                                         1025    1027      +2
evalvar                                             1374    1376      +2
parse_command                                       1463    1460      -3
bb_simplify_path                                     137      55     -82
parse_conf                                          1572    1422    -150
------------------------------------------------------------------------------
(add/remove: 3/2 grow/shrink: 3/3 up/down: 126/-251)         Total: -125 bytes
2009-04-22 13:49:16 +00:00
Denis Vlasenko
5e34ff29bc *: mass renaming of USE_XXXX to IF_XXXX
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially
badly named. It was not skipping anything!
2009-04-21 11:09:40 +00:00
Denis Vlasenko
829bbd3b57 *: unify concurrent-safe update of /etc/{passwd,group,[g]shadow}
by Tito (farmatito AT tiscali.it)

function                                             old     new   delta
update_passwd                                        743    1171    +428
bb_perror_nomsg                                        -       9      +9
find_main                                            436     444      +8
passwd_main                                         1023    1027      +4
nameval                                              202     206      +4
chpasswd_main                                        315     319      +4
bb__parsespent                                       119     117      -2
adduser_main                                         654     650      -4
addgroup_main                                        345     341      -4
sv_main                                             1228    1222      -6
deluser_main                                         173     160     -13
bb_internal_putpwent                                  69       -     -69
add_user_to_group                                    231       -    -231
del_line_matching                                    460      31    -429
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 5/6 up/down: 457/-758)         Total: -301 bytes
2009-04-14 00:51:05 +00:00
Denis Vlasenko
0b791d9a97 move llist_find_str from modutils to libbb 2009-04-13 20:52:00 +00:00
Denis Vlasenko
f81e8dbc74 *: make "pragma GCC visibility push(hidden)" less ugly 2009-04-09 12:35:13 +00:00
Denis Vlasenko
3266aa9ec2 trailing whitespace removal 2009-04-01 11:24:04 +00:00
Denis Vlasenko
9d04b6b630 mkdosfs (aka mkfs.vfat): new applet by Vladimir
text    data     bss     dec     hex filename
 821202     476    7616  829294   ca76e busybox_old
 823577     476    7616  831669   cb0b5 busybox_unstripped
2009-03-28 02:13:01 +00:00
Denis Vlasenko
c0ea82a457 libbb: revent previous version of "concurrent history updating"
and replace it with one which does not "snoop" history written
by others. (1) it is what bug 185 needs, and (2) it is less bloaty:

function                                             old     new   delta
load_history                                           -     252    +252
read_line_input                                     3155    3287    +132
next_token                                           914     918      +4
qrealloc                                              36      33      -3
getoptscmd                                           713     708      -5
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/2 up/down: 388/-8)            Total: 380 bytes
2009-03-23 06:33:37 +00:00
Denis Vlasenko
57abf9e947 libbb: make history saving/loading concurrent-safe
* all history writers always append (not overwrite) history files
* they reload history if they detect that file length has changed since last
write
* they trim history file only when it grows 4 times longer than MAXLINES
* they do this atomically by creating new file and renaming it to old

Unfortunately, this comes at a price:

function                                             old     new   delta
load_history                                           -     346    +346
read_line_input                                     3155    3358    +203
new_line_input_t                                      17      31     +14
...irrelevant small jitter...
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/5 up/down: 573/-13)           Total: 560 bytes
2009-03-22 19:00:05 +00:00
Denis Vlasenko
83518d18a3 Compatibility fixes:
grep: support -z
find: support --mindepth
  together +45 bytes
cpio: support -p (configurable, +230 bytes)
libbb: tweaks for cpio
2009-03-20 22:17:13 +00:00
Denis Vlasenko
9f57cf6604 ftpd: fix command fetching to not do it in 1-byte reads;
fix command de-escaping. Tested to download files with embeeded \xff and LF.
libbb: tweaks for the above

function                                             old     new   delta
ftpd_main                                           2231    2321     +90
xmalloc_fgets_internal                               190     222     +32
xmalloc_fgets_str_len                                  -      27     +27
xmalloc_fgets_str                                      7      23     +16
xmalloc_fgetline_str                                  10      26     +16
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/0 up/down: 181/0)             Total: 181 bytes
2009-03-18 17:32:44 +00:00
Denis Vlasenko
8ec8d5e3db sha: fix thinko in sha512; add FAST_FUNC to sha1/sha256
function                                             old     new   delta
sha512_process_block128                             1334    1336      +2
sha1_hash                                            112     111      -1
sha256_process_block64                               446     440      -6
sha1_process_block64                                 494     484     -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 2/-17)             Total: -15 bytes
2009-03-15 02:56:00 +00:00
Denis Vlasenko
e9afc468fa sha: merge sha1/sha256 handling (they are similar enough for this),
shrink sha215 code

function                                             old     new   delta
sha1_end                                             129     142     +13
sha1_process_block64                                 486     494      +8
sha256_begin                                          37      44      +7
sha1_begin                                            49      56      +7
sha1_hash                                            108     112      +4
...
sha512_end                                           204     184     -20
sha512_process_block128                             1405    1334     -71
sha256_process_block64                               520     446     -74
sha256_end                                           147       -    -147
sha512_hash                                          297     130    -167
sha256_hash                                          260       -    -260
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 11/9 up/down: 59/-752)         Total: -693 bytes
2009-03-15 02:28:05 +00:00
Denis Vlasenko
c8329c9568 sha: reduce sha256/512 context size. Make sha1/sha256 code more similar
function                                             old     new   delta
sha512_end                                           182     204     +22
sha256_end                                           137     147     +10
sha1_hash                                            113     108      -5
sha1_end                                             143     129     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 32/-19)             Total: 13 bytes
2009-03-12 19:06:18 +00:00
Denis Vlasenko
cd2cd312b7 shrink sha hashing a bit more (remove wbuflen field from ctx),
remove the requirement for aligned buffer

function                                             old     new   delta
sha512_hash                                          262     297     +35
sha1_end                                             136     143      +7
passwd_main                                         1019    1023      +4
sha256_end                                           135     137      +2
count_lines                                           72      74      +2
sha256_hash                                          259     260      +1
popstring                                            164     158      -6
sha512_begin                                          88      81      -7
sha256_begin                                          44      37      -7
parse_expr                                           832     824      -8
bbunpack                                             446     438      -8
sha256_process_block64                               529     520      -9
md5_end                                              166     151     -15
evaltreenr                                           817     802     -15
evaltree                                             817     802     -15
sha512_end                                           204     182     -22
sha512_process_block128                             1444    1405     -39
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/11 up/down: 51/-151)         Total: -100 bytes
2009-03-12 15:40:27 +00:00
Denis Vlasenko
98c87f7575 sha256/512: code shrink. Run-tested.
function                                             old     new   delta
sha512_process_block128                                -    1444   +1444
sha1_process_block64                                   -     542    +542
sha256_process_block64                                 -     529    +529
K512_lo                                                -     320    +320
K256                                                   -     320    +320
init512_lo                                             -      32     +32
init256                                                -      32     +32
sha1_hash                                             99     128     +29
sha256_end                                           160     135     -25
sha1_end                                             189     160     -29
sha512_end                                           237     204     -33
sha256_begin                                          77      44     -33
sha512_begin                                         154      88     -66
sha256_hash                                          338     259     -79
sha512_hash                                          358     262     -96
sha1_compile                                         542       -    -542
sha256_process_block                                 594       -    -594
static.K                                             896       -    -896
sha512_process_block                                1861       -   -1861
------------------------------------------------------------------------------
(add/remove: 7/4 grow/shrink: 1/7 up/down: 3248/-4254)      Total: -1006 bytes
   text    data     bss     dec     hex filename
 808013     468    7856  816337   c74d1 busybox_old
 807007     468    7856  815331   c70e3 busybox_unstripped
2009-03-11 21:15:51 +00:00
Denis Vlasenko
c41cba5a57 ftpd: reuse ls applet for LIST/NLST/STAT generation
function                                             old     new   delta
popen_ls                                               -     211    +211
ftpd_main                                           1760    1826     +66
handle_dir_common                                    199     228     +29
get_remote_transfer_fd                                89     104     +15
replace_char                                          30      34      +4
handle_upload_common                                 263     265      +2
bind_for_passive_mode                                129     121      -8
cmdio_write                                           84      62     -22
escape_text                                          166     136     -30
init_data_sock_params                                 81       -     -81
ftpdataio_dispose_transfer_fd                         87       -     -87
write_dirstats                                       149       -    -149
write_filestats                                      603       -    -603
------------------------------------------------------------------------------
(add/remove: 1/4 grow/shrink: 11/5 up/down: 384/-986)        Total: -602 bytes
   text    data     bss     dec     hex filename
 808804     476    7864  817144   c77f8 busybox_old
 808156     476    7864  816496   c7570 busybox_unstripped
2009-03-09 15:46:07 +00:00
Denis Vlasenko
73c571a5ff *: move get_sock_lsa and xwrite_str to libbb, use where appropriate
function                                             old     new   delta
get_sock_lsa                                           -      72     +72
buffer_fill_and_print                                179     196     +17
parse_expr                                           824     832      +8
read_base64                                          343     348      +5
nameval                                              202     206      +4
fbset_main                                          1694    1698      +4
expand                                              1849    1853      +4
udhcp_send_kernel_packet                             249     252      +3
udhcp_get_option                                     223     222      -1
chat_main                                           1246    1245      -1
pack_gzip                                           1661    1659      -2
doset                                                299     297      -2
bb__parsespent                                       119     117      -2
test_main                                            260     257      -3
qgravechar                                           109     106      -3
tcpudpsvd_main                                      1834    1830      -4
sysctl_display_all                                   589     580      -9
xopen_xwrite_close                                    44      33     -11
prs                                                   30      18     -12
find_main                                            418     406     -12
full_write2_str                                       25      12     -13
adduser_main                                         667     654     -13
evaltreenr                                           817     802     -15
evaltree                                             817     802     -15
tftpd_main                                           526     493     -33
ftpd_main                                           2050    1990     -60
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 7/18 up/down: 117/-211)         Total: -94 bytes
2009-03-09 00:12:37 +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
9f00e05781 killall and sestatus also need ARGVN scanning 2009-02-14 01:36:11 +00:00
Denis Vlasenko
cab28aa7de init: preparatory patch, no code changes 2009-01-31 01:02:07 +00:00
Denis Vlasenko
76ddc2e3e4 libbb: add bb_unsetenv (taken from hush).
udhcpc: stop filtering environment passed to the script.
crond: fix uncovered potential bug (failing unsetenv)
mdev: fix uncovered potential bug (failing unsetenv)
tcp, udpsvd: fix uncovered potential bug (failing unsetenv)

function                                             old     new   delta
safe_setenv                                            -      58     +58
bb_unsetenv                                            -      55     +55
builtin_unset                                        139     138      -1
tcpudpsvd_main                                      1843    1830     -13
free_strings_and_unsetenv                             87      53     -34
udhcp_run_script                                    1186    1133     -53
safe_setenv4                                          62       -     -62
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 0/4 up/down: 113/-163)          Total: -50 bytes
2008-12-30 05:05: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
e53738558f *: fix SO_BINDTODEVICE. Kernel wants at least IFNAMSIZ bytes there. 2008-12-10 11:12:16 +00:00
Denis Vlasenko
15437e3e2a libbb: add xgetgrnam too. ~0 code size change 2008-12-05 16:23:06 +00:00
Denis Vlasenko
d7a805efaf libbb: introduce and use xgetpwnam. ~ -150 bytes. 2008-12-03 19:05:55 +00:00
Bernhard Reutner-Fischer
82b1429966 - add new applet mkpasswd(1)
function                                             old     new   delta
bb_ask                                                 -     355    +355
mkpasswd_main                                          -     296    +296
.rodata                                           121746  121847    +101
packed_usage                                       24632   24689     +57
static.methods                                         -      21     +21
gmatch                                               229     248     +19
bb_ask_stdin                                           -      11     +11
applet_names                                        1949    1958      +9
applet_main                                         1172    1176      +4
sulogin_main                                         503     505      +2
applet_nameofs                                       586     588      +2
sha256_hash                                          329     327      -2
correct_password                                     208     206      -2
parse_command                                       1442    1439      -3
get_cred_or_die                                      145     141      -4
passwd_main                                         1054    1044     -10
bb_askpass                                           348       -    -348
------------------------------------------------------------------------------
(add/remove: 4/1 grow/shrink: 7/5 up/down: 877/-369)          Total: 508 bytes
2008-12-03 18:48:39 +00:00
Denis Vlasenko
0c68a874e7 libbb: password/group function helpers rewritten by Tito:
function                                             old     new   delta
xgetpwuid                                              -      27     +27
uid2uname_utoa                                         -      22     +22
gid2group_utoa                                         -      22     +22
uid2uname                                              -      18     +18
gid2group                                              -      18     +18
buffer_fill_and_print                                179     196     +17
print_user                                            12      24     +12
print_group                                           12      24     +12
get_cached                                            89      99     +10
...
print_common                                         134     120     -14
vlock_main                                           415     396     -19
logger_main                                          410     387     -23
crontab_main                                         642     609     -33
bb_getpwuid                                           42       -     -42
bb_getgrgid                                           42       -     -42
bb_getug                                              80       -     -80
------------------------------------------------------------------------------
(add/remove: 6/3 grow/shrink: 9/11 up/down: 187/-296)        Total: -109 bytes
2008-12-02 22:56:59 +00:00
Denis Vlasenko
360d9661b6 libbb: add strncpy_IFNAMSIZ
function                                             old     new   delta
...
udhcp_read_interface                                 225     220      -5
brctl_main                                          1151    1146      -5
add_interface                                        109     104      -5
ipaddr_list_or_flush                                2174    2167      -7
do_add_ioctl                                          88      80      -8
vconfig_main                                         249     240      -9
do_del_ioctl                                          78      68     -10
do_iplink                                           1186    1173     -13
do_if_fetch                                          766     753     -13
buffer_fill_and_print                                196     179     -17
parse_args                                          1709    1684     -25
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/20 up/down: 11/-140)         Total: -129 bytes
2008-12-02 18:18:50 +00:00
Denis Vlasenko
a9acbe6cad timeout: new applet. 370 bytes. by Roberto Foglietta. 2008-11-24 13:25:20 +00:00
Denis Vlasenko
e9b9a19ad3 libbb: disable a second md5 implementation which managed to creep in :)
function                                             old     new   delta
sha512_end                                           239     237      -2
sha256_end                                           162     160      -2
sha1_end                                             191     189      -2
md5_end                                              168     166      -2
__md5__magic                                           4       -      -4
md5_crypt                                            627     621      -6
static.S                                              16       -     -16
__md5_Init                                            42       -     -42
static.P                                              64       -     -64
__md5_Final                                          131       -    -131
__md5_Update                                         153       -    -153
static.C                                             268      12    -256
__md5_Transform                                      293       -    -293
------------------------------------------------------------------------------
(add/remove: 0/7 grow/shrink: 0/6 up/down: 0/-973)           Total: -973 bytes
2008-11-11 01:38:04 +00:00
Denis Vlasenko
56dceb9b77 sha256,sha512: new applets. +4.9kb
we will require sha256/512 code for new $5$ and $6$ style
 password hashes anyway, they are showing up already
 in people's /etc/passwd...
2008-11-10 13:32:50 +00:00
Denis Vlasenko
f10bc3964f correction in comment 2008-11-06 23:28:42 +00:00
Denis Vlasenko
3854c5ddf4 runsvdir: alternative methon of supporting runsvdir-as-init. +66 bytes.
*: s/int/pid_t where appropriate
2008-11-06 22:39:57 +00:00
Denis Vlasenko
35a064b67f build system: tidying up CONFIG_xxx names (suggested by Rob) 2008-11-06 00:49:59 +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
1a9e9bdd93 gunzip: restore mtime. approx +80 bytes of code
rpm: make code more robust
lsmod: small code shrink
2008-11-01 12:54:56 +00:00
Denis Vlasenko
5f6aaf39cf less: reuse former vi's key reading code. Improve SIGWINCH handling.
function                                             old     new   delta
less_main                                           2056    2097     +41
getch_nowait                                         248     273     +25
read_key                                             310     321     +11
static.esccmds                                        61      69      +8
count_lines                                           72      74      +2
less_gets                                            166     142     -24
less_getch                                           172      43    -129
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 6/5 up/down: 91/-170)           Total: -79 bytes
   text    data     bss     dec     hex filename
2008-10-25 23:27:29 +00:00
Denis Vlasenko
0112ff5203 vi: move key reading routine out of vi into llbbb
function                                             old     new   delta
read_key                                               -     310    +310
....
static.esccmds                                       170      61    -109
readit                                               286      60    -226
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 9/10 up/down: 349/-367)         Total: -18 bytes
2008-10-25 23:23:00 +00:00
Denis Vlasenko
ee5dce3365 libpwdgrp: make it coexist with <pwd.h>, <grp.h> and <shadow.h>.
allows to get rid of hacks in libbb.h (extra declaration of setgroups -
 now it comes from grp.h as intended).
2008-09-26 10:35:55 +00:00
Denis Vlasenko
17e7f04c8d top: optional SMP support by Vineet Gupta (vineetg76 AT gmail.com) 2008-09-25 10:48:06 +00:00
Denis Vlasenko
cac0f5b7e5 return setgroups() decl to libbb, it is needed if we use libpwdgrp. 2008-09-25 10:20:46 +00:00
Mike Frysinger
f6cad924b1 we dont provide setgroups() replacement, so dont provide the prototype either ... especially since it conflicts on some systems (like Darwin) 2008-09-25 00:41:49 +00:00
Denis Vlasenko
08ea11ab07 runsvd: shrink by Vladimir
*: use unified trivial signal handler

function                                             old     new   delta
record_signo                                           -      10     +10
process_stdin                                        433     443     +10
bbunpack                                             383     391      +8
wc_main                                              598     605      +7
conescape                                            293     296      +3
nmeter_main                                          670     672      +2
fallbackSort                                        1717    1719      +2
bb_got_signal                                          -       1      +1
microcom_main                                        713     712      -1
signalled                                              2       -      -2
pack_gzip                                           1661    1659      -2
evalvar                                             1376    1374      -2
compare_keys                                         737     735      -2
parse_command                                       1460    1456      -4
expand                                              1748    1744      -4
s_term                                                37      29      -8
s_hangup                                               8       -      -8
fgotsig                                               10       -     -10
find_pair                                            187     169     -18
signal_handler                                       190     170     -20
runsvdir_main                                       1701    1583    -118
------------------------------------------------------------------------------
(add/remove: 2/3 grow/shrink: 6/10 up/down: 43/-199)         Total: -156 bytes
2008-09-11 19:51:11 +00:00
Denis Vlasenko
69f4f9a6f4 optimize config_read() (by Timo Teras <timo.teras AT iki.fi>)
function                                             old     new   delta
bb_get_chunk_with_continuation                         -     176    +176
find_pair                                            169     187     +18
...
process_stdin                                        443     433     -10
config_read                                          549     456     -93
bb_get_chunk_from_file                               139       7    -132
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 7/7 up/down: 215/-254)          Total: -39 bytes
2008-08-09 17:16:40 +00:00
Denis Vlasenko
2afd5ab62c *: use get_console_fd() as appropriate, and make it fail on open error -
get_console_fd_or_die().

function                                             old     new   delta
get_console_fd_or_die                                  -     163    +163
loadkmap_main                                        211     201     -10
loadfont_main                                        440     430     -10
dumpkmap_main                                        218     208     -10
kbd_mode_main                                        158     146     -12
setkeycodes_main                                     156     143     -13
get_console_fd                                       163       -    -163
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/5 up/down: 163/-218)          Total: -55 bytes
2008-08-05 23:32:27 +00:00
Denis Vlasenko
e9ad84dfd4 *: refactor handling of archived files. "tar f file.tar.lzma" now works too.
function                                             old     new   delta
unpack_Z_stream                                        -    1229   +1229
open_zipped                                            -     176    +176
unpack_bz2_stream_prime                                -      60     +60
tar_main                                             642     677     +35
find_main                                            406     418     +12
sv_main                                             1222    1233     +11
decode_format_string                                 829     837      +8
cmp_main                                             641     649      +8
popstring                                            134     140      +6
filter_accept_list_reassign                          120     125      +5
parse_and_put_prompt                                 800     804      +4
passwd_main                                         1053    1049      -4
make_new_name_gunzip                                 119     114      -5
rpm_main                                            1688    1670     -18
prepare                                              302     283     -19
xmalloc_open_zipped_read_close                       135      61     -74
uncompress                                          1229       -   -1229
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 8/5 up/down: 1554/-1349)        Total: 205 bytes
2008-08-05 13:10:34 +00:00
Denis Vlasenko
855ff6f503 modprobe: use buffering line reads (fgets) instead of reads().
libbb: remove reads()

function                                             old     new   delta
include_conf_file_act                                961     980     +19
localcmd                                             282     284      +2
already_loaded                                       155     151      -4
in_cksum                                              58      53      -5
modprobe_main                                       1630    1624      -6
reads                                                129       -    -129
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 2/3 up/down: 21/-144)          Total: -123 bytes
2008-08-04 21:16:46 +00:00
Denis Vlasenko
27842288b3 libbb: make xrealloc_vector zero out the realloc'ed tail
function                                             old     new   delta
xrealloc_vector_helper                                51      76     +25
man_main                                             712     705      -7
act                                                  250     234     -16
create_list                                           91      70     -21
getopt_main                                          695     664     -31
load_dep_bb                                          281     248     -33
fileAction                                           744     709     -35
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/6 up/down: 25/-143)          Total: -118 bytes
2008-08-04 13:20:36 +00:00
Denis Vlasenko
6e69e4237d netstat: optional -p support by L. Gabriel Somlo <somlo AT cmu.edu>
Without FEATURE_NETSTAT_PRG:
function                                             old     new   delta
recursive_action                                     416     425      +9
tcp_do_one                                           420     428      +8
udp_do_one                                           492     499      +7
raw_do_one                                           472     479      +7
expand                                              1697    1701      +4
netstat_main                                         489     492      +3
unix_do_one                                          486     488      +2
flags                                                  1       -      -1
qgravechar                                           109     106      -3
net_conn_line                                          4       -      -4
bbunpack                                             391     383      -8
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 7/2 up/down: 40/-16)             Total: 24 bytes

With FEATURE_NETSTAT_PRG:
file_act                                               -     213    +213
dir_act                                                -     192    +192
netstat_main                                         489     601    +112
prg_cache_get                                          -      50     +50
tcp_do_one                                           420     462     +42
udp_do_one                                           492     533     +41
raw_do_one                                           472     513     +41
unix_do_one                                          486     519     +33
recursive_action                                     416     425      +9
expand                                              1697    1701      +4
flags                                                  1       -      -1
qgravechar                                           109     106      -3
net_conn_line                                          4       -      -4
bbunpack                                             391     383      -8
packed_usage                                       24586   24572     -14
------------------------------------------------------------------------------
(add/remove: 3/2 grow/shrink: 7/3 up/down: 737/-30)           Total: 707 bytes
2008-07-27 12:10:07 +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
Denis Vlasenko
0f99d49ae6 *: conversion to config parser
function                                             old     new   delta
config_read                                          540     597     +57
config_open2                                          41      44      +3
rtnl_rtprot_initialize                                70      66      -4
rtnl_rttable_initialize                               78      73      -5
rtnl_rtscope_initialize                               88      83      -5
rtnl_rtrealm_initialize                               48      43      -5
rtnl_rtdsfield_initialize                             48      43      -5
process_module                                       566     560      -6
bbunpack                                             391     383      -8
rtnl_tab_initialize                                  279     121    -158
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/8 up/down: 60/-196)          Total: -136 bytes
2008-07-24 23:38:04 +00:00
Denis Vlasenko
0f293b96dc fix all cases of strcpy on overlapping strings. 2008-07-22 20:16:55 +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
Bernhard Reutner-Fischer
d73cbd31a2 - first pass to unify/cleanup uid handling (-236b)
This needs further love, alot of love.. Tito?
2008-07-21 14:41:33 +00:00
Denis Vlasenko
dcb3fcb042 libbb: config_read() update 2008-07-19 22:57:00 +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
3b3ca113ed pidof/killall: allow find_pid_by_name to find running
processes started as scripts_with_name_longer_than_15_bytes.sh
 closes bug 4054 (and is generally neat)
2008-07-17 18:39:36 +00:00
Bernhard Reutner-Fischer
679212836a - fix segfault in nameif with mactab file
(by fixing and shrink config parser)

function                                             old     new   delta
config_free_data                                       -      37     +37
config_open                                           43      48      +5
pack_gzip                                           1658    1660      +2
nameif_main                                          527     525      -2
SynchronizeFile                                      629     623      -6
make_device                                         1184    1176      -8
config_close                                          31      18     -13
config_read                                          431     393     -38
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/5 up/down: 44/-67)            Total: -23 bytes
2008-07-17 11:59:13 +00:00
Denis Vlasenko
c01340fe26 update of config file parser from Vladimir 2008-07-16 22:12:18 +00:00
Denis Vlasenko
5e476bab9c libbb: document plans to speed up line-based input 2008-07-15 21:29:44 +00:00
Denis Vlasenko
e559e0a757 libbb: unified config parser (By Vladimir Dronnikov)
mdev: use it

function                                             old     new   delta
config_read                                            -     400    +400
config_open                                            -      43     +43
config_close                                           -       9      +9
qrealloc                                              33      36      +3
compare_keys                                         735     737      +2
xstrtoull_range_sfx                                  296     295      -1
qgravechar                                           109     106      -3
get_address                                          181     178      -3
next_token                                           928     923      -5
sv_main                                             1228    1222      -6
find_main                                            418     406     -12
next_field                                            32       -     -32
make_device                                         1269    1184     -85
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 2/7 up/down: 457/-147)          Total: 310 bytes
2008-07-15 21:09:30 +00:00
Denis Vlasenko
2132e02213 libbb: experimental faster string reading routines. 2008-07-15 10:33:12 +00:00
Denis Vlasenko
b6052724ff open_transformer: do not return fd, it does not change
libbb: adopt zipped read from modprobe-small

function                                             old     new   delta
getoptscmd                                           708     713      +5
qgravechar                                           106     109      +3
huft_build                                          1165    1168      +3
tr_main                                              474     472      -2
open_transformer                                      91      89      -2
evalvar                                             1376    1374      -2
rpm_main                                            1691    1688      -3
qrealloc                                              36      33      -3
get_header_tar_lzma                                   55      52      -3
get_header_tar_gz                                    100      97      -3
get_header_tar_bz2                                    55      52      -3
get_header_tar_Z                                      89      86      -3
find_main                                            418     406     -12
prepare                                              302     283     -19
xmalloc_open_zipped_read_close                       161     135     -26
xmalloc_read                                         248     199     -49
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/13 up/down: 11/-130)         Total: -119 bytes
2008-07-10 17:43:01 +00:00
Denis Vlasenko
f62ab2d774 libbb: use improved xmalloc_read() from modprobe-small
who: fix compile breakage on some systems
modprobe-small: improve Config help text wording
2008-07-09 09:50:33 +00:00
Denis Vlasenko
deeed59de0 libbb: introduce and use xrealloc_vector
function                                             old     new   delta
xrealloc_vector_helper                                 -      51     +51
create_list                                           84      99     +15
getopt_main                                          690     695      +5
passwd_main                                         1049    1053      +4
get_cached                                            85      89      +4
msh_main                                            1377    1380      +3
add_match                                             42      41      -1
read_lines                                           720     718      -2
grave                                               1068    1066      -2
fill_match_lines                                     143     141      -2
add_to_dirlist                                        67      65      -2
add_input_file                                        49      47      -2
act                                                  252     250      -2
fsck_main                                           2252    2246      -6
man_main                                             765     757      -8
bb_internal_initgroups                               228     220      -8
cut_main                                            1052    1041     -11
add_edge_to_node                                      55      43     -12
dpkg_main                                           3851    3835     -16
ifupdown_main                                       2202    2178     -24
sort_main                                            838     812     -26
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/15 up/down: 82/-124)          Total: -42 bytes
2008-07-08 05:14:36 +00:00
Denis Vlasenko
a60f84ebf0 *: rename ATTRIBUTE_XXX to just XXX. 2008-07-05 09:18:54 +00:00
Denis Vlasenko
82604e9730 revert last two commits. vfork cannot be used in subroutine,
it trashes stack on return
2008-07-01 15:59:42 +00:00
Denis Vlasenko
58d60c3333 *: introduce and use xfork()
function                                             old     new   delta
xfork                                                  -      20     +20
msh_main                                            1377    1380      +3
mod_process                                          455     446      -9
forkexit_or_rexec                                     30      17     -13
expand_variables                                    1434    1421     -13
open_transformer                                      91      76     -15
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/4 up/down: 23/-50)            Total: -27 bytes
2008-07-01 11:11:24 +00:00
Denis Vlasenko
3da5572bfa *: introduce and use xvfork()
function                                             old     new   delta
time_main                                           1052    1285    +233
crontab_main                                         623     856    +233
ifupdown_main                                       2202    2403    +201
xvfork                                                 -      20     +20
passwd_main                                         1049    1053      +4
grave                                               1068    1066      -2
script_main                                          935     921     -14
vfork_or_die                                          20       -     -20
vfork_compressor                                     206     175     -31
open_as_user                                         109       -    -109
popen2                                               218       -    -218
edit_file                                            910     690    -220
run_command                                          268       -    -268
------------------------------------------------------------------------------
(add/remove: 1/4 grow/shrink: 4/4 up/down: 691/-882)         Total: -191 bytes
2008-07-01 10:40:41 +00:00
Denis Vlasenko
c94d3564c2 sendmail: from Vladimir:
Here comes the third part of compatibility patch for sendmail.
* Introduced new safe_getdomainname() -- will it be useful?
* Fixed SEGV if sender address is missed. Should snoop for sender address in mail headers?
* More compat: use HOSTNAME instead of HOST when no server is explicitly specified.
* crond: fixed mail recipient address.

function                                             old     new   delta
safe_getdomainname                                     -      56     +56
sendgetmail_main                                    1937    1946      +9
grep_file                                            846     850      +4
crond_main                                          1423    1425      +2
xstrtoull_range_sfx                                  295     296      +1
utoa_to_buf                                          110     108      -2
passwd_main                                         1053    1049      -4
sv_main                                             1234    1228      -6
parse_expr                                           841     833      -8
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/4 up/down: 72/-20)             Total: 52 bytes
2008-06-30 13:30:21 +00:00
Denis Vlasenko
ce13b76002 libbb: shrink monotonic_XXX functions, introduce monotonic_ns
(unused for now)

function                                             old     new   delta
get_mono                                               -      31     +31
sv_main                                             1228    1234      +6
expand                                              1693    1697      +4
get_address                                          178     181      +3
utoa_to_buf                                          108     110      +2
builtin_exit                                          46      48      +2
qrealloc                                              36      33      -3
qgravechar                                           109     106      -3
ash_main                                            1383    1380      -3
grep_file                                            850     846      -4
popstring                                            140     134      -6
monotonic_us                                          85      60     -25
monotonic_sec                                         41      16     -25
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/7 up/down: 48/-69)            Total: -21 bytes
2008-06-29 02:25:53 +00:00
Denis Vlasenko
defc1ea340 *: introduce and use FAST_FUNC: regparm on i386, otherwise no-on
text    data     bss     dec     hex filename
 808035     611    6868  815514   c719a busybox_old
 804472     611    6868  811951   c63af busybox_unstripped
2008-06-27 02:52:20 +00:00
Denis Vlasenko
b4c5bf615e Specially for Bernhard Fischer introduce USE_BB_CRYPT
which selects between libc/custom crypt routines.
2008-06-15 18:35:34 +00:00
Denis Vlasenko
fdddab0c61 make pw_encrypt() return malloc'ed string.
text    data     bss     dec     hex filename
 759802     604    6684  767090   bb472 busybox_old
 759804     604    6676  767084   bb46c busybox_unstripped
2008-06-12 16:56:52 +00:00
Denis Vlasenko
4ea83bf562 uclibc insists on having 70k static buffer for crypt.
For bbox it's not acceptable. Roll our own des and md5 crypt
implementation. Against older uclibc:

   text    data     bss     dec     hex filename
 759945     604    6684  767233   bb501 busybox_old
 759766     604    6684  767054   bb44e busybox_unstripped

so, we still save on code size.
2008-06-12 16:55:59 +00:00
Denis Vlasenko
53354ac47d libbb: introduce and use print_flags().
Mostly by Natanael Copa <natanael.copa AT gmail.com>

function                                             old     new   delta
print_e2flags                                          -     189    +189
print_flags_separated                                  -      86     +86
static.flag_labels                                     -      60     +60
static.dma_wmode_masks                                 -      32     +32
static.flag_masks                                      -      28     +28
static.arp_labels                                      -      16     +16
static.arp_masks                                       -      12     +12
ls_main                                              836     843      +7
...
popstring                                            140     134      -6
arp_show                                             740     708     -32
print_flags                                          189      25    -164
ipaddr_list_or_flush                                2396    2170    -226
process_dev                                         5306    4706    -600
------------------------------------------------------------------------------
(add/remove: 10/0 grow/shrink: 5/10 up/down: 458/-1043)      Total: -585 bytes
   text    data     bss     dec     hex filename
 810564     624    7060  818248   c7c48 busybox_old
 810002     624    7060  817686   c7a16 busybox_unstripped
2008-06-07 15:10:29 +00:00
Bernhard Reutner-Fischer
797c96d8ce - fix compilation on standard-conforming compilers 2008-06-06 10:31:39 +00:00
Denis Vlasenko
f592aa36f3 which: -a support (needed for bfin uclibc build script)
real support (with CONFIG_DESKTOP=y): 120+ bytes:
   text	   data	    bss	    dec	    hex	filename
 807958	    624	   7036	 815618	  c7202	busybox_old
 808085	    624	   7036	 815745	  c7281	busybox_unstripped

"fake" support (with CONFIG_DESKTOP unset): ~45 bytes:
   text	   data	    bss	    dec	    hex	filename
 797790	    611	   6996	 805397	  c4a15	busybox_old
 797834	    611	   6996	 805441	  c4a41	busybox_unstripped
2008-06-05 13:33:59 +00:00
Denis Vlasenko
3b162ecdf6 networking/interface.c: fix indentation 2008-06-04 07:59:51 +00:00
Denis Vlasenko
cd2663f15e ash: optional printf builtin. +25 bytes if off, +35 if on.
by Cristian Ionescu-Idbohrn.
2008-06-01 22:36:39 +00:00
Bernhard Reutner-Fischer
17282292c2 - add strrchr 2008-05-28 14:19:27 +00:00
Denis Vlasenko
af6cca50af move setgroups definition to libbb.h so that it no longer inadvertently
get hidden attribute
2008-05-25 04:31:54 +00:00
Bernhard Reutner-Fischer
ae4342ca3e - Rename getpty() to xgetpty() and adjust callers.
- Rewrite kbd_mode and setconsole
- Introduce and use console_make_active() and xopen_xwrite_close()
- honour buffer-reservation method as set by the user (dumpkmap, loadkmap)
- shrink rtcwake and some console-tools

  Saves about 270 Bytes
2008-05-19 08:18:50 +00:00
Denis Vlasenko
5599502a55 more -Wall warning fixes. -Wall is enabled now. 2008-05-18 22:28:26 +00:00
Bernhard Reutner-Fischer
f3b778a4dc - fix bug where we incorrectly rejected ifconfig eth0 hw ether $whatever
- add support for printing ipoib to ifconfig
2008-05-16 16:10:31 +00:00
Denis Vlasenko
6b06cb80be more of -Wall fixes from Cristian Ionescu-Idbohrn.
Some are fixing real bugs.

function                                             old     new   delta
syslogd_main                                         938     958     +20
get_signum                                           136     143      +7
obj_load                                             777     782      +5
recv_from_to                                         210     214      +4
get_next_block                                      1795    1799      +4
display_topmem_process_list                         1117    1121      +4
logread_main                                         484     487      +3
buffer_fill_and_print                                 73      76      +3
kill_main                                            687     689      +2
ll_remember_index                                    240     241      +1
do_stats                                             452     453      +1
if_readconf                                          166     165      -1
display_process_list                                1192    1191      -1
run_applet_and_exit                                  507     505      -2
print_signames                                        33      31      -2
parse_one_line                                      1092    1090      -2
find_out_spec                                         57      55      -2
add_ksymoops_symbols                                 421     419      -2
ash_main                                            1407    1402      -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 11/8 up/down: 54/-17)            Total: 37 bytes
2008-05-15 21:30:45 +00:00
Denis Vlasenko
98636eb08c Use intra-DSO calls when we build libbusybox. No-op for normal build.
This was Bernhard Fischer' idea.

   text    data     bss     dec     hex filename
 773549    7781    9740  791070   c121e busybox.t7/0_lib/libbusybox.so.1.11.0.svn_unstripped
 769683    7397    9740  786820   c0184 busybox.t9t/0_lib/libbusybox.so.1.11.0.svn_unstripped
2008-05-09 17:59:34 +00:00
Denis Vlasenko
6bf05cf1ff httpd: fix several bugs triggering by realtive path in -h DIR.
function                                             old     new   delta
handle_incoming_and_exit                            2657    2659      +2
send_cgi_and_exit                                    869     862      -7
parse_conf                                          1647    1626     -21
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 2/-28)             Total: -26 bytes
2008-05-07 12:18:48 +00:00
Denis Vlasenko
c0431ed455 cp: fix "cp -RL" to create regular files even if src is a symlink 2008-04-27 22:06:24 +00:00
Denis Vlasenko
5bb2fc2dc1 tentative fix for ppc64 problems with ioctl.
Zero code size impact.
2008-04-21 03:23:59 +00:00
Denis Vlasenko
f3745ea489 libbb: introduce xmalloc_xopen_read_close and use where appropriate
instead of xmalloc_open_read_close.

function                                             old     new   delta
xmalloc_xopen_read_close                               -      34     +34
xmalloc_open_read_close                              163     171      +8
passwd_main                                         1070    1074      +4
rexecve                                              254     257      +3
handle_incoming_and_exit                            2657    2659      +2
parse_command                                       1509    1510      +1
buffer_fill_and_print                                 76      73      -3
evaltreenr                                           599     589     -10
evaltree                                             599     589     -10
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 5/3 up/down: 52/-23)             Total: 29 bytes
2008-04-19 19:32:08 +00:00
Denis Vlasenko
278a1c2264 brctl: optional support for "show" cmd (by L. Gabriel Somlo <somlo AT cmu.edu>)
function                                             old     new   delta
brctl_main                                           739    1186    +447
if_indextoname                                         -     104    +104
static.keywords                                      827     841     +14
static.ops                                             -       7      +7
packed_usage                                       23978   23976      -2
2008-04-06 07:17:02 +00:00
Denis Vlasenko
468aea2d88 shells: do not frocibly enable test, echo and kill _applets_,
just build relevant source and use xxx_main functions.
build system: add a special case when we have exactly one applet enabled
(makes "true", "false", "basename" REALLY tiny).
getopt32: do not use stdio.

function                                             old     new   delta
getopt32                                            1385    1412     +27
make_device                                         1187    1200     +13
basename_main                                        120     127      +7
tcpudpsvd_main                                      1922    1926      +4
testcmd                                                5       -      -5
echocmd                                                5       -      -5
fuser_main                                          1243    1231     -12
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 4/1 up/down: 51/-22)             Total: 29 bytes
2008-04-01 14:47:57 +00:00
Denis Vlasenko
d943af058b libbb: preventive fix for SIGxxx >= 32 2008-03-30 15:56:38 +00:00
Denis Vlasenko
b9ad75fa60 copy_file: handle "cp /dev/foo file" (almost) compatibly to coreutils.
(almost because we do not copy mode, which is probably wasn't intended).
+61 bytes.
2008-03-28 17:49:31 +00:00
Denis Vlasenko
8ee649a02e *: more uniform naming: s/xmalloc_getline/xmalloc_fgetline/ 2008-03-26 20:04:27 +00:00
Denis Vlasenko
0b6c6a9c9f lpd: fix OOM vulnerability (was eating arbitrarily large commands) 2008-03-24 00:04:42 +00:00