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
42ee26d00c
procps: shrink /proc scanning code a bit
...
function old new delta
skip_fields 16 15 -1
.rodata 144266 144258 -8
procps_scan 739 692 -47
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-56) Total: -56 bytes
text data bss dec hex filename
734845 3028 14400 752273 b7a91 busybox_old
734789 3028 14400 752217 b7a59 busybox_unstripped
2007-06-30 08:01:04 +00:00
Denis Vlasenko
88976d00d8
remove extra ')'
2007-06-21 07:09:18 +00:00
Denis Vlasenko
31789a81d5
top,ps: 'stringify' tty only when needed. -60 bytes.
2007-06-19 14:43:17 +00:00
Denis Vlasenko
362c6ec694
top: speedup if tty info is not requested
2007-06-19 13:53:12 +00:00
Denis Vlasenko
3afac4ce06
top,ps: reduce CPU usage in decimal conversion (optional)
...
text data bss dec hex filename
734651 3040 14416 752107 b79eb busybox_old
734751 3040 14416 752207 b7a4f busybox_unstripped
2007-06-19 13:46:24 +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
0696b8aae8
ps: fix -Z (by Yuichi Nakamura <ynakam@hitachisoft.jp>)
2007-06-06 07:40:16 +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
516a0ca2dc
ps: add -o tty and -o rss support
...
1373 14 24 1411 583 busybox.t1/procps/ps.o
1462 14 24 1500 5dc busybox.t2/procps/ps.o
2007-04-19 14:46:14 +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
2405ad659e
ls: use get_cached_username/groupname
2007-01-19 21:24:17 +00:00
Denis Vlasenko
f7996f3b70
Trailing whitespace removal over entire tree
2007-01-11 17:20:00 +00:00
Denis Vlasenko
d686a045c8
safe_strtoXX interface proved to be a bit unconvenient.
...
Remove it, introduce saner bb_strtoXX.
Saved ~350 bytes.
2006-11-27 14:43:21 +00:00
Denis Vlasenko
d031ffa623
tar: sanitize option handling
2006-11-24 21:54:44 +00:00
Denis Vlasenko
b8a8e601df
tar: small fixes:
...
* size-optimize mapping code
* kill double close
2006-11-24 14:59:45 +00:00
Denis Vlasenko
c50f370f98
tar: cache [ug]id->username/groupname mappings. Cuts down amount
...
of open/read/close of /etc/passwd and /etc/group
dramatically (we were rereading those for each untarred file!!!)
2006-11-24 14:57:31 +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
dd539f7687
Unneeded code removed, usused field "unsigned pscpu" removed
2006-11-01 20:20:37 +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
ea62077b85
add open_read_close() and similar stuff
2006-10-14 02:23:43 +00:00
Denis Vlasenko
a6dbb08a48
small style fixes
2006-10-12 19:29:44 +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
Mike Frysinger
58dda84ecc
decuddle () from for/if/while
2006-07-12 20:04:00 +00:00
Rob Landley
22f383e695
Fix http://bugs.busybox.net/view.php?id=906 which could cause failures in top.
2006-06-27 18:14:12 +00:00
Mike Frysinger
373af43bb0
comment all fields
2006-06-07 21:37:59 +00:00
Mike Frysinger
301ad67912
add reference to proc(5)
2006-06-07 20:24:34 +00:00
Bernhard Reutner-Fischer
b1629b1b2a
- remove emacs layout block as suggested by Robert P.J. Day
...
- use shorter boilerplate while at it
2006-05-19 19:29:19 +00:00
Rob Landley
7818a422bc
Portability tweak from Shaun Jackman, don't include asm/page.h directly.
2006-04-25 18:42:23 +00:00
Bernhard Reutner-Fischer
cb44816ba3
- add and use bb_opendir(), bb_xopendir().
...
text data bss dec hex filename
889445 9392 1035784 1934621 1d851d busybox.gcc-4.2.orig
889297 9392 1035784 1934473 1d8489 busybox.gcc-4.2
889009 9820 1037860 1936689 1d8d31 busybox.gcc-4.1.orig
888817 9820 1037860 1936497 1d8c71 busybox.gcc-4.1
2006-04-12 07:35:12 +00:00
Rob Landley
dfba741457
Robert P. Day removed 8 gazillion occurrences of "extern" on function
...
definitions. (That should only be on prototypes.)
2006-03-06 20:47:33 +00:00
"Vladimir N. Oleynik"
465300ced9
cleanups after changes by Denis Vlasenko. Size optimization
2006-02-14 10:17:09 +00:00
Rob Landley
b2804551a0
Cleanups from Denis Vlasenko.
2006-02-13 22:04:27 +00:00
Bernhard Reutner-Fischer
d5bd137a24
- rename libbb's password helpers as suggested in libbb.h
...
my_getpwnam -> bb_xgetpwnam /* dies on error */
my_getgrnam -> bb_xgetgrnam /* dies on error */
my_getgrgid -> bb_getgrgid
my_getpwuid -> bb_getpwuid
my_getug -> bb_getug
2005-09-20 21:06:17 +00:00
"Vladimir N. Oleynik"
f246dc7f57
ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE->CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE
2005-09-16 12:55:29 +00:00
"Vladimir N. Oleynik"
1e07f852e0
FEATURE->ENABLE_FEATURE loses one for 'top' applet
2005-09-14 16:08:06 +00:00
Rob Landley
60158cb93e
A patch from Takeharu KATO to update/fix SE-Linux support.
2005-05-03 06:25:50 +00:00
Eric Andersen
52499cb9ae
Tito writes:
...
Hi,
I've spent the half night staring at the devilish my_getpwuid and my_getgrgid functions
trying to find out a way to avoid actual and future potential buffer overflow problems
without breaking existing code.
Finally I've found a not intrusive way to do this that surely doesn't break existing code
and fixes a couple of problems too.
The attached patch:
1) changes the behaviour of my_getpwuid and my_getgrgid to avoid potetntial buffer overflows
2) fixes all occurences of this function calls in tar.c , id.c , ls.c, whoami.c, logger.c, libbb.h.
3) The behaviour of tar, ls and logger is unchanged.
4) The behavior of ps with somewhat longer usernames messing up output is fixed.
5) The only bigger change was the increasing of size of the buffers in id.c to avoid
false negatives (unknown user: xxxxxx) with usernames longer than 8 chars.
The value i used ( 32 chars ) was taken from the tar header ( see gname and uname).
Maybe this buffers can be reduced a bit ( to 16 or whatever ), this is up to you.
6) The increase of size of the binary is not so dramatic:
size busybox
text data bss dec hex filename
239568 2300 36816 278684 4409c busybox
size busybox_fixed
text data bss dec hex filename
239616 2300 36816 278732 440cc busybox
7) The behaviour of whoami changed:
actually it prints out an username cut down to the size of the buffer.
This could be fixed by increasing the size of the buffer as in id.c or
avoid the use of my_getpwuid and use getpwuid directly instead.
Maybe this colud be also remain unchanged......
Please apply if you think it is ok to do so.
The diff applies on today's cvs tarball (2004-08-25).
Thanks in advance,
Ciao,
Tito
2004-08-26 22:18:59 +00:00
Eric Andersen
242ab83499
Teach busybox ps to get the correct uid when displaying stuff
2004-01-27 20:17:39 +00:00
Glenn L McGrath
a1e4a0ef67
Patch from Atsushi Nemoto, recent MIPS kernel headers
...
does not provide PAGE_SHIFT for userland (because now mips-linux kernel
supports PAGESIZE other than 4K).
2004-01-21 11:36:44 +00:00
Eric Andersen
0933a92f5a
bother. It seems I can't read.
2003-12-20 10:23:28 +00:00
Eric Andersen
f295b5a408
doh!
2003-12-20 09:17:50 +00:00
Eric Andersen
a8d82fe52e
Try to accomodate systems that do not define PAGE_SHIFT
2003-12-20 07:26:10 +00:00
Eric Andersen
9e48045e45
Patch from Russell Coker:
...
I've attached my latest SE Linux patch for busybox against the latest CVS
version of busybox.
2003-07-03 10:07:04 +00:00
Eric Andersen
fab3e12cec
Skip printing "/proc/%d/cmdline" stuff when it is not relevant
2003-05-26 18:07:30 +00:00
Manuel Novoa III
cad5364599
Major coreutils update.
2003-03-19 09:13:01 +00:00
Eric Andersen
deca106b6d
Kill CONFIG_FEATURE_USE_DEVPS_PATCH and the devps patch. I'm not
...
maintaining it anymore, and it is now terribly out of date.
-Erik
2002-12-05 07:24:08 +00:00
Glenn L McGrath
09adaca37d
last_patch_69, 8 bit clean and other fixes from Vladimir N. Oleynik
2002-12-02 21:18:10 +00:00
Glenn L McGrath
393ad1a834
Handle name entries that have a \0 in them, last_patch_65 from Vladimir N. Oleynik
2002-11-25 22:31:37 +00:00
Glenn L McGrath
7b1eca265a
include libbb after stdlib.h as it breaks dmalloc
2002-11-24 01:32:56 +00:00
Eric Andersen
44608e9693
Patch last_pach62 from vodz. This patch moves all the /proc parsing
...
code into libbb so it can be shared by ps, top, etc, saving over 1.5k.
2002-10-22 12:21:15 +00:00