Denis Vlasenko
eda43d7f45
ifupdown: mke it possible to use DHCP clients different from udhcp.
2007-05-02 22:04:38 +00:00
Denis Vlasenko
d01ff13454
hush: simplify debugging prints a little bit
2007-05-02 21:40:23 +00:00
Denis Vlasenko
dd999a2241
klogd: remove dependency on syslogd
2007-05-02 21:39:29 +00:00
Denis Vlasenko
bd100b7478
ifupdown: reread state file before rewriting it.
...
Fixes "ifup started another ifup" state corruption bug.
Patch by Natanael Copa <natanael.copa@gmail.com >.
2007-05-02 21:38:44 +00:00
Denis Vlasenko
4ac530c0ef
hush: add debugging for tracing execution,
...
add FIXME for 'true | exit 3; echo $?' case
2007-05-02 15:35:45 +00:00
Denis Vlasenko
ef36ead370
hush: fix incorrect exitcodes without job control
2007-05-02 15:34:47 +00:00
Denis Vlasenko
dcf4de20a1
test: code size saving, no logic changes
...
ps: fix warning, make a bit smaller
kill -l: make smaller & know much more signals
function old new delta
get_signum 121 153 +32
kill_main 826 843 +17
get_signame 44 36 -8
signals 252 224 -28
.rodata 131955 131923 -32
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/3 up/down: 49/-68) Total: -19 bytes
2007-05-01 20:07:29 +00:00
Denis Vlasenko
f20de5bb42
ash,kill: use common code for kill applet/builtin
...
# make bloatcheck
function old new delta
evaltreenr 644 654 +10
evaltree 644 654 +10
parse_conf 1440 1444 +4
dpkg_deb_main 426 429 +3
ed_main 3319 3321 +2
passwd_main 2093 2091 -2
kill_main 830 826 -4
singlemount 4609 4601 -8
find_command 962 954 -8
get_lcm 123 105 -18
.rodata 132243 132147 -96
killcmd 449 120 -329
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/7 up/down: 29/-465) Total: -436 bytes
# size busybox_old busybox_unstripped
text data bss dec hex filename
723901 2940 27504 754345 b82a9 busybox_old
723457 2940 27504 753901 b80ed busybox_unstripped
2007-04-29 23:42:54 +00:00
Denis Vlasenko
d4728145e3
run_parts: do not check path portion of a name for "bad chars".
...
Needed for ifupdown. Patch by "Gabriel L. Somlo" <somlo@cmu.edu >
2007-04-29 23:38:12 +00:00
Denis Vlasenko
08c8c1d3b3
ash: fix infinite loop on exit if tty is not there anymore
2007-04-28 22:39:02 +00:00
Denis Vlasenko
e3f2f89891
hush: make job control and interactiveness configurable, part 2
2007-04-28 16:48:27 +00:00
Denis Vlasenko
b81b3df1fa
hush: make job control and interactiveness configurable, part 1
2007-04-28 16:48:04 +00:00
Denis Vlasenko
0937be5fa6
hush: make hush properly detect EOF on stdin (even interactive one -
...
think about pty being destroyed) and exit.
2007-04-28 16:47:08 +00:00
Denis Vlasenko
b5eaabb322
hush: add Ctrl-C handling to nofork case
2007-04-28 16:45:59 +00:00
Denis Vlasenko
3ac0e00553
hush: better signal handling across ctrl-z
2007-04-28 16:45:22 +00:00
Denis Vlasenko
18e19f2b0d
hush: fix nofork + ctrl-Z clobbering of globals
2007-04-28 16:43:18 +00:00
Denis Vlasenko
a6a1785a30
hush: add ctrl-Z handling for nofork'ed case
2007-04-28 16:42:11 +00:00
Denis Vlasenko
706fdc98c3
find_root_device: use lstat - don't follow links
2007-04-21 23:28:03 +00:00
Denis Vlasenko
1359da6ac7
hush: make Ctrl-Z work (at least sometimes)
2007-04-21 23:27:30 +00:00
Denis Vlasenko
762d35c75f
hust: add a comment
2007-04-21 17:28:51 +00:00
Denis Vlasenko
52881e9f23
hush: fix more backgrounding bugs. Plenty of them remains still.
2007-04-21 13:42:52 +00:00
Denis Vlasenko
2f1bb36a55
hush: explain why "pipe; exit $?" doesn't show correct exitcode
2007-04-21 10:01:14 +00:00
Denis Vlasenko
87cb2db703
hush: do not print message if killed by signal;
...
move some functions up before main()
2007-04-21 10:00:01 +00:00
Denis Vlasenko
54e7ffb3a4
hush: begin fixing non-functional job control
2007-04-21 00:03:36 +00:00
Denis Vlasenko
5f786c24e4
hush: small code shrink; style fixes
2007-04-20 08:35:45 +00:00
Denis Vlasenko
f6250a3bee
dd: NOEXEC fix
...
dd: correct wrongly capitalized constant
2007-04-19 20:16:14 +00:00
Denis Vlasenko
d1801a4430
dd: fix skip= parse error (spotted by Dirk Clemens <develop@cle-mens.de>)
2007-04-19 20:08:19 +00:00
Denis Vlasenko
9ace613406
stty: fix option parsing bug (spotted by Sascha Hauer <s.hauer@pengutronix.de>)
2007-04-19 19:55:54 +00:00
Denis Vlasenko
05a6d9cbb2
doc: add README on shell job control
2007-04-19 17:26:34 +00:00
Denis Vlasenko
8581863a1b
procps: remove all global variables
...
text data bss dec hex filename
1462 14 24 1500 5dc busybox.t2/procps/ps.o
1484 0 0 1484 5cc busybox.t3/procps/ps.o
3122 0 252 3374 d2e busybox.t1/procps/top.o
3117 0 0 3117 c2d busybox.t3/procps/top.o
2007-04-19 14:47:11 +00:00
Denis Vlasenko
516a0ca2dc
ps: add -o tty and -o rss support
...
1373 14 24 1411 583 busybox.t1/procps/ps.o
1462 14 24 1500 5dc busybox.t2/procps/ps.o
2007-04-19 14:46:14 +00:00
Denis Vlasenko
c34d35557b
loop device code: readability improvement
2007-04-19 00:09:34 +00:00
Denis Vlasenko
3ace9fa6d8
switch_root: error_msg -> perror_msg, reduce by 22 bytes while at it.
2007-04-18 21:40:30 +00:00
Denis Vlasenko
088b959d00
"Unify base64 handling" is done, remove TODO
2007-04-18 21:14:46 +00:00
Denis Vlasenko
2ace1e3f07
make "busybox" w/o args work again, and save 10 bytes in the process.
2007-04-18 21:00:21 +00:00
Denis Vlasenko
55b2de71d7
hush: remove stray semicolon (should change nothing)
2007-04-18 17:21:28 +00:00
Denis Vlasenko
517d1aac7f
ether-wake: save a few more bytes of code
2007-04-16 23:23:33 +00:00
Denis Vlasenko
198714c0dd
ether-wake: close bug 1317. Reorder fuctions to avoid
...
forward refs while at it
2007-04-16 23:16:37 +00:00
Denis Vlasenko
7d4c44e1b1
shells: remove few statics and duplicated code
...
(much more of the same remains, alas)
function old new delta
doset 330 332 +2
warn 53 51 -2
onecommand 463 461 -2
ioecho 40 38 -2
forkexec 1412 1410 -2
err 81 79 -2
setdash 59 56 -3
flag 4 - -4
msh_main 1389 1384 -5
eval 388 381 -7
subgetc 759 747 -12
static.local 14 - -14
b_adduint 70 52 -18
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/10 up/down: 2/-73) Total: -71 bytes
2007-04-16 22:34:39 +00:00
Denis Vlasenko
ac678ec2f1
style fixes, no code changes
2007-04-16 22:32:04 +00:00
Denis Vlasenko
17e3c34aa7
applet.c: ruid is needed only if FEATURE_SUID=y
2007-04-16 20:55:27 +00:00
Denis Vlasenko
0922192740
lineedit: state->hist_file doesn't exist if !FEATURE_EDITING_SAVEHISTORY,
...
#ifdef it out
2007-04-15 13:21:01 +00:00
Denis Vlasenko
84f75b0b94
doc: fix code example which may provoke warning
2007-04-15 11:50:41 +00:00
Denis Vlasenko
8acf521432
e2fsprogs: stop using statics in chattr. Minor code shrinkage (-130 bytes)
2007-04-15 11:48:27 +00:00
Denis Vlasenko
be1a9d4237
deluser: add optional support for removing users from groups
...
(by Tito <farmatito@tiscali.it >)
2007-04-15 08:43:23 +00:00
Denis Vlasenko
91de7c0328
update style-guide.txt
2007-04-15 08:39:39 +00:00
Denis Vlasenko
58394b1e29
xargs: simplify word list management
2007-04-15 08:38:50 +00:00
Denis Vlasenko
e471275813
msh: style fixes
...
shell/README - a place to record things about busybox shells
2007-04-14 15:08:41 +00:00
Denis Vlasenko
5f9468e996
lineedit: nuke two unused variables and code which sets them
...
applets: do not even try to read config if run by real root
msh: use named constants (O_RDONLY etc) in open() instead of magic numbers,
other minor code size reduction.
2007-04-14 13:22:09 +00:00
Denis Vlasenko
8a28e620ce
lash: recognize and use NOFORK applets
...
lash,hush: fix kill buglet (didn't properly recognize ESRCH)
2007-04-14 11:16:29 +00:00
Denis Vlasenko
bf3561fd15
lineedit: do not try to open NULL history file
2007-04-14 10:10:40 +00:00
Denis Vlasenko
f5294e1f4c
hush: use NOFORK applets as appropriate. Net reduction of code size.
2007-04-14 10:09:57 +00:00
Denis Vlasenko
16abcd90ae
teach find_root_device to deal with /dev/ subdirs
...
(by "Kirill K. Smirnov" <lich@math.spbu.ru >)
2007-04-13 23:59:52 +00:00
Denis Vlasenko
334fa9bcb5
dpkg: use nitfields which are a bit closer to typical ushort.
...
Code size -800.
2007-04-13 23:22:58 +00:00
Denis Vlasenko
87468857f6
style fixes
2007-04-13 23:22:00 +00:00
Denis Vlasenko
f7fcca4af7
sourse_route_list -> source_route_list
2007-04-13 22:07:21 +00:00
Denis Vlasenko
1d6a4aec2c
make xsocket die with address family printed (if VERBOSE_RESOLUTION_ERRORS=y)
2007-04-13 21:26:20 +00:00
Denis Vlasenko
fbf6dea5a2
hush: more style fixes.
2007-04-13 19:56:56 +00:00
Denis Vlasenko
f03dbeda90
hush: comment out and replace bug in set_local_var:
...
- if (value == 0 && ++value == 0) {
+ /*if (value == 0 && ++value == 0) ??? -vda */
+ if (value == NULL || value[1] == '\0') {
Style fixes.
2007-04-13 19:55:50 +00:00
Denis Vlasenko
b636d8c18c
shell/: add SUSv3 doc for fast & easy reference
2007-04-13 19:44:22 +00:00
Denis Vlasenko
beaca811e4
fix typo in comment
2007-04-13 16:32:26 +00:00
Denis Vlasenko
62f0479cf1
find: add support for -delete, -path (by Natanael Copa)
2007-04-13 10:00:12 +00:00
Denis Vlasenko
945bd3dee8
sed: fix escaped newlines in -f; fix multiple -f and -e
...
(broke when getopt32 was fixed to not reverse the list)
2007-04-12 21:20:25 +00:00
Denis Vlasenko
3211adc184
login: fixing my brainfart: xspawn(t_argv) <- was using argv!
2007-04-12 20:33:01 +00:00
Denis Vlasenko
b69f35effe
lash: "forking" applets are actually can be treated the same way as "non-forked".
...
Also save a bit of space on trailing NULL array elements.
2007-04-12 17:10:45 +00:00
Denis Vlasenko
7cced6e574
fix realloc-of-non-malloced pointer, and reduce size while at it
2007-04-12 17:08:53 +00:00
Denis Vlasenko
0de3c55b42
login: remove setpgrp call (makes it work from shell prompt again).
...
login: sanitize stdio descriptors (we are suid, need to be careful!)
shrink login and set_environment by ~100 bytes.
2007-04-12 12:31:02 +00:00
Denis Vlasenko
831a20f512
pass a copy of argv[i] to NOFORK applets (they may permute it etc).
...
set/save/restore more shared global variables whan call one applet from another
2007-04-12 12:27:32 +00:00
Denis Vlasenko
51742f4bb0
style fixes. No code changes
2007-04-12 00:32:05 +00:00
Denis Vlasenko
50f7f446ec
bb_full_fd_action: remove potential xmalloc from NOFORK path
...
cat: stop using stdio.h opens
libbb: introduce & use open[3]_or_warn
function old new delta
open3_or_warn - 54 +54
bb_cat 115 144 +29
open_or_warn - 25 +25
unlzma 2404 2412 +8
chattr_main 334 339 +5
xstrtoul_range_sfx 251 255 +4
telnet_main 1514 1510 -4
static.opt 4 - -4
qgravechar 122 118 -4
fuser_add_pid 61 54 -7
fuser_add_inode 154 147 -7
writeFileToTarball 1542 1534 -8
refresh 1156 1148 -8
do_show 856 846 -10
read_leases 212 200 -12
setup_redirects 236 222 -14
iproute_list_or_flush 1582 1568 -14
read_config 427 411 -16
write_leases 284 264 -20
hash_file 338 318 -20
copy_file 1760 1740 -20
do_iproute 2610 2588 -22
bb_full_fd_action 320 269 -51
open_to_or_warn 103 49 -54
fuser_main 1660 1596 -64
.rodata 131160 131096 -64
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 4/19 up/down: 125/-423) Total: -298 bytes
2007-04-11 23:20:53 +00:00
Denis Vlasenko
d7c8196c1b
ash: fix kill -l (by Mats Erik Andersson <mats.andersson64@comhem.se>)
2007-04-11 20:43:31 +00:00
Denis Vlasenko
8fd371276f
fix typo in doc
2007-04-11 19:27:22 +00:00
Denis Vlasenko
6398cf477d
style fixes, no code changes.
2007-04-11 17:04:29 +00:00
Denis Vlasenko
e4f2d064b0
rename: run_applet_by_name -> run_applet_and_exit
2007-04-11 17:03:19 +00:00
Denis Vlasenko
0d058361e7
Add NOFORK/NOEXEC documentation.
2007-04-11 16:16:41 +00:00
Denis Vlasenko
03fc408de6
fix typo in comment
2007-04-11 07:36:31 +00:00
Denis Vlasenko
d571c08c25
fix misplaced #if
2007-04-11 07:26:56 +00:00
Denis Vlasenko
473dae080a
add more convenient defines for [NO]MMU:
...
"#ifndef BB_NOMMU" is a double negative
2007-04-11 07:04:23 +00:00
Denis Vlasenko
f1a7141cfc
random NOMMU fixes. compressed --help really does work for NOMMU! /me happy
2007-04-10 23:32:37 +00:00
Denis Vlasenko
80d14beae9
Rename two config options:
...
FEATURE_SH_STANDALONE_SHELL => FEATURE_SH_STANDALONE
FEATURE_EXEC_PREFER_APPLETS => FEATURE_PREFER_APPLETS
Make SH_STANDALONE depend on PREFER_APPLETS.
getopt.c: more randomconfig-induced fixes
2007-04-10 23:03:30 +00:00
Denis Vlasenko
8905496444
xargs: fix my brain fart (resulted in memory leak)
2007-04-10 21:41:16 +00:00
Denis Vlasenko
c6758a07c6
make compressed help code NOMMU- and NOFORK-friendly -
...
no forking anymore, bunzip2 unpack routine now does all it in memory.
2007-04-10 21:40:19 +00:00
Denis Vlasenko
335b63d8d1
make a few struct bb_applet members conditional
...
rename sllep_and_die -> xfunc_die
make fflush_stdout_and_exit NOFORK-safe
fix some buglets found by randomconfig
2007-04-10 21:38:30 +00:00
Denis Vlasenko
246b5c3916
one-liner: fix indentation
2007-04-10 17:18:12 +00:00
Denis Vlasenko
b38cf3ff8a
bunzip2: big style cleanup. No code changes apart from one s/write/safe_write/
...
(verified with objdump).
2007-04-10 17:16:33 +00:00
Denis Vlasenko
a9d7d24e1f
echo: fix regression ("echo" with no arguments didn't print newline.
...
echo: use fputs if no options are given. Code growth ~15 bytes.
Old:
# time ./busybox find $bigdir -exec echo {} \; >/dev/null
real 0m2.038s
user 0m0.761s
sys 0m0.953s
New:
# time ./busybox find $bigdir -exec echo {} \; >/dev/null
real 0m1.781s
user 0m0.781s
sys 0m0.939s
For comparison: without NOFORK:
# time find $bigdir -exec echo {} \; >/dev/null
real 1m51.129s
user 0m38.442s
sys 1m3.350s
2007-04-10 16:34:00 +00:00
Denis Vlasenko
99912ca733
audit small applets and mark some of them as NOFORK.
...
Put big scary warnings in relevant places.
2007-04-10 15:43:37 +00:00
Denis Vlasenko
ff131b980d
style fixes. No code changes.
2007-04-10 15:42:06 +00:00
Denis Vlasenko
3f3aa2a57d
make xfunctions optionally longjump instead of exit.
...
use it for making NOFORK more practical.
touch: make it a NOFORK applet
2007-04-09 21:35:07 +00:00
Denis Vlasenko
cd7001f705
factor out NOFORK/NOEXEC code from find. Use it for xargs too.
2007-04-09 21:32:30 +00:00
Denis Vlasenko
1b4b2cb20e
xargs: shrink code, ~80 bytes
...
applets.h: +#undef APPLET_NOEXEC
2007-04-09 21:30:53 +00:00
Denis Vlasenko
53d445aa75
wait4pid: if passed with pid < 0, do not set errno - it is already set by exec!
2007-04-09 13:21:33 +00:00
Denis Vlasenko
7e754f12d3
Implement first instance of NOFORK applet - echo
...
find: use NOFORK/NOEXEC; small -exec buglet also eliminated
vfork_daemon_rexec: honor PREFER_APPLETS
echo: small size improvements
find -exec echo {} \; with PREFER_APPLETS=y runs 4 times faster
2007-04-09 13:04:50 +00:00
Denis Vlasenko
2dfdd44d9d
busybox: fix "<applet>: applet not found" message
2007-04-09 03:29:43 +00:00
Denis Vlasenko
c44ab01b75
Improve STANDALONE_SHELL. "safe" applets are renamed NOEXEC applets
...
and now this fact is recorded in applets.h, not ash.c.
Several fixes to "--help + STANDALONE_SHELL" scenarios.
function old new delta
run_current_applet_and_exit - 355 +355
arith 2064 2073 +9
refresh 1148 1156 +8
getopt32 1068 1073 +5
telnet_main 1510 1514 +4
md5_sha1_sum_main 565 566 +1
xstrtoul_range_sfx 255 251 -4
packed_usage 22523 22514 -9
tryexec 255 203 -52
static.safe_applets 152 - -152
.rodata 131320 131128 -192
run_applet_by_name 869 506 -363
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 5/5 up/down: 382/-772) Total: -390 bytes
./busybox ash -c 'i=20000; while test $i != 0; do touch z; i=$((i-1)); done'
runs more than twice as fast with STANDALONE_SHELL versus without.
2007-04-09 03:11:58 +00:00
Denis Vlasenko
95cb3263ae
msh: smallish code shrinkage; cosmetics
2007-04-09 03:06:34 +00:00
Denis Vlasenko
32b633aa3f
merge busybox.c into applets.c
2007-04-09 03:05:48 +00:00
Denis Vlasenko
786834bcee
applets.h: de-obfuscate
2007-04-08 17:30:10 +00:00
Denis Vlasenko
240a1cfbbe
add some missed statics on constant objects.
...
fix few #ifndef ENABLE_xxx
# size busybox_old busybox_unstripped
text data bss dec hex filename
677152 2920 18208 698280 aa7a8 busybox_old
676420 2920 18208 697548 aa4cc busybox_unstripped
2007-04-08 16:07:02 +00:00
Denis Vlasenko
5694d5f8d2
adding small script, mostly for documentational purposes
2007-04-08 15:12:21 +00:00