Commit Graph

495 Commits

Author SHA1 Message Date
Denys Vlasenko
da879ec2e9 modprobe: protect against possible SEGV
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-26 08:17:45 +01:00
Denys Vlasenko
9f93d62192 libbb: better unicode width support. Hopefully fixes bug 839.
Also opens up a possibility to make other unicode stuff smaller
and more correct later. but:

function                                             old     new   delta
static.combining                                       -     516    +516
bb_wcwidth                                             -     328    +328
unicode_cut_nchars                                     -     141    +141
mbstowc_internal                                       -      93     +93
in_table                                               -      78     +78
cal_main                                             899     961     +62
static.combining0x10000                                -      40     +40
unicode_strlen                                         -      31     +31
bb_mbstrlen                                           31       -     -31
bb_mbstowcs                                          173     102     -71
------------------------------------------------------------------------------
(add/remove: 7/1 grow/shrink: 1/1 up/down: 1289/-102)        Total: 1187 bytes

Uses code of Markus Kuhn, which is in public domain:
http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
"Permission to use, copy, modify, and distribute this software
 for any purpose and without fee is hereby granted. The author
 disclaims all warranties with regard to this software."

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-24 07:44:03 +01:00
Denys Vlasenko
725b5a387a modprobe: it's not an error if module is already loaded. Closes bug 833
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-10 04:52:45 +01:00
Denys Vlasenko
28055028a7 fold: unicode support. Based on a patch by Tomas Heinrich <heinrich.tomas@gmail.com>
General Unicode support is tweaked to expose unicode_status.

function                                             old     new   delta
init_unicode                                           -      77     +77
write2stdout                                           -      19     +19
adjust_column                                         68      71      +3
unicode_status                                         -       1      +1
unicode_is_enabled                                     1       -      -1
grep_main                                            780     773      -7
fold_main                                            619     552     -67
check_unicode_in_env                                  77       -     -77
------------------------------------------------------------------------------
(add/remove: 3/2 grow/shrink: 1/2 up/down: 100/-152)          Total: -52 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-04 20:49:58 +01:00
Denys Vlasenko
a7ccdeef39 libbb: added xfdopen_for_read/write
function                                             old     new   delta
xfdopen_helper                                         -      40     +40
logdir_open                                         1163    1184     +21
process_stdin                                        433     443     +10
xfdopen_for_write                                      -       9      +9
doCommands                                          2465    2474      +9
patch_main                                          1214    1222      +8
bbunpack                                             457     465      +8
xfdopen_for_read                                       -       7      +7
scan_tree                                            258     262      +4
xstrtoul_range_sfx                                   230     231      +1
sendmail_main                                        957     955      -2
passwd_main                                         1027    1023      -4
parse                                                969     964      -5
test_main                                            253     247      -6
sed_main                                             655     649      -6
dos2unix_main                                        437     429      -8
fbsplash_main                                        950     938     -12
handle_dir_common                                    371     354     -17
expand_vars_to_list                                 2197    2169     -28
update_passwd                                       1275    1246     -29
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 7/10 up/down: 117/-117)           Total: 0 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-15 23:28:11 +01:00
Denys Vlasenko
ab19ede655 tidy up O_NONBLOCK usage. use libbb functions in stty.
Added O_RDONLY where improves readability. Note: O_RDONLY == 0,
so it is there even if not specified.

function                                             old     new   delta
stty_main                                           1289    1235     -54

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-11 21:05:42 +01:00
Denys Vlasenko
f8a73bfa33 lsmod: beautify. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-04 18:01:17 +01:00
Tomas Heinrich
d31a8793eb lsmod: unicode-aware column formatting
Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-26 12:35:30 +01:00
Denys Vlasenko
77c066ea5c modutils: add FEATURE_INSMOD_TRY_MMAP option
function                                             old     new   delta
try_to_mmap_module                                     -     121    +121
bb_init_module_24                                   4514    4578     +64
bb_init_module                                       119     173     +54
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/0 up/down: 239/0)             Total: 239 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-25 04:35:22 +01:00
Denys Vlasenko
6332151641 modprobe-small: added comment about multiple alias matches
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-10-08 22:54:41 +02:00
Denys Vlasenko
1f27ab0d4b *: optimize code size in strtoul calls
function                                             old     new   delta
bb_parse_mode                                        433     431      -2
rtnl_rtntype_a2n                                     202     198      -4
ParseField                                           511     498     -13
bb_init_module_24                                   4730    4675     -55
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-74)             Total: -74 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-23 17:17:53 +02:00
Denys Vlasenko
0c6914e50c modprobe-small: make string buffer code robust; fix help text
together with previous one-liner:

function                                             old     new   delta
append                                                70      99     +29
parse_module                                         295     311     +16
copy_stringbuf                                        35      36      +1
packed_usage                                       26545   26540      -5
appendc                                               27       -     -27
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 3/1 up/down: 46/-32)             Total: 14 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-07 02:38:26 +02:00
Denys Vlasenko
f9c814b0ee modprobe-small: hopefully fix bug 591 (incorrect detection of alias with '-')
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-07 02:37:19 +02:00
Denys Vlasenko
043b1e5d99 more C standard compat fixes from Dan Fandrich
function                                             old     new   delta
docolon                                              207     204      -3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-06 12:47:55 +02:00
Denys Vlasenko
90a9904e9e remove some GNUisms. by Dan Fandrich (dan AT coneharvesters.com)
function                                             old     new   delta
logdirs_reopen                                      1310    1308      -2
read_line_input                                     4757    4753      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-6)               Total: -6 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-06 02:36:23 +02:00
Denys Vlasenko
5da42fce51 modprobe: treat tabs in modules.dep as delimiters too. closes bug 567
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-08-14 02:10:54 +02:00
Denys Vlasenko
bcbd37df24 tweak Config texts and some broken English elsewhere
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-18 13:23:58 +02:00
Denys Vlasenko
7eaf58d958 modprobe: do not use ->probed_name blidly
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-17 20:33:50 +02:00
Denys Vlasenko
ee47f6e44f modprobe: correct exitcode handling and error messages with respect to -q
function                                             old     new   delta
do_modprobe                                          319     339     +20
bb_delete_module                                      10      26     +16
moderror                                              62      71      +9
bb_init_module                                       112     119      +7
modprobe_main                                        488     494      +6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 58/0)               Total: 58 bytes

Signed-off-by: Gilles Espinasse <g.esp@free.fr>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-17 18:46:06 +02:00
Denys Vlasenko
d5f1b1bbe0 *: add FAST_FUNC to function ptrs where it makes sense
function                                             old     new   delta
evalcommand                                         1195    1209     +14
testcmd                                                -      10     +10
printfcmd                                              -      10     +10
echocmd                                                -      10     +10
func_exec                                            270     276      +6
echo_dg                                              104     109      +5
store_nlmsg                                           85      89      +4
pseudo_exec_argv                                     195     198      +3
dotcmd                                               287     290      +3
machtime_stream                                       29      31      +2
discard_stream                                        24      26      +2
argstr                                              1299    1301      +2
killcmd                                              108     109      +1
evalfor                                              226     227      +1
daytime_stream                                        43      44      +1
run_list                                            2544    2543      -1
lookupvar                                             62      61      -1
ipaddr_modify                                       1310    1309      -1
...
parse_stream                                        2254    2245      -9
evalpipe                                             356     347      -9
collect_if                                           210     197     -13
read_opt                                             869     851     -18
handle_dollar                                        681     658     -23
print_addrinfo                                      1342    1303     -39
iterate_on_dir                                       156      59     -97
print_route                                         1709    1609    -100
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 12/130 up/down: 74/-767)       Total: -693 bytes
   text    data     bss     dec     hex filename
 841748     467    7872  850087   cf8a7 busybox_old
 841061     467    7872  849400   cf5f8 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-05 12:06:05 +02:00
Denys Vlasenko
f3cbfc0e2c modprobe: fix more bugs in modprobe -r
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-28 03:54:29 +02:00
Denys Vlasenko
140def848c modprobe: fix modprobe -r. closes bug 315
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-26 12:48:34 +02:00
Denys Vlasenko
bf2af9acb2 flash_lock, flash_unlock: new applets
By Thierry Reding (thierry.reding AT avionic-design.de)

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-25 04:15:37 +02:00
Denys Vlasenko
16bda3bd1f depmod: fix handling of .gz modules
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-05-18 13:08:04 +02:00
Mike Frysinger
1e12ae9059 modprobe: add comment about expected modules.dep format
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-05-06 05:24:41 -04:00
Mike Frysinger
00ffaeab80 modprobe: add more useful debug points
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-05-05 20:13:45 -04: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
0b791d9a97 move llist_find_str from modutils to libbb 2009-04-13 20:52:00 +00:00
Denis Vlasenko
4144504912 modutils: remove redundant sanitization 2009-04-13 20:32:31 +00:00
Denis Vlasenko
1f63229a8e rmmod: fix bug 263
"modutils/rmmod can't remove modules with dash in name on 2.4 kernels"

function                                             old     new   delta
rmmod_main                                           187     220     +33
2009-04-13 02:25:40 +00:00
Denis Vlasenko
51056b382a modutils: small optimization
function                                             old     new   delta
bb_init_module_24                                   4570    4565      -5
2009-04-12 14:21:29 +00:00
Denis Vlasenko
f81e8dbc74 *: make "pragma GCC visibility push(hidden)" less ugly 2009-04-09 12:35:13 +00:00
Denis Vlasenko
f4393046ef modprobe/insmod for 2.4: support compressed modules.
by Guenter (lists AT gknw.net)

function                                             old     new   delta
bb_init_module_24                                   4551    4570     +19
obj_load                                             786     794      +8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 27/0)               Total: 27 bytes
2009-04-05 23:25:09 +00:00
Denis Vlasenko
0d907eab6c modutils: dont pass NULL options to init_module() 2009-03-29 17:25:14 +00:00
Denis Vlasenko
e1de3af989 module loading for 2.4: use fd-based io instead of FILE based;
use xlseek and xread; simpler check for ELF signature.

   text    data     bss     dec     hex filename
 824460     476    7616  832552   cb428 busybox_old
 824333     476    7616  832425   cb3a9 busybox_unstripped
2009-03-29 16:38:59 +00:00
Denis Vlasenko
3b5c9b8885 insmod/modprobe: do not pass NULL to kernel as module parameter 2009-03-13 23:43:26 +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
a6b6f05379 further work on modprobe
function                                             old     new   delta
gather_options_str                                     -      75     +75
config_file_action                                   388     413     +25
load_modules_dep                                     175     192     +17
add_probe                                             67      72      +5
modprobe_main                                        494     488      -6
gather_options                                        89       -     -89
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 3/1 up/down: 122/-95)            Total: 27 bytes
2009-03-06 22:48:11 +00:00
Denis Vlasenko
0e2f362a61 modprobe: rework/speedup by Timo Teras (timo.teras AT iki.fi)
function                                             old     new   delta
load_modules_dep                                       -     175    +175
helper_get_module                                      -     106    +106
gather_options                                         -      89     +89
add_probe                                              -      67     +67
config_file_action                                   345     388     +43
get_or_add_modentry                                    -      10     +10
loaded                                                 4       -      -4
read_config                                          239     234      -5
llist_find                                            34       -     -34
add_option                                            60       -     -60
modprobe_main                                        567     494     -73
do_modprobe                                          601     273    -328
------------------------------------------------------------------------------
(add/remove: 5/3 grow/shrink: 1/3 up/down: 490/-504)          Total: -14 bytes
   text    data     bss     dec     hex filename
 816778     476    7888  825142   c9736 busybox_old
 816768     476    7880  825124   c9724 busybox_unstripped
2009-03-05 16:32:27 +00:00
Denis Vlasenko
c5741003e9 modutils: delete unused global variable
function                                             old     new   delta
modprobe_main                                        570     567      -3
insmod_main                                          101      98      -3
insmod_outputname                                      4       -      -4
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/2 up/down: 0/-10)             Total: -10 bytes
   text    data     bss     dec     hex filename
 816784     476    7892  825152   c9740 busybox_old
 816778     476    7888  825142   c9736 busybox_unstripped
2009-03-05 09:26:17 +00:00
Denis Vlasenko
9604e1b8fc modprobe: emit "can't open 'modules.dep': (errno)" instead of "module not found"
*: s/can't open %s/can't open '%s'/, it's better to use same string.

function                                             old     new   delta
do_modprobe                                          588     601     +13
config_file_action                                   339     345      +6
modprobe_main                                        565     570      +5
unable_to_open                                        14      16      +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 26/0)               Total: 26 bytes
   text    data     bss     dec     hex filename
 816800     476    7892  825168   c9750 busybox_old
 816812     476    7892  825180   c975c busybox_unstripped
2009-03-03 18:47:56 +00:00
Denis Vlasenko
48637e0924 modutils: oveflow fix 2009-02-26 12:00:52 +00:00
Ned Ludd
039ed437d3 make modutils compile again 2009-02-20 04:56:00 +00:00
Denis Vlasenko
a430b695a2 depmod: accept and ignore -r (Linux kernle build needs this) 2009-02-19 01:25:42 +00:00
Denis Vlasenko
49325969e7 modutils-24: code shrink
function                                             old     new   delta
helper_create_alloced_section                          -     117    +117
print_load_map                                       474     450     -24
bb_init_module_24                                   4615    4545     -70
obj_create_alloced_section                           131      30    -101
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/3 up/down: 117/-195)          Total: -78 bytes
2009-01-31 23:33:54 +00:00
Denis Vlasenko
e35af56790 modutils-24: use xasprintf and xzalloc where appropriate,
remove unreachanble code
build system: correct some dependencies in config system
init: convert one #if into if() - for Rob.

function                                             old     new   delta
obj_string_patch                                     136     129      -7
bb_init_module_24                                   4759    4615    -144
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-151)           Total: -151 bytes
2009-01-31 14:22:24 +00:00
Denis Vlasenko
35261159e6 depmod: fix -b option (by timo.teras AT iki.fi)
function                                             old     new   delta
xfreopen_write                                         -      35     +35
parse_module                                         346     353      +7
depmod_main                                          553     546      -7
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 42/-7)              Total: 35 bytes
2009-01-12 22:12:22 +00:00
Denis Vlasenko
54d10059c9 *: tweak error messages
sysctl: shrink; support recursing if name is a directory:
 "sysctl net.ipv4.conf". Patch by xmaks AT email.cz

   text    data     bss     dec     hex filename
 793659     504    7492  801655   c3b77 busybox_old
 793576     504    7492  801572   c3b24 busybox_unstripped
2008-12-24 03:11:43 +00:00
Denis Vlasenko
9e0a7c9c41 remove a few superfluous includes 2008-11-25 13:33:11 +00:00
Bernhard Reutner-Fischer
9a280fa7e6 - documentation fix 2008-11-22 20:30:53 +00:00