diff options
author | jmallett <jmallett@FreeBSD.org> | 2002-09-16 20:19:51 +0000 |
---|---|---|
committer | jmallett <jmallett@FreeBSD.org> | 2002-09-16 20:19:51 +0000 |
commit | fece93f6bd7aed95bbd6edfb87765c3fcdbfedd5 (patch) | |
tree | 753510a45014ce84706fa2914051fe1c649cbf01 | |
parent | 939d493b8a013b9f890ed54d5f8df60c3bc01062 (diff) | |
download | FreeBSD-src-fece93f6bd7aed95bbd6edfb87765c3fcdbfedd5.zip FreeBSD-src-fece93f6bd7aed95bbd6edfb87765c3fcdbfedd5.tar.gz |
Perform keyword.c:1.27 properly, implement -orss in the New World Order of
ps(1) formatting, using pgtok() to get the value in K, rather than printing
it in pages. This is consistent with behaviour before keyword.c:1.26 (et al)
which exists in STABLE today, and which uses the same metric as VSZ.
Submitted by: bde
-rw-r--r-- | bin/ps/extern.h | 1 | ||||
-rw-r--r-- | bin/ps/keyword.c | 3 | ||||
-rw-r--r-- | bin/ps/print.c | 10 |
3 files changed, 12 insertions, 2 deletions
diff --git a/bin/ps/extern.h b/bin/ps/extern.h index 054dd74..58777e3 100644 --- a/bin/ps/extern.h +++ b/bin/ps/extern.h @@ -69,6 +69,7 @@ void pri(KINFO *, VARENT *); void printheader(void); void priorityr(KINFO *, VARENT *); void rgroupname(KINFO *, VARENT *); +void rss(KINFO *, VARENT *); void runame(KINFO *, VARENT *); void rvar(KINFO *, VARENT *); int s_rgroupname(KINFO *); diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c index 53e9cde..ebaab5b 100644 --- a/bin/ps/keyword.c +++ b/bin/ps/keyword.c @@ -147,8 +147,7 @@ static VAR var[] = { UINT, UIDFMT, 0}, {"rgroup", "RGROUP", NULL, LJUST|DSIZ, rgroupname, s_rgroupname, USERLEN, 0, CHAR, NULL, 0}, - {"rss", "RSS", NULL, 0, kvar, NULL, 4, KOFF(ki_rssize), UINT, "d", - 0}, + {"rss", "RSS", NULL, 0, rss, NULL, 4, 0, CHAR, NULL, 0}, {"rtprio", "RTPRIO", NULL, 0, priorityr, NULL, 7, KOFF(ki_pri), CHAR, NULL, 0}, {"ruid", "RUID", NULL, 0, kvar, NULL, UIDLEN, KOFF(ki_ruid), diff --git a/bin/ps/print.c b/bin/ps/print.c index acbb9cc..79ca1eb 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -317,6 +317,16 @@ s_runame(KINFO *k) return (strlen(user_from_uid(k->ki_p->ki_ruid, 0))); } + +void +rss(KINFO *k, VARENT *ve) +{ + VAR *v; + + v = ve->var; + (void)printf("%*ld", v->width, (long)ps_pgtok(k->ki_p->ki_rssize)); +} + void tdev(KINFO *k, VARENT *ve) { |