summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2000-11-29 21:09:21 +0000
committerjhb <jhb@FreeBSD.org>2000-11-29 21:09:21 +0000
commitdcf60473e2e0cb294b2c02896171753c9a553836 (patch)
tree193eee43132720b2397de7ef44c3535e475dfa6c /bin
parentb5bd88f4f5f17b408b2353820f51e8580ea3029c (diff)
downloadFreeBSD-src-dcf60473e2e0cb294b2c02896171753c9a553836.zip
FreeBSD-src-dcf60473e2e0cb294b2c02896171753c9a553836.tar.gz
Introduce a 'mtxname' keyword that displays the current mutex that a
process is blocked on or '-'.
Diffstat (limited to 'bin')
-rw-r--r--bin/ps/extern.h1
-rw-r--r--bin/ps/keyword.c1
-rw-r--r--bin/ps/print.c18
3 files changed, 20 insertions, 0 deletions
diff --git a/bin/ps/extern.h b/bin/ps/extern.h
index a14390d..d184eda 100644
--- a/bin/ps/extern.h
+++ b/bin/ps/extern.h
@@ -57,6 +57,7 @@ void logname __P((KINFO *, VARENT *));
void longtname __P((KINFO *, VARENT *));
void lstarted __P((KINFO *, VARENT *));
void maxrss __P((KINFO *, VARENT *));
+void mtxname __P((KINFO *, VARENT *));
void nlisterr __P((struct nlist *));
void p_rssize __P((KINFO *, VARENT *));
void pagein __P((KINFO *, VARENT *));
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c
index cbabd97..de87d40 100644
--- a/bin/ps/keyword.c
+++ b/bin/ps/keyword.c
@@ -112,6 +112,7 @@ VAR var[] = {
NULL, USER, rvar, NULL, 4, ROFF(ru_majflt), LONG, "ld"},
{"minflt", "MINFLT",
NULL, USER, rvar, NULL, 4, ROFF(ru_minflt), LONG, "ld"},
+ {"mtxname", "MUTEX", NULL, LJUST, mtxname, NULL, 6},
{"msgrcv", "MSGRCV",
NULL, USER, rvar, NULL, 4, ROFF(ru_msgrcv), LONG, "ld"},
{"msgsnd", "MSGSND",
diff --git a/bin/ps/print.c b/bin/ps/print.c
index 600a639..9b1c913 100644
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -394,6 +394,24 @@ lstarted(k, ve)
}
void
+mtxname(k, ve)
+ KINFO *k;
+ VARENT *ve;
+{
+ VAR *v;
+
+ v = ve->var;
+ if (KI_PROC(k)->p_blocked) {
+ if (KI_PROC(k)->p_mtxname)
+ (void)printf("%-*.*s", v->width, v->width,
+ KI_EPROC(k)->e_mtxname);
+ else
+ (void)printf("%-*s", v->width, "???");
+ } else
+ (void)printf("%-*s", v->width, "-");
+}
+
+void
wchan(k, ve)
KINFO *k;
VARENT *ve;
OpenPOWER on IntegriCloud