Commit Graph

76 Commits

Author SHA1 Message Date
Denis Vlasenko
fcfb5c04bb defconfig: update
appletli.c: add vda's (C)
top: fixlet for incorrect display of "0"
Makefile: reduce stack size from 20k to 16k
2007-12-24 12:16:24 +00:00
Denis Vlasenko
5576136563 fixes revealed by randomconfig run 2007-10-16 22:53:05 +00:00
Denis Vlasenko
9b49a5ed85 add -fvisibility=hidden to CC flags, mark XXX_main functions
EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
2007-10-11 10:05:36 +00:00
Denis Vlasenko
4daad9004d introduce bb_putchar(). saves ~1800 on uclibc (less on glibc). 2007-09-27 10:20:47 +00:00
Denis Vlasenko
5d61e71c3a introduce safe_poll (fixes a problem in top)
function                                             old     new   delta
safe_poll                                              -      77     +77
svlogd_main                                         1470    1466      -4
zcip_main                                           1530    1524      -6
forkexec                                            1345    1338      -7
decode_format_string                                 795     788      -7
collect_blk                                          474     467      -7
buffer_pread                                         540     532      -8
tftp                                                1182    1172     -10
microcom_main                                        763     749     -14
arpping                                              441     424     -17
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/9 up/down: 77/-80)             Total: -3 bytes
   text    data     bss     dec     hex filename
 770162    1034   10404  781600   bed20 busybox_old
 770158    1034   10404  781596   bed1c busybox_unstripped
2007-09-27 10:09:59 +00:00
Denis Vlasenko
4d7605af86 top: small fix for command line wrapping 2007-09-08 17:42:00 +00:00
Denis Vlasenko
4c1d88daff top: get rid of on-stack variable buffers, use permanent one.
code shrank with and without TOPMEM:

top_main                                             828     844     +16
display_process_list                                1525    1473     -52
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/1 up/down: 16/-52)            Total: -36 bytes

top_main                                            1150    1171     +21
display_topmem_process_list                         1150    1167     +17
display_process_list                                1525    1473     -52
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/1 up/down: 38/-52)            Total: -14 bytes
2007-09-08 17:34:05 +00:00
Denis Vlasenko
e7c1ad1540 top: add sizeof(G) check; fix style 2007-09-08 17:21:01 +00:00
Denis Vlasenko
ff6e8e2974 top: TOPMEM feature - 's(how sizes)' command. +2.5k when enabled,
+80 bytes when disabled (mainly because of text wrapping fixes
in display_process_list).
2007-09-08 16:51:19 +00:00
Denis Vlasenko
05241802a7 top: another readability fix 2007-08-29 18:34:26 +00:00
Denis Vlasenko
8bdba4d011 top: don't wait before final bailout (try top -b -n1).
top: make code a bit more readable.
2007-08-29 18:18:08 +00:00
Denis Vlasenko
b308d81e92 top: use poll instead of select for waiting on one descriptor
smart_ulltoa5: make it more cryptic. -50 bytes.

function                                             old     new   delta
passwd_main                                         1095    1103      +8
getNum                                               557     565      +8
buffer_fill_and_print                                 73      76      +3
udhcpc_main                                         2393    2395      +2
mkfs_minix_main                                     3071    3070      -1
dname_enc                                            377     373      -4
expmeta                                              480     472      -8
smart_ulltoa5                                        334     283     -51
top_main                                             911     815     -96
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/5 up/down: 21/-160)          Total: -139 bytes
   text    data     bss     dec     hex filename
 770872    1063   10788  782723   bf183 busybox_old
 770732    1063   10788  782583   bf0f7 busybox_unstripped
2007-08-28 19:35:34 +00:00
Denis Vlasenko
6ee023cf62 *: compile fixes for 64-bit build 2007-08-23 10:52:52 +00:00
Denis Vlasenko
fe7cd642b0 don't pass argc in getopt32, it's superfluous
(add/remove: 0/0 grow/shrink: 12/131 up/down: 91/-727) Total: -636 bytes
   text    data     bss     dec     hex filename
 773469    1058   11092  785619   bfcd3 busybox_old
 772644    1058   11092  784794   bf99a busybox_unstripped
2007-08-18 15:32:12 +00:00
Denis Vlasenko
856be770a6 assorted fixes for breakage found by randomconfig 2007-08-17 08:29:48 +00:00
Denis Vlasenko
110967a6f7 top: nested function allows us to reuse some code
(not everyone likes them - but code does get smaller).

display_generic                                        -     761    +761
static.fmt_100percent_8                                -     111    +111
fmt_100percent_8                                     101       -    -101
display_status                                      1489     581    -908
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 0/1 up/down: 872/-1009)        Total: -137 bytes
   text    data     bss     dec     hex filename
 677020    3344   13936  694300   a981c busybox_old
 676876    3344   13936  694156   a978c busybox_unstripped
2007-07-15 19:27:48 +00:00
Denis Vlasenko
24c5fbaf42 top: make "100%" case less ugly, and shrink code while at it
fmt_100percent_8                                       -     101    +101
.rodata                                           129185  129153     -32
display_status                                      1726    1489    -237
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/2 up/down: 101/-269)         Total: -168 bytes
   text    data     bss     dec     hex filename
 677180    3344   13936  694460   a98bc busybox_old
 677020    3344   13936  694300   a981c busybox_unstripped
2007-07-15 19:25:01 +00:00
Denis Vlasenko
c1166c3a8c top: simpler loadavg processing
display_status                                      1787    1726     -61
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-61)             Total: -61 bytes
   text    data     bss     dec     hex filename
 677244    3344   13936  694524   a98fc busybox_old
 677180    3344   13936  694460   a98bc busybox_unstripped
2007-07-15 19:23:38 +00:00
Denis Vlasenko
9109fbeaa1 top: truncate usernames to 8 chars 2007-07-15 17:07:58 +00:00
Denis Vlasenko
98ebab8b76 top,ps: improve /proc/PID/cmdinfo reading code
function                                             old     new   delta
display_status                                         -    1231   +1231
read_cmdline                                           -     101    +101
parse_conf                                          1284    1303     +19
arith                                               2033    2042      +9
collect_blk                                          467     474      +7
fsck_main                                           1909    1911      +2
dhcprelay_main                                      1125    1122      -3
singlemount                                         4555    4547      -8
read_close                                            50      36     -14
get_lcm                                              123     105     -18
ed_main                                             3111    3084     -27
func_args                                             73      28     -45
procps_scan                                          732     658     -74
top_main                                            2187     899   -1288
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 4/8 up/down: 1369/-1477)       Total: -108 bytes
   text    data     bss     dec     hex filename
 676048    2744   13968  692760   a9218 busybox_old
 675940    2744   13968  692652   a91ac busybox_unstripped
2007-06-30 14:47:41 +00:00
Denis Vlasenko
f7d07b1723 killall, pidof: use argv0 for process matching too
top: show cmdline, not comm field
(fixes problems with re-execed applets showing as processes with name "exe",
and not being found by pidof/killall by applet name)

function                                             old     new   delta
find_pid_by_name                                      98     156     +58
procps_scan                                          692     732     +40
top_main                                            2724    2762     +38
find_pair                                            164     180     +16
collect_int                                          114     123      +9
cmp_main                                             547     555      +8
collect_fork                                         112     119      +7
collect_ctx                                          112     119      +7
read_package_field                                   253     257      +4
passwd_main                                         1983    1985      +2
process_stdin                                        435     433      -2
xstrtoul_range_sfx                                   229     226      -3
get_next_block                                      1852    1849      -3
arith                                               2042    2033      -9
sv_main                                             1236    1226     -10
singlemount                                         4690    4672     -18
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 10/6 up/down: 189/-45)          Total: 144 bytes
   text    data     bss     dec     hex filename
 734789    3028   14400  752217   b7a59 busybox_old
 734933    3028   14400  752361   b7ae9 busybox_unstripped
2007-06-30 08:03:26 +00:00
Denis Vlasenko
745119605e top: on user suggestion make percentile calculations configurable. -56 bytes when off. +600 bytes when on
top: reorder columns, so that [P]PIDs are together and VSZ/%MEM are together. Makes more sense
2007-06-11 16:31:55 +00:00
Denis Vlasenko
b1e5addfed top: improve global CPU percentage (smaller & faster code) 2007-06-10 18:04:54 +00:00
Denis Vlasenko
5a65447e30 top: add config option and code for global CPU % display 2007-06-10 17:11:59 +00:00
Denis Vlasenko
b6adbf1be2 usage.c: remove reference to busybox.h
*: s/include "busybox.h"/include "libbb.h"
2007-05-26 19:00:18 +00:00
Denis Vlasenko
8581863a1b procps: remove all global variables
text    data     bss     dec     hex filename
   1462      14      24    1500     5dc busybox.t2/procps/ps.o
   1484       0       0    1484     5cc busybox.t3/procps/ps.o
   3122       0     252    3374     d2e busybox.t1/procps/top.o
   3117       0       0    3117     c2d busybox.t3/procps/top.o
2007-04-19 14:47:11 +00:00
Denis Vlasenko
ac678ec2f1 style fixes, no code changes 2007-04-16 22:32:04 +00:00
Mike Frysinger
0aa6ba5d44 make sure ps/top output what they claim: vsz, not rss ... down the line we should make the output controllable either at runtime or buildtime as both statistics are quite useful 2007-02-08 08:21:58 +00:00
Denis Vlasenko
06af216528 suppress warnings about easch <applet>_main() having
no preceding prototype
2007-02-03 17:28:39 +00:00
Denis Vlasenko
f7996f3b70 Trailing whitespace removal over entire tree 2007-01-11 17:20:00 +00:00
Denis Vlasenko
3bba545a54 done a dozen of randconfig test. guess what? ALL failed...
these are resulting fixes
2006-12-30 17:57:03 +00:00
Denis Vlasenko
459e4d6cf7 replace /proc scanning code by more versatile one.
Use it where appropriate.
Stop scanning /etc/passwd *for every process*!!! (uid->username)
top: reduce memory usage - we won't save unneeded fields
from /proc info anymore. Downside: ~+250 bytes of code
2006-11-05 00:43:51 +00:00
Denis Vlasenko
fa07680091 top: improve CPU% calculation
style fixes
2006-11-05 00:38:51 +00:00
Denis Vlasenko
35fb512728 PID should be stored in pid_t, not int or long.
find_pid_by_name() was returning 0 or -1 in last array element,
but -1 was never checked. We can use just 0 intead.
2006-11-01 09:16:49 +00:00
Denis Vlasenko
25d8062128 top: batch mode should output all processes 2006-10-27 09:34:22 +00:00
Denis Vlasenko
ea62077b85 add open_read_close() and similar stuff 2006-10-14 02:23:43 +00:00
Denis Vlasenko
1385899416 attempt to regularize atoi mess. 2006-10-08 12:49:22 +00:00
Denis Vlasenko
c12f53090b dnsd fix; option_mask32 added. dnsd needs more love. 2006-10-06 09:49:47 +00:00
Denis Vlasenko
67b23e6043 getopt_ulflags -> getopt32.
It is impossible to formulate sane ABI based on
size of ulong because it can be 32-bit or 64-bit.
Basically it means that you cannot portably use
more that 32 option chars in one call anyway...
Make it explicit.
2006-10-03 21:00:06 +00:00
Denis Vlasenko
266bc17690 top: add support for -b, -n <iterations> 2006-09-29 17:16:39 +00:00
Denis Vlasenko
42dfcd2612 top: fixed wrong comment, made error message more clear 2006-09-09 12:55:02 +00:00
Rob Landley
d921b2ecc0 Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only
had one user), clean up lots of #includes...  General cleanup pass.  What I've
been doing for the last couple days.

And it conflicts!  I've removed httpd.c from this checkin due to somebody else
touching that file.  It builds for me.  I have to catch a bus.  (Now you know
why I'm looking forward to Mercurial.)
2006-08-03 15:41:12 +00:00
Rob Landley
a526c30cc5 Make another warning go away. 2006-06-30 20:30:10 +00:00
Rob Landley
db1ab1aeb3 Top was catching sigterm (and fumbling sigint) so it could reset the terminal
type on the way out, but the signal handler didn't exit.  Plus it did
unnecessary things with sigaction.  This code is overgrown and needs a serious
weed-whacking...
2006-06-28 14:11:25 +00:00
Bernhard Reutner-Fischer
e15d7573a1 - move #include busybox.h to the very top so we pull in the config
and eventual platform specific includes in early.
2006-06-02 20:56:16 +00:00
Rob Landley
299a6b4d7b Consolidate #include <sys/time.h> so libbb.h does it. 2006-05-27 21:42:58 +00:00
Bernhard Reutner-Fischer
e2922e42a0 - make it C89 compatible; Declarations in the middle of a function is of course
fine in C99, but it really serves no purpose other than breaking compilation
  on C89 compilers.
  Thanks to Rich Felker for pointing this out.
2006-05-19 12:48:56 +00:00
Rob Landley
0c43046fde Fix allbareconfig. 2006-05-04 19:51:22 +00:00
Rob Landley
997650b972 From Denis Vlasenko:
* CPU% = process[i].ticks/sum(process[i].ticks) * busy_cpu_ticks/total_cpu_ticks
* got rid of empty line under "Load average" line
  and used last line - +2 visible processes
* do not do float conversion of loadavg, just read it as string from /proc
* fix display on small screens
* dropped unused .stime, .utime fields
* a few variables were renamed
* style fixes
2006-04-24 23:13:46 +00:00
Bernhard Reutner-Fischer
d9cf7ac781 - patch from Denis Vlasenko to add and use bb_xchdir() 2006-04-12 18:39:58 +00:00