aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSteve Price <steve@FreeBSD.org>1998-05-25 05:07:18 +0000
committerSteve Price <steve@FreeBSD.org>1998-05-25 05:07:18 +0000
commitad863cac06b4376b11d869fb252daa1a83f3a722 (patch)
tree5fe8cda00700ecd9cdf54c99a4e97d8301a6b5cf /bin
parente172f0e587cba56a647b7c8daa87ef2a58f2fefc (diff)
Notes
Diffstat (limited to 'bin')
-rw-r--r--bin/ps/extern.h3
-rw-r--r--bin/ps/keyword.c4
-rw-r--r--bin/ps/print.c37
3 files changed, 39 insertions, 5 deletions
diff --git a/bin/ps/extern.h b/bin/ps/extern.h
index 679bd7990bbb..81a633b5b7c4 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.6 1997/04/29 05:26:04 jkh Exp $
+ * $Id: extern.h,v 1.7 1997/08/03 08:25:00 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 61105a64ac4d..2612e62b168b 100644
--- a/bin/ps/keyword.c
+++ b/bin/ps/keyword.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)keyword.c 8.5 (Berkeley) 4/2/94";
#else
static const char rcsid[] =
- "$Id: keyword.c,v 1.17 1997/08/11 02:35:16 steve Exp $";
+ "$Id: keyword.c,v 1.18 1997/08/11 02:41:02 steve Exp $";
#endif
#endif /* not lint */
@@ -151,7 +151,7 @@ VAR var[] = {
{"rss", "RSS", NULL, 0, p_rssize, NULL, 4},
{"rssize", "", "rsz"},
{"rsz", "RSZ", NULL, 0, rssize, NULL, 4},
- {"rtprio", "RTPRIO", NULL, 0, pvar, NULL, 7, POFF(p_rtprio), LONG, "d"},
+ {"rtprio", "RTPRIO", NULL, 0, rtprior, NULL, 7, POFF(p_rtprio)},
{"ruid", "RUID", NULL, 0, evar, NULL, UIDLEN, EOFF(e_pcred.p_ruid),
ULONG, UIDFMT},
{"ruser", "RUSER", NULL, LJUST|DSIZ, runame, s_runame, USERLEN},
diff --git a/bin/ps/print.c b/bin/ps/print.c
index 5a6a07f89a5e..5d7a0fd87f2a 100644
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94";
#endif
static const char rcsid[] =
- "$Id$";
+ "$Id: print.c,v 1.25 1998/05/15 06:29:16 charnier Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -156,9 +156,10 @@ logname(k, ve)
VARENT *ve;
{
VAR *v;
+ char *s;
v = ve->var;
- (void)printf("%-*s", v->width, KI_EPROC(k)->e_login);
+ (void)printf("%-*s", v->width, (s = KI_EPROC(k)->e_login, *s) ? s : "-");
}
void
@@ -586,6 +587,38 @@ tsize(k, ve)
(void)printf("%*ld", v->width, (long)pgtok(KI_EPROC(k)->e_vm.vm_tsize));
}
+void
+rtprior(k, ve)
+ KINFO *k;
+ VARENT *ve;
+{
+ VAR *v;
+ struct rtprio *prtp;
+ char str[8];
+ unsigned prio, type;
+
+ v = ve->var;
+ prtp = (struct rtprio *) ((char *)KI_PROC(k) + v->off);
+ prio = prtp->prio;
+ type = prtp->type;
+ switch (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.