Commit Graph

13408 Commits

Author SHA1 Message Date
Denys Vlasenko
d8290c2ef0 libbb: fix thinko in rtc_xopen()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-02 09:07:16 +02:00
Denys Vlasenko
528808fa7b libbb: make rtc_xopen try harder on EBUSY
function                                             old     new   delta
rtc_xopen                                             77     139     +62

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-02 09:05:03 +02:00
Denys Vlasenko
fe33683c8b Fix compile failures
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-02 07:18:55 +02:00
Denys Vlasenko
43b8a1cc38 crond: implement "SHELL=prog" in crontab. Export LOGNAME as POSIX wants
function                                             old     new   delta
fork_job                                             343     456    +113
load_crontab                                         688     777     +89
crond_main                                          1456    1434     -22
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 202/-22)           Total: 180 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-30 17:38:27 +02:00
Denys Vlasenko
d5929d602e crond: simplify logging code
Slight change in behavior: now -l 5 will enable the same messages
formerly only enabled for -d 5. (Old behavior was non-sensical).

function                                             old     new   delta
reopen_logfile_to_stderr                               -      34     +34
log8                                                   -      26     +26
log7                                                   -      26     +26
log5                                                   -      26     +26
load_crontab                                         706     688     -18
rescan_crontab_dir                                   157     137     -20
crond_main                                          1486    1456     -30
fork_job                                             389     343     -46
crondlog                                             108      38     -70
------------------------------------------------------------------------------
(add/remove: 4/0 grow/shrink: 0/5 up/down: 112/-184)          Total: -72 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-30 14:49:52 +02:00
Denys Vlasenko
3dfe0ae5a8 libbb: make syslog level for bb_error_msg's configurable. use it in crond
function                                             old     new   delta
bb_verror_msg                                        380     386      +6
syslog_level                                           -       1      +1
crondlog                                             165     108     -57

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-30 14:48:28 +02:00
Denys Vlasenko
01a1a967c9 crond: tweak help text, make course less cryptic
function                                             old     new   delta
packed_usage                                       29736   29740      +4
crond_main                                          1485    1486      +1
load_crontab                                         712     706      -6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-30 14:47:28 +02:00
Denys Vlasenko
07e5555a8f modprobe-small: (un)load all modules which match the alias, not only first one
Closes 627 and 7034.

Commonly seen case is (un)loading of an alias
which matches ata_generic and a more specific ata module.

For example:

modprobe [-r] pci:v00008086d00007010sv00000000sd00000000bc01sc01i80
(ata_generic and pata_acpi)

modprobe [-r] pci:v00001106d00000571sv00001509sd00009022bc01sc01i8a
(ata_generic and pata_via)

function                                             old     new   delta
process_module                                       615     728    +113
parse_module                                         309     395     +86
find_alias                                           621     653     +32
pathname_matches_modname                              78      79      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 232/0)             Total: 232 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-21 16:59:36 +02:00
Denys Vlasenko
5a21c8550e ntpd: fix wrong delay value in one of the printed messages
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-20 13:04:23 +02:00
Denys Vlasenko
d531f93f64 ntpd: truly ignore high delay packet
Before this cahnge, sometimes they were used after the next packet
from another peer was received, because we did updare some peer stats
from high delay packet before dropping it.

function                                             old     new   delta
recv_and_process_peer_pkt                            922     966     +44

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-19 19:00:16 +02:00
Denys Vlasenko
6116cb23cc modprobe-small: remove redundant aliases from modules.dep.bb
function                                             old     new   delta
parse_module                                         309     395     +86

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-19 16:17:27 +02:00
Denys Vlasenko
5fd3ddfb24 modprobe-small: fix help messages for aliased module-related applets
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-19 15:04:39 +02:00
Denys Vlasenko
e152cb8189 adjtimex: make its help text and printed data a bit less cryptic
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-17 11:29:34 +02:00
Denys Vlasenko
eb9f485b07 libbb/obscure.c: code shrink. Suggested by Tito.
function                                             old     new   delta
string_checker                                        97      92      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-16 19:51:34 +02:00
Denys Vlasenko
3fa97af7cc ash,hush: set $HOSTNAME is bash compat. Closes 7028
function                                             old     new   delta
hush_main                                           1056    1128     +72
ash_main                                            1442    1487     +45

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-15 11:43:29 +02:00
Bernhard Reutner-Fischer
ad16741ccd libbb: provide usleep() fallback implementation
POSIX.1-2008 removed the usleep function, provide a fallback
implementaion using the recommended nanosleep().

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-13 16:37:57 +02:00
Denys Vlasenko
69b114fb8a less: fix bugs discovered with "git log -p | less -m" on kernel tree
function                                             old     new   delta
read_lines                                           685     733     +48

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-13 16:02:59 +02:00
Denys Vlasenko
32afd3aa60 vi: some simplifications
function                                             old     new   delta
file_insert                                          301     315     +14
init_text_buffer                                     179     171      -8
colon                                               2889    2878     -11
file_size                                             37       -     -37
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/2 up/down: 14/-56)            Total: -42 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-05 22:57:46 +02:00
Denys Vlasenko
e7430867a8 vi: clear undo buffer when we change to another file
function                                             old     new   delta
init_text_buffer                                     156     190     +34
undo_push                                            360     382     +22
count_lines                                           74      72      -2
undo_pop                                             246     222     -24
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 56/-26)             Total: 30 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-03 12:47:48 +02:00
Denys Vlasenko
2c51202aec vi: undo code shrink
function                                             old     new   delta
undo_push                                            414     395     -19
do_cmd                                              4803    4761     -42

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-03 01:45:05 +02:00
Jody Bruchon
a8d6f9bee4 vi: undo support for vi with intermediate queuing
function                                             old     new   delta
undo_push                                              -     411    +411
undo_pop                                               -     288    +288
do_cmd                                              4160    4426    +266
char_insert                                          363     483    +120
undo_queue_commit                                      -      61     +61
text_hole_delete                                     108     163     +55
string_insert                                         94     127     +33
colon                                               2864    2882     +18
yank_delete                                           92     101      +9
vi_main                                              273     280      +7
dot_scroll                                            88      93      +5
dot_right                                             29      34      +5
dot_prev                                              20      25      +5
dot_next                                              20      25      +5
dot_left                                              24      29      +5
dot_end                                               20      25      +5
dot_begin                                             20      25      +5
init_text_buffer                                     154     156      +2
text_hole_make                                       145     142      -3
file_insert                                          333     318     -15
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 15/2 up/down: 1305/-18)        Total: 1287 bytes

(without queuing it's ~870 bytes)

Signed-off-by: Jody Bruchon <jody@jodybruchon.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-02 13:49:26 +02:00
Drew Moseley
7537406edd build system: specify '-nostldlib' when linking to .o files
For certain cross build scenarios the LD variable is overridden
to use the gcc executive to ensure all the target tuning parameters
are used.  In these cases, the executive errors out as shown below
but since this step is only linking to a .o file the standard libs
are not needed.

    $ make LD=gcc applets/built-in.o
      LD      applets/built-in.o
    /usr/bin/ld: cannot find -lgcc_s
    /usr/bin/ld: cannot find -lgcc_s
    collect2: ld returned 1 exit status
    make[1]: *** [applets/built-in.o] Error 1
    make: *** [applets_dir] Error 2

Signed-off-by: Drew Moseley <drew_moseley@mentor.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-02 12:12:46 +02:00
Tito Ragusa
c9a67133d6 swapon/swapoff: -a returns 0 on ignored errors
Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-01 09:51:27 +02:00
Tito Ragusa
a3f326cd66 swapon/swapoff: size reduction, cleanup, fixes, improvements
1) real swapon/swapoff handles also devices on the commandline with -a;
2) xstat(device)  in  swap_enable_disable aborts on error when cycling through
   fstab so some devices  are not handled;
3) duplicated code for ENABLE_FEATURE_SWAPON_DISCARD and
   ENABLE_FEATURE_SWAPON_PRI was moved to functions.
4) silence some error messages with -a;
5) minor cleanups and code refactoring reduced the size as per bloat-check:
6) I also added support for /proc/swaps handling to swapoff:
"When the -a flag is given, swapping is disabled on all known  swap  devices
 and  files  (as  found  in  /proc/swaps  or /etc/fstab)."
So now swapoff first cycles through  /proc/swaps and then through fstab
to swapoff all devices.

function                                             old     new   delta
set_discard_flag                                       -     106    +106
swap_enable_disable                                  147     238     +91
set_priority_flag                                      -      79     +79
retrieve_file_data                                   470     467      -3
swap_on_off_main                                     638     418    -220
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 1/2 up/down: 276/-223)           Total: 53 bytes

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-31 16:39:26 +02:00
Denys Vlasenko
faa9e94db6 wget: fix a case where progress bar isn't updated if writes are very slow
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-27 16:50:29 +01:00
Matt Whitlock
0a53b203f9 add discard option -d to swapon
Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-23 18:36:23 +01:00
Matt Whitlock
b9bbd4ddf6 fix interaction of -a and -p options in swapon
Swap entries in /etc/fstab inherit the priority specified on the command line unless they have 'pri' in their mount options.

Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-23 18:36:22 +01:00
Matt Whitlock
c3a27b0bfd avoid calling bb_strtou twice in MIN macro expansion
Also, the maximum allowable value of swap priority is technically SWAP_FLAG_PRIO_MASK >> SWAP_FLAG_PRIO_SHIFT.

Signed-off-by: Matt Whitlock <busybox@mattwhitlock.name>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-23 18:36:22 +01:00
Denys Vlasenko
504fe45f35 ntpd: add optional support for /etc/ntp.conf
function                                             old     new   delta
add_peers                                              -      98     +98
packed_usage                                       29470   29511     +41
ntp_init                                             407     428     +21
pw_encrypt                                            14      27     +13
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/0 up/down: 173/0)             Total: 173 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-23 18:34:51 +01:00
Denys Vlasenko
f332617fbd docs/new-applet-HOWTO.txt: tweak a bit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-17 15:06:29 +01:00
Denys Vlasenko
c50493854a libbb: fix a bad check for uclibc >= 0.9.31
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-16 20:53:40 +01:00
Bartosz Golaszewski
9dbe4d0547 docs: update new-applet-HOWTO.txt
This patch adds some information about the gen_build_files.sh script and how
it allows to keep the Kbuild, Config.in etc. declarations in .c files.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-16 18:47:44 +01:00
Denys Vlasenko
109ee5d336 ash: make "locak VAR" unset VAR (bash does that)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-16 18:41:11 +01:00
Denys Vlasenko
438b4ac286 script: make it work even if fd 0 is closed
Testcase:
script -q -c "echo hey" /dev/null 0>&-

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-16 12:34:53 +01:00
Denys Vlasenko
29f3526048 build system: for "find", use POSIX not operator (!) instead of -not
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-16 12:05:58 +01:00
Romain Naour
0e3334c8d8 su: add a delay if the password is incorrect
Signed-off-by: Romain Naour <romain.naour@openwide.fr>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-16 11:18:19 +01:00
Denys Vlasenko
ac03a40cba ash,hush: fix a thinko about 2^64-1 factorization
function                                             old     new   delta
next_random                                          113     119      +6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-15 09:25:46 +01:00
Denys Vlasenko
2bba591991 hush: make "true" built-in
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-14 12:43:57 +01:00
Denys Vlasenko
f93187512d random: cosmetic tweaks in debug code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-13 13:03:27 +01:00
Denys Vlasenko
fb183076a3 ash,hush: improve randomness of $RANDOM, add easy-ish way to test it
function                                             old     new   delta
next_random                                           68     113     +45
change_random                                        103     121     +18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-13 12:52:43 +01:00
Denys Vlasenko
69f9567de2 shuf: trim help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-07 14:41:53 +01:00
Denys Vlasenko
102f0d0d07 shuf: do not use strings for -i RANGE case
function                                             old     new   delta
shuf_main                                            482     496     +14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-07 14:32:39 +01:00
Bartosz Golaszewski
190693ced1 shuf: improve help text
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-07 14:07:35 +01:00
Bartosz Golaszewski
58adbb5505 shuf: fix a segfault on 'shuf -e'
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-07 11:46:03 +01:00
Denys Vlasenko
0ed5f7aacd use [s]rand(), not [s]random()
rand() is the most standard C library function,
and on uclibc they are the same. I guess
they are the same in most todays' libc...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-05 18:58:15 +01:00
Denys Vlasenko
2cdcb1082c shuf: new applet
function                                             old     new   delta
shuf_main                                              -     478    +478
packed_usage                                       29571   29719    +148
applet_names                                        2460    2465      +5
applet_main                                         1428    1432      +4
applet_nameofs                                       714     716      +2
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 4/0 up/down: 637/0)             Total: 637 bytes

Based on the code by Bartosz Golaszewski <bartekgola@gmail.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-05 18:56:20 +01:00
Denys Vlasenko
30f17e9556 man: default to ascii
Default to ascii instead of latin1. Otherwise man pages can be displayed
incorrectly. E.g. bullets show as "<B7>".

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-03 15:14:26 +01:00
Denys Vlasenko
ecd8c3affc ip link: add support for "address ETHADDR". Closes 4862
function                                             old     new   delta
do_iplink                                           2175    2289    +114

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-01 17:38:41 +01:00
Denys Vlasenko
81071e6872 unlzma: add comments about possible bug from BZ 2689
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-28 15:42:10 +01:00
Denys Vlasenko
2108a6f0b5 unlzma: move some variables in "more local" scope
No code changes as verified by objdump

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-28 15:05:43 +01:00