summaryrefslogtreecommitdiffstats
path: root/lib/libkvm/kvm_proc.c
diff options
context:
space:
mode:
authortegge <tegge@FreeBSD.org>1997-06-25 20:56:48 +0000
committertegge <tegge@FreeBSD.org>1997-06-25 20:56:48 +0000
commit6f1b5cd02c9e004ca16dcedba814035d6d164943 (patch)
tree9468ad11a3d49154c1f94a9734bfd86a74d92b04 /lib/libkvm/kvm_proc.c
parent5a98e53b38854233386fab5b7f048e60bfe2574a (diff)
downloadFreeBSD-src-6f1b5cd02c9e004ca16dcedba814035d6d164943.zip
FreeBSD-src-6f1b5cd02c9e004ca16dcedba814035d6d164943.tar.gz
Fill in parent process id when reading process information from a
memory dump. This fixes one of the problems noted in PR kern/3581.
Diffstat (limited to 'lib/libkvm/kvm_proc.c')
-rw-r--r--lib/libkvm/kvm_proc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c
index 6a0df4a..d167f34 100644
--- a/lib/libkvm/kvm_proc.c
+++ b/lib/libkvm/kvm_proc.c
@@ -110,6 +110,7 @@ kvm_proclist(kd, what, arg, p, bp, maxcnt)
struct session sess;
struct tty tty;
struct proc proc;
+ struct proc pproc;
for (; cnt < maxcnt && p != NULL; p = proc.p_list.le_next) {
if (KREAD(kd, (u_long)p, &proc)) {
@@ -155,6 +156,17 @@ kvm_proclist(kd, what, arg, p, bp, maxcnt)
proc.p_pgrp);
return (-1);
}
+ if (proc.p_oppid)
+ eproc.e_ppid = proc.p_oppid;
+ else if (proc.p_pptr) {
+ if (KREAD(kd, (u_long)proc.p_pptr, &pproc)) {
+ _kvm_err(kd, kd->program, "can't read pproc at %x",
+ proc.p_pptr);
+ return (-1);
+ }
+ eproc.e_ppid = pproc.p_pid;
+ } else
+ eproc.e_ppid = 0;
eproc.e_sess = pgrp.pg_session;
eproc.e_pgid = pgrp.pg_id;
eproc.e_jobc = pgrp.pg_jobc;
OpenPOWER on IntegriCloud