aboutsummaryrefslogtreecommitdiff
path: root/libbb/procps.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-06-19 13:53:12 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-06-19 13:53:12 +0000
commit362c6ec6941c774992abcf008459616dbce0e7af (patch)
treea9216114d07fddd8cfd376e3d04e4811bf49d7e1 /libbb/procps.c
parent3afac4ce0659553ca3e3daf6a8b2131a0607e729 (diff)
downloadbusybox-362c6ec6941c774992abcf008459616dbce0e7af.tar.gz
top: speedup if tty info is not requested
Diffstat (limited to 'libbb/procps.c')
-rw-r--r--libbb/procps.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libbb/procps.c b/libbb/procps.c
index 879cc105a..e04ff34ff 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -243,10 +243,12 @@ procps_status_t* procps_scan(procps_status_t* sp, int flags)
sp->tty_str[0] = '?';
/* sp->tty_str[1] = '\0'; - done by memset */
tty = fast_strtoul_10(cp, &cp);
- if (tty) /* tty field of "0" means "no tty" */
+ if (tty && (flags & PSSCAN_TTY)) {
+ /* tty field of "0" means "no tty" */
snprintf(sp->tty_str, sizeof(sp->tty_str), "%u,%u",
(tty >> 8) & 0xfff, /* major */
(tty & 0xff) | ((tty >> 12) & 0xfff00));
+ }
cp = skip_fields(cp, 6); /* tpgid, flags, min_flt, cmin_flt, maj_flt, cmaj_flt */
sp->utime = fast_strtoul_10(cp, &cp);
sp->stime = fast_strtoul_10(cp, &cp);