diff options
author | julian <julian@FreeBSD.org> | 2002-02-07 20:28:25 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2002-02-07 20:28:25 +0000 |
commit | fce570367d0faf3002916a499e684172e61d8b9b (patch) | |
tree | f3dab10081f4698472d5c54f0a2f010454b5b4c6 /lib/libkvm | |
parent | 1fc1e7448f962a485f7718f6ae1e352e3bbde28b (diff) | |
download | FreeBSD-src-fce570367d0faf3002916a499e684172e61d8b9b.zip FreeBSD-src-fce570367d0faf3002916a499e684172e61d8b9b.tar.gz |
pre-emptively fix a KSE/M3 problem.
Make a slight change so that libkvm reaches the main thread via the
linked list, rather than assuming it is in the proc structure. Both
conditions are true in -current but only the first will be true in
the KSE M3 world.
Diffstat (limited to 'lib/libkvm')
-rw-r--r-- | lib/libkvm/kvm_proc.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c index e16173f..6cce411 100644 --- a/lib/libkvm/kvm_proc.c +++ b/lib/libkvm/kvm_proc.c @@ -117,6 +117,7 @@ kvm_proclist(kd, what, arg, p, bp, maxcnt) struct procsig procsig; struct pstats pstats; struct ucred ucred; + struct thread mainthread; struct proc proc; struct proc pproc; @@ -128,6 +129,12 @@ kvm_proclist(kd, what, arg, p, bp, maxcnt) _kvm_err(kd, kd->program, "can't read proc at %x", p); return (-1); } + if (KREAD(kd, (u_long)TAILQ_FIRST(&proc.p_threads), + &mainthread)) { + _kvm_err(kd, kd->program, "can't read thread at %x", + TAILQ_FIRST(&proc.p_threads)); + return (-1); + } if (KREAD(kd, (u_long)proc.p_ucred, &ucred) == 0) { kp->ki_ruid = ucred.cr_ruid; kp->ki_svuid = ucred.cr_svuid; @@ -260,8 +267,8 @@ kvm_proclist(kd, what, arg, p, bp, maxcnt) nopgrp: kp->ki_tdev = NODEV; } - if (proc.p_thread.td_wmesg) /* XXXKSE */ - (void)kvm_read(kd, (u_long)proc.p_thread.td_wmesg, + if (mainthread.td_wmesg) /* XXXKSE */ + (void)kvm_read(kd, (u_long)mainthread.td_wmesg, kp->ki_wmesg, WMESGLEN); #ifdef sparc @@ -299,10 +306,10 @@ nopgrp: strncpy(kp->ki_comm, proc.p_comm, MAXCOMLEN); kp->ki_comm[MAXCOMLEN] = 0; } - if (proc.p_thread.td_blocked != 0) { /* XXXKSE */ + if (mainthread.td_blocked != 0) { /* XXXKSE */ kp->ki_kiflag |= KI_MTXBLOCK; - if (proc.p_thread.td_mtxname) /* XXXKSE */ - (void)kvm_read(kd, (u_long)proc.p_thread.td_mtxname, + if (mainthread.td_mtxname) /* XXXKSE */ + (void)kvm_read(kd, (u_long)mainthread.td_mtxname, kp->ki_mtxname, MTXNAMELEN); kp->ki_mtxname[MTXNAMELEN] = 0; } @@ -318,7 +325,7 @@ nopgrp: kp->ki_swtime = proc.p_swtime; kp->ki_flag = proc.p_flag; kp->ki_sflag = proc.p_sflag; - kp->ki_wchan = proc.p_thread.td_wchan; /* XXXKSE */ + kp->ki_wchan = mainthread.td_wchan; /* XXXKSE */ kp->ki_traceflag = proc.p_traceflag; kp->ki_stat = proc.p_stat; kp->ki_pri = proc.p_ksegrp.kg_pri; /* XXXKSE */ @@ -326,7 +333,7 @@ nopgrp: kp->ki_lock = proc.p_lock; kp->ki_rqindex = proc.p_kse.ke_rqindex; /* XXXKSE */ kp->ki_oncpu = proc.p_kse.ke_oncpu; /* XXXKSE */ - kp->ki_lastcpu = proc.p_thread.td_lastcpu; /* XXXKSE */ + kp->ki_lastcpu = mainthread.td_lastcpu; /* XXXKSE */ bcopy(&kinfo_proc, bp, sizeof(kinfo_proc)); ++bp; ++cnt; |