aboutsummaryrefslogtreecommitdiff
path: root/util-linux
AgeCommit message (Collapse)Author
2020-11-22mdev: clear LOGMODE_STDIO only directly before daemonizingDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-22uevent: make it survive ENOBUFSDenys Vlasenko
function old new delta uevent_main 285 337 +52 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-22mdev: clean upDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-22mdev: add -v to increase log verbosityJan Klötzke
If logging to stderr and/or syslog the -v option can be given one or more times to increase the log verbosity. If mdev is used as hotplug helper the log level is fixed set to 2 if mdev.log is found an appended because there is no possiblity to pass arguments to the hotplug helper. Signed-off-by: Jan Klötzke <jan@kloetzke.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-22mdev: add syslog logging modeJan Klötzke
If mdev is run as daemon it should be possible to forward the debug messages to syslog. This feature might be useful if mdev is run with -s during boot too. OTOH it makes no sense for the daemon to log to mdev.log. This can be handled by a syslog daemon way better. If the daemon stays in the foreground due to -f, the messages are still written to stderr as before. Signed-off-by: Jan Klötzke <jan@kloetzke.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-22mdev: re-initialize if uevent messages were lostJan Klötzke
If the netlink read() failed with ENOBUFS we know that we have missed at least one message due to a socket receive buffer overrun. The only way how to recover is to drop the old socket, open a fresh one and make a cold-plug scan of the current system state. Signed-off-by: Jan Klötzke <jan@kloetzke.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-22mdev: move daemon setup to dedicated functionJan Klötzke
Signed-off-by: Jan Klötzke <jan@kloetzke.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-22uevent: increase netlink buffer sizesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-22mdev: increase netlink buffer sizesJan Klötzke
The socket receive buffer turned out to be too small for real world systems. Use the same size as udevd to be on the safe side. As this is just a limit and the memory is not allocated by the kernel until really needed there is actually no memory wasted. Signed-off-by: Jan Klötzke <jan@kloetzke.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-19volume_id: improve struct layout (smaller offesets, smaller insns on x86)Denys Vlasenko
function old new delta volume_id_probe_xfs 101 98 -3 volume_id_probe_vfat 827 824 -3 volume_id_probe_udf 541 538 -3 volume_id_probe_ubifs 67 64 -3 volume_id_probe_squashfs 86 83 -3 volume_id_probe_romfs 97 94 -3 volume_id_probe_reiserfs 246 243 -3 volume_id_probe_ocfs2 110 107 -3 volume_id_probe_ntfs 288 285 -3 volume_id_probe_nilfs 100 97 -3 volume_id_probe_minix 85 82 -3 volume_id_probe_luks 92 89 -3 volume_id_probe_linux_swap 251 248 -3 volume_id_probe_linux_raid 131 128 -3 volume_id_probe_lfs 62 59 -3 volume_id_probe_jfs 110 107 -3 volume_id_probe_iso9660 318 315 -3 volume_id_probe_f2fs 107 104 -3 volume_id_probe_exfat 285 282 -3 volume_id_probe_erofs 89 86 -3 volume_id_probe_cramfs 67 64 -3 volume_id_probe_btrfs 134 131 -3 volume_id_probe_bcache 107 104 -3 volume_id_probe_sysv 194 188 -6 volume_id_probe_hfs_hfsplus 518 512 -6 add_to_uuid_cache 271 265 -6 volume_id_probe_ext 131 122 -9 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/27 up/down: 0/-96) Total: -96 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-18util-linux: support erofs filesystemNorbert Lange
Add erofs to the known volume_ids. function old new delta volume_id_probe_erofs - 89 +89 fs1 24 28 +4 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 1/0 up/down: 93/0) Total: 93 bytes Signed-off-by: Norbert Lange <nolange79@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-15chrt: support for musl C libraryChristian Eggers
musl "implements" several sched_xxx() functions by returning ENOSYS. As an alternative, either pthread_(g|s)etschedparam() or direct syscalls can be used. References: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/commit/schedutils/chrt.c?id=fcc3078754291d2f5121797eb91b364f8e24b2f1 References: http://git.musl-libc.org/cgit/musl/commit/src/sched/sched_setscheduler.c?id=1e21e78bf7a5c24c217446d8760be7b7188711c2 Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-10-25compat: move hexdump -R functionality to xxd -rDenys Vlasenko
function old new delta xxd_main 466 680 +214 packed_usage 33474 33483 +9 hexdump_opts 17 16 -1 hexdump_main 565 401 -164 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/2 up/down: 223/-165) Total: 58 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-10-20xxd: fix printing of trailing spacesDenys Vlasenko
function old new delta bb_dump_dump 1497 1523 +26 xxd_main 459 466 +7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 33/0) Total: 33 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-10-06avoid using strok - eliminates use of hidden global variableDenys Vlasenko
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-01libbb: shrink recursive_action() by reducing memory pressureDenys Vlasenko
function old new delta recursive_action1 - 316 +316 file_action_grep 161 164 +3 add_to_prg_cache_if_socket 202 205 +3 depmod_main 509 511 +2 writeFileToTarball 488 489 +1 parse_module 281 282 +1 fileAction 207 208 +1 act 189 190 +1 add_to_dirlist 65 64 -1 writeTarFile 196 194 -2 uuidcache_init 47 45 -2 uuidcache_check_device 109 107 -2 true_action 8 6 -2 run_parts_main 310 308 -2 netstat_main 534 532 -2 lsusb_main 29 27 -2 lspci_main 45 43 -2 initial_scan 138 136 -2 grep_main 845 843 -2 find_main 482 480 -2 config_file_action 437 435 -2 chmod_main 142 140 -2 dirAction 14 10 -4 diff_main 1544 1540 -4 chown_main 154 148 -6 skip_dir 136 129 -7 dir_act 191 184 -7 recursive_action 453 69 -384 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 7/20 up/down: 328/-439) Total: -111 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-10-01mount: support the sizelimit and offset option for loop devicesSteffen Trumtrar
Starting with linux kernel v5.4 squashfs has a more strict parameter checking implemented. Unlike util-linux mount, busybox never supported the sizelimit option but simply forwards it to the kernel. Since v5.4 mounting will fail with squashfs: Unknown parameter 'sizelimit' Support the sizelimit parameter by setting it in the LOOP_SET_STATUS64 structure before handing it to the kernel. While at it also add support for the offset option, which currently will always be set to 0. function old new delta cut_out_ull_opt - 167 +167 singlemount 1230 1266 +36 set_loop 834 862 +28 losetup_main 479 483 +4 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 3/0 up/down: 235/0) Total: 235 bytes Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-08-15hwclock: Fix settimeofday for glibc v2.31+Eddie James
The glibc implementation changed for settimeofday, resulting in "invalid argument" error when attempting to set both timezone and time with a single call. Fix this by calling settimeofday twice Signed-off-by: Eddie James <eajames@linux.ibm.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-08-13build system: drop PLATFORM_LINUXRon Yorston
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-06-29acpid: only display -p if supported in usageNorbert Lange
Signed-off-by: Norbert Lange <nolange79@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-06-24nologin: make it possible to build it as single appletDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-02-14fdisk: add HFS / HFS+ partition typeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-19Remove stime() function callsAlistair Francis
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>
2019-11-09taskset: tighten the check for stride valuesDenys Vlasenko
function old new delta taskset_main 986 987 +1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-09taskset: implement stride argumentDenys Vlasenko
function old new delta taskset_main 925 986 +61 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-08taskset: update commentDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-11-01taskset: add support for taking/printing CPU list (-c option)Denys Vlasenko
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>
2019-10-25suppress a few "unused function" warningsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-04fdisk_aix: fix aliasing warning, comment out unused global variablesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-10-04fdisk: avoid overflow in "mega/gigabytes" calculation, code shrinkDenys Vlasenko
function old new delta list_disk_geometry 175 145 -30 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-07-02libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne
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>
2019-06-09mount,losetup: use /dev/loop-control is it existsDenys Vlasenko
function old new delta get_free_loop - 58 +58 set_loop 597 649 +52 losetup_main 482 476 -6 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/1 up/down: 110/-6) Total: 104 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-06-08blockdev: add usage comment, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-06-03libbb: move netlink socket binding to the utility functionDenys Vlasenko
function old new delta create_and_bind_to_netlink - 134 +134 ifplugd_main 1117 1052 -65 uevent_main 399 306 -93 mdev_main 314 215 -99 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/3 up/down: 134/-257) Total: -123 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-06-03mdev: add support to run as daemonJan Klötzke
Adds the -d option to run mdev in daemon mode handling hotplug events from the kernel like udev. If the system generates many hotplug events this mode of operation will consume less resources than registering mdev as hotplug helper or using the uevent applet. function old new delta daemon_loop - 152 +152 initial_scan - 127 +127 open_mdev_log - 85 +85 mdev_main 255 314 +59 packed_usage 33284 33316 +32 process_action 1051 992 -59 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 2/1 up/down: 455/-59) Total: 396 bytes Signed-off-by: Jan Klötzke <jan@kloetzke.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-06-03mdev: use option parser helperJan Klötzke
function old new delta process_action - 1051 +1051 mdev_main 1324 255 -1069 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/1 up/down: 1051/-1069) Total: -18 bytes Signed-off-by: Jan Klötzke <jan@kloetzke.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-06-03mdev: move action processing into separate functionsJan Klötzke
This purely moves code from main() to separate functions for better extensibility. Signed-off-by: Jan Klötzke <jan@kloetzke.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-30losetup: Add partition scanning optionJack O'Sullivan
Add -P option from util-linux losetup to scan for partitions. function old new delta losetup_main 449 482 +33 packed_usage 33264 33292 +28 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 61/0) Total: 61 bytes Signed-off-by: Jack O'Sullivan <jackos1998@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-23losetup: implement -cDenys Vlasenko
function old new delta losetup_main 422 449 +27 packed_usage 33243 33264 +21 get_next_block 1677 1681 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 52/0) Total: 52 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-05-14style fix, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-05chrt: fix for SCHED_RESET_ON_FORK bitDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-05chrt: do not segfault if policy number is unknownDenys Vlasenko
While at it, improve help text function old new delta packed_usage 33319 33344 +25 policy_name - 22 +22 show_min_max 59 64 +5 chrt_main 432 429 -3 policies 72 - -72 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 2/1 up/down: 52/-75) Total: -23 bytes text data bss dec hex filename 982150 485 7296 989931 f1aeb busybox_old 982183 485 7296 989964 f1b0c busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-03-30blockdev: code shrinkDenys Vlasenko
function old new delta bdcmd_names - 82 +82 bdcmd_ioctl - 44 +44 bdcmd_flags - 11 +11 blockdev_main 273 258 -15 bdcommands 176 - -176 ------------------------------------------------------------------------------ (add/remove: 3/1 grow/shrink: 0/1 up/down: 137/-191) Total: -54 bytes text data bss dec hex filename 982326 485 7296 990107 f1b9b busybox_old 982272 485 7296 990053 f1b65 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-03-15Fix off by one error in FAT16 <=> FAT32 detectionThomas Frauendorfer
cluster_count is compared against FAT16_MAX, which is defined as 0xfff4 That is the maximum number of cluster a FAT16 can have. For reference also check the hardware whitepaper from Microsoft FAT: General Overview of On-Disk Format, version 1.03 page 15 Signed-off-by: Thomas Frauendorfer <tf@miray.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-28config: add size information for three more appletsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-28config: update size informationDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-12-08mdev: suppress aliasing warningDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-27hush: allow hush to run embedded scriptsRon Yorston
Embedded scripts require a shell to be present in the BusyBox binary. Allow either ash or hush to be used for this purpose. If both are enabled ash takes precedence. The size of the binary is unchanged in the default configuration: both ash and hush are present but support for embedded scripts isn't compiled into hush. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-27docs: add embedded-scripts.txtRon Yorston
Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-17Treat custom and applet scripts as appletsRon Yorston
BusyBox has support for embedded shell scripts. Two types can be distinguished: custom scripts and scripts implementing applets. Custom scripts should be placed in the 'embed' directory at build time. They are given a default applet configuration and appear as applets to the user but no further configuration is possible. Applet scripts are integrated with the BusyBox build system and are intended to be used to ship standard applets that just happen to be implemented as scripts. They can be configured at build time and appear just like native applets. Such scripts should be placed in the 'applets_sh' directory. A stub C program should be written to provide the usual applet configuration details and placed in a suitable subsystem directory. It may be helpful to have a configuration option to enable any dependencies the script requires: see the 'nologin' applet for an example. function old new delta scripted_main - 41 +41 applet_names 2773 2781 +8 applet_main 1600 1604 +4 i2cdetect_main 672 674 +2 applet_suid 100 101 +1 applet_install_loc 200 201 +1 applet_flags 100 101 +1 packed_usage 33180 33179 -1 tryexec 159 152 -7 evalcommand 1661 1653 -8 script_names 9 - -9 packed_scripts 123 114 -9 complete_cmd_dir_file 826 811 -15 shellexec 271 254 -17 find_command 1007 990 -17 busybox_main 642 624 -18 run_applet_and_exit 100 78 -22 find_script_by_name 51 - -51 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 6/9 up/down: 58/-174) Total: -116 bytes text data bss dec hex filename 950034 477 7296 957807 e9d6f busybox_old 949918 477 7296 957691 e9cfb busybox_unstripped Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>