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>
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 34425389e0
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>
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>
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>
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>
$ dd bs=1G <sda1 of=/dev/sda1
dd: error writing '/dev/sda1': No space left on device
1+0 records in
0+0 records out
999292928 bytes (953.0MB) copied, 0.784617 seconds, 1.2GB/s
function old new delta
write_and_stats 99 102 +3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
With FEATURE_SYNC_FANCY not set:
function old new delta
fsync_main 130 123 -7
With FEATURE_SYNC_FANCY set, should be much larger code size savings.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
sync: add O_NOCTTY
fsync: drop O_NOATIME, add O_NONBLOCK, set exitcode to 1 if fsync() fails,
update --help message to be similar to sync.
both: reformat code to minimize "diff -u sync.c fsync.c":
in particular, they use same open() flags now
function old new delta
fsync_main 126 130 +4
packed_usage 33316 33317 +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 5/0) Total: 5 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Thanks to Cristian Ionescu-Idbohrn for noticing.
Also fix "%d" ' 42' to skip leading whitespace.
function old new delta
print_direc 435 454 +19
bb_strtoll 99 103 +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 23/0) Total: 23 bytes
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Kconfig-language.txt was deleted in commit 4fa499a17b back in 2006.
Move to docs/ as suggested by Xabier Oneca:
http://lists.busybox.net/pipermail/busybox/2014-May/080914.html
Also update references to it everywhere.
Signed-off-by: Kartik Agaram <akkartik@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
On sorting all kernel/linux/arch/ *.[ch] files,
this reduces memory usage by 6%.
yes | head -99999999 | sort
goes down from 1900Mb to 380 Mb.
function old new delta
sort_main 862 1098 +236
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>