Commit Graph

945 Commits

Author SHA1 Message Date
Bernhard Reutner-Fischer
86a7f18f21 *: Switch to POSIX utmpx API
UTMP is SVID legacy, UTMPX is mandated by POSIX.

Glibc and uClibc have identical layout of UTMP and UTMPX, both of these
libc treat _PATH_UTMPX as _PATH_UTMP so from a user-perspective nothing
changes except the names of the API entrypoints.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-04-02 23:03:46 +02:00
Denys Vlasenko
8dff01d06a libbb: introduce and use is_prefixed_with()
function                                             old     new   delta
is_prefixed_with                                       -      18     +18
complete_username                                     78      77      -1
man_main                                             737     735      -2
fsck_device                                          429     427      -2
unpack_ar_archive                                     80      76      -4
strip_unsafe_prefix                                  105     101      -4
singlemount                                         1054    1050      -4
rtc_adjtime_is_utc                                    90      86      -4
resolve_mount_spec                                    88      84      -4
parse_one_line                                      1029    1025      -4
parse_conf                                          1460    1456      -4
may_wakeup                                            83      79      -4
loadkmap_main                                        219     215      -4
get_irqs_from_stat                                   103      99      -4
get_header_cpio                                      913     909      -4
findfs_main                                           79      75      -4
fbsplash_main                                       1230    1226      -4
load_crontab                                         776     771      -5
expand_vars_to_list                                 1151    1146      -5
date_main                                            881     876      -5
skip_dev_pfx                                          30      24      -6
make_device                                         2199    2193      -6
complete_cmd_dir_file                                773     767      -6
run_applet_and_exit                                  715     708      -7
uudecode_main                                        321     313      -8
pwdx_main                                            197     189      -8
execute                                              568     560      -8
i2cdetect_main                                      1186    1176     -10
procps_scan                                         1242    1230     -12
procps_read_smaps                                   1017    1005     -12
process_module                                       746     734     -12
patch_main                                          1903    1891     -12
nfsmount                                            3572    3560     -12
stack_machine                                        126     112     -14
process_timer_stats                                  449     435     -14
match_fstype                                         111      97     -14
do_ipaddr                                           1344    1330     -14
open_list_and_close                                  359     343     -16
get_header_tar                                      1795    1779     -16
prepend_new_eth_table                                340     323     -17
fsck_main                                           1811    1794     -17
find_iface_state                                      56      38     -18
dnsd_main                                           1321    1303     -18
base_device                                          179     158     -21
find_keyword                                         104      82     -22
handle_incoming_and_exit                            2785    2762     -23
parse_and_put_prompt                                 774     746     -28
modinfo                                              347     317     -30
find_action                                          204     171     -33
update_passwd                                       1470    1436     -34
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/49 up/down: 18/-540)         Total: -522 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-03-12 17:48:34 +01:00
Denys Vlasenko
54e9585e10 trivial code shrink
function                                             old     new   delta
rdate_main                                           246     251      +5
show_entry                                           291     287      -4
daytime_stream                                        44      39      -5
packed_usage                                       30176   30168      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 5/-17)             Total: -12 bytes
   text	   data	    bss	    dec	    hex	filename
 929453	    932	  17684	 948069	  e7765	busybox_old
 929411	    932	  17684	 948027	  e773b	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-18 13:47:46 +01:00
Bernhard Reutner-Fischer
70e30e8eec dc: tweak parsing
https://bugs.debian.org/538685
dc requires whitespace between language elements.

We were requiring
1 2 + p
instead of the abbreviated
1 2+p
(for example).

function                                             old     new   delta
stack_machine                                         97     126     +29
dc_main                                              117      79     -38
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 29/-38)             Total: -9 bytes

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-16 17:12:04 +01:00
Bartosz Golaszewski
622a7aab2c i2cget, i2cset, i2cdetect, i2cdump: new applets
Add a minimal implementation of i2cget, i2cset, i2cdump and i2cdetect
tools. Supports most features of upstream i2c-tools.

function                                             old     new   delta
i2cdump_main                                           -    1444   +1444
i2cset_main                                            -    1239   +1239
i2cdetect_main                                         -     611    +611
list_i2c_busses_and_exit                               -     532    +532
packed_usage                                       29975   30438    +463
i2cget_main                                            -     380    +380
check_read_funcs                                       -     140    +140
i2c_funcs_tab                                          -     128    +128
confirm_action                                         -     100    +100
i2c_dev_open                                           -      57     +57
i2c_smbus_access                                       -      44     +44
confirm_or_abort                                       -      43     +43
check_funcs_test_end                                   -      39     +39
i2c_smbus_read_word_data                               -      38     +38
i2c_smbus_read_byte_data                               -      38     +38
i2c_smbus_read_byte                                    -      37     +37
i2c_set_slave_addr                                     -      32     +32
applet_names                                        2480    2512     +32
adap_descs                                             -      32     +32
i2c_set_pec                                            -      29     +29
get_funcs_matrix                                       -      21     +21
i2c_parse_data_addr                                    -      18     +18
i2c_parse_bus_addr                                     -      18     +18
i2c_bus_lookup                                         -      18     +18
i2c_smbus_write_byte                                   -      17     +17
applet_main                                         1440    1456     +16
will_skip                                              -      14     +14
no_support                                             -      11     +11
applet_nameofs                                       720     728      +8
applet_install_loc                                   180     182      +2
------------------------------------------------------------------------------
(add/remove: 26/0 grow/shrink: 5/0 up/down: 5601/0)          Total: 5601 bytes

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-10 03:16:25 +01:00
Micke Prag
07fa09a952 ubiattach: add option -O
Some images do not have the default VID offset. The option -O must
be used to attach such images.

Signed-off-by: Micke Prag <micke.prag@telldus.se>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-30 18:33:24 +01:00
Baruch Siach
ad0d009e0c nanddump: don't show --bb in usage when disabled
The --bb options now depends on LONG_OPTS. Omit mentions of --bb from usage
text when LONG_OPTS is disabled.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-18 11:55:08 +01:00
Baruch Siach
e835afadfe nandwrite: fix build when long options are disabled
The Required_argument macro is only defined when long options are enabled.
Fixes the following build error:

miscutils/nandwrite.c: In function 'nandwrite_main':
miscutils/nandwrite.c:120:10: error: expected ',' or ';' before 'Required_argument'

Reported-by: Christian Kästner <kaestner at cs.cmu.edu>
Signed-off-by: Baruch Siach <baruch at tkos.co.il>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-17 17:02:37 +01:00
Jacob Kjaergaard
bd7c1f2d13 flashcp: change BUFSIZE to 4k
some flash partitions can be smaller than the existing BUFSIZE thus write
BUFSIZE will fail with "no space left on device"

Signed-off-by: Jacob Kjaergaard <jacob.kjaergaard@prevas.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-10 13:44:27 +01:00
Denys Vlasenko
476654cdbe man: do not mangle $MANPATH in memory
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-11-30 19:39:58 +01:00
Denys Vlasenko
ee41094b80 man: accept a list of dirs in $MANPATH
function                                             old     new   delta
add_MANPATH                                            -     143    +143
man_main                                             852     731    -121
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 143/-121)           Total: 22 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-11-27 00:40:08 +01:00
Denys Vlasenko
186b98a86f ubiupdatevol: fix -t to not require an option. Closes 7466
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-25 22:10:32 +02:00
Aaro Koskinen
307d26c0eb less: make -E work
function                                             old     new   delta
buffer_print                                          71     104     +33

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-23 22:58:18 +02:00
Denys Vlasenko
865814a617 less: trivial code shrink
function                                             old     new   delta
read_lines                                           715     695     -20

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-22 21:17:24 +02:00
Denys Vlasenko
d6e7672545 less: move "retry-on-EAGAIN" logic closer to read ops
This makes "G" (goto end of input) command work as well as
/search_for_nonexistent_string: both will read to EOF now
even from somewhat slow input (such as kernel's "git log").

function                                             old     new   delta
ndelay_on                                             35      43      +8
ndelay_off                                            35      43      +8
read_lines                                           695     691      -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 16/-4)              Total: 12 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-22 21:14:02 +02:00
Denys Vlasenko
15943c886d less: disable "suppress empty wraparound" optimization
It is buggy wrt another use case...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-21 22:10:55 +02:00
Denys Vlasenko
f02c52bcde taskset: fix logic error in "if it doesn't start with 0x..."
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-08-31 01:35:45 +02:00
Denys Vlasenko
962c4e8220 taskset: support CPU masks for more than 64 CPUs
function                                             old     new   delta
taskset_main                                         522     631    +109

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-08-17 19:36:22 +02:00
Richard Genoud
2a870d091e nanddump: change default to --bb=skipbad
since mtd-utils 1.4.7, the default behaviour of nanddump is skipbad
(commit 2521d4f1b6b9866a9c89f3c11a4f6a3d763ff1d7)

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-25 17:38:30 +02:00
Richard Genoud
8feb25956f nanddump: kill -b Omit bad block
since mtd-utils 1.4.7, the omit bad block method has been removed.
(cf commit d8b8f780ec3c916f3990e9227d6bfbb22bf42ef8)

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-25 17:37:01 +02:00
Richard Genoud
f17fbe1d36 nanddump: add options --bb=skipbad and padbad
In mtd-utils, the bad block options changed in favor of
--bb=[skipbad|padbad|dumpbad] and omitbad has been removed.

This patch add the --bb=skipbad and padbad methods to busybox' nanddump.
padbad is the current default behaviour.
The difference between skipbad and omitbad is this one:
On a 16K block NAND, if the 1st block of mtd0 is bad, we'll have:
nanddump  -b -l 16384 /dev/mtd0 | wc -c
0
nanddump  --bb=skipbad -l 16384 /dev/mtd0 | wc -c
16384 <- data from 1st good block

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-25 17:37:01 +02:00
Richard Genoud
cbf3bfa57a nanddump: correct rounding to next page (lead to infinite loop)
The rounding to next page formula was wrong:
ex: (len | ~(meminfo->writesize - 1)) + 1;
len=128K
writesize=4K
(len | ~(meminfo->writesize - 1)) + 1 => 4 294 963 201 ?!

correct rounding formula:
((len - 1) | (meminfo->writesize - 1)) + 1 => 128K
len = 130K
((len - 1) | (meminfo->writesize - 1)) + 1 => 132K

modprobe nandsim parts="20,20" badblocks="22,23"

without patch:
nanddump  /dev/mtd1 | wc -c
[...] infinite loop

with the patch:
nanddump /dev/mtd1 | wc -c
327680

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-25 16:37:37 +02:00
Denys Vlasenko
fe33683c8b Fix compile failures
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-02 07:18:55 +02:00
Denys Vlasenko
43b8a1cc38 crond: implement "SHELL=prog" in crontab. Export LOGNAME as POSIX wants
function                                             old     new   delta
fork_job                                             343     456    +113
load_crontab                                         688     777     +89
crond_main                                          1456    1434     -22
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 202/-22)           Total: 180 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-30 17:38:27 +02:00
Denys Vlasenko
d5929d602e crond: simplify logging code
Slight change in behavior: now -l 5 will enable the same messages
formerly only enabled for -d 5. (Old behavior was non-sensical).

function                                             old     new   delta
reopen_logfile_to_stderr                               -      34     +34
log8                                                   -      26     +26
log7                                                   -      26     +26
log5                                                   -      26     +26
load_crontab                                         706     688     -18
rescan_crontab_dir                                   157     137     -20
crond_main                                          1486    1456     -30
fork_job                                             389     343     -46
crondlog                                             108      38     -70
------------------------------------------------------------------------------
(add/remove: 4/0 grow/shrink: 0/5 up/down: 112/-184)          Total: -72 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-30 14:49:52 +02:00
Denys Vlasenko
3dfe0ae5a8 libbb: make syslog level for bb_error_msg's configurable. use it in crond
function                                             old     new   delta
bb_verror_msg                                        380     386      +6
syslog_level                                           -       1      +1
crondlog                                             165     108     -57

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-30 14:48:28 +02:00
Denys Vlasenko
01a1a967c9 crond: tweak help text, make course less cryptic
function                                             old     new   delta
packed_usage                                       29736   29740      +4
crond_main                                          1485    1486      +1
load_crontab                                         712     706      -6

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-30 14:47:28 +02:00
Denys Vlasenko
e152cb8189 adjtimex: make its help text and printed data a bit less cryptic
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-17 11:29:34 +02:00
Denys Vlasenko
69b114fb8a less: fix bugs discovered with "git log -p | less -m" on kernel tree
function                                             old     new   delta
read_lines                                           685     733     +48

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-13 16:02:59 +02:00
Denys Vlasenko
30f17e9556 man: default to ascii
Default to ascii instead of latin1. Otherwise man pages can be displayed
incorrectly. E.g. bullets show as "<B7>".

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-03 15:14:26 +01:00
Denys Vlasenko
640ce3de07 zcat: complain if input is not compressed
function                                             old     new   delta
buffer_fill_and_print                                178     191     +13
varvalue                                             735     743      +8
bbunpack                                             747     755      +8
open_zipped                                           85      89      +4
xmalloc_open_zipped_read_close                        61      63      +2
get_addr_1                                           240     242      +2
fbsplash_main                                       1228    1230      +2
pstree_main                                          322     321      -1
builtin_type                                         121     119      -2
do_load                                              954     926     -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 7/3 up/down: 39/-31)              Total: 8 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-02 02:06:38 +01:00
Denys Vlasenko
821e64316a less: accept and ignore -s
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-22 16:36:22 +01:00
John Spencer
ff65061311 man: parse "DEFINE pager" in config
function                                             old     new   delta
man_main                                             789     844     +55

Signed-off-by: John Spencer <maillist-busybox@barfooze.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-22 15:31:10 +01:00
Denys Vlasenko
327f550669 Use unsigned printf/scanf conversion where more appropriate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-29 16:45:45 +01:00
Denys Vlasenko
9b2a9f0210 fix assorted unused code and wrong format specs found by cppchekc (bug 6716)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-29 16:43:33 +01:00
Denys Vlasenko
4d8ad381ab devfsd: remove static variable
function                                             old     new   delta
static.msg                                             4       -      -4
get_uid_gid                                          114     107      -7
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-11)             Total: -11 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-26 12:12:27 +01:00
Denys Vlasenko
2635369a92 rfkill: use new-style config/kbuild/applet
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-20 14:21:29 +01:00
Ryan Mallon
1d30b3f1f6 wall,crontab: use xopen_as_uid_gid()
This fixes a narrow security race in crontab.

function                                             old     new   delta
xopen_as_uid_gid                                       -      80     +80
seteuid                                                -      64     +64
setegid                                                -      64     +64
setreuid                                               -      37     +37
xseteuid                                               -      22     +22
xsetegid                                               -      22     +22
crontab_main                                         590     577     -13
setfsuid                                              33       -     -33
setfsgid                                              33       -     -33
wall_main                                            138     102     -36
open_as_user                                         109       -    -109

   text    data     bss     dec     hex filename
 893539     497    7568  901604   dc1e4 busybox_old
 893618     497    7568  901683   dc233 busybox_unstripped

Signed-off-by: Ryan Mallon <rmallon@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-08 14:53:29 +02:00
Denys Vlasenko
cd256e1c40 wall: access FILE under real user's credentials
While at it, move applet/config/kbuild bits into wall.c.
(This way, it's more visible that applet is suid'ed).

function                                             old     new   delta
wall_main                                             87     138     +51

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-06 15:14:25 +02:00
John Spencer
d6ae4fb446 man: find posix man pages
Add the 0p/1p/3p sections to the search.

Signed-off-by: John Spencer <maillist-busybox@barfooze.de>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-08-25 17:38:25 -04:00
Denys Vlasenko
a5e6c6cd3b setsid: code shrink, expanded comments
function                                             old     new   delta
setsid_main                                           56      53      -3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-07 18:49:51 +02:00
Paul B. Henson
985345d002 ubi_tools: fix typo in strcpy
Signed-off-by: Paul B. Henson <henson@acm.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-04 21:07:20 +02:00
Denys Vlasenko
cc1c9ca6f8 less: support "less 1<>TTY"
function                                             old     new   delta
less_main                                           2466    2507     +41
xmalloc_ttyname                                       46      42      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-08-04 17:41:19 +02:00
Bernhard Reutner-Fischer
0dacb68e1a chrt: remove warning for _POSIX_PRIORITY_SCHEDULING
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-07-08 11:20:13 +02:00
Denys Vlasenko
e9b3fcc3e4 ubi_tools: enhance -s option to allow size multiplier to match mtd-utils
Based on patch by Paul B. Henson <henson@acm.org>

function                                             old     new   delta
static.size_suffixes                                   -      32     +32
ubi_tools_main                                      1141    1148      +7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-06-30 02:47:45 +02:00
Denys Vlasenko
f798ba9717 ubi_tools: add forgotten argv++
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-06-30 02:46:44 +02:00
Denys Vlasenko
65bdf0b737 ubi_tools: extend supported volume size to 64 bits; shrink code
function                                             old     new   delta
get_num_from_file                                      -      90     +90
packed_usage                                       29395   29377     -18
ubi_tools_main                                      1349    1141    -208
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 90/-226)          Total: -136 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-06-30 02:38:18 +02:00
Paul B. Henson
f86404f773 ubimkvol: add -m option to create volume of maximum size
Signed-off-by: Paul B. Henson <henson@acm.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-06-30 02:37:05 +02:00
Bernhard Reutner-Fischer
c608731e78 setserial: Fix typo: s/baund_rate/baud_rate/g
as noted by Christoph Handel opensource at macht-blau.org

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-22 17:04:51 +01:00
Alexander Shiyan
45dc96c8a6 flash_eraseall: implement -N
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-15 00:42:39 +01:00