add a keyword "lname", to print l_name.

This commit is contained in:
yamt 2007-09-01 16:54:39 +00:00
parent 9336b1ca30
commit 37ac06be56
4 changed files with 28 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.30 2006/10/29 22:32:53 christos Exp $ */
/* $NetBSD: extern.h,v 1.31 2007/09/01 16:54:39 yamt Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -60,6 +60,7 @@ void groups(void *, VARENT *, int);
void groupnames(void *, VARENT *, int);
void logname(void *, VARENT *, int);
void longtname(void *, VARENT *, int);
void lname(void *, VARENT *, int);
void lstarted(void *, VARENT *, int);
void lstate(void *, VARENT *, int);
void maxrss(void *, VARENT *, int);

View File

@ -1,4 +1,4 @@
/* $NetBSD: keyword.c,v 1.50 2006/10/29 22:32:53 christos Exp $ */
/* $NetBSD: keyword.c,v 1.51 2007/09/01 16:54:39 yamt Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)keyword.c 8.5 (Berkeley) 4/2/94";
#else
__RCSID("$NetBSD: keyword.c,v 1.50 2006/10/29 22:32:53 christos Exp $");
__RCSID("$NetBSD: keyword.c,v 1.51 2007/09/01 16:54:39 yamt Exp $");
#endif
#endif /* not lint */
@ -142,6 +142,7 @@ VAR var[] = {
LVAR("laddr", "LADDR", 0, l_laddr, KPTR, PRIx64),
LVAR("lid", "LID", 0, l_lid, INT32, "d"),
VAR4("lim", "LIM", 0, maxrss),
VAR4("lname", "LNAME", LJUST|LWP, lname),
VAR4("login", "LOGIN", LJUST, logname),
VAR3("logname", "login", ALIAS),
VAR6("lstart", "STARTED", LJUST, lstarted, POFF(p_ustart_sec), UINT32),

View File

@ -1,4 +1,4 @@
/* $NetBSD: print.c,v 1.100 2007/07/28 17:05:50 dsl Exp $ */
/* $NetBSD: print.c,v 1.101 2007/09/01 16:54:39 yamt Exp $ */
/*
* Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
@ -70,7 +70,7 @@
#if 0
static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94";
#else
__RCSID("$NetBSD: print.c,v 1.100 2007/07/28 17:05:50 dsl Exp $");
__RCSID("$NetBSD: print.c,v 1.101 2007/09/01 16:54:39 yamt Exp $");
#endif
#endif /* not lint */
@ -1433,3 +1433,20 @@ putimeval(void *arg, VARENT *ve, int mode)
usec / 10000u );
}
}
void
lname(void *arg, VARENT *ve, int mode)
{
struct kinfo_lwp *l;
VAR *v;
l = arg;
v = ve->var;
if (l->l_name && l->l_name[0] != '\0') {
strprintorsetwidth(v, l->l_name, mode);
v->width = min(v->width, KI_LNAMELEN);
} else {
if (mode == PRINTMODE)
(void)printf("%-*s", v->width, "-");
}
}

View File

@ -1,4 +1,4 @@
.\" $NetBSD: ps.1,v 1.78 2007/06/25 00:24:01 yamt Exp $
.\" $NetBSD: ps.1,v 1.79 2007/09/01 16:54:40 yamt Exp $
.\"
.\" Copyright (c) 1980, 1990, 1991, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\"
.\" @(#)ps.1 8.3 (Berkeley) 4/18/94
.\"
.Dd June 25, 2007
.Dd September 2, 2007
.Dt PS 1
.Os
.Sh NAME
@ -548,6 +548,8 @@ belonging to the LWP.
ID of the LWP
.It Ar lim
memory use limit
.It Ar lname
descriptive name of the LWP
.It Ar logname
login name of user who started the process (alias
.Ar login )