summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryamt <yamt@NetBSD.org>2007-09-01 16:54:39 +0000
committeryamt <yamt@NetBSD.org>2007-09-01 16:54:39 +0000
commit37ac06be56b949b04778fbf6a8fe5da59a4e286e (patch)
tree6c1aeec9a25b44478f289f1bead036df651c60eb
parent9336b1ca3099c2aa809d5c898ec44c1ff66d920f (diff)
add a keyword "lname", to print l_name.
-rw-r--r--bin/ps/extern.h3
-rw-r--r--bin/ps/keyword.c5
-rw-r--r--bin/ps/print.c21
-rw-r--r--bin/ps/ps.16
4 files changed, 28 insertions, 7 deletions
diff --git a/bin/ps/extern.h b/bin/ps/extern.h
index 8e6b55f6c71..14e8fe2a131 100644
--- a/bin/ps/extern.h
+++ b/bin/ps/extern.h
@@ -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);
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c
index 31797b54b67..9cab9d8b28a 100644
--- a/bin/ps/keyword.c
+++ b/bin/ps/keyword.c
@@ -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),
diff --git a/bin/ps/print.c b/bin/ps/print.c
index 779d7228886..d7a5427fb41 100644
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -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, "-");
+ }
+}
diff --git a/bin/ps/ps.1 b/bin/ps/ps.1
index dbf053411c4..b1aceaf90d7 100644
--- a/bin/ps/ps.1
+++ b/bin/ps/ps.1
@@ -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 )