oweals/busybox.git
4 years agoash: improve expandstr()
Ron Yorston [Thu, 23 Jan 2020 11:26:08 +0000 (11:26 +0000)]
ash: improve expandstr()

The dash maintainer recently posted a fix for issues with expanding
PS1.  These had already been fixed differently in BusyBox ash.  Borrow
a couple of improvements:

- Use a single call to setjmp() to trap errors in both readtoken1()
  and expandarg().

- In case of error set the prompt to the literal value of PS1 rather
  than the half-digested nonsense in stackblock() which might include
  ugly control characters.

function                                             old     new   delta
expandstr                                            353     300     -53

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
4 years agosyslogd: add config option to include milliseconds in timestamps
Peter Korsgaard [Mon, 27 Jan 2020 14:36:41 +0000 (15:36 +0100)]
syslogd: add config option to include milliseconds in timestamps

For some use cases, having logs with more than 1 second accuracy can be
helpful.  Add an option to include milliseconds when adding a timestamp in
HH:MM:SS.mmm format, similar to syslog-ng with fraq_digits(3) or journalctl
-o short-precise.

For simplicity, abuse the remaining space in the buffer used by ctime to add
the millieconds (overwriting year).

function                                             old     new   delta
timestamp_and_log                                    401     448     +47

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
4 years agoudhcpd: mangle hostnames starting with dash ("-option")
Denys Vlasenko [Tue, 14 Jan 2020 16:05:48 +0000 (17:05 +0100)]
udhcpd: mangle hostnames starting with dash ("-option")

function                                             old     new   delta
add_lease                                            316     328     +12

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
4 years agowhois: limit total length of response to 32+2 kb
Denys Vlasenko [Tue, 3 Dec 2019 13:52:17 +0000 (14:52 +0100)]
whois: limit total length of response to 32+2 kb

function                                             old     new   delta
query                                                517     554     +37

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
4 years agoinit: improve handling of signals racing with each other
Denys Vlasenko [Tue, 3 Dec 2019 12:48:55 +0000 (13:48 +0100)]
init: improve handling of signals racing with each other

Before this change, a request to reboot could be "overwritten" by e.g.
SIGHUP.

function                                             old     new   delta
init_main                                            709     793     +84
packed_usage                                       33273   33337     +64
run_actions                                          109     117      +8
stop_handler                                          87      88      +1
check_delayed_sigs                                   340     335      -5
run                                                  214     198     -16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/2 up/down: 157/-21)           Total: 136 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
4 years agoinit: if tcgetattr() fails, don't even try to tcsetattr()
Denys Vlasenko [Mon, 2 Dec 2019 15:39:54 +0000 (16:39 +0100)]
init: if tcgetattr() fails, don't even try to tcsetattr()

function                                             old     new   delta
set_sane_term                                        111     114      +3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
4 years agohush: fix preprocessor directives indentation
Denys Vlasenko [Thu, 28 Nov 2019 09:28:14 +0000 (10:28 +0100)]
hush: fix preprocessor directives indentation

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
4 years agogrep: add -R
Tomi Leppanen [Mon, 25 Nov 2019 15:59:52 +0000 (17:59 +0200)]
grep: add -R

This adds -R option to grep similar to GNU grep. It is the same as -r
but also dereferences symbolic links to directories.

function                                             old     new   delta
grep_main                                            834     850     +16
packed_usage                                       33362   33368      +6
grep_file                                           1440    1441      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 23/0)               Total: 23 bytes

Signed-off-by: Tomi Leppanen <tomi.leppanen@jolla.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
4 years agobc: fix comparison bug, closes 12336
Denys Vlasenko [Sat, 23 Nov 2019 16:25:21 +0000 (17:25 +0100)]
bc: fix comparison bug, closes 12336

function                                             old     new   delta
bc_num_cmp                                           249     259     +10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
4 years agoRemove stime() function calls
Alistair Francis [Tue, 19 Nov 2019 12:06:40 +0000 (13:06 +0100)]
Remove stime() function calls

stime() has been deprecated in glibc 2.31 and replaced with
clock_settime(). Let's replace the stime() function calls with
clock_settime() in preperation.

function                                             old     new   delta
rdate_main                                           197     224     +27
clock_settime                                          -      27     +27
date_main                                            926     941     +15
stime                                                 37       -     -37
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 2/0 up/down: 69/-37)             Total: 32 bytes

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
4 years agoUpdated inittab example documentation
Denys Vlasenko [Sun, 17 Nov 2019 16:48:53 +0000 (17:48 +0100)]
Updated inittab example documentation

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
4 years agochgrp: correct the usage for non-desktop chgrp calls
Liu, Shuang (ADITG/ESM) [Wed, 13 Nov 2019 14:36:20 +0000 (14:36 +0000)]
chgrp: correct the usage for non-desktop chgrp calls

When IF_DESKTOP is not defined, chown and chgrp only takes option -R -h,
However the usage output of chgrp is wrong:

$ ./busybox.nosuid chown
Usage: chown [-Rh]... USER[:[GRP]] FILE...

$ ./busybox.nosuid chgrp
Usage: chgrp [-RhLHP]... GROUP FILE...

$ ./busybox.nosuid chgrp -H group dummy
chgrp: invalid option -- 'H'
Usage: chgrp [-RhLHP]... GROUP FILE...

The chgrp is now a wrapper of chown, so the recognized options shall be the same.
This is introduced by 34425389e09353a8dacdd6b23a62553f699c544c

I would expect the correct behavior shall be the same as chown.
So suggest the below patch, the behavior shall be:

$ ./busybox.nosuid chgrp
Usage: chgrp [-Rh]... GROUP FILE...

Signed-off-by: Shuang Liu <sliu@de.adit-jv.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotaskset: tighten the check for stride values
Denys Vlasenko [Sat, 9 Nov 2019 16:32:43 +0000 (17:32 +0100)]
taskset: tighten the check for stride values

function                                             old     new   delta
taskset_main                                         986     987      +1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotaskset: implement stride argument
Denys Vlasenko [Sat, 9 Nov 2019 16:05:14 +0000 (17:05 +0100)]
taskset: implement stride argument

function                                             old     new   delta
taskset_main                                         925     986     +61

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agounxz: show -t in --help
Denys Vlasenko [Fri, 8 Nov 2019 15:37:28 +0000 (16:37 +0100)]
unxz: show -t in --help

function                                             old     new   delta
packed_usage                                       33236   33247     +11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotaskset: update comment
Denys Vlasenko [Fri, 8 Nov 2019 15:32:37 +0000 (16:32 +0100)]
taskset: update comment

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotaskset: add support for taking/printing CPU list (-c option)
Denys Vlasenko [Fri, 1 Nov 2019 14:44:49 +0000 (15:44 +0100)]
taskset: add support for taking/printing CPU list (-c option)

function                                             old     new   delta
taskset_main                                         511     855    +344

Based on patch by Fryderyk Wrobel <frd1996@gmail.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agohush: restore redirected stdin
Denys Vlasenko [Fri, 1 Nov 2019 13:16:07 +0000 (14:16 +0100)]
hush: restore redirected stdin

function                                             old     new   delta
restore_redirects                                     52      95     +43
save_fd_on_redirect                                  243     253     +10
hfopen                                                90      99      +9
fgetc_interactive                                    259     261      +2
builtin_type                                         117     115      -2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/1 up/down: 64/-2)              Total: 62 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agontpd: decrease MIN_FREQHOLD by 2, increase "penalty" for largish offset x2
Denys Vlasenko [Wed, 30 Oct 2019 11:13:46 +0000 (12:13 +0100)]
ntpd: decrease MIN_FREQHOLD by 2, increase "penalty" for largish offset x2

> 2018-07-25:
> ntpd: increase MIN_FREQHOLD by 3
> This means we'll start correcting frequency ~5 minutes after start,
> not ~3.5 ones.
> With previous settings I still often see largish ~0.7s initial offsets
> only about 1/2 corrected before frequency correction kicks in,
> resulting in ~200ppm "correction" which is then slowly undone.

Review of real-world results of the above shows that with small
initial offsets, freq correction can be allowed to kick in sooner,
whereas with large (~0.8s) offsets, we still start freq correction
a bit too soon.

Let's rebalance this a bit.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agonslookup: implement support for SRV records
Jo-Philipp Wich [Thu, 27 Jun 2019 15:27:29 +0000 (17:27 +0200)]
nslookup: implement support for SRV records

Add support for querying and parsing SRV DNS records.

function                                             old     new   delta
send_queries                                        1711    1865    +154
qtypes                                                72      80      +8

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agonslookup: handle replies without RRs
Jo-Philipp Wich [Thu, 27 Jun 2019 15:27:28 +0000 (17:27 +0200)]
nslookup: handle replies without RRs

Under some circumstances, a DNS reply might contain no resource records,
e.g. when a valid domain is queried that does not have records of the
requested type.

Example with nslookup from BIND dnsutils:

    $ nslookup -q=SRV example.org
    Server: 10.11.12.13
    Address: 10.11.12.13#53

    Non-authoritative answer:
    *** Can't find example.org: No answer

Currently the busybox nslookup applet simply prints nothing after the
"Non-authoritative answer:" line in the same situation.

This change modifies nslookup to either print "Parse error" or "No answer"
diagnostics, depending on the parse_reply() return value.

function                                             old     new   delta
send_queries                                        1676    1711     +35

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agogunzip: fix incorrect decoding of "fixed" inflate blocks
Denys Vlasenko [Sat, 26 Oct 2019 18:04:34 +0000 (20:04 +0200)]
gunzip: fix incorrect decoding of "fixed" inflate blocks

function                                             old     new   delta
huft_build                                          1008    1022     +14
inflate_block                                       1253    1256      +3
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 17/0)               Total: 17 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agohdparm: placate "warning: taking the absolute value of unsigned type"
Denys Vlasenko [Fri, 25 Oct 2019 15:47:22 +0000 (17:47 +0200)]
hdparm: placate "warning: taking the absolute value of unsigned type"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agovi: placate "warning: shifting a negative signed value is undefined"
Denys Vlasenko [Fri, 25 Oct 2019 15:42:23 +0000 (17:42 +0200)]
vi: placate "warning: shifting a negative signed value is undefined"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoread_key(): placate "warning: shifting a negative signed value is undefined"
Denys Vlasenko [Fri, 25 Oct 2019 15:40:57 +0000 (17:40 +0200)]
read_key(): placate "warning: shifting a negative signed value is undefined"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agontpd: abs(tmx.offset) was truncating a "long" typed value
Denys Vlasenko [Fri, 25 Oct 2019 15:35:58 +0000 (17:35 +0200)]
ntpd: abs(tmx.offset) was truncating a "long" typed value

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotc: array address is never NULL
Denys Vlasenko [Fri, 25 Oct 2019 11:41:31 +0000 (13:41 +0200)]
tc: array address is never NULL

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotraceroute: fix gcc-ism
Denys Vlasenko [Fri, 25 Oct 2019 11:39:41 +0000 (13:39 +0200)]
traceroute: fix gcc-ism

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agosuppress a few "unused function" warnings
Denys Vlasenko [Fri, 25 Oct 2019 11:05:15 +0000 (13:05 +0200)]
suppress a few "unused function" warnings

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agonetstat: suppress a warning (conversion from 'int' to 'smallint' changes value)
Denys Vlasenko [Fri, 25 Oct 2019 11:00:01 +0000 (13:00 +0200)]
netstat: suppress a warning (conversion from 'int' to 'smallint' changes value)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoMakefile.flags: suppress some clang-9 warnings
Denys Vlasenko [Fri, 25 Oct 2019 10:56:51 +0000 (12:56 +0200)]
Makefile.flags: suppress some clang-9 warnings

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoclang/llvm 9 fix - do not eliminate a store to a fake "const"
Denys Vlasenko [Fri, 25 Oct 2019 10:12:22 +0000 (12:12 +0200)]
clang/llvm 9 fix - do not eliminate a store to a fake "const"

This is *much* better (9 kbytes better) than dropping "*const"
optimization trick.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotar: fix fallout of: change -a from meaning "lzma" to mean "autodetect by extension"
Denys Vlasenko [Fri, 25 Oct 2019 08:30:53 +0000 (10:30 +0200)]
tar: fix fallout of: change -a from meaning "lzma" to mean "autodetect by extension"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoRemove syscall wrappers around clock_gettime, closes 12091
Denys Vlasenko [Thu, 24 Oct 2019 14:26:55 +0000 (16:26 +0200)]
Remove syscall wrappers around clock_gettime, closes 12091

12091 "Direct use of __NR_clock_gettime is not time64-safe".

function                                             old     new   delta
runsv_main                                          1698    1712     +14
startservice                                         378     383      +5
get_mono                                              31      25      -6
date_main                                            932     926      -6
gettimeofday_ns                                       17       -     -17
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 2/2 up/down: 19/-29)            Total: -10 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoshell: better comments in BASE#nn code
Denys Vlasenko [Tue, 22 Oct 2019 12:25:43 +0000 (14:25 +0200)]
shell: better comments in BASE#nn code

function                                             old     new   delta
evaluate_string                                      932     930      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoshell/ulimit: code shrink
Denys Vlasenko [Mon, 21 Oct 2019 14:47:09 +0000 (16:47 +0200)]
shell/ulimit: code shrink

    text    data     bss     dec     hex filename
1001949     551    5612 1008112   f61f0 busybox_old
1001906     551    5612 1008069   f61c5 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agogunzip: code shrink by using int-, not short-sized struct member
Denys Vlasenko [Sun, 20 Oct 2019 17:07:06 +0000 (19:07 +0200)]
gunzip: code shrink by using int-, not short-sized struct member

function                                             old     new   delta
inflate_block                                       1254    1253      -1
inflate_codes                                        629     621      -8
huft_build                                          1054    1008     -46
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-55)             Total: -55 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agogzip: code shrink
Denys Vlasenko [Sat, 19 Oct 2019 16:52:41 +0000 (18:52 +0200)]
gzip: code shrink

huft_build() still has way too many params

function                                             old     new   delta
lit                                                    -      94     +94
dist                                                   -      94     +94
huft_build                                          1058    1054      -4
inflate_block                                       1281    1254     -27
cpdext                                                30       -     -30
cplext                                                31       -     -31
cpdist                                                60       -     -60
cplens                                                62       -     -62
------------------------------------------------------------------------------
(add/remove: 2/4 grow/shrink: 0/2 up/down: 188/-214)          Total: -26 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agogzip: code shrink
Denys Vlasenko [Sat, 19 Oct 2019 16:33:49 +0000 (18:33 +0200)]
gzip: code shrink

huft_build() has way too many params

function                                             old     new   delta
inflate_block                                       1293    1281     -12
huft_build                                          1085    1058     -27
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-39)             Total: -39 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotelnet: add disabled code to emit EC and IP
Denys Vlasenko [Fri, 18 Oct 2019 14:47:37 +0000 (16:47 +0200)]
telnet: add disabled code to emit EC and IP

> I'm trying to connect to a Korenix 3005 switch through telnet
> for management purposes, and all is well except for the backspace character
> - seems like my switch doesn't handle it too well and instead of erasing
> the last character all it does is print some garbage to the screen.
> I've had the same issue before while using putty, but saw a solution that
> suggests to enable "Telnet special commands" in the options menu, and it
> worked.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobrctl: code shrink
Denys Vlasenko [Tue, 15 Oct 2019 10:31:54 +0000 (12:31 +0200)]
brctl: code shrink

function                                             old     new   delta
show_bridge                                          323     317      -6
brctl_main                                          2171    2164      -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-13)             Total: -13 bytes
   text    data     bss     dec     hex filename
1002083     551    5612 1008246   f6276 busybox_old
1002065     551    5612 1008228   f6264 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoconfig: PID_FILE_PATH required for FEATURE_CROND_SPECIAL_TIMES
James Byrne [Wed, 17 Jul 2019 15:53:04 +0000 (15:53 +0000)]
config: PID_FILE_PATH required for FEATURE_CROND_SPECIAL_TIMES

When crond is built with FEATURE_CROND_SPECIAL_TIMES enabled, it creates
a file called 'crond.reboot' at CONFIG_PID_FILE_PATH, but if
FEATURE_PIDFILE is disabled, this will be an empty string and the file
will be created in the root directory, which is undesirable.

This commit makes PID_FILE_PATH depend on FEATURE_CROND_SPECIAL_TIMES as
well as FEATURE_PIDFILE so that you get sensible behaviour in crond when
FEATURE_PIDFILE is switched off.

Signed-off-by: James Byrne <james.byrne@origamienergy.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobrctl: tweak help text, fix comments
Denys Vlasenko [Sat, 12 Oct 2019 17:51:46 +0000 (19:51 +0200)]
brctl: tweak help text, fix comments

function                                             old     new   delta
packed_usage                                       33255   33236     -19

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobrctl: fold show_bridge_ports_ into its caller
Denys Vlasenko [Sat, 12 Oct 2019 17:42:37 +0000 (19:42 +0200)]
brctl: fold show_bridge_ports_ into its caller

function                                             old     new   delta
brctl_main                                          2235    2171     -64

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobrctl: code shrink
Denys Vlasenko [Sat, 12 Oct 2019 17:24:38 +0000 (19:24 +0200)]
brctl: code shrink

packed_usage                                       33253   33255      +2
write_uint                                            96      90      -6
show_bridge_timer                                     93      69     -24
brctl_main                                          2338    2235    -103
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 2/-133)           Total: -131 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobrctl: add support for showstp command
Martin Lewis [Thu, 10 Oct 2019 21:00:19 +0000 (16:00 -0500)]
brctl: add support for showstp command

function                                             old     new   delta
brctl_main                                           974    2339   +1365
show_bridge_timer                                      -      93     +93
static.state_names                                     -      48     +48
printf_xstrtou                                         -      26     +26
packed_usage                                       33243   33253     +10
show_bridge                                          333     323     -10
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 2/1 up/down: 1542/-10)         Total: 1532 bytes
   text    data     bss     dec     hex filename
 999868     551    5612 1006031   f59cf busybox_old
1002309     551    5612 1008472   f6358 busybox_unstripped

Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agodpkg-deb: work around bogus error message when working with XZ compressed packages
Denys Vlasenko [Fri, 11 Oct 2019 12:11:44 +0000 (14:11 +0200)]
dpkg-deb: work around bogus error message when working with XZ compressed packages

function                                             old     new   delta
unpack_xz_stream                                    2309    2317      +8
bb_full_fd_action                                    464     472      +8

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoreplace: count_strstr - Handle an edge case where sub is empty
Martin Lewis [Sun, 15 Sep 2019 16:51:30 +0000 (18:51 +0200)]
replace: count_strstr - Handle an edge case where sub is empty

If sub is empty, avoids an infinite loop.

function                                             old     new   delta
count_strstr                                          45      63     +18

Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agolibbb: Converted safe_read to safe_write format
Martin Lewis [Sun, 15 Sep 2019 16:13:28 +0000 (18:13 +0200)]
libbb: Converted safe_read to safe_write format

Changed safe_read to be symmetrical to safe_write, it shall
never return EINTR because it calls read multiple times,
the error is considered transient.

function                                             old     new   delta
safe_read                                             44      57     +13

Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agorunsv: Use 64 prefix syscall if we have to
Alistair Francis [Wed, 18 Sep 2019 16:28:51 +0000 (09:28 -0700)]
runsv: Use 64 prefix syscall if we have to

Some 32-bit architectures no longer have the 32-bit time_t syscalls.
Instead they have suffixed syscalls that returns a 64-bit time_t. If
the architecture doesn't have the non-suffixed syscall and is using a
64-bit time_t let's use the suffixed syscall instead.

This fixes build issues when building for RISC-V 32-bit with 5.1+ kernel
headers.

If an architecture only supports the suffixed syscalls, but is still
using a 32-bit time_t report a compilation error. This avoids us have to
deal with converting between 64-bit and 32-bit values. There are
currently no architectures where this is the case.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotime: Use 64 prefix syscall if we have to
Alistair Francis [Wed, 18 Sep 2019 16:28:50 +0000 (09:28 -0700)]
time: Use 64 prefix syscall if we have to

Some 32-bit architectures no longer have the 32-bit time_t syscalls.
Instead they have suffixed syscalls that returns a 64-bit time_t. If
the architecture doesn't have the non-suffixed syscall and is using a
64-bit time_t let's use the suffixed syscall instead.

This fixes build issues when building for RISC-V 32-bit with 5.1+ kernel
headers.

If an architecture only supports the suffixed syscalls, but is still
using a 32-bit time_t report a compilation error. This avoids us have to
deal with converting between 64-bit and 32-bit values. There are
currently no architectures where this is the case.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agodate: Use 64 prefix syscall if we have to
Alistair Francis [Wed, 18 Sep 2019 16:28:49 +0000 (09:28 -0700)]
date: Use 64 prefix syscall if we have to

Some 32-bit architectures no longer have the 32-bit time_t syscalls.
Instead they have suffixed syscalls that returns a 64-bit time_t. If
the architecture doesn't have the non-suffixed syscall and is using a
64-bit time_t let's use the suffixed syscall instead.

This fixes build issues when building for RISC-V 32-bit with 5.1+ kernel
headers.

If an architecture only supports the suffixed syscalls, but is still
using a 32-bit time_t fall back to the libc call.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoudhcpc: fix segmentation fault on empty bin opt
Michal Kazior [Wed, 25 Sep 2019 12:03:13 +0000 (14:03 +0200)]
udhcpc: fix segmentation fault on empty bin opt

The following caused udhcpc to segfault:
  busybox udhcpc -i lo -s /dev/null -x 0x3d:

function                                             old     new   delta
udhcp_str2optset                                     629     641     +12

Signed-off-by: Michal Kazior <michal@plume.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobrctl: add support for showmacs command
Martin Lewis [Sun, 15 Sep 2019 16:04:49 +0000 (18:04 +0200)]
brctl: add support for showmacs command

function                                             old     new   delta
brctl_main                                           680     974    +294
packed_usage                                       33167   33187     +20
compare_fdbs                                           -      19     +19
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/0 up/down: 333/0)             Total: 333 bytes

Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoln: --no-target-directory implies --no-dereference
Kaarle Ritvanen [Tue, 8 Oct 2019 12:07:50 +0000 (14:07 +0200)]
ln: --no-target-directory implies --no-dereference

as in GNU coreutils

Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoroute: fix output of "route -n -A inet6"
Tomas Paukrt [Tue, 8 Oct 2019 09:51:48 +0000 (11:51 +0200)]
route: fix output of "route -n -A inet6"

The output of the command "route -n -A inet6" may be corrupted
due to partially initialized structure snaddr6 in the function
INET6_displayroutes.

Signed-off-by: Tomas Paukrt <tomaspaukrt@email.cz>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotee: do not intercept SIGPIPE
Denys Vlasenko [Mon, 7 Oct 2019 12:25:45 +0000 (14:25 +0200)]
tee: do not intercept SIGPIPE

GNU tee does this only with -p, which we don't have yet.

function                                             old     new   delta
tee_main                                             306     295     -11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agofdisk_aix: fix aliasing warning, comment out unused global variables
Denys Vlasenko [Fri, 4 Oct 2019 15:16:15 +0000 (17:16 +0200)]
fdisk_aix: fix aliasing warning, comment out unused global variables

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agofdisk: avoid overflow in "mega/gigabytes" calculation, code shrink
Denys Vlasenko [Fri, 4 Oct 2019 14:45:04 +0000 (16:45 +0200)]
fdisk: avoid overflow in "mega/gigabytes" calculation, code shrink

function                                             old     new   delta
list_disk_geometry                                   175     145     -30

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotelnet: fix uninitialized variable bug
Denys Vlasenko [Wed, 25 Sep 2019 11:48:01 +0000 (13:48 +0200)]
telnet: fix uninitialized variable bug

function                                             old     new   delta
telnet_main                                         1236    1238      +2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoudhcpc6: add ELAPSED_TIME option to outgoing packets
Denys Vlasenko [Tue, 24 Sep 2019 12:01:00 +0000 (14:01 +0200)]
udhcpc6: add ELAPSED_TIME option to outgoing packets

function                                             old     new   delta
init_d6_packet                                        53     121     +68
udhcpc_main                                         2577    2582      +5
udhcpc6_main                                        2593    2597      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 77/0)               Total: 77 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoash: fix BASE###nn bashism for bases 36..64
Denys Vlasenko [Sun, 22 Sep 2019 21:40:10 +0000 (23:40 +0200)]
ash: fix BASE###nn bashism for bases 36..64

function                                             old     new   delta
evaluate_string                                      876     932     +56

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoash: fix BASE###nn bashism to accept letter 'digits' for bases > 9
Denys Vlasenko [Sun, 22 Sep 2019 16:26:05 +0000 (18:26 +0200)]
ash: fix BASE###nn bashism to accept letter 'digits' for bases > 9

function                                             old     new   delta
evaluate_string                                      873     876      +3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agobc: Add 'U' suffix in UINT_MAX preprocessor check
Kang-Che Sung [Thu, 5 Sep 2019 15:40:38 +0000 (23:40 +0800)]
bc: Add 'U' suffix in UINT_MAX preprocessor check

Without the 'U' unsigned suffix, gcc will throw a "integer constant is
so large that it is unsigned" warning.

Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agowget: increase redirections limit
David Demelier [Thu, 29 Aug 2019 12:05:27 +0000 (14:05 +0200)]
wget: increase redirections limit

Some hosting services like sourceforge perform a lot of relocations
before actually serving the file. Example of current limitation:

    busybox wget http://sourceforge.net/projects/fluxbox/files/fluxbox/1.3.7/fluxbox-1.3.7.tar.xz
    Connecting to sourceforge.net (216.105.38.13:80)
    Connecting to sourceforge.net (216.105.38.13:443)
    Connecting to sourceforge.net (216.105.38.13:443)
    Connecting to sourceforge.net (216.105.38.13:443)
    Connecting to downloads.sourceforge.net (216.105.38.13:443)
    wget: too many redirections

Signed-off-by: David Demelier <markand@malikania.fr>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoexamples/udhcp/simple.script: print the filename actually changed
Rolf Eike Beer [Tue, 13 Aug 2019 15:41:56 +0000 (17:41 +0200)]
examples/udhcp/simple.script: print the filename actually changed

Signed-off-by: Rolf Eike Beer <eb@emlix.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agofind: implement -empty
Aaro Koskinen [Thu, 12 Sep 2019 10:04:13 +0000 (12:04 +0200)]
find: implement -empty

function                                             old     new   delta
func_empty                                             -     121    +121
packed_usage                                       33154   33167     +13
parse_params                                        1490    1500     +10
static.params                                        228     235      +7
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/0 up/down: 151/0)             Total: 151 bytes

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agogzip: code shrink
Denys Vlasenko [Fri, 6 Sep 2019 15:56:57 +0000 (17:56 +0200)]
gzip: code shrink

Converted a few 16-bit variables and small arrays to 32-bit.

Stopped pulling desc->FOO members into temporary local variables
in gen_bitlen(): on register-starved arches, this is a loss,
temporaries go into stack slots.

Sprinkled a few "const" on pointer arguments.

function                                             old     new   delta
pack_gzip                                            742     745      +3
gen_codes                                            101      97      -4
build_tree                                           886     833     -53
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/2 up/down: 3/-57)             Total: -54 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoexamples/udhcp/simple.script: up interface on deconfig event
Denys Vlasenko [Thu, 5 Sep 2019 12:58:08 +0000 (14:58 +0200)]
examples/udhcp/simple.script: up interface on deconfig event

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoash: add a FIXME comment
Denys Vlasenko [Thu, 5 Sep 2019 12:31:49 +0000 (14:31 +0200)]
ash: add a FIXME comment

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agohush: fix "set -o INVALID" affecting -e flag state
Denys Vlasenko [Thu, 5 Sep 2019 12:07:14 +0000 (14:07 +0200)]
hush: fix "set -o INVALID" affecting -e flag state

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agogzip: code shrink
Denys Vlasenko [Thu, 5 Sep 2019 11:22:24 +0000 (13:22 +0200)]
gzip: code shrink

function                                             old     new   delta
gzip_main                                            267     264      -3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agogzip: set default compression level to 6 when CONFIG_FEATURE_GZIP_LEVELS=n
Daniel Edgecumbe [Mon, 2 Sep 2019 21:09:15 +0000 (22:09 +0100)]
gzip: set default compression level to 6 when CONFIG_FEATURE_GZIP_LEVELS=n

With this change, GNU gzip -n and BusyBox gzip now produce identical output
assuming that CONFIG_GZIP_FAST=2.

>> Excuse me, but I wonder one thing: Why should we follow
>> strictly with gzip on the no-options default behavior?

> First, the default 6 compression level is a de-facto standard. BSD gzip
> and Apple gzip (on macOS) use this default as well. So there is a
> reasonable expectation that different gzip implementations act the same.
> For instance, if the default for busybox gzip becomes 9, then someone
> writing a script using busybox gzip could reasonably expect that the
> compression level will still be 9 when the same script is run on another
> system. That would be wrong. Implementations should not deviate from
> de-facto standards without a strong reason.
>
> Second, the inherent reason for this default has not gone away. While
> processor speeds have exploded since the default was set, so has the
> typical size of compressed files. Multiple gigabytes are nothing unusual
> these days. And gzip is often used for compression on the fly, precisely
> because it offers a good compromise between speed and compression ratio.
> So I believe 6 continues to be a reasonable default.

function                                             old     new   delta
deflate                                              939     927     -12

Signed-off-by: Daniel Edgecumbe <git@esotericnonsense.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agogzip: set compression flags correctly as per standard
Daniel Edgecumbe [Mon, 2 Sep 2019 21:05:26 +0000 (22:05 +0100)]
gzip: set compression flags correctly as per standard

With this change and CONFIG_GZIP_FAST=2, CONFIG_FEATURE_GZIP_LEVELS=y,

GNU gzip and BusyBox gzip now produce identical output at each compression
level (excluding 1..3, as BusyBox does not implement these levels).

Signed-off-by: Daniel Edgecumbe <git@esotericnonsense.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agogzip: default level with ENABLE_FEATURE_GZIP_LEVELS should be 6
Daniel Edgecumbe [Mon, 2 Sep 2019 21:03:14 +0000 (22:03 +0100)]
gzip: default level with ENABLE_FEATURE_GZIP_LEVELS should be 6

Fixes an off-by-one that actually resulted in level 7 being used

Signed-off-by: Daniel Edgecumbe <git@esotericnonsense.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agodc: Parse error & fix out of bounds read in xc_program_printString
Brian Foley [Thu, 5 Sep 2019 08:53:21 +0000 (10:53 +0200)]
dc: Parse error & fix out of bounds read in xc_program_printString

function                                             old     new   delta
xc_program_print                                     712     735     +23

Signed-off-by: Brian Foley <bpfoley@google.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agodc: Fix segfault when executing strings generated using asciify
Brian Foley [Thu, 5 Sep 2019 08:50:13 +0000 (10:50 +0200)]
dc: Fix segfault when executing strings generated using asciify

function                                             old     new   delta
zxc_vm_process                                      6884    6891      +7

Signed-off-by: Brian Foley <bpfoley@google.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agodc: execute shouldn't pop if stack head is not a string
Brian Foley [Thu, 5 Sep 2019 08:46:22 +0000 (10:46 +0200)]
dc: execute shouldn't pop if stack head is not a string

This matches the behaviour of both GNU dc (as specified in
its man page), and BSD dc (where stack_popstring() pops
only if the head is a string.)

Add a couple of tests to verify this behavior.

function                                             old     new   delta
zxc_vm_process                                      6882    6884      +2

Signed-off-by: Brian Foley <bpfoley@google.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoudhcpc6: support stateless DHCPv6
Eivind Versvik [Sat, 24 Aug 2019 15:23:48 +0000 (17:23 +0200)]
udhcpc6: support stateless DHCPv6

-l will send Information-Request to request configuration parameters

function                                             old     new   delta
packed_usage                                       33114   33180     +66
send_d6_info_request                                   -      62     +62
udhcpc6_main                                        2534    2593     +59
udhcpc6_longopts                                     199     211     +12
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/0 up/down: 199/0)             Total: 199 bytes

Signed-off-by: Eivind Versvik <versvikeivind@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotop: do not use previous colleced data wheh "h" toggles threads display
Denys Vlasenko [Sun, 11 Aug 2019 14:17:11 +0000 (16:17 +0200)]
top: do not use previous colleced data wheh "h" toggles threads display

This prevents first update from showing incorrect CPU usage data

function                                             old     new   delta
handle_input                                         620     643     +23

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoudhcpc6: s/iphdr/ip6_hdr/
Denys Vlasenko [Fri, 9 Aug 2019 18:43:40 +0000 (20:43 +0200)]
udhcpc6: s/iphdr/ip6_hdr/

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agonmeter: do not clamp down %Nc to minimum of 10 (think nmeter "%`nproc`c")
Denys Vlasenko [Tue, 6 Aug 2019 14:56:00 +0000 (16:56 +0200)]
nmeter: do not clamp down %Nc to minimum of 10 (think nmeter "%`nproc`c")

Also, go for unsigned divisions.

function                                             old     new   delta
init_cpu                                              61      73     +12
collect_cpu                                          444     422     -22
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 12/-22)            Total: -10 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agostat: print nanosecond times, fix printing of empty lines
Denys Vlasenko [Sat, 3 Aug 2019 16:08:27 +0000 (18:08 +0200)]
stat: print nanosecond times, fix printing of empty lines

function                                             old     new   delta
human_time                                            36      73     +37

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoash: fix set -o to not show "nameless" options
Denys Vlasenko [Fri, 2 Aug 2019 14:43:36 +0000 (16:43 +0200)]
ash: fix set -o to not show "nameless" options

Patch by Martijn Dekker <martijn@inlv.org>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotar: change -a from meaning "lzma" to mean "autodetect by extension"
Denys Vlasenko [Fri, 2 Aug 2019 13:19:56 +0000 (15:19 +0200)]
tar: change -a from meaning "lzma" to mean "autodetect by extension"

function                                             old     new   delta
tar_main                                            1026    1100     +74
packed_usage                                       33311   33329     +18
tar_longopts                                         309     325     +16
vfork_compressor                                     246     210     -36
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/1 up/down: 108/-36)            Total: 72 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agotar: code shrink
Denys Vlasenko [Thu, 1 Aug 2019 13:07:21 +0000 (15:07 +0200)]
tar: code shrink

function                                             old     new   delta
writeLongname                                        226     228      +2
static.prefilled                                      48       -     -48
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/0 up/down: 2/-48)             Total: -46 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoash: only catch unexpected exceptions in PS1 expansion
Ron Yorston [Mon, 29 Jul 2019 08:51:14 +0000 (09:51 +0100)]
ash: only catch unexpected exceptions in PS1 expansion

Commit d1a2fa2a4 (ash: catch error in arithmetic expansion in PS1)
catches all exceptions raised by expandarg().  Some exceptions, such as
the EXEXIT raised when command expansion is used, are expected:

   export PS1='$(echo "$ ")'

These should be processed normally or the shell hangs at the prompt.

function                                             old     new   delta
expandstr                                            344     353      +9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 9/0)                 Total: 9 bytes

Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agounicode: code shrink in character width determination
Denys Vlasenko [Tue, 23 Jul 2019 09:26:54 +0000 (11:26 +0200)]
unicode: code shrink in character width determination

function                                             old     new   delta
bb_wcwidth                                           267     238     -29

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agolibbb: include <crypt.h> only if necessary
Denys Vlasenko [Tue, 16 Jul 2019 13:09:06 +0000 (15:09 +0200)]
libbb: include <crypt.h> only if necessary

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agontpd: add comment about mode6, no code changes
Denys Vlasenko [Tue, 2 Jul 2019 13:03:47 +0000 (15:03 +0200)]
ntpd: add comment about mode6, no code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agontpd: commonalize message strings
Denys Vlasenko [Tue, 2 Jul 2019 11:10:19 +0000 (13:10 +0200)]
ntpd: commonalize message strings

function                                             old     new   delta
recv_and_process_peer_pkt                            961     973     +12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 12/0)               Total: 12 bytes
   text    data     bss     dec     hex filename
 953108     481    7288  960877   ea96d busybox_old
 953086     481    7288  960855   ea957 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agolibbb: reduce the overhead of single parameter bb_error_msg() calls
James Byrne [Tue, 2 Jul 2019 09:35:03 +0000 (11:35 +0200)]
libbb: reduce the overhead of single parameter bb_error_msg() calls

Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by
Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower
overhead call to bb_perror_msg() when only a string was being printed
with no parameters. This saves space for some CPU architectures because
it avoids the overhead of a call to a variadic function. However there
has never been a simple version of bb_error_msg(), and since 2007 many
new calls to bb_perror_msg() have been added that only take a single
parameter and so could have been using bb_simple_perror_message().

This changeset introduces 'simple' versions of bb_info_msg(),
bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and
bb_herror_msg_and_die(), and replaces all calls that only take a
single parameter, or use something like ("%s", arg), with calls to the
corresponding 'simple' version.

Since it is likely that single parameter calls to the variadic functions
may be accidentally reintroduced in the future a new debugging config
option WARN_SIMPLE_MSG has been introduced. This uses some macro magic
which will cause any such calls to generate a warning, but this is
turned off by default to avoid use of the unpleasant macros in normal
circumstances.

This is a large changeset due to the number of calls that have been
replaced. The only files that contain changes other than simple
substitution of function calls are libbb.h, libbb/herror_msg.c,
libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c,
networking/udhcp/common.h and util-linux/mdev.c additonal macros have
been added for logging so that single parameter and multiple parameter
logging variants exist.

The amount of space saved varies considerably by architecture, and was
found to be as follows (for 'defconfig' using GCC 7.4):

Arm:     -92 bytes
MIPS:    -52 bytes
PPC:   -1836 bytes
x86_64: -938 bytes

Note that for the MIPS architecture only an exception had to be made
disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h)
because it made these files larger on MIPS.

Signed-off-by: James Byrne <james.byrne@origamienergy.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agontpd: abort if argvs are (unexpectedly) given
Denys Vlasenko [Tue, 2 Jul 2019 09:28:18 +0000 (11:28 +0200)]
ntpd: abort if argvs are (unexpectedly) given

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agofree: include SReclaimable in cached value
Lukas Rusak [Tue, 25 Jun 2019 16:52:33 +0000 (18:52 +0200)]
free: include SReclaimable in cached value

I noticed that the 'used' values from busybox free and
procps-ng free differed so I looked into why. It turns
out that procps-ng uses the "SReclaimable" value as
part of the cached value.

This was changed in
procps-ng commit 05d751c4f076a2f0118b914c5e51cfbb4762ad8e

function                                             old     new   delta
free_main                                            633     653     +20

Signed-off-by: Lukas Rusak <lorusak@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agolibbb: deal with "declaration of 'link' shadows a global declaration" warning
Denys Vlasenko [Tue, 25 Jun 2019 16:51:00 +0000 (18:51 +0200)]
libbb: deal with "declaration of 'link' shadows a global declaration" warning

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agopidof: support "pidof /path/to/binary" case
Denys Vlasenko [Sat, 15 Jun 2019 16:35:39 +0000 (18:35 +0200)]
pidof: support "pidof /path/to/binary" case

function                                             old     new   delta
find_pid_by_name                                     230     227      -3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoreadlink,realpath: fix a case with a symplink, closes 11021
Denys Vlasenko [Thu, 13 Jun 2019 15:08:29 +0000 (17:08 +0200)]
readlink,realpath: fix a case with a symplink, closes 11021

function                                             old     new   delta
xmalloc_realpath_coreutils                           125     201     +76

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoudhcpc: fix comment, no code changes
Denys Vlasenko [Thu, 13 Jun 2019 08:02:03 +0000 (10:02 +0200)]
udhcpc: fix comment, no code changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agoudhcpc6: fix aliasing warning
Denys Vlasenko [Tue, 11 Jun 2019 16:18:48 +0000 (18:18 +0200)]
udhcpc6: fix aliasing warning

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
5 years agodhcpc.c: Added support for relay server parameter.
Martin Lewis [Mon, 10 Jun 2019 15:06:17 +0000 (17:06 +0200)]
dhcpc.c: Added support for relay server parameter.

Resolved a TODO by adding support for gateway_nip parameter.

function                                             old     new   delta
udhcp_run_script                                     792     835     +43

Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>