If no value is present for the login name set it to '-'.
Also pretty-up the display of 'ps -Ortprio'. PR: 4947 Submitted by: Martin Kammerhofer <dada@sbox.tu-graz.ac.at>
This commit is contained in:
parent
e172f0e587
commit
ad863cac06
@ -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 *));
|
||||
|
@ -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},
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user