summaryrefslogtreecommitdiffstats
path: root/bin/ps/keyword.c
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2004-06-20 22:22:49 +0000
committergad <gad@FreeBSD.org>2004-06-20 22:22:49 +0000
commit2c5e2e94693c9159381f6e2e1ec3fb737fc89771 (patch)
tree174b5d352e07d284d8d3601bc7353f5cac157b44 /bin/ps/keyword.c
parentbe237c4660a612a95a37d9558c1a24c8f217786f (diff)
downloadFreeBSD-src-2c5e2e94693c9159381f6e2e1ec3fb737fc89771.zip
FreeBSD-src-2c5e2e94693c9159381f6e2e1ec3fb737fc89771.tar.gz
Add new output-format keywords of LWP and NLWP, which show the thread-id
and number-of-threads tied to a process. Result can be seen by typing, e.g.: ps -HO lwp,nlwp These new options are not documented yet. More options will be coming, and I will update the man page after I get farther along. PR: bin/65803 (though adjusted to fit our present source) Submitted by: Cyrille Lefevre
Diffstat (limited to 'bin/ps/keyword.c')
-rw-r--r--bin/ps/keyword.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c
index 6f01354..f5aa959 100644
--- a/bin/ps/keyword.c
+++ b/bin/ps/keyword.c
@@ -57,6 +57,10 @@ static int vcmp(const void *, const void *);
#define KOFF(x) offsetof(struct kinfo_proc, x)
#define ROFF(x) offsetof(struct rusage, x)
+#define LWPFMT "d"
+#define LWPLEN 6
+#define NLWPFMT "d"
+#define NLWPLEN 4
#define UIDFMT "u"
#define UIDLEN 5
#define PIDFMT "d"
@@ -102,6 +106,8 @@ static VAR var[] = {
{"logname", "", "login", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
{"lstart", "STARTED", NULL, LJUST|USER, lstarted, NULL, 28, 0, CHAR,
NULL, 0},
+ {"lwp", "LWP", NULL, 0, kvar, NULL, LWPLEN, KOFF(ki_tid), UINT,
+ LWPFMT, 0},
{"majflt", "MAJFLT", NULL, USER, rvar, NULL, 4, ROFF(ru_majflt),
LONG, "ld", 0},
{"minflt", "MINFLT", NULL, USER, rvar, NULL, 4, ROFF(ru_minflt),
@@ -116,6 +122,8 @@ static VAR var[] = {
0},
{"nivcsw", "NIVCSW", NULL, USER, rvar, NULL, 5, ROFF(ru_nivcsw),
LONG, "ld", 0},
+ {"nlwp", "NLWP", NULL, 0, kvar, NULL, NLWPLEN, KOFF(ki_numthreads),
+ UINT, NLWPFMT, 0},
{"nsignals", "", "nsigs", 0, NULL, NULL, 0, 0, CHAR, NULL, 0},
{"nsigs", "NSIGS", NULL, USER, rvar, NULL, 4, ROFF(ru_nsignals),
LONG, "ld", 0},
OpenPOWER on IntegriCloud