Catch up to SMTX -> SLOCK changes.

This commit is contained in:
jhb 2002-10-02 20:33:52 +00:00
parent 8c9a393a04
commit b79961de95
6 changed files with 34 additions and 37 deletions

View File

@ -59,7 +59,7 @@ void logname(KINFO *, VARENT *);
void longtname(KINFO *, VARENT *);
void lstarted(KINFO *, VARENT *);
void maxrss(KINFO *, VARENT *);
void mtxname(KINFO *, VARENT *);
void lockname(KINFO *, VARENT *);
void mwchan(KINFO *, VARENT *);
void pagein(KINFO *, VARENT *);
void parsefmt(const char *);

View File

@ -110,7 +110,7 @@ static VAR var[] = {
LONG, "ld", 0},
{"msgsnd", "MSGSND", NULL, USER, rvar, NULL, 4, ROFF(ru_msgsnd),
LONG, "ld", 0},
{"mtxname", "MUTEX", NULL, LJUST, mtxname, NULL, 6, 0, CHAR, NULL,
{"lockname", "LOCK", NULL, LJUST, lockname, 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},

View File

@ -227,8 +227,8 @@ state(KINFO *k, VARENT *ve)
*cp = 'W';
break;
case SMTX:
*cp = 'M';
case SLOCK:
*cp = 'L';
break;
case SZOMB:
@ -420,15 +420,15 @@ lstarted(KINFO *k, VARENT *ve)
}
void
mtxname(KINFO *k, VARENT *ve)
lockname(KINFO *k, VARENT *ve)
{
VAR *v;
v = ve->var;
if (k->ki_p->ki_kiflag & KI_MTXBLOCK) {
if (k->ki_p->ki_mtxname[0] != 0)
if (k->ki_p->ki_kiflag & KI_LOCKBLOCK) {
if (k->ki_p->ki_lockname[0] != 0)
(void)printf("%-*.*s", v->width, v->width,
k->ki_p->ki_mtxname);
k->ki_p->ki_lockname);
else
(void)printf("%-*s", v->width, "???");
} else
@ -466,10 +466,10 @@ mwchan(KINFO *k, VARENT *ve)
else
(void)printf("%-*lx", v->width,
(long)k->ki_p->ki_wchan);
} else if (k->ki_p->ki_kiflag & KI_MTXBLOCK) {
if (k->ki_p->ki_mtxname[0]) {
} else if (k->ki_p->ki_kiflag & KI_LOCKBLOCK) {
if (k->ki_p->ki_lockname[0]) {
(void)printf("%-*.*s", v->width, v->width,
k->ki_p->ki_mtxname);
k->ki_p->ki_lockname);
} else {
(void)printf("%-*s", v->width, "???");
}

View File

@ -191,7 +191,7 @@ will display information.
.Pp
A complete list of the available keywords are listed below.
Some of these keywords are further specified as follows:
.Bl -tag -width mtxname
.Bl -tag -width lockname
.It %cpu
The cpu utilization of the process; this is a decaying average over up to
a minute of previous (real) time.
@ -232,17 +232,15 @@ The exact time the command started, using the ``%c'' format described in
.Xr strftime 3 .
.It lvl
The LOMAC level of the process.
.It mtxname
The name of the
.Xr mutex 9
that the process is currently blocked on.
.It lockname
The name of the lock 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
The event name if the process is blocked normally, or the lock name if
the process is blocked on a lock.
See the wchan and lockname keywords
for details.
.It nice
The process scheduling increment (see
@ -272,8 +270,8 @@ Marks a process which is in
.Xr jail 2 .
The hostname of the prison can be found in
.Ql Li /proc/<pid>/status .
.It M
Marks a process that is waiting to acquire a mutex.
.It L
Marks a process that is waiting to acquire a lock.
.It R
Marks a runnable process.
.It S
@ -408,11 +406,10 @@ total page reclaims
total messages received (reads from pipes/sockets)
.It msgsnd
total messages sent (writes on pipes/sockets)
.It mtxname
.Xr mutex 9
currently blocked on (as a symbolic name)
.It lockname
lock currently blocked on (as a symbolic name)
.It mwchan
wait channel or mutex currently blocked on
wait channel or lock currently blocked on
.It nice
nice value (alias ni)
.It nivcsw

View File

@ -317,12 +317,12 @@ kvm_proclist(kd, what, arg, p, bp, maxcnt)
}
if ((proc.p_state != PRS_ZOMBIE) &&
(mtd.td_blocked != 0)) {
kp->ki_kiflag |= KI_MTXBLOCK;
if (mtd.td_mtxname)
kp->ki_kiflag |= KI_LOCKBLOCK;
if (mtd.td_lockname)
(void)kvm_read(kd,
(u_long)mtd.td_mtxname,
kp->ki_mtxname, MTXNAMELEN);
kp->ki_mtxname[MTXNAMELEN] = 0;
(u_long)mtd.td_lockname,
kp->ki_lockname, LOCKNAMELEN);
kp->ki_lockname[LOCKNAMELEN] = 0;
}
bintime2timeval(&proc.p_runtime, &tv);
kp->ki_runtime = (u_int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
@ -349,8 +349,8 @@ kvm_proclist(kd, what, arg, p, bp, maxcnt)
} else if (
TD_IS_SLEEPING(&mtd)) {
kp->ki_stat = SSLEEP;
} else if (TD_ON_MUTEX(&mtd)) {
kp->ki_stat = SMTX;
} else if (TD_ON_LOCK(&mtd)) {
kp->ki_stat = SLOCK;
} else {
kp->ki_stat = SWAIT;
}

View File

@ -114,7 +114,7 @@ static char up_header[] =
char *state_abbrev[] =
{
"", "START", "RUN\0\0\0", "SLEEP", "STOP", "ZOMB", "WAIT", "MUTEX"
"", "START", "RUN\0\0\0", "SLEEP", "STOP", "ZOMB", "WAIT", "LOCK"
};
@ -143,7 +143,7 @@ static long cp_diff[CPUSTATES];
int process_states[8];
char *procstatenames[] = {
"", " starting, ", " running, ", " sleeping, ", " stopped, ",
" zombie, ", " waiting, ", " mutex, ",
" zombie, ", " waiting, ", " lock, ",
NULL
};
@ -533,9 +533,9 @@ char *(*get_userid)();
else
strcpy(status, "RUN");
break;
case SMTX:
if (pp->ki_kiflag & KI_MTXBLOCK) {
sprintf(status, "*%.6s", pp->ki_mtxname);
case SLOCK:
if (pp->ki_kiflag & KI_LOCKBLOCK) {
sprintf(status, "*%.6s", pp->ki_lockname);
break;
}
/* fall through */