Commit Graph

16821 Commits

Author SHA1 Message Date
Alex Samorukov
09aba8bac4 Fix missing "crypt.h" compilation error on the FreeBSD
FreeBSD does not use crypt.h, but unistd.h which is already included

Signed-off-by: Alex Samorukov <samm@os2.kiev.ua>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04 13:28:28 +01:00
Alex Samorukov
92d84c4014 Fix klogd applet compilation on the FreeBSD
FreeBSD also using /dev/klog, see syslogd(8)

Signed-off-by: Alex Samorukov <samm@os2.kiev.ua>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04 13:28:28 +01:00
Alex Samorukov
dae90bbcc2 Fix httpd compilation on the FreeBSD
FreeBSD is not exporting s6_addr32 by default, but has it.

Signed-off-by: Alex Samorukov <samm@os2.kiev.ua>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04 13:28:28 +01:00
Alex Samorukov
d4624d3468 Fix bb_setpgrp weapper on the FreeBSD
FreeBSD uses setpgrp(pid_t, pid_t)
This patch makes crond.c and probably others compilable

Signed-off-by: Alex Samorukov <samm@os2.kiev.ua>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04 13:28:28 +01:00
Alex Samorukov
0544933501 Do not add -lresolv on non-Linux systems
On FreeBSD getaddrinfo and friends are part of libc.
Other OS-es will also have own dependencies

Signed-off-by: Alex Samorukov <samm@os2.kiev.ua>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04 13:28:28 +01:00
Denys Vlasenko
4e039bab37 ash: improve --help
function                                             old     new   delta
packed_usage                                       33504   33499      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04 03:50:38 +01:00
Denys Vlasenko
3b053051c7 hush: code shrink
function                                             old     new   delta
hush_main                                           1071    1066      -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-5)               Total: -5 bytes
   text	   data	    bss	    dec	    hex	filename
1020110	    559	   5020	1025689	  fa699	busybox_old
1020037	    559	   5020	1025616	  fa650	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-04 03:05:34 +01:00
Denys Vlasenko
8b085d60bc nuke: default to N
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-03 16:48:53 +01:00
Denys Vlasenko
85158b600d ash: code shrink
function                                             old     new   delta
ash_main                                            1218    1202     -16

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-03 12:14:58 +01:00
Denys Vlasenko
3f8ec00b0c ash: make a strdup copy of $HISTFILE for line editing
Otherwise if $HISTFILE is unset or reassigned, bad things can happen.

function                                             old     new   delta
ash_main                                            1210    1218      +8

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-03 10:55:39 +01:00
Andre Kalb
5f2e00f66d udhcpc: Add support to change default interface name
Signed-off-by: Andre Kalb <Andre.Kalb@sma.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-01 19:08:28 +01:00
Denys Vlasenko
868f383699 tls: code shrink
function                                             old     new   delta
curve25519                                           881     832     -49

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-01 18:48:38 +01:00
Denys Vlasenko
9daa877d6b tar: add TODO about a bug with non-writable directories on extract
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-01-01 13:34:25 +01:00
Denys Vlasenko
49fd1d69ba nslookup: do not print "No answer" for NODATA replies, closes 13006
Only print when there was no answer at all.

function                                             old     new   delta
send_queries                                        1834    1813     -21

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-31 01:39:44 +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
89a55972fd libbb/procps: smaller global data for username/groupname cache
function                                             old     new   delta
get_cached                                           101     133     +32
cache_user_group                                       -       4      +4
get_cached_username                                   17      14      -3
username                                               8       -      -8
groupname                                              8       -      -8
clear_username_cache                                  65      47     -18
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 1/2 up/down: 36/-37)             Total: -1 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-30 01:04:56 +01:00
Denys Vlasenko
b230ff9d8f *: use fopen helpers where appropriate
function                                             old     new   delta
finalize                                             348     343      -5
parse_resolvconf                                     306     299      -7
list_i2c_busses_and_exit                             495     483     -12
bootchartd_main                                     1091    1076     -15
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-39)             Total: -39 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-30 00:16:27 +01:00
Maxim Storchak
04e0d8e579 httpd: fix offset for sendfile
If the Range: header is not present it the request,
the offset passed to sendfile is wrong,
and httpd falls back to the read-write loop.

function                                             old     new   delta
send_file_and_exit                                   857     865      +8
handle_incoming_and_exit                            2239    2230      -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 8/-9)               Total: -1 bytes

Signed-off-by: Maxim Storchak <m.storchak@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-29 23:03:32 +01:00
Denys Vlasenko
29a9043b36 bc,dc: make BC_LINE_LENGTH/DC_LINE_LENGTH more compatible with GNU
function                                             old     new   delta
xc_vm_init                                           640     682     +42

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-29 18:52:19 +01:00
Denys Vlasenko
cba45d9b65 Start 1.34.0 development cycle
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-29 17:43:40 +01:00
Denys Vlasenko
a4c3a34139 Bump version to 1.33.0
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-29 17:42:59 +01:00
Denys Vlasenko
ec9a5e6083 libiproute: band-aid for old uclibc missing IFA_FLAGS
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-29 17:34:34 +01:00
Denys Vlasenko
fecb1693cc modprobe-small: convert to new recursive_action() API
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-29 17:02:06 +01:00
Denys Vlasenko
40f9fe2160 bc: placate gcc (it thinks 's' can be uninitialized here)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-29 17:02:06 +01:00
Denys Vlasenko
77a51a2709 randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-29 16:53:11 +01:00
Denys Vlasenko
c7ef818768 hush: make comment more clear
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-27 16:04:54 +01:00
Denys Vlasenko
1462673dde man: implement SECTION parameters
function                                             old     new   delta
man_main                                             807     942    +135
is_section_name                                        -      52     +52
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 187/0)             Total: 187 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-27 16:02:37 +01:00
Denys Vlasenko
cad20ced86 typo fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-25 19:08:16 +01:00
Denys Vlasenko
1237d627e9 hush: fix this case: echo "SCRIPT" | hush
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-25 19:01:49 +01:00
Denys Vlasenko
46a71dc30c hush: if !EDITING, do not regenerate prompt for every input char
function                                             old     new   delta
fgetc_interactive                                    261     258      -3
pseudo_exec_argv                                     406     399      -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-10)             Total: -10 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-25 18:49:29 +01:00
Lauri Kasanen
6cfec7dd02 mount: Surround syslog.h with the config check
This lets bb mount build for limited targets without syslog.h,
as long as the parts using it like NFS are disabled.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-25 18:15:37 +01:00
Denys Vlasenko
51a471d05d ash: change "clear ungetc counter on syntax errors" fix to match dash
function                                             old     new   delta
ash_main                                            1203    1210      +7
raise_exception                                       39      26     -13
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 7/-13)              Total: -6 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-24 00:22:24 +01:00
Denys Vlasenko
521220ed1a hush: fix ^C in INTERACTIVE, !EDITING config
function                                             old     new   delta
refill_HFILE_and_getc                                 88     170     +82
fgetc_interactive                                    226     250     +24
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 106/0)             Total: 106 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-23 23:44:55 +01:00
Denys Vlasenko
18bcaf374c hush: revert "make interactive ^C break out of PS2 mode"
It made ^C break out of the entire shell, if we aren't in PS2 mode.
Need a better idea.

function                                             old     new   delta
expand_one_var                                      2344    2353      +9
syntax_error_unterm_ch                                21      29      +8
parse_dollar                                         817     824      +7
parse_stream                                        2251    2238     -13
fgetc_interactive                                    249     227     -22
syntax_error_unterm_str                               26       -     -26
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 3/2 up/down: 24/-61)            Total: -37 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-23 23:01:18 +01:00
Denys Vlasenko
649acb9e23 hush: fix PS1 prompth in !EDITING config
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-23 15:29:13 +01:00
Denys Vlasenko
a7b52d26c4 hush: fix fallout from tweaking ${var:START:LEN} code
function                                             old     new   delta
expand_one_var                                      2344    2353      +9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-23 12:38:03 +01:00
Denys Vlasenko
93e2a22482 shell: for signal exitcode, use 128 | sig, not 128 + sig - MIPS has signal 128
function                                             old     new   delta
wait_for_child_or_signal                             213     214      +1
refill_HFILE_and_getc                                 89      88      -1
getstatus                                             97      96      -1
builtin_wait                                         339     337      -2
checkjobs                                            187     183      -4
process_wait_result                                  450     444      -6
waitcmd                                              290     281      -9
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/6 up/down: 1/-23)             Total: -22 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-23 12:23:21 +01:00
Denys Vlasenko
0ab2dd4f28 hush: fix comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-23 02:22:08 +01:00
Denys Vlasenko
6297d66eda factor: fix comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-23 02:03:04 +01:00
Denys Vlasenko
6452c30036 factor: detect squares
If we have a square, the speedup can be extremely large
(in best case example below, it's ~40000 times faster):

$ time ./busybox_old factor 18446743988964486098
18446743988964486098: 2 3037000493 3037000493
real	0m4.246s
$ time ./busybox factor 18446743988964486098
18446743988964486098: 2 3037000493 3037000493
real	0m0.000s

function                                             old     new   delta
isqrt_odd                                              -      57     +57
print_w                                                -      36     +36
factorize                                            218     236     +18
print_h                                                -       7      +7
factorize_numstr                                      65      72      +7
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 2/0 up/down: 125/0)             Total: 125 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-22 20:24:30 +01:00
Denys Vlasenko
96717d9fb4 lineedit: code shrink
function                                             old     new   delta
read_line_input                                     3171    3157     -14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-21 22:50:23 +01:00
Denys Vlasenko
fae7332ebf lineedit: add a comment about possible use of tcflush()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-21 21:55:03 +01:00
Denys Vlasenko
00eb23b47a bc: do not allocate line editing state until needed
function                                             old     new   delta
xc_read_line                                         324     353     +29
free_line_input_t                                     34      39      +5
xc_vm_init                                           656     640     -16
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 34/-16)             Total: 18 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-21 21:36:58 +01:00
Andy Shevchenko
e4202df091 modprobe: Add support for modprobe.blacklist=module1,module2,...
function                                             old     new   delta
parse_and_add_kcmdline_module_options                  -     186    +186
modprobe_main                                        713     798     +85
do_modprobe                                          648     451    -197
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 271/-197)           Total: 74 bytes

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-21 21:15:35 +01:00
Denys Vlasenko
07abc7c6f7 hush: deal with FIXMEs for corner cases in parameter expansion
function                                             old     new   delta
expand_one_var                                      2323    2344     +21

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-21 10:14:18 +01:00
Denys Vlasenko
901d2c3862 factor: fix typo in undef
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-21 07:45:08 +01:00
Denys Vlasenko
3e544d6ec7 factor: code shrink
function                                             old     new   delta
factor_main                                          176     171      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-21 07:22:55 +01:00
Denys Vlasenko
f079f91371 factor: 30% faster trial division (better sieve)
function                                             old     new   delta
packed_wheel                                           -     192    +192
factor_main                                          108     176     +68
factorize                                            284     218     -66
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/1 up/down: 260/-66)           Total: 194 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-20 21:37:29 +01:00
Denys Vlasenko
bb4e32befa hush: remove one redundant getpid() on every startup
function                                             old     new   delta
hush_main                                           1151    1147      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-20 16:36:00 +01:00
Denys Vlasenko
c8f6c1d775 ping6: add -w/-W NUM to --help
function                                             old     new   delta
packed_usage                                       33515   33533     +18

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-12-20 11:25:50 +01:00