diff options
| author | Steve Price <steve@FreeBSD.org> | 1998-06-04 22:20:33 +0000 |
|---|---|---|
| committer | Steve Price <steve@FreeBSD.org> | 1998-06-04 22:20:33 +0000 |
| commit | 163ff400ce1dedb321bcb5b5ef2d4b3246eb7ab5 (patch) | |
| tree | cc71ceac96078d00c1f3f71461125b896c05d8c4 /bin | |
| parent | f458046329f00253d49bb4ad8d59b55f29902ed3 (diff) | |
Notes
Diffstat (limited to 'bin')
| -rw-r--r-- | bin/ps/extern.h | 3 | ||||
| -rw-r--r-- | bin/ps/keyword.c | 4 | ||||
| -rw-r--r-- | bin/ps/print.c | 36 |
3 files changed, 38 insertions, 5 deletions
diff --git a/bin/ps/extern.h b/bin/ps/extern.h index 0dbda2fc0f7d..f764b2374608 100644 --- a/bin/ps/extern.h +++ b/bin/ps/extern.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)extern.h 8.3 (Berkeley) 4/2/94 - * $Id: extern.h,v 1.2 1994/09/24 02:56:42 davidg Exp $ + * $Id: extern.h,v 1.3 1996/10/21 07:30:23 peter Exp $ */ struct kinfo; @@ -64,6 +64,7 @@ void parsefmt __P((char *)); void pcpu __P((KINFO *, VARENT *)); void pmem __P((KINFO *, VARENT *)); void pri __P((KINFO *, VARENT *)); +void rtprior __P((KINFO *, VARENT *)); void printheader __P((void)); void pvar __P((KINFO *, VARENT *)); void rssize __P((KINFO *, VARENT *)); diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c index 16cb8dd32a72..8edce726e54f 100644 --- a/bin/ps/keyword.c +++ b/bin/ps/keyword.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: keyword.c,v 1.8 1995/10/28 20:11:15 phk Exp $ + * $Id: keyword.c,v 1.9 1996/07/31 09:27:23 davidg Exp $ */ #ifndef lint @@ -139,7 +139,7 @@ VAR var[] = { {"rss", "RSS", NULL, 0, p_rssize, 4}, {"rssize", "", "rsz"}, {"rsz", "RSZ", NULL, 0, rssize, 4}, - {"rtprio", "RTPRIO", NULL, 0, pvar, 7, POFF(p_rtprio), LONG, "d"}, + {"rtprio", "RTPRIO", NULL, 0, rtprior, 7, POFF(p_rtprio)}, {"ruid", "RUID", NULL, 0, evar, UIDLEN, EOFF(e_pcred.p_ruid), ULONG, UIDFMT}, {"ruser", "RUSER", NULL, LJUST, runame, USERLEN}, diff --git a/bin/ps/print.c b/bin/ps/print.c index 8347c4d6080a..01598f45158c 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: print.c,v 1.16.2.1 1997/04/16 16:10:48 jdp Exp $ + * $Id: print.c,v 1.16.2.2 1997/08/03 08:33:17 peter Exp $ */ #ifndef lint @@ -164,12 +164,13 @@ logname(k, ve) VARENT *ve; { VAR *v; + char *s; v = ve->var; #ifndef NEWVM (void)printf("%-*s", v->width, KI_PROC(k)->p_logname); #else - (void)printf("%-*s", v->width, KI_EPROC(k)->e_login); + (void)printf("%-*s", v->width, (s = KI_EPROC(k)->e_login, *s) ? s : "-"); #endif } @@ -657,6 +658,37 @@ trss(k, ve) } #endif +void +rtprior(k, ve) + KINFO *k; + VARENT *ve; +{ + VAR *v; + struct rtprio *prtp; + char str[8]; + unsigned type, prio; + + v = ve->var; + prtp = (struct rtprio *) ((char *)KI_PROC(k) + v->off); + prio = prtp->prio; + switch (type = prtp->type) { + case RTP_PRIO_REALTIME: + snprintf(str, sizeof(str), "real:%u", prio); + break; + case RTP_PRIO_NORMAL: + strncpy(str, "normal", sizeof(str)); + break; + case RTP_PRIO_IDLE: + snprintf(str, sizeof(str), "idle:%u", prio); + break; + default: + snprintf(str, sizeof(str), "%u:%u", type, prio); + break; + } + str[sizeof(str)-1] = '\0'; + (void)printf("%*s", v->width, str); +} + /* * Generic output routines. Print fields from various prototype * structures. |
