Commit Graph

628 Commits

Author SHA1 Message Date
Denys Vlasenko
1ec49732e2 mpstat: code shrink
function                                             old     new   delta
get_uptime                                           134     129      -5
get_irqs_from_stat                                   110     103      -7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-05 18:39:23 +01:00
Guillermo Rodriguez
75a1403f26 free: handle "cached" value too
function                                             old     new   delta
free_main                                            356     481    +125

Signed-off-by: Guillermo Rodriguez <guille.rodriguez@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-05 18:34:53 +01:00
Denys Vlasenko
6c6d37ee45 top: fix memset length (sizeof(ptr) vs sizeof(array) problem)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-29 17:00:30 +02:00
Timo Teräs
7df1f1dda1 top: fix and merge code to parse /proc/meminfo
display_header() code to parse meminfo as is was buggy:
- uninitialized variables were used if meminfo was not as expected
- meminfo parsing failed on new kernels (3.14+) as new field 'MemAvailable'
  was introduced between MemFree and Buffers
- shared memory was handled only for ancient kernels (2.4.x and earlier)

as result Buffers and shared memory fields were shown with bogus values
on current kernels.

The new code does not try to parse the old style summary header, as the
separated fields are always present (it saves code size). Additionally,
both Shmem (2.6+) and MemShared (2.4 and earlier) fields are now parsed
and summed for shared memory usage; as only one of them exists depending
on kernel version.

display_topmem_header() parses also meminfo so this makes it use the
same code for code shrink.

function                                             old     new   delta
display_header                                         -     681    +681
display_topmem_process_list                          465     684    +219
parse_meminfo                                          -     189    +189
static.fields                                          -     106    +106
static.match                                         132       -    -132
.rodata                                           120254  120117    -137
display_topmem_header                                513       -    -513
display_process_list                                1705     667   -1038
------------------------------------------------------------------------------
(add/remove: 3/2 grow/shrink: 1/2 up/down: 1195/-1820)       Total: -625 bytes

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-27 21:49:27 +02:00
Bartosz Golaszewski
5d2e409ef8 libbb: use a wrapper around sysconf(_SC_CLK_TCK) to save a few bytes
function                                             old     new   delta
bb_sc_clk_tck                                          -      10     +10
timescmd                                             118     113      -5
print_route                                         1763    1758      -5
mpstat_main                                         1288    1283      -5
iostat_main                                         1947    1942      -5
INET_setroute                                        879     871      -8
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/5 up/down: 10/-28)            Total: -18 bytes
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-22 14:01:13 +02:00
Denys Vlasenko
6554d03735 sysctl: do not error out showing write-only data. Closes 6386
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-24 17:28:43 +01:00
Bartosz Golaszewski
2de232da53 top.c: fix compilation warnings
pfd[1] is unused

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-20 03:26:34 +01:00
Denys Vlasenko
4b26f82c78 kill[all[5]]: code shrink
function                                             old     new   delta
kill_main                                            992     947     -45

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-12-16 17:45:44 +01:00
Uros Vampl
3ac1e0d753 killall5: return 2 if no processes got killed
function                                             old     new   delta
kill_main                                            943     992     +49

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-12-16 17:44:58 +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
dc57294485 top: fix breakage introduced by previous commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-09-06 12:59:48 +02:00
Denys Vlasenko
a407cf74cc Make smart_ulltoa return pointer to end (allows for code shink in callers)
function                                             old     new   delta
smart_ulltoa5                                        405     408      +3
smart_ulltoa4                                        273     276      +3
list_table                                          1113    1114      +1
scale                                                 36      34      -2
put_lu                                                55      53      -2
ulltoa6_and_space                                     19      14      -5
powertop_main                                       1470    1461      -9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-09-06 12:53:14 +02:00
Denys Vlasenko
173aa78bcf pstree: fix theoretically unsafe code
In practice, p->comm is never long enough to trigger the bug, but still.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-06-28 01:59:25 +02:00
Thomas De Schampheleire
879f008a8f lsof: correct check for symbolic link
Busybox lsof used the d_type field of a 'struct dirent' to verify whether the
entry is a symbolic link. This field, however, is not portable. On at least
one board [1] I have seen, that field is 0, and the check fails even though
the entry is a link.

The explicit check for a symbolic link is really only needed to skip the
default directory entries '.' and '..'. The directory /proc/<pid>/fd/
should not contain anything else but these two and symbolic links.
With these assumptions, this patch replaces the explicit link check with a
basic check for '.' and '..' (and any hidden file). In the unlikely case that
there are other file types, xmalloc_readlink() will return NULL, and we can
skip the entry.

[1] A MIPS-based board with glibc 2.9, Linux 2.6.32.27.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-06-27 03:44:46 +02:00
Mike Frysinger
fea2588021 pstree: stop truncating thread names
This also fixes a minor buffer overflow when displaying threads as
add_proc() only expects COMM_LEN bytes, but we give it one more than
that.

Reported-by: Dag Wieers <dag@wieers.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-06-19 11:29:57 -04:00
Denys Vlasenko
8f2cb7ab26 libbb: introduce and use strftime_[YYYYMMDD]HHMMSS()
function                                             old     new   delta
strftime_fmt                                           -      53     +53
strftime_YYYYMMDDHHMMSS                                -      12     +12
strftime_HHMMSS                                        -      12     +12
human_time                                            44      43      -1
fmtstr_t                                               9       -      -9
step_time                                            361     345     -16
watch_main                                           261     232     -29
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 0/3 up/down: 77/-55)             Total: 22 bytes
   text	   data	    bss	    dec	    hex	filename
 919203	    932	  17692	 937827	  e4f63	busybox_old
 919209	    932	  17692	 937833	  e4f69	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-29 12:30:33 +01:00
Denys Vlasenko
7794c21daf pgrep: fix a "missing closing paren" build error
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-28 15:51:55 +01:00
Bernhard Walle
47f8558eee pgrep: fix -x option
Because when -x is used (exact match), then we cannot compile the
regular expression with REG_NOSUB. The manual page regcomp(3) states
in section "Byte offsets":

    Unless REG_NOSUB was set for the compilation of the pattern
    buffer, it is possible to obtain substring match addressing
    information.

The problem was detected on an ARM system with glibc 2.16.
Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-28 12:42:38 +01:00
Denys Vlasenko
17d4436424 ps: seconds_since_boot: uint64_t -> ulong
Even if long is 32-bit, 4 billion second uptime isn't likely :)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-26 14:21:15 +01:00
Denys Vlasenko
778794d1dd *: reuse more strings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-22 10:13:52 +01:00
Denys Vlasenko
6aab061d2d ps: fix sscanf format specifier (%l); make uptime unsigned
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-22 10:07:23 +01:00
Denys Vlasenko
60cb48ca50 whitespace cleanup. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 15:57:44 +01:00
Denys Vlasenko
6967578728 whitespace fixes. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 01:34:48 +01:00
Lauri Hintsala
fb499c5752 powertop: fix error message
Application tries to use timer_stats module instead of cpufreq_stats.
Error message is printed if opening of the file /proc/timer_stats fails.

Signed-off-by: Lauri Hintsala <lauri.hintsala@bluegiga.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-01-04 17:45:44 -05:00
Denys Vlasenko
c4f2d997a4 libbb: correctness/size tweaks in signal-related helpers
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-27 13:20:34 +02:00
Denys Vlasenko
73a1990897 top: do not touch stdin if -b
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-26 16:58:25 +02:00
Denys Vlasenko
ffe03f04cb top: fix build failure in !USE_TERMIOS case
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-25 12:48:46 +02:00
Denys Vlasenko
42be921d48 ps: fix build failure in !DESKTOP case
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-25 12:48:10 +02:00
Denys Vlasenko
2fb8d0dee9 top: implement scrolling up/down (_very_ useful)
function                                             old     new   delta
handle_input                                         494     564     +70
top_main                                             928     947     +19
display_topmem_process_list                          363     381     +18
display_process_list                                1442    1453     +11
clearmems                                             38      28     -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/1 up/down: 118/-10)           Total: 108 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-21 13:04:37 +02:00
Joshua Kahlenberg
c439851438 sysctl: implement -q
function                                             old     new   delta
packed_usage                                       29208   29223     +15
sysctl_act_recursive                                 605     598      -7
sysctl_main                                          233     222     -11

Signed-off-by: Joshua Kahlenberg <jbkberg@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-05 18:15:12 +02:00
Denys Vlasenko
dac8e79a19 Move several applets to different install dir:
Moved to [/usr]/sbin:
addgroup, adduser, delgroup, deluser,
arping, chat, ether-wake, fdformat, ifplugd,
ip, ipaddr, iplink, iproute, iprule, iptunnel,
killall5, readahead, rtcwake, tftpd, add-shell, remove-shell, powertop.

Moved to /bin for /usr/bin: kbd_mode.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-20 20:24:57 +02:00
Michael Tokarev
ac42e3de90 ps: use separate get_uptime() and make it work on non-linux too
Create get_uptime() function in procps/ps.c, and use it rather than
relying on linux-specific sysinfo() inline.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-13 02:52:28 +02:00
Denys Vlasenko
14850308e9 killall5: don't do STOP/CONT dance if the signal we send is SIGSTOP or SIGCONT
function                                             old     new   delta
kill_main                                            913     942     +29

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-03 08:16:05 +02:00
Sven Oliver Moll
1c12b67705 lsof: new applet
text    data     bss     dec     hex filename
    221       0       0     221      dd lsof.o

Signed-off-by: Sven Oliver Moll <busybox@svol.li>
Signed-off-by: souf <souf_oued@yahoo.fr>
Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-01 16:23:23 +02:00
Denys Vlasenko
0687a5b496 libbb: make xchroot do a chdir("/") after chroot
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-08 00:28:24 +01:00
Alexey Fomenko
6a93212b54 kill: fix segfault in arguments parsing
Signed-off-by: Alexey Fomenko <ext-alexey.fomenko@nokia.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-12-22 11:38:57 +01:00
Denys Vlasenko
3b1603410a nmeter: fix block i/o count on newer Linux kernels
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-11-01 23:34:46 +01:00
Cristian Ionescu-Idbohrn
85b1f292c9 ps: fix for !FEATURE_PS_LONG build
Signed-off-by: Cristian Ionescu-Idbohrn <cii@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-29 11:02:00 +02:00
Flemming Madsen
b64bd16459 ps: with -l, show STIME too
Signed-off-by: Flemming Madsen <busybox@themadsens.dk>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-27 15:31:25 +02:00
Denys Vlasenko
8d9ac30572 ps: add support for -l for !DESKTOP
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-26 02:56:08 +02:00
Denys Vlasenko
d184a728cf rename archive.h to bb_archive.h. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-22 12:45:14 +02:00
Denys Vlasenko
16714245f9 add INIT_G()'s. No code changes.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-21 01:59:15 +02:00
Denys Vlasenko
5845a06c9e uptime: more compatible output
was: 12:59:35 up  1:57, 4 users,  load average: 0.11, 0.20, 0.53
is:  12:59:37 up  1:57,  4 users,  load average: 0.11, 0.20, 0.53

While at it, switched code to unsigned division.

Based on patch by Pere Orga <gotrunks@gmail.com>.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-10 13:00:04 +02:00
Pere Orga
d91b13806f uptime: add config flag to allow displaying the number of users currently logged on
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-09 04:09:17 +02:00
Denys Vlasenko
67905e2d7c *: work around sysinfo.h versus linux/*.h problems
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-07-26 13:42:12 +02:00
Denys Vlasenko
12ac6287ee procps: remove PSSCAN_STAT define, users were using it incorrectly
Also contains small cleanups ps.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-18 15:49:47 +02:00
Wade Berrier
000ae5cefe pkill/pgrep: support extended regular expressions
Done by enabling the REG_EXTENDED and REG_NOSUB regex flags,
which also increases compatibility with the procps versions.

Signed-off-by: Wade Berrier <wade_berrier@appsig.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-10 06:01:30 +02:00
Denys Vlasenko
d7efa06b83 fix breakage caused by 'remove "Options:" string from help texts' commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05 15:07:31 +02:00
Denys Vlasenko
66426760be *: remove "Options:" string from help texts
function                                             old     new   delta
packed_usage                                       28706   28623     -83

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05 03:58:28 +02:00
Maksym Kryzhanovskyy
9f7780250c iostat: code shrink
function                                             old     new   delta
iostat_main                                         2048    2400    +352
is_partition                                          48       -     -48
print_stats_dev_struct                               350       -    -350

Signed-off-by: Maksym Kryzhanovskyy <xmaks@email.cz>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05 03:37:14 +02:00
Denys Vlasenko
217a7f4bf9 fuser: fix inverted access() check. Closes 3799.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-29 02:03:38 +02:00
Denys Vlasenko
abb0952e63 nmeter: trim help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-26 09:00:23 +02:00
Maksym Kryzhanovskyy
eeed2306fc fuser: code shrink
function                                             old     new   delta
scan_proc_net_or_maps                                  -     427    +427
scan_recursive                                         -     380    +380
search_dev_inode                                      74      71      -3
add_pid                                               39       -     -39
scan_link                                             46       -     -46
scan_dir_links                                        76       -     -76
scan_pid_maps                                        222       -    -222
fuser_main                                           871     297    -574
------------------------------------------------------------------------------
(add/remove: 2/4 grow/shrink: 0/2 up/down: 807/-960)         Total: -153 bytes

Signed-off-by: Maksym Kryzhanovskyy <xmaks@email.cz>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-23 03:39:48 +02:00
Denys Vlasenko
24b71fd894 top: display sort indicator in memory display
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-18 12:11:19 +02:00
Denys Vlasenko
eafc558f94 top: better indicator of selected field in mem view
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-14 01:32:09 +02:00
Denys Vlasenko
60a9414cad fix "variable 'foo' set but not used" warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-13 20:57:01 +02:00
Maksym Kryzhanovskyy
29c54aa9f9 iostat: code shrink ~0.5k
Signed-off-by: Maksym Kryzhanovskyy <xmaks@email.cz>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-07 04:37:22 +02:00
Denys Vlasenko
c3f8db99bf preparatory patch
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-07 04:36:46 +02:00
Denys Vlasenko
4d6059eedc top: another scripting improvement
function                                             old     new   delta
handle_input                                         492     493      +1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-06 20:47:54 +02:00
Denys Vlasenko
7d9a1d25e5 top: make it possible to feed commands via pipe
function                                             old     new   delta
handle_input                                           -     492    +492
mult_lvl_cmp                                          38      49     +11
packed_usage                                       28247   28257     +10
top_main                                            1345     928    -417
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/1 up/down: 513/-417)           Total: 96 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-06 20:34:04 +02:00
Marek Polacek
2a6d5988b4 mpstat.c: remove unused line
Signed-off-by: Marek Polacek <mpolacek@redhat.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-30 22:09:01 +02:00
Pere Orga
5bc8c005a8 move remaining help text from include/usage.src.h
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-11 03:29:49 +02:00
Denys Vlasenko
a9e5c43b8b pstree: fix "warning: 'handle_thread' defined but not used"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-27 16:15:02 +02:00
Pere Orga
cf8b55c40b pwdx: new applet
function                                             old     new   delta
pwdx_main                                              -     197    +197
packed_usage                                       28237   28261     +24
applet_names                                        2391    2396      +5
applet_main                                         1392    1396      +4
applet_nameofs                                       696     698      +2
applet_install_loc                                   174     175      +1
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 5/0 up/down: 233/0)             Total: 233 bytes

Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-12 18:13:15 +01:00
Pere Orga
9283d7c5c2 kill: fix infinite loop when passed PIDs are not valid numbers
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-07 17:00:25 +01:00
Denys Vlasenko
e3b1a1fd28 Replace "depends on PLATFORM_LINUX" with "select PLATFORM_LINUX"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-26 22:24:08 +01:00
Denys Vlasenko
b12553faa8 ash: fix ash-signals/signal8 testcase failure
function                                             old     new   delta
killcmd                                              109     224    +115
kill_main                                            882     910     +28
changepath                                           194     195      +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 144/0)             Total: 144 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-21 03:22:20 +01:00
Denys Vlasenko
b7c9fb27cb whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-03 00:05:48 +01:00
Denys Vlasenko
099e528919 ps: implement -o stat
function                                             old     new   delta
func_stat                                              -      24     +24
out_spec                                             300     320     +20

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-02 00:59:35 +01:00
Denys Vlasenko
9aa599dc9d top: replace %MEM with %VSZ in header text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-25 12:48:47 +01:00
Denys Vlasenko
444ff284c4 top: document a debugging script
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-25 01:57:31 +01:00
Denys Vlasenko
b9f2d9f7d9 mass removal of underscores from _BB_DIR_foo and _BB_SUID_foo
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18 13:58:01 +01:00
Denys Vlasenko
e8d0a1450a remove a few aliasing warnings
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-16 11:21:15 +01:00
Denys Vlasenko
068444629f top: add keyboard commands to --help
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2011-01-13 16:07:51 +01:00
Denys Vlasenko
a6041860f8 nmeter: deprecate %NNNd specified, use -d MSEC instead
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-12-13 15:17:22 +01:00
Lauri Kasanen
da6fb7e331 procps/Config.src: Add pstree to FEATURE_THREADS deps. Slight text edit
Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-12-13 14:45:08 +01:00
Denys Vlasenko
86aa803047 pstree: use stdin for screen size detection
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-12-06 12:54:24 +01:00
Denys Vlasenko
2161bd701a pstree: another tiny shrink
function                                             old     new   delta
pstree_main                                          327     324      -3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-05 19:36:58 +01:00
Denys Vlasenko
c32e626988 pstree: tiny shrink
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-05 16:05:03 +01:00
Lauri Kasanen
e48e6f85bf pstree: fix width logic. +30 bytes
Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-05 15:55:06 +01:00
Lauri Kasanen
6578f2cf5b pstree: new applet. +1664 bytes
text    data     bss     dec     hex filename
 883379     936   17192  901507   dc183 busybox_old
 885043     936   17192  903171   dc803 busybox_unstripped

Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-12-05 05:22:29 +01:00
Maksym Kryzhanovskyy
0ebafcc5b1 powertop: code shrink
function                                             old     new   delta
process_timer_stats                                  490     449     -41

Signed-off-by: Maksym Kryzhanovskyy <xmaks@email.cz>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-11-06 01:56:19 +01:00
Denys Vlasenko
dea28e1e55 powertop: fix last line detection in process_timer_stats()
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-04 23:30:11 +01:00
Denys Vlasenko
dcb163aa8e powertop: replace erroneous \n with \0; make numberic conversion more robust
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-04 23:22:40 +01:00
Maksym Kryzhanovskyy
6052c2b0be powertop: code shrink
function                                             old     new   delta
read_cstate_counts                                   355     360      +5
print_intel_cstates                                  494     499      +5
process_timer_stats                                  554     480     -74
process_irq_counts                                   765     530    -235
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 10/-309)          Total: -299 bytes

Signed-off-by: Maksym Kryzhanovskyy <xmaks@email.cz>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-04 08:41:57 +01:00
Denys Vlasenko
833d4e7f84 rename archival/libunarchive -> archival/libarchive; move bz/ into it
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-11-03 02:38:31 +01:00
Denys Vlasenko
f29a1c5656 powertop: build fix for !386 compiles
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-29 16:25:18 +02:00
Denys Vlasenko
fb132e4737 whitespace cleanup
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-29 11:46:52 +02:00
Denys Vlasenko
e4dcba1c10 *: whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-28 18:57:19 +02:00
Marek Polacek
3c99d59b5d top: Use _exit() instead of exit() in sighandler
Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-27 02:25:16 +02:00
Denys Vlasenko
4fa07bd8fa whitespace fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-27 00:04:50 +02:00
Denys Vlasenko
a43e969574 powertop: simplified C-state display code
function                                             old     new   delta
.rodata                                           145530  145514     -16
powertop_main                                       1510    1403    -107

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-26 13:03:31 +02:00
Denys Vlasenko
d8b687f992 powertop: IPIs and hw irqs were swapped, fixing
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-26 12:42:53 +02:00
Denys Vlasenko
c3f1fa10d6 powertop: fixes to output format and code shrink
function                                             old     new   delta
process_timer_stats                                    -     631    +631
clear_lines                                           72      74      +2
process_irq_counts                                   729     726      -3
.rodata                                           145699  145530    -169
powertop_main                                       2341    1510    -831
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 1/2 up/down: 1359/-1729)       Total: -370 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-26 12:39:36 +02:00
Denys Vlasenko
373789e567 powertop: code shrink
function                                             old     new   delta
process_irq_count_deltas                               -     729    +729
read_cstate_counts                                     -     358    +358
save_line                                              -     150    +150
clear_lines                                           80      72      -8
line_compare                                          18       7     -11
.rodata                                           145736  145699     -37
powertop_main                                       2527    2341    -186
push_line                                            193       -    -193
read_data                                            348       -    -348
do_proc_irq                                          890       -    -890
------------------------------------------------------------------------------
(add/remove: 3/3 grow/shrink: 0/4 up/down: 1237/-1673)       Total: -436 bytes

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-26 02:54:13 +02:00
Marek Polacek
b507cc3ace powertop: new applet
Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-25 03:44:34 +02:00
Alexander Shishkin
cbfeaac7af smemcap: close /proc handle upon cleaning up
Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-22 13:18:23 +02:00
Denys Vlasenko
d3036ef608 pmap: get rid of a warning
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-22 13:15:15 +02:00
Denys Vlasenko
5542934d65 free: add -b/k/m/g options; remove 4 TB limitation. +100 bytes
Based on patch by Stefan Tomanek (stefan@pico.ruhr.de)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-01 21:57:59 +02:00
Denys Vlasenko
5a0d899ee4 smemcap: use correct tar magic
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-12 17:13:29 +02:00
Cristian Ionescu-Idbohrn
6957d79bd6 remove redundant ENABLE_DESKTOP in procps/ps.c
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-09-05 15:49:37 +02:00
Denys Vlasenko
b32a543663 nandwrite: complain on malformed -s NUM
Elsewhere: use common error message. -30 bytes net size change

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-29 13:29:02 +02:00
Alexander Shishkin
0834a6d3b9 pmap: new applet. +1k.
pmap is a tool used to look at processes' memory maps, normally found
in procps package. It provides more readable and easily sortable output
(one line per mapping) from  maps/smaps files in /proc/PID/.  This would
help in debugging memory usage issues, especially on devices where lots
of typing is not a viable option.

This patch does'n implement -d and -A command line options of GNU pmap,
since those are not that must have features and I was afraid of going
blind from looking at its code.

The implementation takes smaps scanning part out of procps_scan() function
and moves it into procps_read_smaps(), which does more detailed processing
of a single PID's smaps data.

Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-28 23:20:34 +02:00
Dan Fandrich
159677c884 Rename a struct member from "interrupt"
This is nonstandard, but common, keyword in embedded compilers.

Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-24 07:38:34 +02:00
Denys Vlasenko
bdaea46318 nmeter: fix misplaced closing comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 20:42:14 +02:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 20:14:46 +02:00
Denys Vlasenko
9768a82eb0 *: fix "see file License ..." - the file is named LICENSE (in uppercase)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 03:04:14 +02:00
Denys Vlasenko
c9b9750a0e libbb: factor out common code from mpstat/iostat
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 02:49:21 +02:00
Denys Vlasenko
dcaed97e0f iostat: add forgotted fclose(); fix default count.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-12 15:36:34 +02:00
Denys Vlasenko
7783248eaa *: s/xatoi_u/xatoi_positive/g - I got bored of mistyping xatoi_u as xatou_i
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-12 14:14:45 +02:00
Denys Vlasenko
7bfbbd434a free: more compatible output. +16 bytes. Closes bug 2383.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-12 01:56:44 +02:00
Marek Polacek
733f26f407 iostat: new applet. 2800 bytes
Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-11 17:00:59 +02:00
Marek Polacek
85a359afab mpstat: do not use /sys to get number of CPUs. /proc should be ok.
function                                             old     new   delta
get_cpu_nr                                             -     137    +137
mpstat_main                                         1140    1131      -9
get_proc_cpu_nr                                      137       -    -137
get_sys_cpu_nr                                       178       -    -178
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 0/1 up/down: 137/-324)         Total: -187 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-30 16:43:11 +02:00
Denys Vlasenko
3fb4a5e6d8 mpstat: better fix for IRQ counts
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-30 13:55:35 +02:00
Denys Vlasenko
9bb0510b9b mpstat: fix total par-cpu IRQ counts
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-30 13:38:46 +02:00
Denys Vlasenko
64c67891a2 mpstat: fix/improve handling of interrupt names
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-30 12:45:14 +02:00
Maksym Kryzhanovskyy
5e87c2ef15 mpstat: small code shrink
Signed-off-by: Maksym Kryzhanovskyy <xmaks@email.cz>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-30 03:56:02 +02:00
Denys Vlasenko
217df6ea9f mpstat: small code shrink
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-21 11:54:33 +02:00
Marek Polacek
23e8c08fa2 mpstat: new applet. ~5.5k
Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-21 10:29:07 +02:00
Jeremie Koenig
1d7266d3b5 mark Linux-specific configuration options
PLATFORM_LINUX is used as a dependency for applets or features
which require Linux-specific interfaces.

Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-19 00:44:56 +02:00
Denys Vlasenko
a95ce93e57 top: add tie breaking for topmem mode
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-13 12:13:04 +02:00
Denys Vlasenko
52827e3ebc *: tar-related cleanups: move struct to unarchive.h; move help to tar.c
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-26 18:21:36 +02:00
Denys Vlasenko
a091d45c3b smemcap: new applet
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-24 05:05:12 +02:00
Denys Vlasenko
adbbee46ad bootchartd: added optional compat features
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-21 07:17:23 +02:00
Denys Vlasenko
d70e0e995e *: add INSERTs to *.src files where appropriate
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-08 12:15:11 +02:00
Maksym Kryzhanovskyy
e3657dcdd6 fuser: code shrink
function                                             old     new   delta
fuser_main                                           918     871     -47

Signed-off-by: Maksym Kryzhanovskyy <xmaks@email.cz>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06 22:56:12 +02:00
Denys Vlasenko
d94332f2b6 top: code shrink, -26 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06 17:40:54 +02:00
Maksym Kryzhanovskyy
87496aa081 top: code shrink
text    data     bss     dec     hex filename
 853034     453    6820  860307   d2093 busybox_old
 852726     453    6820  859999   d1f5f busybox_unstripped

Signed-off-by: Maksym Kryzhanovskyy <xmaks@email.cz>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06 08:24:39 +02:00
Denys Vlasenko
2f32bf8be6 remove defconfig. Now "make defconfig" simply uses defaults from Config.in
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06 04:14:28 +02:00
Denys Vlasenko
da929a95aa mass renaming Kbuild -> Kbuild.src, Config.in -> Config.src
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-04 20:10:51 +02:00
Denys Vlasenko
9e07219c78 ps: make "ps -o BAD" emit list of good -o params
also make ps help more informative

function                                             old     new   delta
find_out_spec                                         58     103     +45
packed_usage                                       27039   27079     +40

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-23 00:34:42 +02:00
Maksym Kryzhanovskyy
fef9ee7072 fuser: code shrink, fixing default signal, exitcode and PID display
Defult signal is KILL, not TERM.
We used to not display PIDs with -k but without -s, but
upstream (fuser from PSmisc 22.7) still shows PIDs.
Filtering out of our own PID was buggy.

function                                             old     new   delta
fuser_main                                           669     918    +249
search_dev_inode                                      67      74      +7
add_pid                                               38      39      +1
scan_pid_maps                                        225     222      -3
add_inode                                             91      88      -3
packed_usage                                       27047   27039      -8
scan_dir_links                                       102      76     -26
scan_link                                             78      46     -32
file_to_dev_inode                                     64       -     -64
scan_proc_net                                        307       -    -307
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 3/5 up/down: 257/-443)         Total: -186 bytes

Signed-off-by: Maksym Kryzhanovskyy <xmaks@email.cz>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-22 20:41:08 +02:00
Denys Vlasenko
d9a3e89f50 consolidate ESC sequences
function                                             old     new   delta
bell                                                   2       -      -2
CMdown                                                 2       -      -2
Ceos                                                   4       -      -4
Ceol                                                   4       -      -4
CMup                                                   4       -      -4
SOs                                                    5       -      -5
SOn                                                    5       -      -5
CMrc                                                   9       -      -9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-16 23:42:13 +02:00
Denys Vlasenko
fe360480aa fix typo in commented-out code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-04 14:59:01 +02:00
Denys Vlasenko
39601843d7 ps: fix non-DESKTOP option handling code
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-07 18:03:34 +02:00
Denys Vlasenko
c2fdd41f5f sysctl: tiny code shrink
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-27 05:02:00 +01:00
Denys Vlasenko
651a2697f7 *: merge some common strings
text   data    bss    dec    hexfilename
 838650   8009      0 846659  ceb43busybox_old
 838519   8009      0 846528  ceac0busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-23 16:25:17 +01:00
Denys Vlasenko
917693b5b3 top: make 's' display easier to understand
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-04 12:50:59 +01:00
Bernhard Reutner-Fischer
7e7728cd66 free: silence warning about unused argv
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-26 09:28:30 +01:00
Denys Vlasenko
bef5711dab free: code shrink
function                                             old     new   delta
free_main                                            330     302     -28

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-21 05:39:59 +01:00
Denys Vlasenko
153fcaa6c1 Replace __uClinux__ define with !BB_MMU
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-21 05:17:41 +01:00
Denys Vlasenko
98a4c7cf3d *: suppress ~60% of "aliased warnings" on gcc-4.4.1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-04 15:00:15 +01:00
Denys Vlasenko
6b9f163353 *: style fixes. no code changes (verified with objdump)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-28 02:24:24 +01:00
Denys Vlasenko
302af9e3d1 watch: compat: use stderr to determine screen dimensions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-19 02:26:38 +01:00
Denys Vlasenko
2ec91aead5 *: remove some uses of argc
function                                             old     new   delta
whoami_main                                           34      37      +3
logname_main                                          60      63      +3
hostid_main                                           35      38      +3
ttysize_main                                         136     135      -1
nmeter_main                                          673     672      -1
logger_main                                          387     386      -1
uuencode_main                                        330     328      -2
ifupdown_main                                       2125    2123      -2
mesg_main                                            158     155      -3
free_main                                            333     330      -3
cal_main                                             902     899      -3
acpid_main                                           443     440      -3
ar_main                                              196     189      -7
find_main                                            476     467      -9
ifconfig_main                                       1235    1221     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/12 up/down: 9/-49)            Total: -40 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-04 14:15:38 +01:00
Denys Vlasenko
f25252c69e watch: more compatible screen format
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-02 01:57:32 +01:00
Denys Vlasenko
887d963037 ps: add comment about -T
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-24 03:52:24 +01:00
Denys Vlasenko
6331cf059c *: use "can't" instead of "cannot"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-13 09:08:27 +01:00
Denys Vlasenko
9be4f31da0 top: do not use #if inside printf, it can be a macro
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-07 04:06:31 +01:00
Denys Vlasenko
8131eea3dc *: introduce and use ffulsh_all()
function                                             old     new   delta
buffer_fill_and_print                                179     196     +17
fflush_all                                             -       9      +9
spawn                                                 87      92      +5
rtcwake_main                                         455     453      -2
...
alarm_intr                                            93      84      -9
readcmd                                             1072    1062     -10
bb_ask                                               345     333     -12
more_main                                            845     832     -13
flush_stdout_stderr                                   42      23     -19
xfflush_stdout                                        27       -     -27
flush_stderr                                          30       -     -30
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 2/50 up/down: 31/-397)         Total: -366 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-02 14:19:51 +01:00