Commit Graph

39 Commits

Author SHA1 Message Date
Denys Vlasenko
689d0650ab libbb: shrink recursive_action() by reducing memory pressure
function                                             old     new   delta
recursive_action1                                      -     316    +316
file_action_grep                                     161     164      +3
add_to_prg_cache_if_socket                           202     205      +3
depmod_main                                          509     511      +2
writeFileToTarball                                   488     489      +1
parse_module                                         281     282      +1
fileAction                                           207     208      +1
act                                                  189     190      +1
add_to_dirlist                                        65      64      -1
writeTarFile                                         196     194      -2
uuidcache_init                                        47      45      -2
uuidcache_check_device                               109     107      -2
true_action                                            8       6      -2
run_parts_main                                       310     308      -2
netstat_main                                         534     532      -2
lsusb_main                                            29      27      -2
lspci_main                                            45      43      -2
initial_scan                                         138     136      -2
grep_main                                            845     843      -2
find_main                                            482     480      -2
config_file_action                                   437     435      -2
chmod_main                                           142     140      -2
dirAction                                             14      10      -4
diff_main                                           1544    1540      -4
chown_main                                           154     148      -6
skip_dir                                             136     129      -7
dir_act                                              191     184      -7
recursive_action                                     453      69    -384
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 7/20 up/down: 328/-439)        Total: -111 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-10-01 21:52:16 +02:00
Denys Vlasenko
ebe6d9d875 whitespace and comment format fixes, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-10-05 14:40:24 +02:00
Denys Vlasenko
4f0b540d08 modprobe: do not descend into /etc/modprobe.d/DIR/. Closes 8686
Also expanded comments in recursive_action.c

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-04-06 15:23:26 +02:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 20:14:46 +02:00
Denys Vlasenko
8f7a6d294f find: -follow should not error out on dandling links
function                                             old     new   delta
recursive_action                                     425     465     +40
find_main                                            436     465     +29
test_main                                            247     253      +6
need_print                                             1       -      -1
doCommands                                          2523    2521      -2
compare_keys                                         737     735      -2
xdev_dev                                               4       -      -4
xdev_count                                             4       -      -4
recurse_flags                                          4       -      -4
mkfs_vfat_main                                      1609    1605      -4
actions                                                4       -      -4
fileAction                                           588     583      -5
------------------------------------------------------------------------------
(add/remove: 0/5 grow/shrink: 3/4 up/down: 75/-30)             Total: 45 bytes
   text	   data	    bss	    dec	    hex	filename
 822711	    450	   7684	 830845	  cad7d	busybox_old
 822773	    445	   7668	 830886	  cada6	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-29 11:07:04 +02: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
a60f84ebf0 *: rename ATTRIBUTE_XXX to just XXX. 2008-07-05 09:18:54 +00:00
Denis Vlasenko
a8a3b497fc libbb/recursive_action.c: fix slight error in prev commit 2008-07-04 10:29:30 +00:00
Denis Vlasenko
671691cf21 modutils: optional modutils-small by Vladimir Dronnikov.
15kb smaller than standard one.
libbb/recursive_action.c: commented-out code for aborting the scan.
2008-07-04 10:25:44 +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
2649f215ae open_transformer: fix bug of calling exit instead of _exit
open_transformer: don't leak compressed descriptor anymore
recursive_action: tiny shrink
2008-06-26 03:26:57 +00:00
Denis Vlasenko
68404f13d4 *: add -Wunused-parameter; fix resulting breakage
function                                             old     new   delta
procps_scan                                         1265    1298     +33
aliascmd                                             278     283      +5
parse_file_cmd                                       116     120      +4
dname_enc                                            373     377      +4
setcmd                                                90      93      +3
execcmd                                               57      60      +3
count_lines                                           72      74      +2
process_command_subs                                 340     339      -1
test_main                                            409     407      -2
mknod_main                                           179     177      -2
handle_incoming_and_exit                            2653    2651      -2
argstr                                              1312    1310      -2
shiftcmd                                             131     128      -3
exitcmd                                               46      43      -3
dotcmd                                               297     294      -3
breakcmd                                              86      83      -3
evalpipe                                             353     349      -4
evalcommand                                         1180    1176      -4
evalcmd                                              109     105      -4
send_tree                                            374     369      -5
mkfifo_main                                           82      77      -5
evalsubshell                                         152     147      -5
typecmd                                               75      69      -6
letcmd                                                61      55      -6
add_cmd                                             1190    1183      -7
main                                                 891     883      -8
ash_main                                            1415    1407      -8
parse_stream                                        1377    1367     -10
alloc_procps_scan                                     55       -     -55
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 7/21 up/down: 54/-148)          Total: -94 bytes
   text    data     bss     dec     hex filename
 797195     658    7428  805281   c49a1 busybox_old
 797101     658    7428  805187   c4943 busybox_unstripped
2008-03-17 09:00:54 +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
d166f83d74 md5_sha1_sum: fix mishandling when run as /bin/md5sum (with path)
chown/chgrp: completely match coreutils 6.8 wrt symlink handling

function                                             old     new   delta
recursive_action                                     411     422     +11
arith                                               2033    2042      +9
collect_blk                                          467     474      +7
dhcprelay_main                                      1122    1125      +3
fsck_main                                           1909    1911      +2
singlemount                                         4555    4547      -8
xmalloc_realpath                                      14       -     -14
get_lcm                                              123     105     -18
ed_main                                             3111    3084     -27
chown_main                                           217     183     -34
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 5/4 up/down: 32/-101)           Total: -69 bytes
   text    data     bss     dec     hex filename
 684132    2744   14000  700876   ab1cc busybox_old
 684060    2744   14000  700804   ab184 busybox_unstripped
2007-07-05 00:12:55 +00:00
Denis Vlasenko
bbd695d801 find: fix handling of -prune
recursive_actions: uppercase flag constants
2007-04-08 10:52:28 +00:00
Bernhard Reutner-Fischer
3e816c1252 - fold recurse, depthFirst and dereference params into one param flags.
Minor size improvement (-16b for size, -24b according to bloat-o-meter).
2007-03-29 10:30:50 +00:00
Denis Vlasenko
f7996f3b70 Trailing whitespace removal over entire tree 2007-01-11 17:20:00 +00:00
Denis Vlasenko
5e2db5e8ee build system: small fix for "release" target to work 2006-12-12 23:46:31 +00:00
Denis Vlasenko
5d499e1600 find: a lot more compliant to 'standard' find
(we were not respecting order of actions!).
Add -o and -a handling.
2006-10-29 19:07:01 +00:00
Denis Vlasenko
8c35d65c43 recursive_action: add depth param
chmod: match coreutils versus following links
2006-10-27 23:42:25 +00:00
Denis Vlasenko
3b8fc1c582 recursive_action: preparatory changes. will introduce "int level". 2006-10-27 17:59:14 +00:00
Denis Vlasenko
3a6755f56f grep: add support for -r 2006-10-14 14:24:30 +00:00
Denis Vlasenko
0c45bb23d2 tar: fix "xopen with O_CREAT" warning, improve zero padding write
(was doing zillions of 1-byte write syscalls)
2006-09-09 12:49:03 +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
Bernhard Reutner-Fischer
b1629b1b2a - remove emacs layout block as suggested by Robert P.J. Day
- use shorter boilerplate while at it
2006-05-19 19:29:19 +00:00
Bernhard Reutner-Fischer
cb44816ba3 - add and use bb_opendir(), bb_xopendir().
text    data     bss     dec     hex filename
 889445    9392 1035784 1934621  1d851d busybox.gcc-4.2.orig
 889297    9392 1035784 1934473  1d8489 busybox.gcc-4.2
 889009    9820 1037860 1936689  1d8d31 busybox.gcc-4.1.orig
 888817    9820 1037860 1936497  1d8c71 busybox.gcc-4.1
2006-04-12 07:35:12 +00:00
Eric Andersen
66a56aa028 Vladimir N. Oleynik writes:
Hi.

Last changes (rev 1.12) to recursive_actions() by Christian Grigis
have problem.
Test for demonstrate:

$ mkdir aaa bbb ccc
$ su
# chown root bbb
# chmod 700 bbb
# exit
$ busybox chmod 777 -R .
./bbb: Permision denied

But "./ccc" mode not changed. Previous variant works fine,
errors skiped and continued recursion.


--w
vodz
2004-04-07 17:59:04 +00:00
Eric Andersen
3f47c453da Christian Grigis, christian.grigis at smartdata dot ch writes:
Hello everyone,

Busybox's insmod fails to locate a module when that module is the only one
existing in the /lib/modules directory (with a unique name).

Example:

# find /lib/modules/ -type f
/lib/modules/kernel/drivers/char/bios.o
# insmod bios
insmod: bios.o: no module by that name found
# touch /lib/modules/dummy
# find /lib/modules/ -type f
/lib/modules/kernel/drivers/char/bios.o
/lib/modules/dummy
# insmod bios
Using /lib/modules/kernel/drivers/char/bios.o

As long as there is another file in the /lib/modules directory, insmod
finds it OK.

I tracked the problem down to 'check_module_name_match()' in insmod.c:

It returns TRUE when a match is found, and FALSE otherwise. In the case
where there is only one module in the /lib/modules directory (or more that
one module, but all with the same name), 'recursive_action()' will return
TRUE and we end up on line 4196 in 'insmod.c' which returns an error.
[The reason it works with more than one module with different
names is that in this case there will always be one not matching,
'recursive_action()' will return FALSE and we end up in line 4189.]

Now, from the implementation of 'recursive_action()' and from other
usages of it (tar.c, etc.), it seems to me that FALSE should be returned
to indicate that we want to stop the recursion, so TRUE and FALSE should
be inverted in 'check_module_name_match()'.

At the same time, 'recursive_action()' continues to recurse even after
the recursive call has returned FALSE; again in my understanding and
other usages of it, we can safely stop recursing at this point.


Here is my patch against 1.00-pre8:
2004-04-06 11:56:26 +00:00
Eric Andersen
c7bda1ce65 Remove trailing whitespace. Update copyright to include 2004. 2004-03-15 08:29:22 +00:00
Eric Andersen
cb81e6484d Update a bunch of docs. Run a script to update my email addr. 2003-07-14 21:21:08 +00:00
Glenn L McGrath
393183dccc Vodz, last_patch_86 2003-05-26 14:07:50 +00:00
Manuel Novoa III
cad5364599 Major coreutils update. 2003-03-19 09:13:01 +00:00
Glenn L McGrath
b2e28a0e35 Use error_msg instead of fprintf(stderr 2002-11-28 10:27:50 +00:00
Matt Kraai
1f0c43668a Remove == TRUE' tests and convert != TRUE' and `== FALSE' tests to use !. 2001-12-20 23:13:26 +00:00
Eric Andersen
bdfd0d78bc Major rework of the directory structure and the entire build system.
-Erik
2001-10-24 05:00:29 +00:00
Eric Andersen
04095e58fb Move messages.c to libbb. Make each string in messages.c be its own .o file.
This way, we can new get rid of all that tedious #define rubbish we used to
need to enable specific messages.  This way is enormously simpler, and as a
bonus also ends up saving us 96 bytes.
 -Erik
2001-04-25 05:39:18 +00:00
Eric Andersen
fd402941a7 Patch from Valdimir to reduce stack usage, since recursive_action
is (as the name implies) is recursive, reducing stack memory usage
is important to avoid exhausting available stack memory.
2001-04-10 17:53:49 +00:00
Eric Andersen
1ca20a7747 A nice patch from Larry Doolittle that adds -Wshadow and
cleans up most of the now-revealed problems.
2001-03-21 07:34:27 +00:00
Eric Andersen
aad1a88c76 Convert utility.c into libbb.a. It is now a whole pile of .c
files.  Clean up the resulting damage and fix up the makefile.
 -Erik
2001-03-16 22:47:14 +00:00