Commit Graph

775 Commits

Author SHA1 Message Date
Denys Vlasenko
f282c6b657 libbb: remove is_directory's argument which is always NULL
function                                             old     new   delta
send_cgi_and_exit                                    892     890      -2
ln_main                                              447     445      -2
handle_incoming_and_exit                            2784    2780      -4
is_directory                                          66      59      -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/6 up/down: 2/-19)             Total: -15 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-18 03:27:46 +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
1dc80bae0b libbb.h: add check for bad off_t size detection
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-17 21:51:32 +01:00
Denys Vlasenko
f59a50ee30 libbb.h: tighten up macro code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-16 21:30:19 +01:00
Peter Korsgaard
743edac6c8 bb_daemonize_or_rexec(): add flag to double-fork; use it in start-stop-daemon
Add a DAEMON_DOUBLE_FORK flag to make bb_daemonize double-fork so it isn't a
session leader, and hence doesn't get a controlling tty on Linux if a tty is
ever opened, similar to how libdaemon's daemon_fork or the big
start-stop-daemon does it - And use it in start-stop-daemon.

For details, see http://www.win.tue.nl/~aeb/linux/lk/lk-10.html#ss10.3

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-09 19:44:37 +01:00
Denys Vlasenko
9ce09bc9cb lineedit: add support for M-b, M-f, M-d, M-Backspace
function                                             old     new   delta
ctrl_left                                              -      96     +96
ctrl_right                                             -      76     +76
static.esccmds                                        81      93     +12
read_line_input                                     3876    3885      +9
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 2/0 up/down: 193/0)             Total: 193 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-03 13:28:22 +01:00
Leonid Lisovskiy
328f27fe44 libbb: split decode_base64 off read_base64
function                                             old     new   delta
decode_base64                                          -     182    +182
read_base64                                          378     255    -123
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 182/-123)           Total: 59 bytes

Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-28 13:59:55 +02:00
Denys Vlasenko
ec447c7f01 libbb.h: remove unused defines
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-24 04:06:18 +02:00
Denys Vlasenko
1f56e51ca1 udhcpc: add support for DHCP option 212 (RFC 5969)
The patch is from OpenWRT people.

function                                             old     new   delta
xmalloc_optname_optval                               637     874    +237
dhcp_option_strings                                  237     243      +6
dhcp_optflags                                         68      70      +2
len_of_option_as_string                               12      13      +1
dhcp_option_lengths                                   12      13      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 247/0)             Total: 247 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-19 22:40:35 +02:00
Denys Vlasenko
16714245f9 add INIT_G()'s. No code changes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-21 01:59:15 +02:00
Denys Vlasenko
13e709c53f losetup: implement -r option. Closes 4033.
function                                             old     new   delta
packed_usage                                       28595   28633     +38
losetup_main                                         285     290      +5
singlemount                                          906     908      +2
set_loop                                             674     672      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-12 08:30:16 +02:00
Denys Vlasenko
dd1061b6a7 wget: URL-decode user:password before base64-encoding it into auth hdr. Closes 3625.
function                                             old     new   delta
percent_decode_in_place                                -     152    +152
parse_url                                            304     317     +13
handle_incoming_and_exit                            2795    2798      +3
httpd_main                                           763     760      -3
decodeString                                         152       -    -152
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 2/1 up/down: 168/-155)           Total: 13 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-11 21:04:02 +02:00
Denys Vlasenko
d48fdde370 stop declariong our own dirname prototype
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-10 13:48:34 +02:00
Baruch Siach
e8f36330d9 networking: consolidate the IP checksum code. -129 bytes.
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-07 17:55:40 +02:00
Denys Vlasenko
e45af7ad17 lineedit: remove SAVE_HISTORY bit, ->hist_file can be used as indicator
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-04 16:15:24 +02:00
Denys Vlasenko
bede215cf1 lineedit: add support for history saving on exit
Based on the patch by Dennis Groenen <tj.groenen@gmail.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-04 16:12:33 +02: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
be391e7596 libbb.h: do not use homegrown struct sysinfo.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-25 11:05:43 +02:00
Dan Fandrich
75214cfe00 Use the _unlocked stdio macros only when they're all available
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-30 02:59:17 +02:00
Denys Vlasenko
0c4cf42c1e libbb.h: tweak _unlocked hack
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-30 02:44:27 +02:00
Denys Vlasenko
06448912e6 libbb: use _unlocked variants of stdio I/O.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-20 10:06:28 +02:00
Timo Teras
adcabf3235 parse_config: use getline. BIG speedup with glibc (~40%).
function                                             old     new   delta
config_read                                          559     604     +45
getline                                                -      23     +23
config_close                                          29      49     +20
find_pair                                            169     187     +18
showmode                                             330     338      +8
hash_find                                            233     234      +1
builtin_umask                                        133     132      -1
lzo1x_optimize                                      1434    1429      -5
test_main                                            253     247      -6
buffer_fill_and_print                                196     179     -17
create_J                                            1849    1826     -23
config_free_data                                      37       -     -37
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 5/5 up/down: 138/-89)            Total: 26 bytes

Signed-off-by: Timo Teras <timo.teras@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-20 09:49:56 +02:00
Denys Vlasenko
12ac6287ee procps: remove PSSCAN_STAT define, users were using it incorrectly
Also contains small cleanups ps.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-18 15:49:47 +02:00
Denys Vlasenko
a1a448347e libbb: split bb_get_chunk_from_file and bb_get_chunk_with_continuation
This also moves bb_get_chunk_with_continuation into its sole user,
parse_config.c.
This allows to optimize both functions separately,
they need to be optimized for speed.
(this need was highlighted by slow modprobe caused in part by slow
bb_get_chunk_with_continuation in config parser).

function                                             old     new   delta
bb_get_chunk_from_file                                 7     130    +123
config_read                                          457     558    +101
bb_get_chunk_with_continuation                       194       -    -194
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 2/0 up/down: 224/-194)           Total: 30 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-17 03:37:43 +02:00
Denys Vlasenko
e6df7e261e libbb.h: small reordering
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-23 03:39:08 +02:00
Denys Vlasenko
9be4702a30 main: free suid_config list after use
function                                             old     new   delta
run_applet_no_and_exit                               438     450     +12
ifupdown_main                                       2147    2149      +2
writeFileToTarball                                  1325    1326      +1
pidof_main                                           244     245      +1
last_main                                            896     897      +1
grep_main                                            779     780      +1
find_list_entry2                                     121     122      +1
tar_main                                             835     833      -2
llist_unlink                                          28      26      -2
llist_rev                                             23      21      -2
main                                                 791     782      -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/4 up/down: 19/-15)              Total: 4 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-16 12:21:31 +02:00
Denys Vlasenko
12a432715f adduser: safe username passing to passwd/addgroup
passwd: support creating SHA passwords
random code shrink

function                                             old     new   delta
crypt_make_pw_salt                                     -      87     +87
adduser_main                                         883     904     +21
...
crypt_make_salt                                       99      89     -10
chpasswd_main                                        329     312     -17
packed_usage                                       28731   28691     -40
passwd_main                                         1070    1000     -70
cryptpw_main                                         310     224     -86
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/12 up/down: 154/-288)        Total: -134 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-13 03:19:01 +02:00
Denys Vlasenko
89f5bfd6c3 libbb.h: use inlined sigfillset, sigemptyset, sigisemptyset on uclibc
text    data     bss     dec     hex filename
 875879     493    7584  883956   d7cf4 busybox_old
 875879     493    7584  883956   d7cf4 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-12 23:03:18 +02:00
Denys Vlasenko
80542bad2f hush: make read builtin interruptible.
function                                             old     new   delta
builtin_read                                         185     471    +286
check_and_run_traps                                  200     262     +62
nonblock_immune_read                                  73     119     +46
sigismember                                            -      44     +44
record_signal                                          -      21     +21
sigisemptyset                                          -      16     +16
...
------------------------------------------------------------------------------
(add/remove: 5/0 grow/shrink: 7/5 up/down: 483/-46)           Total: 437 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-08 21:23:43 +02:00
Denys Vlasenko
80c5b6893d libbb: nonblock_safe_read->nonblock_immune_read, remove unused param of xmalloc_reads
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-08 21:21:10 +02:00
Denys Vlasenko
ca18311d0a libbb: make set_nport accept pointer to sockaddr, not to len_and_sockaddr.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-07 17:52:20 +02:00
Denys Vlasenko
2c4de5b045 ash,hush: optional support for $HISTFILESIZE.
Based on patch from Alexey Fomenko (ext-alexey.fomenko AT nokia.com)

function                                             old     new   delta
size_from_HISTFILESIZE                                 -      44     +44
hush_main                                            998    1025     +27
ash_main                                            1348    1374     +26
read_line_input                                     3361    3372     +11
new_line_input_t                                      17      24      +7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-31 13:16:52 +02:00
Denys Vlasenko
681efe20d3 use user's shell instead of hardwired "/bin/sh" (android needs this)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-08 21:00:36 +01:00
Denys Vlasenko
7d65abea09 libbb: make user/group name cache strings longer (~27 chars)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-01 16:27:13 +01:00
Denys Vlasenko
ab8d00d64f progress meter: fix bugs found in stall detection and unknown size logic
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-11 19:09:30 +01:00
Denys Vlasenko
d55e139649 progress meter: move file name to bb_progress_t. +20 bytes
We were doing expensive unicode conversion on every update

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-11 18:56:13 +01:00
Denys Vlasenko
805aa9fec9 progress bar: better overflow protection; more precise bar
function                                             old     new   delta
bb_progress_update                                   639     749    +110

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-10 14:25:51 +01:00
Denys Vlasenko
698e8095fa use unistd.h before _POSIX_VERSION
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-08 05:35:04 +01:00
Denys Vlasenko
66c5b12dbf ash: fix TMOUT not restoring tty attributes
function                                             old     new   delta
pgetc                                                420     500     +80
readtoken1                                          3202    3239     +37
read_line_input                                     3316    3337     +21
udhcpc_main                                         2610    2630     +20
file_get                                             266     272      +6
expandarg                                            958     963      +5
localcmd                                             257     259      +2
addLines                                              85      87      +2
read_line                                             94      95      +1
ed_main                                             2540    2541      +1
timed_out                                              1       -      -1
lineedit_read_key                                    256     255      -1
alrm_sighandler                                       44       -     -44
cmdloop                                              539     434    -105
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 10/2 up/down: 175/-151)          Total: 24 bytes
   text    data     bss     dec     hex filename
 887379     936   17200  905515   dd12b busybox_old
 887411     936   17192  905539   dd143 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-08 05:07:02 +01:00
Denys Vlasenko
dd807c16f9 incorporate header fixes proposed in bug 3097
Not sure these are *really* needed, but I suppose they don't hurt

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-07 14:58:57 +01:00
Denys Vlasenko
046341e8bd ash: optional support for $TMOUT variable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-04 17:53:59 +01:00
Denys Vlasenko
6307357eff move nofork_save_area from libbb.h to vfork_daemon_rexec.c
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-02 19:05:25 +01:00
Denys Vlasenko
b72baeb003 hush: use FEATURE_SH_NOFORK to enable NOFORK trick
Also expands docs

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-02 18:38:57 +01:00
Denys Vlasenko
c71b469f5d libbb: make BB_EXECVP/LP try to exec real binary if there's no /proc/self/exe
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-02 03:28:56 +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
Davide Cavalca
9b3b9790b3 add ENABLE_FEATURE_SYSTEMD and use it in syslogd
Signed-off-by: Davide Cavalca <davide@geexbox.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-25 02:26:03 +01:00
Denys Vlasenko
975c714183 nicer looking ifdef in libbb/makedev.c
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-24 23:53:12 +01:00
Chris Rees
330718ef55 FreeBSD compat
Signed-off-by: Chris Rees <utisoft@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-24 17:07:06 +01:00
Chris Rees
e3c127d846 FreeBSD compat
Signed-off-by: Chris Rees <utisoft@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-24 17:04:59 +01:00
Denys Vlasenko
e9a40e3b91 libbb: make ndelay_no/off a bit more clever. +14 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-24 00:29:55 +01:00