Denys Vlasenko
d661cb1977
ash: sleep builtin with no arguments should not exit
...
function old new delta
sleep_main 116 143 +27
.rodata 105245 105268 +23
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 50/0) Total: 50 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-04-25 16:47:22 +02:00
Denys Vlasenko
99476502f9
Remove "select PLATFORM_LINUX"
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-11-29 14:14:06 +01:00
Samuel Thibault
77216c368f
Fix non-Linux builds
...
Various tools are Linuxish and should thus only attempted to build on
Linux only. Some features are also Linux-only.
Also, libresolv is used on all GNU platforms, notably GNU/Hurd and
GNU/kfreeBSD.
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-11-29 14:10:22 +01:00
Louis Sautier
707a7ef4c7
pkill: add -e to display the name and PID of the process being killed
...
This mimics the behaviour of pkill -e / --echo from procps.
function old new delta
.rodata 105179 105200 +21
packed_usage 34523 34516 -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 21/-7) Total: 14 bytes
Signed-off-by: Louis Sautier <sautier.louis@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-10-14 14:33:34 +02:00
Denys Vlasenko
fe73c8d557
*: style fix
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-08-30 16:41:17 +02:00
Denys Vlasenko
8d67007a4d
top: improve large PID display in memory ('s') mode
...
function old new delta
display_topmem_process_list 530 564 +34
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-05-12 11:44:47 +02:00
Denys Vlasenko
1099a27696
top: code shrink
...
function old new delta
display_process_list 1186 1168 -18
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-05-10 14:04:34 +02:00
Denys Vlasenko
69f82e305b
top: code shrink
...
function old new delta
display_process_list 1191 1186 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-05-10 13:51:09 +02:00
Denys Vlasenko
294881d2e9
top: fix display of large PID/PPID
...
function old new delta
display_process_list 1077 1191 +114
.rodata 104803 104807 +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 118/0) Total: 118 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-05-10 12:56:28 +02:00
Denys Vlasenko
987be932ed
*: slap on a few ALIGN_PTR where appropriate
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-02-06 20:07:12 +01:00
Denys Vlasenko
12566e7f9b
ash,hush: fix handling of SIGINT while waiting for interactive input
...
function old new delta
lineedit_read_key 160 237 +77
__pgetc 522 589 +67
fgetc_interactive 244 309 +65
safe_read_key - 39 +39
read_key 588 607 +19
record_pending_signo 23 32 +9
signal_handler 75 81 +6
.rodata 104312 104309 -3
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 6/1 up/down: 282/-3) Total: 279 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-01-17 11:46:23 +01:00
Denys Vlasenko
524fecf7c3
nmeter: %[md] %[mw] - dirty file-backed pages, writeback pages
...
function old new delta
collect_mem 333 387 +54
.rodata 104369 104380 +11
packed_usage 34184 34175 -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 65/-9) Total: 56 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-01-11 19:32:16 +01:00
Denys Vlasenko
89092c61bc
powertop: fix cpuid asm: ebx saving/restoring is properly done by gcc
...
function old new delta
print_intel_cstates 481 477 -4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2022-01-07 01:33:46 +01:00
Denys Vlasenko
94c78aa0b9
config system: move some options closer to relevalnt tool subdirectories
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-10-12 13:23:29 +02:00
Denys Vlasenko
eb048a450c
ps: fix -o pid=PID,args interpreting entire "PID,args" as header
...
procps-ng 3.3.15 does not do this.
(It could, allowing commas in headers and requiring
"ps -opid=PID -oargs" form for this case, but it does not).
function old new delta
parse_o 167 190 +23
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-10-07 21:55:16 +02:00
YU Jincheng
1f925038ab
*: generalize "const trick"
...
While at it, change all "__asm__" to "asm"
Co-authored-by: canyie <31466456+canyie@users.noreply.github.com>
Signed-off-by: YU Jincheng <shana@zju.edu.cn>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-10-07 15:22:35 +02:00
Denys Vlasenko
62d5a1e56f
tar,smemcap: commonalyze checksumming code for tar header
...
function old new delta
chksum_and_xwrite_tar_header - 99 +99
writeheader 280 199 -81
chksum_and_xwrite 102 - -102
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 0/1 up/down: 99/-183) Total: -84 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-08-20 17:58:49 +02:00
Denys Vlasenko
dc30f3dce2
free: implement -h
...
function old new delta
.rodata 103331 103363 +32
packed_usage 33652 33654 +2
free_main 657 588 -69
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 34/-69) Total: -35 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-18 12:08:02 +02:00
Denys Vlasenko
57be5daa40
lsof: print fd# too
...
function old new delta
lsof_main 179 188 +9
.rodata 103194 103187 -7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-16 12:49:15 +02:00
Denys Vlasenko
1f60d88cf6
*: more --help tweaks
...
function old new delta
packed_usage 33552 33541 -11
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-15 10:00:18 +02:00
Denys Vlasenko
e2b9215868
*: --help tweaks
...
function old new delta
packed_usage 33589 33552 -37
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-14 20:47:20 +02:00
Denys Vlasenko
6f7b10cdab
*: more --help tweaking
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-13 03:51:55 +02:00
Denys Vlasenko
1849285a20
*: more --help tweaks, mostly expanding ts --help
...
function old new delta
packed_usage 33554 33596 +42
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-13 03:12:09 +02:00
Denys Vlasenko
6b6826f0b8
*: --help tweaks
...
function old new delta
.rodata 103190 103189 -1
packed_usage 33590 33566 -24
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-25) Total: -25 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-06-13 01:08:48 +02:00
Ron Yorston
cad3fc743a
libbb: introduce and use fputs_stdout
...
function old new delta
fputs_stdout - 12 +12
zxc_vm_process 7237 7230 -7
yes_main 85 78 -7
write_block 380 373 -7
wrapf 305 298 -7
strings_main 437 430 -7
show_bridge 353 346 -7
rev_main 384 377 -7
put_prompt_custom 58 51 -7
put_cur_glyph_and_inc_cursor 168 161 -7
print_numbered_lines 152 145 -7
print_named_ascii 130 123 -7
print_name 135 128 -7
print_login_issue 386 379 -7
print_ascii 208 201 -7
powertop_main 1249 1242 -7
od_main 1789 1782 -7
logread_main 518 511 -7
head_main 804 797 -7
display_process_list 1319 1312 -7
cut_main 1002 995 -7
bb_dump_dump 1550 1543 -7
bb_ask_noecho 393 386 -7
baseNUM_main 702 695 -7
expand_main 755 745 -10
dumpleases_main 497 487 -10
write1 12 - -12
putcsi 37 23 -14
print_login_prompt 55 41 -14
paste_main 525 511 -14
cat_main 440 426 -14
print_it 245 230 -15
print_addrinfo 1188 1171 -17
print_rule 770 750 -20
print_linkinfo 842 822 -20
httpd_main 791 771 -20
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/34 up/down: 12/-341) Total: -329 bytes
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-03 20:52:40 +01:00
Denys Vlasenko
2266c12a79
pmap: fix column width, closes 13431
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-05 19:39:34 +01:00
Denys Vlasenko
3c13da3dab
libbb: introduce and use xgettimeofday(), do not truncate 64-bit time_t in shells
...
function old new delta
xgettimeofday - 11 +11
get_local_var_value 280 281 +1
svlogd_main 1323 1322 -1
change_epoch 67 66 -1
timestamp_and_log 461 458 -3
hwclock_main 301 298 -3
fmt_time_bernstein_25 135 132 -3
step_time 331 326 -5
script_main 1207 1202 -5
machtime 34 28 -6
curtime 61 54 -7
ts_main 423 415 -8
nmeter_main 761 751 -10
gettime1900d 67 46 -21
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/12 up/down: 12/-73) Total: -61 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-30 23:48:01 +01:00
Denys Vlasenko
84d5eddb25
help text: replace [OPTIONS] with actual options (if not too long)
...
function old new delta
packed_usage 33620 33665 +45
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-13 22:34:05 +01:00
Denys Vlasenko
965b795b87
decrease paddign: gcc-9.3.1 slaps 32-byte alignment on arrays willy-nilly
...
text data bss dec hex filename
1021988 559 5052 1027599 fae0f busybox_old
1021236 559 5052 1026847 fab1f busybox_unstripped
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-30 13:03:03 +01:00
Denys Vlasenko
fc63549352
free: code shrink
...
function old new delta
free_main 664 657 -7
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-27 12:40:31 +01:00
Denys Vlasenko
2496616b0a
avoid using strok - eliminates use of hidden global variable
...
function old new delta
udhcp_str2optset 616 650 +34
setpriv_main 950 975 +25
switch_root_main 688 706 +18
parse 958 970 +12
getopt_main 622 628 +6
parse_resolvconf 302 306 +4
mpstat_main 1139 1142 +3
static.p 4 - -4
cdcmd 717 702 -15
strtok 148 - -148
------------------------------------------------------------------------------
(add/remove: 0/3 grow/shrink: 7/1 up/down: 102/-167) Total: -65 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-10-06 02:36:47 +02:00
Ron Yorston
5c69ad0ecd
build system: drop PLATFORM_LINUX
...
PLATFORM_LINUX is a hidden configuration option which is disabled by
default and enabled at over a hundred locations for features that are
deemed to be Linux specific.
The only effect of PLATFORM_LINUX is to control compilation of
libbb/match_fstype.c. This file is only needed by mount and umount.
Remove all references to PLATFORM_LINUX and compile match_fstype.c
if mount or umount is enabled.
Signed-off-by: Ron Yorston <rmy@pobox.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-08-13 17:12:56 +02:00
Denys Vlasenko
df1f479fc5
randomconfig fixes
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-23 03:13:55 +02:00
Denys Vlasenko
4789c7cd81
nmeter: add %T (zero-based timestamp) format
...
function old new delta
collect_tv - 132 +132
collect_monotonic - 61 +61
nmeter_main 754 778 +24
gmtime - 21 +21
init_monotonic - 18 +18
init_functions 44 48 +4
packed_usage 33432 33420 -12
collect_time 125 19 -106
------------------------------------------------------------------------------
(add/remove: 5/0 grow/shrink: 2/2 up/down: 260/-118) Total: 142 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-10 15:37:39 +02:00
Denys Vlasenko
002be6e821
sysctl: do report EACCES errors on write
...
function old new delta
sysctl_act_recursive 165 179 +14
sysctl_act_on_setting 467 471 +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 18/0) Total: 18 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-09 15:58:32 +02:00
Denys Vlasenko
e5897d041d
suppress a few "unused function" warnings
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-25 13:05:15 +02:00
Denys Vlasenko
ac78f2ac96
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>
2019-08-11 16:17:11 +02:00
Denys Vlasenko
85b380f6b2
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>
2019-08-06 16:59:50 +02:00
James Byrne
6937487be7
libbb: reduce the overhead of single parameter bb_error_msg() calls
...
Back in 2007, commit 0c97c9d437
("'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>
2019-07-02 11:35:03 +02:00
Lukas Rusak
9663bbd17b
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>
2019-06-25 18:53:10 +02:00
Denys Vlasenko
3106784e65
ps: ensure fields are separated by at least one space, closes 11826
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-03 09:49:56 +02:00
Thomas De Schampheleire
2b6282117f
top: provide cmdline argument '-H' to enable thread scanning by default
...
In particular useful when you want to evaluate the threads in batch mode:
top -Hbn1
function old new delta
top_main 928 941 +13
packed_usage 33317 33319 +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 15/0) Total: 15 bytes
Signed-off-by: Philippe Belet <philippe.belet@nokia.com>
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-04 14:14:24 +02:00
Denys Vlasenko
0ddc742c04
watch: support fractional -n SEC
...
function old new delta
watch_main 212 232 +20
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-03-12 18:56:51 +01:00
Denys Vlasenko
4a6748662a
top: tweak --help
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-02-27 16:45:39 +01:00
Aaro Koskinen
c89764c063
sysctl: fix compatibility with procps sysctl
...
Busybox sysctl is incompatible with procps when '.' appears in
directory name, mostly happens with VLANs.
busybox syntax (since 2008): net.ipv4.conf.eth0.100.mc_forwarding
procps syntax (since 2002): net.ipv4.conf.eth0/100.mc_forwarding
(supported by both: net/ipv4/conf/eth0.100/mc_forwarding)
Use procps syntax for output; for input, allow both.
function old new delta
sysctl_dots_to_slashes 86 143 +57
sysctl_act_on_setting 443 453 +10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 67/0) Total: 67 bytes
Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-02-08 16:52:51 +01:00
Denys Vlasenko
78301861ef
sysctl: do slash/dot conversions only on name, not value part
...
function old new delta
sysctl_dots_to_slashes 71 86 +15
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-02-08 16:02:39 +01:00
Denys Vlasenko
1422ba6dea
sysctl: on EIO ("sysctl net.ipv6.conf.all.stable_secret") set nonzero exitcode
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-02-08 14:59:06 +01:00
Denys Vlasenko
679c30e73e
sysctl: avoid stat() on every item if in -w mode
...
function old new delta
sysctl_act_recursive 163 167 +4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-02-08 14:27:21 +01:00
Denys Vlasenko
317498f3b3
sysctl: allow setting empty values
...
function old new delta
sysctl_act_on_setting 451 445 -6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-02-08 14:02:59 +01:00
Denys Vlasenko
aad76968cd
pmap: make 32-bit version work better on 64-bit kernels
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-31 15:18:45 +01:00