mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
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.
This commit is contained in:
parent
b5ed0bcd23
commit
3daf63fc50
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=90360
|
@ -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 @@ kvm_proclist(kd, what, arg, p, bp, maxcnt)
|
|||
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 @@ kvm_proclist(kd, what, arg, p, bp, maxcnt)
|
|||
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 @@ kvm_proclist(kd, what, arg, p, bp, maxcnt)
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue