aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-03-30applet_tables: save space by removing applet name offsetsRon Yorston
The array applet_nameofs consumes two bytes per applet. It encodes nofork/noexec flags suid flags the offset of the applet name in the applet_name string Change the applet_table build tool to store the flags in two separate arrays (applet_flags and applet_suid). Replace applet_nameofs[] with a smaller version that only stores a limited number of offsets. This requires changes to the macros APPLET_IS_NOFORK, APPLET_IS_NOEXEC and APPLET_SUID. According to Valgrind the original find_applet_by_name required 353 cycles per call, averaged over all names. Adjusting the number of known offsets allows space to be traded off against execution time: KNOWN_OFFSETS cycles bytes (wrt KNOWN_OFFSETS = 0) 0 9057 - 2 4604 32 4 2407 75 8 1342 98 16 908 130 32 884 194 This patch uses KNOWN_OFFSETS = 8. v2: Remove some dead code from the applet_table tool; Treat the applet in the middle of the table as a special case. v3: Use the middle applet to adjust the start of the linear search as well as the last applet found. v4: Use an augmented linear search in find_applet_by_name. Drop the special treatment of the middle name from get_applet_name: most of the advantage now derives from the last stored value. v5: Don't store index in applet_nameofs, it can be calculated. v6: Tweaks by Denys function old new delta find_applet_by_name 25 125 +100 applet_suid - 92 +92 run_applet_no_and_exit 452 460 +8 run_applet_and_exit 695 697 +2 applet_name_compare 31 - -31 applet_nameofs 734 14 -720 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 3/1 up/down: 202/-751) Total: -549 bytes text data bss dec hex filename 925464 906 17160 943530 e65aa busybox_old 924915 906 17160 942981 e6385 busybox_unstripped Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-29Revert "networking: properly initialize ipv6 scope id for printing it"Denys Vlasenko
This reverts commit 2fb63292f7083fb259a3f8d8ee70ef8acdaed626. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-29modprobe: skip non-.conf files only in subdirectoriesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-28umount: build fix for older glibcDenys Vlasenko
Based on a patch by Veli-Pekka Peltola <veli-pekka.peltola@ray.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-28networking: properly initialize ipv6 scope id for printing itTimo Teräs
Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-28grep: make errors other than "not found" result in exit code 2. Closes 8796Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-22ash_test: ignore generated filesMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2016-03-22ash_test: printenv: fix missing includesMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2016-03-22ash: fix corruption of ${#var} if $var contains UTF-8 charactersRon Yorston
As reported in bug 8506: $ X=abcdÉfghÍjklmnÓpqrstÚvwcyz $ echo ${#X} abcd26 The result should be 26. This regression was introduced by: <d68d1fb> 2015-05-18 [Ron Yorston] ash: code shrink around varvalue The length in characters was being used to discard the contents of the variable instead of the length in bytes. URL: https://bugs.busybox.net/8506 Reported-by: Martijn Dekker <martijn@inlv.org> Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2016-03-17wget: make -T timeout work on header reads too. Closes 8636Denys Vlasenko
function old new delta set_alarm - 27 +27 fgets_and_trim 76 92 +16 wget_main 2610 2616 +6 open_socket 64 54 -10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-15nmeter: reinstate and document -d-1Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-15nmeter: remove undocumented %NNNd specifierDenys Vlasenko
function old new delta nmeter_main 707 745 +38 init_functions 48 44 -4 init_delay 63 - -63 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/1 up/down: 38/-67) Total: -29 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-15nmeter: simple code shrink here and thereDenys Vlasenko
function old new delta nmeter_main 709 707 -2 init_cr 15 12 -3 collect_time 141 131 -10 collect_cpu 610 593 -17 init_cpu 82 63 -19 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/5 up/down: 0/-51) Total: -51 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-15nmeter: convert field list to bit listDenys Vlasenko
function old new delta rdval 34 157 +123 collect_int 123 122 -1 collect_thread_nr 65 62 -3 collect_blk 559 552 -7 collect_if 207 199 -8 collect_fork 119 111 -8 collect_ctx 119 111 -8 collect_fd 81 71 -10 collect_swp 120 107 -13 collect_cpu 623 610 -13 collect_mem 371 339 -32 rdval_loadavg 38 - -38 vrdval 170 - -170 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 1/10 up/down: 123/-311) Total: -188 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-15nmeter: code shrinkDenys Vlasenko
function old new delta put 52 43 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-15nmeter: fix a bug with unterminated varargsDenys Vlasenko
function old new delta collect_mem 361 371 +10 collect_swp 116 120 +4 vrdval 168 170 +2 collect_thread_nr 63 65 +2 collect_int 121 123 +2 collect_if 205 207 +2 collect_fork 117 119 +2 collect_fd 79 81 +2 collect_ctx 117 119 +2 collect_cpu 621 623 +2 collect_blk 557 559 +2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 11/0 up/down: 32/0) Total: 32 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-14New example config: android_502_defconfigDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-14more bionic fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-14fixes for problems found by bionic buildDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-11udhcpc: fix a warning in debug codeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-10udhcp: fix a SEGV on malformed RFC1035-encoded domain nameDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-07renice: tweak help textDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-06ls: fix columnar output. Closes 8731Denys Vlasenko
In coreutils/ls.c, 1.19 introduced commit 2f7d9e8903029b1b5e51a15f9cb0dcb6ca17c3ac, removing the variable tabstops and hard coding the column separation to 2 characters, but was not done correctly. The column_width assumes a gap of 1 character, so the computed number of columns exceeds the terminal width when many small files are encountered. A minor problem but surprisingly annoying. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-06inotifyd: swap meaning of 'y' and 'm' events in help text. Closes 8726Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-04udhcpc: do not use -t NUM for counting "select" packets, use 3Denys Vlasenko
Otherwise, "-t 0" usage may end up sending them forever if server does not respond. function old new delta udhcpc_main 2846 2836 -10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-04ntpd: add experimental patchDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-04ntpd: if peer does not reply anymore, try re-resolving its hostnameDenys Vlasenko
function old new delta ntpd_main 1053 1130 +77 add_peers 166 195 +29 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-04ntpd: do not use a peer more than once (say, if two peers resolve to the ↵Denys Vlasenko
same IP) function old new delta add_peers 98 166 +68 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-03ntpd: more informative poll lowering messageDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-03ifupdowm: fix "warning: unused variable 'iface_list'"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-03dhcpc: Use client IP address as source address for DHCP renew/rebind messagesHans Dedecker
RFC2131 paragraph 4.1 states DHCP messages broadcast by a client prior to that client obtaining its IP address must have the source IP address field in the header set to 0. Request messages transmitted in renewing and rebinding state need to use the obtained IP address as source IP address in the header; this behavior lines up with other implementations like ISC dhcp client. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-01udhcpd: keep expired leases at startupChristian Lindeberg
Let udhcpd retain the information about expired leases when restarting so that the leases are reserved until they possibly become the oldest expired lease. This reduces the frequency of IP address changes for example when the DHCP server and a group of clients, who do not store and request their previously offered IP address across restarts, are collectively restarted and the startup order of the clients are not guaranteed. Signed-off-by: Christian Lindeberg <christian.lindeberg@axis.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-01ifupdown: allow duplicate interface definitionsNicolas Cavallari
This patch allow to have multiple interface definitions, much like Debian's ifupdown. More specifically, it removes the check for a duplicate definition, so the impact on binary size should be fairly minimal. This configuration: iface eth0 inet static address 192.168.0.15 netmask 255.255.0.0 gateway 192.168.0.1 iface eth0 inet static address 10.0.0.1 netmask 255.255.255.0 Will add two addresses to eth0 if ip is used. If ifconfig is used, the standards methods will likely not stack, but the administrator may still use the manual method. The DHCP method may work depending on the DHCP client in use. This is a fairly advanced feature for power users who knows what they are doing. There are not many other network configuration systems that allows multiple addresses on an interface. Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-26udhcpc: fix OPTION_6RD parsing (could overflow its malloced buffer)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-26udhcp: trivial shrinkDenys Vlasenko
function old new delta dname_dec 337 332 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-26taskset: fix non-fancy cpuset printing on big-endianArnout Vandecappelle (Essensium/Mind)
The non-fancy version of the from_cpuset uses CPU_SETSIZE as if it represents the number of bytes in the cpuset, while it is actually the number of bits. This leads to out-of-bounds accesses on the cpu_set_t in the big-endian case. Basically all uses of CPU_SETSIZE have to be divided by 8. This is done correctly in the fancy version of from_cpuset. In addition, the big-endian case is completely wrong to begin with. All standard C libraries that I know of implement cpu_set_t as an unsigned long array, so both for big and little endian, the least significant bits are in the beginning of the array. Therefore, the approach taken for the little endian case is equally valid. We only need special handling for big endian when CPU_SETSIZE is large and we use an unsigned long long to get more bits out. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-24ntpd: print packet delay in clock update messageDenys Vlasenko
function old new delta update_local_clock 820 826 +6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-12modprobe: only parse files that end in .confMike Frysinger
This matches behavior with kmod which has been the standard for a long time at this point. URL: https://bugs.busybox.net/8021 Reported-by: Jö <jorrit@jorrit.de> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2016-02-12build: add a sanitizer debug optionMike Frysinger
Building & running with ASAN is super helpful, so add a dedicated config knob for it. This way people don't have to guess at the right compiler settings in order to get a good build. We can just tell people to enable this one option. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2016-02-11networking: allow dot at the end of the domain name in dhcp responseDenys Vlasenko
Patch based on Balaji Punnuru <balaji.punnuru@gmail.com> work. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-11init: make the command-line rewrite optionalNicolas Carrier
When launched as PID 1 and after parsing its arguments, init wipes all all of them except argv[0] and rewrites argv[0] to contain only "init", so that its command-line appears solely as "init" in tools such as ps. This patch adds the FEATURE_INIT_MODIFY_CMDLINE which, if set to n, will make init preserve all its arguments including argv[0], be they parsed or ignored. The original command-line used to launch init can then be retrieved in /proc/1/cmdline on Linux, for example. Signed-off-by: Nicolas Carrier <nicolas.carrier@parrot.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-10ntpd: shorter messageDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-10ntpd: step when |offset| > 1 sec, not 0.125 secDenys Vlasenko
update_local_clock 769 820 +51 recv_and_process_peer_pkt 838 862 +24 reset_peer_stats 137 133 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 75/-4) Total: 71 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-01busybox: fix uninitialized memory when displaying IPv6 addressesFelix Fietkau
After commit 8e74adab0107658e3dc04ed342206272a284f43e ("libbb: make INET[6]_rresolve use sockaddr2{host,dotted}_noport") INET_sprint6 uses more than just sin6_addr, it also tries to display the scope id, which is uninitialized when called from ife_print6. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-01dd: support iflag=skip_bytesRafał Miłecki
It allows specifying amount of bytes directly (not only amount of blocks) is also supported by GNU's Coreutils. function old new delta parse_comma_flags - 93 +93 static.iflag_words - 12 +12 dd_main 1569 1580 +11 packed_usage 30591 30600 +9 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 2/0 up/down: 125/0) Total: 125 bytes Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-01Fix compiling with musl's utmp stubsKylie McClain
This patch fixes compiling busybox with FEATURE_UTMP and _WTMP enabled. musl, while not really support utmp/wtmp, provides stub functions, as well as variables such as _PATH_UTMP, so that programs using utmp or wtmp can still compile fine. My reasoning for this patch is that on Exherbo, I'm currently trying to get us to be able to use the same busybox config file for both glibc and musl systems, using utmp/wtmp on systems that support it, and using the stubs on musl without needing two different configs. As of latest musl git, it provides all utmp functions needed; 1.1.12 doesn't, but I sent a patch to Rich to add the utmp{,x}name functions expected to exist, which was merged into musl upstream. Signed-off-by: Kylie McClain <somasissounds@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-01-31printf: short-circuit output when argument to %b includes \cRon Yorston
printf wasn't correctly handling \c in an argument to the %b format specifier. printf %bXX OK\\c returned 'OK\cXX' rather than the expected 'OK'. function old new delta printf_main 886 899 +13 Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-01-24sed: make 's///w FILE' actually write to FILE. Closes 8251Denys Vlasenko
function old new delta add_cmd 1167 1210 +43 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-01-23patch: correctly handle "patch FILE_TO_PATCH" form. Closes 7736Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-01-17dos2unix: try to preserve ownership. closes 8311Denys Vlasenko
function old new delta dos2unix_main 426 441 +15 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>