Denis Vlasenko
fb0eba706c
libbb: introduce and use safe_waitpid (loops in EINTR)
...
*: use more approproate (shorter) versions of wait()
function old new delta
safe_waitpid - 48 +48
wait_any_nohang - 17 +17
send_tree 365 369 +4
processorstop 432 435 +3
text_yank 110 108 -2
make_human_readable_str 202 200 -2
crond_main 1368 1366 -2
handle_sigchld 49 43 -6
reapchild 166 159 -7
custom 260 250 -10
checkscript 191 177 -14
wait_nohang 17 - -17
wait_pid 43 - -43
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 2/7 up/down: 72/-103) Total: -31 bytes
2008-01-02 19:55:04 +00:00
Denis Vlasenko
c03e872112
save a bit of code with *strchrnul = '\0' trick
...
function old new delta
nextline 59 55 -4
include_conf 902 898 -4
read_config 414 406 -8
fsck_main 1880 1869 -11
2007-12-26 20:56:55 +00:00
Denis Vlasenko
ed6a49c657
ip: stop propagating argc; optimize ip_parse_common_args
...
function old new delta
find_pair 167 187 +20
static.families - 17 +17
die_must_be_on_off - 11 +11
...
on_off 33 22 -11
do_ipaddr 103 90 -13
do_iptunnel 1001 986 -15
iproute_list_or_flush 1237 1217 -20
static.ip_common_commands 43 22 -21
do_iproute 2217 2193 -24
parse_args 1444 1414 -30
ip_do 47 16 -31
do_iprule 994 963 -31
ip_main 153 113 -40
ipaddr_modify 1357 1305 -52
ipaddr_list_or_flush 2543 2490 -53
ip_parse_common_args 294 159 -135
------------------------------------------------------------------------------
(add/remove: 4/1 grow/shrink: 4/24 up/down: 85/-563) Total: -478 bytes
text data bss dec hex filename
775561 966 9236 785763 bfd63 busybox_old
775073 962 9236 785271 bfb77 busybox_unstripped
2007-11-18 22:56:25 +00:00
Denis Vlasenko
6df9e3c9a3
inetd: revert bogus fix for bug 1562; shrink inetd a bit
...
function old new delta
dupconfig 159 146 -13
getconfigent 1123 1073 -50
2007-11-12 21:21:35 +00:00
Denis Vlasenko
1bec1b980e
telnet: use poll, it's shorter
...
*: style fixes
2007-11-06 02:23:39 +00:00
Denis Vlasenko
9d1afdb571
inetd: fix bug 1562 "inetd does not set argv[0] properly" (fix by IlyaPanfilov)
...
inetd: code shrink while at it
function old new delta
static.SOCK_xxx - 6 +6
getconfigent 1222 1123 -99
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 6/-99) Total: -93 bytes
text data bss dec hex filename
776099 974 9420 786493 c003d busybox_old
776020 974 9420 786414 bffee busybox_unstripped
2007-10-30 19:54:39 +00:00
Denis Vlasenko
4f95e5aab8
vi: don't wait 50 ms before reading ESC sequences
...
inetd,syslogd: use safe_read instead of open-coded EINTR handling
syslogd: bail out if you see null read from Unix socket
(should never happen, but if it does, spinning forever
and eating 100% CPU is not a good idea)
2007-10-11 10:10:15 +00:00
Denis Vlasenko
9b49a5ed85
add -fvisibility=hidden to CC flags, mark XXX_main functions
...
EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
2007-10-11 10:05:36 +00:00
Denis Vlasenko
0c97c9d437
'simple' error message functions by Loic Grenie <loic.grenie@gmail.com>.
...
263 bytes saved.
2007-10-01 11:58:38 +00:00
Denis Vlasenko
3982407ba4
inetd: move struct fields around -> save .25 k of code
...
function old new delta
freeconfig 75 76 +1
register_rpc 200 196 -4
dupconfig 165 159 -6
reapchild 173 166 -7
retry 93 82 -11
goaway 112 101 -11
getconfigent 1241 1222 -19
setup 645 592 -53
inetd_main 2160 2107 -53
config 1602 1518 -84
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/9 up/down: 1/-248) Total: -247 bytes
text data bss dec hex filename
773951 1038 10332 785321 bfba9 busybox_old
773703 1038 10332 785073 bfab1 busybox_unstripped
2007-09-26 10:46:18 +00:00
Denis Vlasenko
512a545f0d
inetd: make some fields smaller, move data out of data/bss sections
...
function old new delta
inetd_main 2125 2160 +35
setup 640 645 +5
initring 48 53 +5
reapchild 169 173 +4
retry 92 93 +1
goaway 113 112 -1
inetd_setproctitle 175 173 -2
chargen_dg 229 227 -2
uid 4 - -4
.......................
Argv 4 - -4
rlim_ofile_cur 8 - -8
config 1610 1602 -8
rlim_ofile 16 - -16
getconfigent 1271 1241 -30
builtins 176 132 -44
ring 128 - -128
allsock 128 - -128
------------------------------------------------------------------------------
(add/remove: 0/18 grow/shrink: 5/6 up/down: 50/-423) Total: -373 bytes
text data bss dec hex filename
774144 1051 10708 785903 bfdef busybox_old
774108 1039 10380 785527 bfc77 busybox_unstripped
$ size inetd.o inetd_orig.o
text data bss dec hex filename
9027 0 0 9027 2343 inetd.o
9064 12 324 9400 24b8 inetd_orig.o
2007-09-24 10:41:30 +00:00
Denis Vlasenko
fe7cd642b0
don't pass argc in getopt32, it's superfluous
...
(add/remove: 0/0 grow/shrink: 12/131 up/down: 91/-727) Total: -636 bytes
text data bss dec hex filename
773469 1058 11092 785619 bfcd3 busybox_old
772644 1058 11092 784794 bf99a busybox_unstripped
2007-08-18 15:32:12 +00:00
Denis Vlasenko
a27a11bb2c
introduce and use xdup2(int, int)
...
stop checking whether setsockopt_reuseaddr(int fd) was successful (it always is)
remove second parameter (sockllen) from xmalloc_sockaddr2xxxxx functions
sockaddr2str 142 156 +14
collect_blk 467 474 +7
xdup2 28 33 +5
singlemount 4456 4454 -2
print_host 214 212 -2
nslookup_main 139 137 -2
ftpgetput_main 414 412 -2
udhcpd_main 1258 1255 -3
udhcpc_main 2405 2402 -3
traceroute_main 4125 4122 -3
nc_main 1072 1069 -3
buffer_fill_and_print 76 73 -3
xmalloc_sockaddr2hostonly_noport 18 14 -4
xmalloc_sockaddr2host_noport 18 14 -4
xmalloc_sockaddr2host 15 11 -4
xmalloc_sockaddr2dotted_noport 18 14 -4
xmalloc_sockaddr2dotted 18 14 -4
wget_main 2618 2614 -4
ping_main 393 389 -4
ip_port_str 120 115 -5
dhcprelay_main 1146 1141 -5
dnsd_main 1531 1525 -6
passwd_main 1110 1102 -8
udhcp_kernel_packet 206 197 -9
udhcp_listen_socket 154 144 -10
getty_main 2576 2566 -10
setup 655 640 -15
xmove_fd 51 34 -17
dolisten 759 742 -17
tcpudpsvd_main 1866 1836 -30
startservice 339 299 -40
2007-08-18 14:16:39 +00:00
Denis Vlasenko
b6adbf1be2
usage.c: remove reference to busybox.h
...
*: s/include "busybox.h"/include "libbb.h"
2007-05-26 19:00:18 +00:00
Denis Vlasenko
5b34083004
several *.c files:
...
move 'extern environ' up to the location of #includes
2007-05-17 23:02:14 +00:00
Bernhard Reutner-Fischer
febe3c4211
- sed -e "s/char[[:space:]]*\*[[:space:]]*argv\[\]/char **argv/g"
2007-04-04 20:52:03 +00:00
Denis Vlasenko
10457b90db
make pidfile writing configurable.
...
[ui]toa_to_buf: change API. No users yet.
2007-03-27 22:01:31 +00:00
Denis Vlasenko
5a142025d3
move everything to new NOMMU helpers, except udhcp
2007-03-26 13:20:54 +00:00
Denis Vlasenko
55f30b05ac
inetd,ed,msh: data/bss reduction (in mss, more than 9k of it)
2007-03-24 22:42:29 +00:00
Denis Vlasenko
9067f13be0
NOMMU re-exec trick shuld not depend on existence of "don't daemonize"
...
option for every affected applet (and dnsd, for example, don't have one).
Thus rework re-exec support to not require it. Code got smaller too.
2007-03-24 12:11:17 +00:00
Denis Vlasenko
ce074df814
inetd: indent labels uniformly
2007-03-24 12:07:31 +00:00
Denis Vlasenko
06af216528
suppress warnings about easch <applet>_main() having
...
no preceding prototype
2007-02-03 17:28:39 +00:00
Denis Vlasenko
b6aae0f381
preparatory patch for -Wwrite-strings #2
2007-01-29 22:51:25 +00:00
Denis Vlasenko
35d4da0fb5
exterminate u_intXXX.
...
fix ping6 buglet (memset is too short), minor sync between ping and ping6
2007-01-22 14:04:27 +00:00
Denis Vlasenko
9af7c9d6b6
openvt,getty,vfork_daemon_rexec,mount: tighten up fd cleanup code
...
(will close all fd's > 2 on daemonization now)
getty: fix "getty -" support, and also do not try to chown/chmod "-"
telnetd: fix "lost ctty" bug
Yet another attempt on saner function names:
bb_sanitize_server_stdio(0/1) -> bb_sanitize_stdio() + bb_daemonize();
2007-01-19 21:19:35 +00:00
Denis Vlasenko
b64eed6030
httpd: use fd#1 in inetd mode
...
inetd: micro style fix
2007-01-14 17:06:11 +00:00
Denis Vlasenko
d1a6e8d320
inetd: preparatory patch, no code changes
2007-01-14 14:46:18 +00:00
Denis Vlasenko
d97c9244b1
Rename bb_sanitize_stdio -> bb_sanitize_server_stdio
...
(name is still bad - it doesn't hint that function
may do daemonization trick for you if asked to).
Small fixes to fakeidentd.
2007-01-14 13:12:06 +00:00
Denis Vlasenko
ffcef2d1f7
inetd: open log after daemonization
2007-01-14 02:03:28 +00:00
Denis Vlasenko
7a431b3715
By popular request reinstate fakeidentd's standalone mode.
...
Since this is also needed for other applets like telnetd,
introduce generic driver for such things.
It even supports inetd-wait ('linger') mode, when inetd
hands out listen socket to child and waits to it to die,
instead of handing out accepted socket and continuing
listening itself (nowait mode).
Code growth ~200 bytes.
NB: our inetd doesn't support wait mode yet (or mabe it is buggy).
2007-01-14 01:29:06 +00:00
Denis Vlasenko
f8138d1f91
fakeinetd: attempted ipv6-ization (and it's done)
...
but entire applet can be orders of magnitude smaller
if written as an inetd service.
So did that (#ifdef'ed out entire old version).
inetd version is less than 10% of old one!
function old new delta
packed_usage 22083 22105 +22
nobodystr 4 - -4
bind_ip_address 4 - -4
ident_substr 20 - -20
chmatch 22 - -22
movefd 25 - -25
skipchars 49 - -49
handlexitsigs 51 - -51
replyError 70 - -70
.rodata 158120 158024 -96
deleteConn 102 - -102
G 524 388 -136
conns 560 - -560
fakeidentd_main 1457 143 -1314
------------------------------------------------------------------------------
(add/remove: 0/10 grow/shrink: 1/3 up/down: 22/-2453) Total: -2431 bytes
2007-01-11 23:26:13 +00:00
Denis Vlasenko
bf0a201008
style fixes
...
last xcalloc replaced by xzalloc
2006-12-26 10:42:51 +00:00
Denis Vlasenko
bf66fbc8e2
introduce LONE_CHAR (optimized strcmp with one-char string)
2006-12-21 13:23:14 +00:00
Denis Vlasenko
28703015ab
u_short, ulong exterminated
...
fdiskXXX: add a bit of sanity (not enough by far)
2006-12-19 20:32:02 +00:00
Denis Vlasenko
48237b0c88
introduce setsockopt_reuseaddr(int fd), setsockopt_broadcast(int fd),
...
use them where appropriate. 200 bytes saved
2006-11-22 23:22:06 +00:00
Denis Vlasenko
ea62077b85
add open_read_close() and similar stuff
2006-10-14 02:23:43 +00:00
Denis Vlasenko
1385899416
attempt to regularize atoi mess.
2006-10-08 12:49:22 +00:00
Denis Vlasenko
8f8f268cfd
bb_applet_name -> applet_name
2006-10-03 21:00:43 +00:00
Denis Vlasenko
67b23e6043
getopt_ulflags -> getopt32.
...
It is impossible to formulate sane ABI based on
size of ulong because it can be 32-bit or 64-bit.
Basically it means that you cannot portably use
more that 32 option chars in one call anyway...
Make it explicit.
2006-10-03 21:00:06 +00:00
Denis Vlasenko
c1876d7364
inetd: deindent main loop, other readability enhancements
2006-09-23 15:58:01 +00:00
Denis Vlasenko
ec17d437ab
inetd: reformat with tabs for indentation
2006-09-23 15:18:38 +00:00
Denis Vlasenko
3538b9a882
Implement optional syslog logging using ordinary
...
bb_xx_msg calls, and convert networking/* to it.
The rest of bbox will be converted gradually.
2006-09-06 18:36:50 +00:00
Rob Landley
099ed50f91
Unbreak allbareconfig a bit. (The telnetd.c fix is a perfect example of why
...
applets which are a forest of #ifdefs are unmaintainable.)
2006-08-28 09:41:49 +00:00
Bernhard Reutner-Fischer
d591a360d3
- merge -r15463:15564 from busybox_scratch branch through these changesets:
...
------------------------------------------------------------------------
r15465 | aldot | 2006-06-21 20:48:06 +0200 (Wed, 21 Jun 2006) | 3 lines
- use CONFIG_BUSYBOX_EXEC_PATH as before it one was broken by a recent revert.
- use xchdir() since all is invain if it fails there anyways, supposedly
------------------------------------------------------------------------
r15466 | aldot | 2006-06-21 20:55:16 +0200 (Wed, 21 Jun 2006) | 2 lines
- adjust docs to take CONFIG_BUSYBOX_EXEC_PATH into account.
------------------------------------------------------------------------
r15467 | aldot | 2006-06-21 21:31:24 +0200 (Wed, 21 Jun 2006) | 18 lines
- partial fallout of my TREE_USED touchup against gcc-4.2: rip unused vars, save
s 144 bytes
text data bss dec hex filename
862434 10156 645924 1518514 172bb2 busybox.old
862322 10156 645892 1518370 172b22 busybox
function old new delta
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
new_text 70 60 -10
ipaddr_list_link 33 23 -10
gzip_main 898 822 -76
------------------------------------------------------------------------------
(add/remove: 0/6 grow/shrink: 0/3 up/down: 0/-120) Total: -120 bytes
------------------------------------------------------------------------
r15468 | aldot | 2006-06-21 21:43:05 +0200 (Wed, 21 Jun 2006) | 19 lines
- remove useless global exports
function old new delta
rpm_main 940 1601 +661
rpm_getstring 107 112 +5
rpm_getint 148 153 +5
loop_through_files 103 106 +3
fileaction_dobackup 115 113 -2
fileaction_list 5 - -5
rpm_getcount 42 - -42
extract_cpio_gz 161 - -161
rpm_gettags 504 - -504
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 4/1 up/down: 674/-714) Total: -40 bytes
text data bss dec hex filename
862322 10156 645892 1518370 172b22 busybox.old
862290 10156 645892 1518338 172b02 busybox
------------------------------------------------------------------------
r15555 | aldot | 2006-06-30 14:10:11 +0200 (Fri, 30 Jun 2006) | 22 lines
- shrink syslog a little bit, move a big buffer (for 'line') off the bss, fold s
emaphore stuff into single caller manually.
stats:
function old new delta
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
small 1 - -1
local_logging 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
syslogd_main 1299 1285 -14
static.res 36 16 -20
.rodata 186650 186586 -64
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/5 grow/shrink: 2/3 up/down: 48/-1136) Total: -1088 bytes
cow@s37:~/src/busybox_scratch$ size sysklogd/syslogd.o{.orig,}
text data bss dec hex filename
3723 348 5242 9313 2461 sysklogd/syslogd.o.orig
3697 348 4188 8233 2029 sysklogd/syslogd.o
==============================================================================
Overall bloatcheck for the changeset mentioned above:
function old new delta
rpm_main 953 1608 +655
logMessage 395 427 +32
message 1245 1257 +12
opts - 4 +4
rpm_getstring 107 110 +3
rpm_getint 148 151 +3
loop_through_files 103 104 +1
small 1 - -1
fileaction_dobackup 115 113 -2
z_len 4 - -4
textend 4 - -4
part_nb 4 - -4
local_logging 4 - -4
insize 4 - -4
ifile_size 4 - -4
do_link 4 - -4
doRemoteLog 4 - -4
circular_logging 4 - -4
fileaction_list 5 - -5
new_text 70 60 -10
ipaddr_list_link 33 23 -10
clear_bufs 31 21 -10
syslogd_main 1287 1273 -14
builtin_help 190 176 -14
static.res 36 16 -20
builtin_source 229 199 -30
rpm_getcount 42 - -42
gzip_main 842 786 -56
.rodata 227176 227112 -64
lash_main 609 527 -82
busy_loop 3883 3739 -144
extract_cpio_gz 155 - -155
rpm_gettags 501 - -501
static.line 1025 - -1025
------------------------------------------------------------------------------
(add/remove: 1/15 grow/shrink: 6/12 up/down: 710/-2221) Total: -1511 bytes
2006-08-20 17:35:13 +00:00
Rob Landley
d921b2ecc0
Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
...
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only
had one user), clean up lots of #includes... General cleanup pass. What I've
been doing for the last couple days.
And it conflicts! I've removed httpd.c from this checkin due to somebody else
touching that file. It builds for me. I have to catch a bus. (Now you know
why I'm looking forward to Mercurial.)
2006-08-03 15:41:12 +00:00
Rob Landley
afb94ecf2b
Convert setuid/setgid users to xsetuid/xsetgid.
2006-07-16 08:06:34 +00:00
"Robert P. J. Day"
63fc1a9e08
Standardize on the vi editing directives being on the first line.
2006-07-02 19:47:05 +00:00
Bernhard Reutner-Fischer
c418d482ba
- s/defined(__uClinux__)/BB_NOMMU/
...
This needs a second pass to:
+ add bb_daemon(unsigned char no_chdir, unsigned char no_close, const char*flag)
+ eventually globally export argc and argv, so we don't need to pass it to
bb_daemon().
2006-05-31 10:19:51 +00:00
Rob Landley
299a6b4d7b
Consolidate #include <sys/time.h> so libbb.h does it.
2006-05-27 21:42:58 +00:00
Bernhard Reutner-Fischer
2c99851181
- patch from Denis Vlasenko to add and use bb_xdaemon()
2006-04-12 18:09:26 +00:00