diff options
author | dillon <dillon@FreeBSD.org> | 2002-02-21 18:27:16 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 2002-02-21 18:27:16 +0000 |
commit | 23fcffffc97fe63a1b023e4e4ed26f6733a72c3b (patch) | |
tree | e04800e18864bebe6cb04c2e71e4e606803bf7bc | |
parent | 5c90e6187fe6e32f02426460574227d62a8e546f (diff) | |
download | FreeBSD-src-23fcffffc97fe63a1b023e4e4ed26f6733a72c3b.zip FreeBSD-src-23fcffffc97fe63a1b023e4e4ed26f6733a72c3b.tar.gz |
Revert wchan functionality. Add 'mwchan' to supply new duel mutex/msleep
functionality and make it the default.
With additional improvements by: Mark Peek <mp@FreeBSD.org>
-rw-r--r-- | bin/ps/extern.h | 1 | ||||
-rw-r--r-- | bin/ps/keyword.c | 1 | ||||
-rw-r--r-- | bin/ps/print.c | 25 | ||||
-rw-r--r-- | bin/ps/ps.1 | 8 | ||||
-rw-r--r-- | bin/ps/ps.c | 2 |
5 files changed, 34 insertions, 3 deletions
diff --git a/bin/ps/extern.h b/bin/ps/extern.h index a322d56..7c68460 100644 --- a/bin/ps/extern.h +++ b/bin/ps/extern.h @@ -77,5 +77,6 @@ void uname(KINFO *, VARENT *); int s_uname(KINFO *); void vsize(KINFO *, VARENT *); void wchan(KINFO *, VARENT *); +void mwchan(KINFO *, VARENT *); void lattr(KINFO *, VARENT *); __END_DECLS diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c index b5cc152..e1ff7ba 100644 --- a/bin/ps/keyword.c +++ b/bin/ps/keyword.c @@ -119,6 +119,7 @@ static VAR var[] = { LONG, "ld", 0}, {"mtxname", "MUTEX", NULL, LJUST, mtxname, NULL, 6, 0, CHAR, NULL, 0}, + {"mwchan", "MWCHAN", NULL, LJUST, mwchan, NULL, 6, 0, CHAR, NULL, 0}, {"ni", "", "nice", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, {"nice", "NI", NULL, 0, kvar, NULL, 2, KOFF(ki_nice), CHAR, "d", 0}, diff --git a/bin/ps/print.c b/bin/ps/print.c index 4de0dd7..74e7f8f 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -409,8 +409,31 @@ wchan(KINFO *k, VARENT *ve) else (void)printf("%-*lx", v->width, (long)k->ki_p->ki_wchan); + } else { + (void)printf("%-*s", v->width, "-"); + } +} + +void +mwchan(KINFO *k, VARENT *ve) +{ + VAR *v; + + v = ve->var; + if (k->ki_p->ki_wchan) { + if (k->ki_p->ki_wmesg[0] != 0) + (void)printf("%-*.*s", v->width, v->width, + k->ki_p->ki_wmesg); + else + (void)printf("%-*lx", v->width, + (long)k->ki_p->ki_wchan); } else if (k->ki_p->ki_kiflag & KI_MTXBLOCK) { - (void)printf("%-*.*s", v->width, v->width, k->ki_p->ki_mtxname); + if (k->ki_p->ki_mtxname[0]) { + (void)printf("%-*.*s", v->width, v->width, + k->ki_p->ki_mtxname); + } else { + (void)printf("%-*s", v->width, "???"); + } } else { (void)printf("%-*s", v->width, "-"); } diff --git a/bin/ps/ps.1 b/bin/ps/ps.1 index b9237e8..32402e7 100644 --- a/bin/ps/ps.1 +++ b/bin/ps/ps.1 @@ -106,7 +106,7 @@ user, pid, ppid, pgid, jobc, state, tt, time and command. List the set of available keywords. .It Fl l Display information associated with the following keywords: -uid, pid, ppid, cpu, pri, nice, vsz, rss, wchan, state, tt, time +uid, pid, ppid, cpu, pri, nice, vsz, rss, mwchan, state, tt, time and command. .It Fl M Extract values associated with the name list from the specified core @@ -234,6 +234,10 @@ that the process is currently blocked on. If the name is invalid or unknown, then .Dq ???\& is displayed. +.It mwchan +The event name if the process is blocked normally, or the mutex name if +the process is blocked on a mutex. See the wchan and mtxname keywords +for details. .It nice The process scheduling increment (see .Xr setpriority 2 ) . @@ -393,6 +397,8 @@ total messages sent (writes on pipes/sockets) .It mtxname .Xr mutex 9 currently blocked on (as a symbolic name) +.It mwchan +wait channel or mutex currently blocked on .It nice nice value (alias ni) .It nivcsw diff --git a/bin/ps/ps.c b/bin/ps/ps.c index 0897ccb..55445e7 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -103,7 +103,7 @@ static uid_t *getuids(const char *, int *); static char dfmt[] = "pid tt state time command"; static char jfmt[] = "user pid ppid pgid jobc state tt time command"; -static char lfmt[] = "uid pid ppid cpu pri nice vsz rss wchan state tt time command"; +static char lfmt[] = "uid pid ppid cpu pri nice vsz rss mwchan state tt time command"; static char o1[] = "pid"; static char o2[] = "tt state time command"; static char ufmt[] = "user pid %cpu %mem vsz rss tt state start time command"; |