oweals/busybox.git
11 years agoudhcpc: tweak math shell style with the metric var
Mike Frysinger [Wed, 27 Feb 2013 06:05:34 +0000 (01:05 -0500)]
udhcpc: tweak math shell style with the metric var

Some shells (like dash) are lame and omit the POSIX increment/decrement
feature (because it is listed as optional).  Tweak the shell script to
work in all POSIX variants.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agoudhcpc: support resolv.conf symlinks
Mike Frysinger [Wed, 27 Feb 2013 06:01:43 +0000 (01:01 -0500)]
udhcpc: support resolv.conf symlinks

Often it is desirable to have /etc/ be on read-only storage (well, the
whole rootfs) but have things like /etc/resolv.conf be symlinks to a
writable location.  Tweak the simple script to support that.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agomdev: add environment variable match
Denys Vlasenko [Mon, 25 Feb 2013 23:40:46 +0000 (00:40 +0100)]
mdev: add environment variable match

function                                             old     new   delta
make_device                                         1998    2189    +191
clean_up_cur_rule                                     61      96     +35
dirAction                                             75      87     +12
mdev_main                                            838     849     +11
packed_usage                                       29272   29273      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 250/0)             Total: 250 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomove endofname() to libbb
Denys Vlasenko [Mon, 25 Feb 2013 23:36:53 +0000 (00:36 +0100)]
move endofname() to libbb

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agotail: make help text for -n +N syntax more correct
Denys Vlasenko [Mon, 25 Feb 2013 06:24:44 +0000 (07:24 +0100)]
tail: make help text for -n +N syntax more correct

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agohead: support -n -NUM and -c -NUM
Denys Vlasenko [Mon, 25 Feb 2013 00:26:09 +0000 (01:26 +0100)]
head: support -n -NUM and -c -NUM

function                                             old     new   delta
head_main                                            406     832    +426
packed_usage                                       29234   29252     +18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 444/0)             Total: 444 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agohead,tail: use common suffix struct. simplify help text.
Denys Vlasenko [Mon, 25 Feb 2013 00:24:32 +0000 (01:24 +0100)]
head,tail: use common suffix struct. simplify help text.

function                                             old     new   delta
head_tail_suffixes                                     -      32     +32
head_main                                            415     406      -9
packed_usage                                       29252   29234     -18
tail_suffixes                                         32       -     -32
head_suffixes                                         32       -     -32
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 0/2 up/down: 32/-91)            Total: -59 bytes
   text    data     bss     dec     hex filename
 890474     497    7584  898555   db5fb busybox_old
 890415     497    7584  898496   db5c0 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agorpm: unmap rpm file before working with next one
Denys Vlasenko [Wed, 20 Feb 2013 15:01:48 +0000 (16:01 +0100)]
rpm: unmap rpm file before working with next one

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agorpm: stop using statics; move main() to the end of the source file
Denys Vlasenko [Wed, 20 Feb 2013 15:01:10 +0000 (16:01 +0100)]
rpm: stop using statics; move main() to the end of the source file

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agorpm: use "create+rename" method of replacing existing files
Denys Vlasenko [Wed, 20 Feb 2013 14:58:42 +0000 (15:58 +0100)]
rpm: use "create+rename" method of replacing existing files

Users were reporting getting errors like
"ls: error while loading shared libraries: libc.so.6: ELF load command past end of file"
while rpm was unpacking glibc tarball.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agorpm: make -ql display more compatible; improve help text
Denys Vlasenko [Wed, 20 Feb 2013 14:57:39 +0000 (15:57 +0100)]
rpm: make -ql display more compatible; improve help text

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agofdisk_sun: fix partition alignment
Aaro Koskinen [Sat, 9 Feb 2013 19:12:26 +0000 (21:12 +0200)]
fdisk_sun: fix partition alignment

When the display unit is sectors, the partition alignment will convert
the partition start to a wrong unit (it should always be in sectors). Fix
this.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agofdisk_sun: fix corrupted partition data with blank disk
Aaro Koskinen [Sat, 9 Feb 2013 19:12:25 +0000 (21:12 +0200)]
fdisk_sun: fix corrupted partition data with blank disk

After creating Sun disk label for the first time for a blank disk,
the partition table appears corrupted because current_label_type will
never get set to a proper type. Fix this by calling check_sun_label()
after BusyBox has created the label.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovasprintf: return -1 on strdup failure
Denys Vlasenko [Sun, 10 Feb 2013 22:03:38 +0000 (23:03 +0100)]
vasprintf: return -1 on strdup failure

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovasprintf: do not use xmalloc, it will deadlock on OOM
Denys Vlasenko [Thu, 7 Feb 2013 15:06:54 +0000 (16:06 +0100)]
vasprintf: do not use xmalloc, it will deadlock on OOM

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomdev: chdir back to /dev after trying to read firmware
Denys Vlasenko [Mon, 4 Feb 2013 22:35:27 +0000 (23:35 +0100)]
mdev: chdir back to /dev after trying to read firmware

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoarp: code shrink
Denys Vlasenko [Mon, 4 Feb 2013 15:18:58 +0000 (16:18 +0100)]
arp: code shrink

function                                             old     new   delta
packed_usage                                       29257   29252      -5
arp_main                                            1487    1471     -16

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoarp: fix -H/-t handling.
Kuleshov Aleksey [Mon, 4 Feb 2013 14:14:20 +0000 (15:14 +0100)]
arp: fix -H/-t handling.

While at it, shrank code.
function                                             old     new   delta
arp_main                                            1558    1487     -71

Signed-off-by: Kuleshov Aleksey <rndfax@yandex.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomdev: extend debug logging output
Denys Vlasenko [Wed, 30 Jan 2013 15:51:22 +0000 (16:51 +0100)]
mdev: extend debug logging output

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoudhcpc6: fix port numbers used if !FEATURE_UDHCP_PORT
Denys Vlasenko [Mon, 28 Jan 2013 14:25:35 +0000 (15:25 +0100)]
udhcpc6: fix port numbers used if !FEATURE_UDHCP_PORT

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agotestsuite/du/du-k-works: fix false positive
Kang Kai [Mon, 28 Jan 2013 13:02:51 +0000 (14:02 +0100)]
testsuite/du/du-k-works: fix false positive

Signed-off-by: Kang Kai <kai.kang@windriver.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoflashcp: trivial code shrink
Denys Vlasenko [Mon, 28 Jan 2013 11:26:29 +0000 (12:26 +0100)]
flashcp: trivial code shrink

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agops: seconds_since_boot: uint64_t -> ulong
Denys Vlasenko [Sat, 26 Jan 2013 13:21:15 +0000 (14:21 +0100)]
ps: seconds_since_boot: uint64_t -> ulong

Even if long is 32-bit, 4 billion second uptime isn't likely :)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agogetopt: improve help text; code shrink
Denys Vlasenko [Thu, 24 Jan 2013 10:36:00 +0000 (11:36 +0100)]
getopt: improve help text; code shrink

function                                             old     new   delta
generate_output                                      356     351      -5
packed_usage                                       29271   29257     -14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoflashcp: pad output to BUFSIZE. Hopefully closes 5882
Denys Vlasenko [Wed, 23 Jan 2013 10:41:22 +0000 (11:41 +0100)]
flashcp: pad output to BUFSIZE. Hopefully closes 5882

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agounzip: add missing fflush; code shrink
Denys Vlasenko [Tue, 22 Jan 2013 10:16:08 +0000 (11:16 +0100)]
unzip: add missing fflush; code shrink

function                                             old     new   delta
my_fgets80                                             -      41     +41
unzip_main                                          2291    2242     -49

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomount: whitespace fix. no code changes
Denys Vlasenko [Tue, 22 Jan 2013 10:00:45 +0000 (11:00 +0100)]
mount: whitespace fix. no code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years ago*: reuse more strings
Denys Vlasenko [Tue, 22 Jan 2013 09:13:52 +0000 (10:13 +0100)]
*: reuse more strings

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agops: fix sscanf format specifier (%l); make uptime unsigned
Denys Vlasenko [Tue, 22 Jan 2013 09:07:23 +0000 (10:07 +0100)]
ps: fix sscanf format specifier (%l); make uptime unsigned

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoStart 1.22.0 development cycle
Denys Vlasenko [Mon, 21 Jan 2013 07:56:21 +0000 (08:56 +0100)]
Start 1.22.0 development cycle

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoBump version to 1.21.0 1_21_0
Denys Vlasenko [Mon, 21 Jan 2013 07:51:23 +0000 (08:51 +0100)]
Bump version to 1.21.0

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agofix testsuite false positive
Denys Vlasenko [Mon, 21 Jan 2013 07:28:37 +0000 (08:28 +0100)]
fix testsuite false positive

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomdev: fix mode of dir1 in =dir1/dir2/file rule
Denys Vlasenko [Mon, 21 Jan 2013 00:22:12 +0000 (01:22 +0100)]
mdev: fix mode of dir1 in =dir1/dir2/file rule

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoifconfig: do not accept "ifconfig eth0 up 1.2.3.4/17" (ip with mask). Closes 5786
Denys Vlasenko [Sun, 20 Jan 2013 17:10:12 +0000 (18:10 +0100)]
ifconfig: do not accept "ifconfig eth0 up 1.2.3.4/17" (ip with mask). Closes 5786

function                                             old     new   delta
ifconfig_main                                       1221    1237     +16

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agogrep: fix grep -Fw not respecting the -w option. Closes 5792
Denys Vlasenko [Sun, 20 Jan 2013 15:57:19 +0000 (16:57 +0100)]
grep: fix grep -Fw not respecting the -w option. Closes 5792

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosyslogd: do not segfault on parse error when using default config. Closes 5762
Denys Vlasenko [Sun, 20 Jan 2013 15:05:41 +0000 (16:05 +0100)]
syslogd: do not segfault on parse error when using default config. Closes 5762

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: code shrink
Denys Vlasenko [Sat, 19 Jan 2013 23:38:09 +0000 (00:38 +0100)]
sha3: code shrink

function                                             old     new   delta
sha3_hash                                            155     101     -54

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosyslogd: convert dummy functions to statics and get rid of IF_FEATURE_* checks
Peter Korsgaard [Sun, 6 Jan 2013 12:11:04 +0000 (13:11 +0100)]
syslogd: convert dummy functions to statics and get rid of IF_FEATURE_* checks

As suggested by Mike. No bloat-o-meter difference, but a bit nicer to look at.
We cannot convert the call to log_to_shmem() as it checks for G.shbuf outside
the function, and G.shbuf is only available when IPC support is enabled.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodc: code shrink
Denys Vlasenko [Fri, 18 Jan 2013 12:30:13 +0000 (13:30 +0100)]
dc: code shrink

function                                             old     new   delta
stack_machine                                        103     101      -2
operators                                            176     168      -8

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoash: revert wrong "fix" for an apparent memory leak. Closes 5822
Denys Vlasenko [Thu, 17 Jan 2013 12:02:27 +0000 (13:02 +0100)]
ash: revert wrong "fix" for an apparent memory leak. Closes 5822

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agocode shrink
Denys Vlasenko [Thu, 17 Jan 2013 10:02:21 +0000 (11:02 +0100)]
code shrink

function                                             old     new   delta
applet_name_compare                                   36      31      -5
find_applet_by_name                                   43      25     -18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agofix a typo in config help text. Closes 5714
Denys Vlasenko [Thu, 17 Jan 2013 09:24:51 +0000 (10:24 +0100)]
fix a typo in config help text. Closes 5714

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomount: fix -o user=foo mishandling, fix unc= generation, add prefixpath=
Bernhard Reutner-Fischer [Thu, 17 Jan 2013 01:30:35 +0000 (02:30 +0100)]
mount: fix -o user=foo mishandling, fix unc= generation, add prefixpath=

function                                             old     new   delta
singlemount                                         1019    1049     +30
packed_usage                                       29252   29257      +5
parse_mount_options                                  230     232      +2
mount_option_str                                     337     338      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 38/0)               Total: 38 bytes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: s/sha3_process_block76/sha3_process_block72/
Denys Vlasenko [Wed, 16 Jan 2013 11:23:23 +0000 (12:23 +0100)]
sha3: s/sha3_process_block76/sha3_process_block72/

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: rename KeccakF->sha3_process_block76.
Denys Vlasenko [Wed, 16 Jan 2013 01:20:31 +0000 (02:20 +0100)]
sha3: rename KeccakF->sha3_process_block76.

This brings the naming more in line with other hashes.
Pulled most statics and constants into it.
Also noticed that two byte arrays are 1 element too big.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agomount: add unc option to CIFS mount (needed for Linux 3.4+)
Martin Santesson [Tue, 15 Jan 2013 23:47:19 +0000 (00:47 +0100)]
mount: add unc option to CIFS mount (needed for Linux 3.4+)

unc option for CIFS mount is mandatory after CIFS option parsing
was rewritten in Linux 3.4

Signed-off-by: Martin Santesson <martinsn@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: cache ctx->bytes_queued
Denys Vlasenko [Tue, 15 Jan 2013 21:19:24 +0000 (22:19 +0100)]
sha3: cache ctx->bytes_queued

function                                             old     new   delta
sha3_hash                                            171     155     -16

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: remove two "small code" codepaths: I can't reproduce code size win on them...
Denys Vlasenko [Tue, 15 Jan 2013 21:07:48 +0000 (22:07 +0100)]
sha3: remove two "small code" codepaths: I can't reproduce code size win on them anymore

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: tweak choice of a fast code path for 64-bit
Denys Vlasenko [Tue, 15 Jan 2013 20:50:41 +0000 (21:50 +0100)]
sha3: tweak choice of a fast code path for 64-bit

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: cosmetic tweaks to various names, comments. No logic changes.
Denys Vlasenko [Tue, 15 Jan 2013 18:52:30 +0000 (19:52 +0100)]
sha3: cosmetic tweaks to various names, comments. No logic changes.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: code shrink
Denys Vlasenko [Tue, 15 Jan 2013 15:27:39 +0000 (16:27 +0100)]
sha3: code shrink

function                                             old     new   delta
KeccakF                                             1053    1078     +25
KeccakF_RoundConstants                               192      48    -144

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: code shrink
Denys Vlasenko [Tue, 15 Jan 2013 14:22:30 +0000 (15:22 +0100)]
sha3: code shrink

function                                             old     new   delta
KeccakF                                             1064    1053     -11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: another speedup for SHA3_SMALL=0 case
Denys Vlasenko [Tue, 15 Jan 2013 13:47:05 +0000 (14:47 +0100)]
sha3: another speedup for SHA3_SMALL=0 case

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agowhitespace fixes. no code changes
Denys Vlasenko [Tue, 15 Jan 2013 12:58:01 +0000 (13:58 +0100)]
whitespace fixes. no code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3: make size/speed optimization decision configurable
Denys Vlasenko [Tue, 15 Jan 2013 00:12:26 +0000 (01:12 +0100)]
sha3: make size/speed optimization decision configurable

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agowhitespace cleanup. no code changes
Denys Vlasenko [Mon, 14 Jan 2013 14:57:44 +0000 (15:57 +0100)]
whitespace cleanup. no code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosha3sum: new applet
Lauri Kasanen [Mon, 14 Jan 2013 04:20:50 +0000 (05:20 +0100)]
sha3sum: new applet

function                                             old     new   delta
KeccakF                                                -     496    +496
KeccakF_RoundConstants                                 -     192    +192
sha3_hash                                              -     171    +171
sha3_end                                               -      40     +40
hash_file                                            274     299     +25
KeccakF_RotationConstants                              -      25     +25
KeccakF_PiLane                                         -      25     +25
packed_usage                                       29213   29232     +19
sha3_begin                                             -      18     +18
KeccakF_Mod5                                           -      10     +10
applet_names                                        2445    2453      +8
applet_main                                         1420    1424      +4
applet_nameofs                                       710     712      +2
------------------------------------------------------------------------------
(add/remove: 8/0 grow/shrink: 9/7 up/down: 1049/-54)         Total: ~995 bytes

Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agontpd: fix incorrect m_status field in outgoing packets. Closes 5120
Paul Marks [Mon, 14 Jan 2013 01:39:10 +0000 (02:39 +0100)]
ntpd: fix incorrect m_status field in outgoing packets. Closes 5120

When using busybox ntpd with an NTPv3 client and NTPv4 server (or vice
versa), the version numbers can be incorrectly ORed together, yielding
the bogus value of "NTPv7".  This makes ntpd unusable with clients
such as Chrony and Windows "Internet Time".

This patch avoids the version mangling, by copying only the Leap
Indicator bits from the server's status field.

Signed-off-by: Paul Marks <paul@pmarks.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoRemove redundant 'config FEATURE_VOLUMEID_SQUASHFS'
Denys Vlasenko [Mon, 14 Jan 2013 01:24:27 +0000 (02:24 +0100)]
Remove redundant 'config FEATURE_VOLUMEID_SQUASHFS'

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovolume_id: add squashfs detection
Sven-Göran Bergh [Mon, 14 Jan 2013 01:21:41 +0000 (02:21 +0100)]
volume_id: add squashfs detection

function                                             old     new   delta
volume_id_probe_squashfs                               -      74     +74
fs1                                                   12      16      +4

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agowhitespace fixes. no code changes
Denys Vlasenko [Mon, 14 Jan 2013 00:34:48 +0000 (01:34 +0100)]
whitespace fixes. no code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovolume_id: uuid_format small code shrink
Sven-Göran Bergh [Sun, 13 Jan 2013 23:50:49 +0000 (00:50 +0100)]
volume_id: uuid_format small code shrink

function                                             old     new   delta
volume_id_set_uuid                                   318     300     -18

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovolume_id: display hfs[+] 128-bit UUID properly
Sven-Göran Bergh [Sun, 13 Jan 2013 23:37:00 +0000 (00:37 +0100)]
volume_id: display hfs[+] 128-bit UUID properly

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoblkid: add type display for hfsplus
Sven-Göran Bergh [Sun, 13 Jan 2013 23:35:31 +0000 (00:35 +0100)]
blkid: add type display for hfsplus

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agosyslogd: add option to log to Linux kernel printk buffer
Peter Korsgaard [Sat, 5 Jan 2013 23:07:19 +0000 (00:07 +0100)]
syslogd: add option to log to Linux kernel printk buffer

Why invent our own shared memory circular buffer when the kernel has a
perfectly fine one already?

This can be used as a smaller/simpler alternative to the syslogd IPC support
(as IPC shmem/klogd/logread aren't needed), while also allowing centralised
logging of everything (kernel messages, userspace bootup and syslog)
when used together with ttyprintk.

Notice that kernel 3.5+ is needed to store syslog facility in printk buffer,
otherwise only the priority is stored.

bloat-o-meter compared to IPC+klogd+logread:
function                                             old     new   delta
get_linux_version_code                                 -      84     +84
lbb_prepare                                           25      90     +65
applet_nameofs                                         6       -      -6
static.stdout@@GLIBC_2                                 8       -      -8
applet_names                                          23       9     -14
bb_msg_standard_output                                16       -     -16
init_sem                                              18       -     -18
xatoull_range                                         19       -     -19
overlapping_strcpy                                    21       -     -21
init_data                                             56      32     -24
applet_main                                           24       -     -24
main                                                 124      99     -25
full_write2_str                                       26       -     -26
error_exit                                            26       -     -26
bb_basename                                           30       -     -30
sem_up                                                32       -     -32
interrupted                                           35       -     -35
fflush_stdout_and_exit                                38       -     -38
bb_banner                                             46       -     -46
find_applet_by_name                                   59       -     -59
bb_signals_recursive_norestart                        90       -     -90
run_applet_no_and_exit                               104       -    -104
timestamp_and_log                                    651     523    -128
syslogd_main                                         798     581    -217
xstrtoull_range_sfx                                  267       -    -267
run_applet_and_exit                                  432       -    -432
klogd_main                                           490       -    -490
logread_main                                         508       -    -508
.rodata                                             1870     937    -933
bb_common_bufsiz1                                   8193       -   -8193
------------------------------------------------------------------------------
(add/remove: 2/26 grow/shrink: 1/6 up/down: 149/-11829)    Total: -11680 bytes

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agoklogd: handle multi-char log levels
Peter Korsgaard [Sat, 5 Jan 2013 23:07:18 +0000 (00:07 +0100)]
klogd: handle multi-char log levels

Since Linux 3.5 (7ff9554bb5: printk: convert byte-buffer to variable-length
record buffer), klog buffer can now contain log lines with multi-char
loglevel indicators (<[0-9]+>) - So use strtoul to parse it.

function                                             old     new   delta
klogd_main                                           490     525     +35
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 35/0)               Total: 35 bytes

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agodmesg: handle multi-char log levels
Peter Korsgaard [Sat, 5 Jan 2013 23:07:17 +0000 (00:07 +0100)]
dmesg: handle multi-char log levels

Since Linux 3.5 (7ff9554bb5: printk: convert byte-buffer to variable-length
record buffer), klog buffer can now contain log lines with multi-char
loglevel indicators (<[0-9]+>) - So we can no longer just skip 3 bytes.

Instead skip past the terminating '>' like util-linux does.

function                                             old     new   delta
dmesg_main                                           266     280     +13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 13/0)               Total: 13 bytes

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agopowertop: fix error message
Lauri Hintsala [Fri, 4 Jan 2013 08:51:57 +0000 (10:51 +0200)]
powertop: fix error message

Application tries to use timer_stats module instead of cpufreq_stats.
Error message is printed if opening of the file /proc/timer_stats fails.

Signed-off-by: Lauri Hintsala <lauri.hintsala@bluegiga.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agoifenslave: fix missing close paren
Mike Frysinger [Wed, 26 Dec 2012 22:12:26 +0000 (17:12 -0500)]
ifenslave: fix missing close paren

Reported-by: David J Cozatt <ygdrasil@comcast.net>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agoCONFIG_PID_FILE_PATH: new configuration option for pidfile paths
Anthony G. Basile [Mon, 10 Dec 2012 19:49:39 +0000 (14:49 -0500)]
CONFIG_PID_FILE_PATH: new configuration option for pidfile paths

We set a default path for the directory where pidfiles are create
when FEATURE_PIDFILE is selected.  The default has no effect on
applets which must specify a pidfile path on the command line to
run, and it can be overridden by applets which optionally allow
the user to specify the pidfile path.

We also add pidfile write/remove support for klogd, ntpd and watchdog.
For syslogd, we add a missing remove_pidfile() for better cleanup
on daemon exit.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
11 years agodu: document incompatibility with standard tool
Denys Vlasenko [Fri, 14 Dec 2012 16:14:11 +0000 (17:14 +0100)]
du: document incompatibility with standard tool

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodecompress_uncompress: comment out a bigger chunk of debug code
Denys Vlasenko [Wed, 5 Dec 2012 10:08:30 +0000 (11:08 +0100)]
decompress_uncompress: comment out a bigger chunk of debug code

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodecompress_uncompress: comment out debug printout on corrupted data
Denys Vlasenko [Wed, 5 Dec 2012 00:06:05 +0000 (01:06 +0100)]
decompress_uncompress: comment out debug printout on corrupted data

99% plus of all people who'll get corrupted archive wouldn't bother
debugging it. The rest can uncomment the code.

function                                             old     new   delta
unpack_Z_stream                                     1304    1234     -70

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agodecompress_uncompress: move 'code' variable into loop - sole user
Denys Vlasenko [Wed, 5 Dec 2012 00:04:54 +0000 (01:04 +0100)]
decompress_uncompress: move 'code' variable into loop - sole user

Apparently, gcc does this optimization itself, since generated code is the same.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoash: fix a memory leak
Jon Tollefson [Tue, 13 Nov 2012 18:26:53 +0000 (19:26 +0100)]
ash: fix a memory leak

The script which triggers the leak:

while true
  do
    while true
      do
        break;
    done</dev/null
done

Signed-off-by: Jon Tollefson <kniht@linux.vnet.ibm.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agovolume_id: add exFAT detection
S-G Bergh [Tue, 13 Nov 2012 13:40:37 +0000 (14:40 +0100)]
volume_id: add exFAT detection

function                                             old     new   delta
volume_id_probe_exfat                                  -     294    +294

Signed-off-by: S-G Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 years agoifupdown: code shrink
Denys Vlasenko [Fri, 9 Nov 2012 16:16:40 +0000 (17:16 +0100)]
ifupdown: code shrink

function                                             old     new   delta
execute                                              571     548     -23

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoifupdown: remove unused errno assignments
Denys Vlasenko [Mon, 5 Nov 2012 13:18:36 +0000 (14:18 +0100)]
ifupdown: remove unused errno assignments

function                                             old     new   delta
execute                                              607     571     -36

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoifupdown: simple code shrink
Denys Vlasenko [Mon, 5 Nov 2012 12:22:56 +0000 (13:22 +0100)]
ifupdown: simple code shrink

function                                             old     new   delta
execute                                              631     607     -24

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoblkid: show filesystem when both label and UUID are missing, but type is known
S-G Bergh [Mon, 5 Nov 2012 12:16:07 +0000 (13:16 +0100)]
blkid: show filesystem when both label and UUID are missing, but type is known

Signed-off-by: S-G Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agobuild system: use pkg-config to look up selinux libs
Mike Frysinger [Sat, 20 Oct 2012 19:01:26 +0000 (15:01 -0400)]
build system: use pkg-config to look up selinux libs

Newer versions of libselinux has started linking against more libs.
Rather than continuing hardcoding things, switch to using pkg-config
to query for its dependencies.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agofbsplash: fix regression from e4fa7b7
Timo Teräs [Wed, 17 Oct 2012 17:39:34 +0000 (19:39 +0200)]
fbsplash: fix regression from e4fa7b7

commit e4fa7b7 (limit progress bar flicker) made the progress bar
counter unsigned causing i < 0 to never come true.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agonanddump: invert the meaning of the -o parameter to match upstream
Baruch Siach [Mon, 15 Oct 2012 12:32:23 +0000 (14:32 +0200)]
nanddump: invert the meaning of the -o parameter to match upstream

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agonanddump: skip bad blocks when instructed to do so
Baruch Siach [Mon, 15 Oct 2012 12:25:26 +0000 (14:25 +0200)]
nanddump: skip bad blocks when instructed to do so

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agonanddump: use the right operator of logic AND
Baruch Siach [Mon, 15 Oct 2012 12:21:45 +0000 (14:21 +0200)]
nanddump: use the right operator of logic AND

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agomktemp: fix mktemp -u temp.XXXXXX returning garbage when TMPDIR is set
Ron Yorston [Mon, 8 Oct 2012 09:47:22 +0000 (11:47 +0200)]
mktemp: fix mktemp -u temp.XXXXXX returning garbage when TMPDIR is set

Use mktemp instead of tempnam for compatibility with real mktemp.
Don't let mktemp fail silently, print some simple error messages.
Don't ignore -q.

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Ron Yorston <rmy@tigress.co.uk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoadduser: make it accept "adduser USER GROUP" form
Tito Ragusa [Mon, 8 Oct 2012 09:18:08 +0000 (11:18 +0200)]
adduser: make it accept "adduser USER GROUP" form

Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agomark get_shell_name FAST_FUNC
Denys Vlasenko [Wed, 3 Oct 2012 07:42:21 +0000 (09:42 +0200)]
mark get_shell_name FAST_FUNC

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agotop/ps: argv0:"gdm-session-worker [pam/gdm-password]" == comm:"gdm-session-wor"
Denys Vlasenko [Tue, 2 Oct 2012 09:31:37 +0000 (11:31 +0200)]
top/ps: argv0:"gdm-session-worker [pam/gdm-password]" == comm:"gdm-session-wor"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoash: implement export -n
Denys Vlasenko [Mon, 1 Oct 2012 11:41:17 +0000 (13:41 +0200)]
ash: implement export -n

function                                             old     new   delta
exportcmd                                            129     175     +46

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agobrctl: fix description and usage
Nicolas Thill [Tue, 25 Sep 2012 12:06:01 +0000 (14:06 +0200)]
brctl: fix description and usage

brctl uncorrectly displays the "showmacs" command as being supported while
it is not, remove it from the usage and Config.src file.

Signed-off-by: Nicolas Thill <nico@openwrt.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoudhcpc[6]: allow discover_retries == 0 (infinite)
Felix Fietkau [Thu, 27 Sep 2012 14:22:24 +0000 (16:22 +0200)]
udhcpc[6]: allow discover_retries == 0 (infinite)

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoflashcp: remove unused variable opts
Manuel Zerpies [Thu, 27 Sep 2012 14:06:34 +0000 (16:06 +0200)]
flashcp: remove unused variable opts

Signed-off-by: Manuel Zerpies <manuel.f.zerpies@ww.stud.uni-erlangen.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agolineedit: in !EDITING config, return -1 on fgets error
Denys Vlasenko [Thu, 27 Sep 2012 14:03:49 +0000 (16:03 +0200)]
lineedit: in !EDITING config, return -1 on fgets error

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agofix unsafe bb_perror_msg(filename) calls
Denys Vlasenko [Thu, 27 Sep 2012 13:35:10 +0000 (15:35 +0200)]
fix unsafe bb_perror_msg(filename) calls

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoscripts/kconfig/mconf: work on systems w/o SIGWINCH
Denys Vlasenko [Thu, 27 Sep 2012 13:26:40 +0000 (15:26 +0200)]
scripts/kconfig/mconf: work on systems w/o SIGWINCH

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agolibbb: correctness/size tweaks in signal-related helpers
Denys Vlasenko [Thu, 27 Sep 2012 11:20:34 +0000 (13:20 +0200)]
libbb: correctness/size tweaks in signal-related helpers

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agotop: do not touch stdin if -b
Denys Vlasenko [Wed, 26 Sep 2012 14:58:25 +0000 (16:58 +0200)]
top: do not touch stdin if -b

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agomodprobe_small: make rmmod to NOT remove dependencies. Closes 5162
Denys Vlasenko [Tue, 25 Sep 2012 18:37:38 +0000 (20:37 +0200)]
modprobe_small: make rmmod to NOT remove dependencies. Closes 5162

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoash: trivial fixes for compile failures
Denys Vlasenko [Tue, 25 Sep 2012 10:49:29 +0000 (12:49 +0200)]
ash: trivial fixes for compile failures

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>