Deleted Added
full compact
kvm_proc.c (160682) kvm_proc.c (163709)
1/*-
2 * Copyright (c) 1989, 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software developed by the Computer Systems
6 * Engineering group at Lawrence Berkeley Laboratory under DARPA contract
7 * BG 91-66 and contributed to Berkeley.
8 *

--- 28 unchanged lines hidden (view full) ---

37
38#if 0
39#if defined(LIBC_SCCS) && !defined(lint)
40static char sccsid[] = "@(#)kvm_proc.c 8.3 (Berkeley) 9/23/93";
41#endif /* LIBC_SCCS and not lint */
42#endif
43
44#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1989, 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software developed by the Computer Systems
6 * Engineering group at Lawrence Berkeley Laboratory under DARPA contract
7 * BG 91-66 and contributed to Berkeley.
8 *

--- 28 unchanged lines hidden (view full) ---

37
38#if 0
39#if defined(LIBC_SCCS) && !defined(lint)
40static char sccsid[] = "@(#)kvm_proc.c 8.3 (Berkeley) 9/23/93";
41#endif /* LIBC_SCCS and not lint */
42#endif
43
44#include <sys/cdefs.h>
45__FBSDID("$FreeBSD: head/lib/libkvm/kvm_proc.c 160682 2006-07-25 22:39:57Z yar $");
45__FBSDID("$FreeBSD: head/lib/libkvm/kvm_proc.c 163709 2006-10-26 21:42:22Z jb $");
46
47/*
48 * Proc traversal interface for kvm. ps and w are (probably) the exclusive
49 * users of this code, so we've factored it out into a separate module.
50 * Thus, we keep this grunge out of the other kvm applications (i.e.,
51 * most other applications are interested only in open/close/read/nlist).
52 */
53

--- 55 unchanged lines hidden (view full) ---

109 struct tty tty;
110 struct vmspace vmspace;
111 struct sigacts sigacts;
112 struct pstats pstats;
113 struct ucred ucred;
114 struct prison pr;
115 struct thread mtd;
116 /*struct kse mke;*/
46
47/*
48 * Proc traversal interface for kvm. ps and w are (probably) the exclusive
49 * users of this code, so we've factored it out into a separate module.
50 * Thus, we keep this grunge out of the other kvm applications (i.e.,
51 * most other applications are interested only in open/close/read/nlist).
52 */
53

--- 55 unchanged lines hidden (view full) ---

109 struct tty tty;
110 struct vmspace vmspace;
111 struct sigacts sigacts;
112 struct pstats pstats;
113 struct ucred ucred;
114 struct prison pr;
115 struct thread mtd;
116 /*struct kse mke;*/
117 struct ksegrp mkg;
117 /*struct ksegrp mkg;*/
118 struct proc proc;
119 struct proc pproc;
120 struct timeval tv;
121 struct sysentvec sysent;
122 char svname[KI_EMULNAMELEN];
123
124 kp = &kinfo_proc;
125 kp->ki_structsize = sizeof(kinfo_proc);

--- 6 unchanged lines hidden (view full) ---

132 if (proc.p_state != PRS_ZOMBIE) {
133 if (KREAD(kd, (u_long)TAILQ_FIRST(&proc.p_threads),
134 &mtd)) {
135 _kvm_err(kd, kd->program,
136 "can't read thread at %x",
137 TAILQ_FIRST(&proc.p_threads));
138 return (-1);
139 }
118 struct proc proc;
119 struct proc pproc;
120 struct timeval tv;
121 struct sysentvec sysent;
122 char svname[KI_EMULNAMELEN];
123
124 kp = &kinfo_proc;
125 kp->ki_structsize = sizeof(kinfo_proc);

--- 6 unchanged lines hidden (view full) ---

132 if (proc.p_state != PRS_ZOMBIE) {
133 if (KREAD(kd, (u_long)TAILQ_FIRST(&proc.p_threads),
134 &mtd)) {
135 _kvm_err(kd, kd->program,
136 "can't read thread at %x",
137 TAILQ_FIRST(&proc.p_threads));
138 return (-1);
139 }
140#if 0
140 if ((proc.p_flag & P_SA) == 0) {
141 if (KREAD(kd,
142 (u_long)TAILQ_FIRST(&proc.p_ksegrps),
143 &mkg)) {
144 _kvm_err(kd, kd->program,
145 "can't read ksegrp at %x",
146 TAILQ_FIRST(&proc.p_ksegrps));
147 return (-1);
148 }
141 if ((proc.p_flag & P_SA) == 0) {
142 if (KREAD(kd,
143 (u_long)TAILQ_FIRST(&proc.p_ksegrps),
144 &mkg)) {
145 _kvm_err(kd, kd->program,
146 "can't read ksegrp at %x",
147 TAILQ_FIRST(&proc.p_ksegrps));
148 return (-1);
149 }
149#if 0
150 if (KREAD(kd,
151 (u_long)TAILQ_FIRST(&mkg.kg_kseq), &mke)) {
152 _kvm_err(kd, kd->program,
153 "can't read kse at %x",
154 TAILQ_FIRST(&mkg.kg_kseq));
155 return (-1);
156 }
150 if (KREAD(kd,
151 (u_long)TAILQ_FIRST(&mkg.kg_kseq), &mke)) {
152 _kvm_err(kd, kd->program,
153 "can't read kse at %x",
154 TAILQ_FIRST(&mkg.kg_kseq));
155 return (-1);
156 }
157#endif
158 }
157 }
158#endif
159 }
160 if (KREAD(kd, (u_long)proc.p_ucred, &ucred) == 0) {
161 kp->ki_ruid = ucred.cr_ruid;
162 kp->ki_svuid = ucred.cr_svuid;
163 kp->ki_rgid = ucred.cr_rgid;
164 kp->ki_svgid = ucred.cr_svgid;
165 kp->ki_ngroups = ucred.cr_ngroups;
166 bcopy(ucred.cr_groups, kp->ki_groups,

--- 253 unchanged lines hidden (view full) ---

420 /* Stuff from the thread */
421 kp->ki_pri.pri_level = mtd.td_priority;
422 kp->ki_pri.pri_native = mtd.td_base_pri;
423 kp->ki_lastcpu = mtd.td_lastcpu;
424 kp->ki_wchan = mtd.td_wchan;
425 kp->ki_oncpu = mtd.td_oncpu;
426
427 if (!(proc.p_flag & P_SA)) {
159 }
160 if (KREAD(kd, (u_long)proc.p_ucred, &ucred) == 0) {
161 kp->ki_ruid = ucred.cr_ruid;
162 kp->ki_svuid = ucred.cr_svuid;
163 kp->ki_rgid = ucred.cr_rgid;
164 kp->ki_svgid = ucred.cr_svgid;
165 kp->ki_ngroups = ucred.cr_ngroups;
166 bcopy(ucred.cr_groups, kp->ki_groups,

--- 253 unchanged lines hidden (view full) ---

420 /* Stuff from the thread */
421 kp->ki_pri.pri_level = mtd.td_priority;
422 kp->ki_pri.pri_native = mtd.td_base_pri;
423 kp->ki_lastcpu = mtd.td_lastcpu;
424 kp->ki_wchan = mtd.td_wchan;
425 kp->ki_oncpu = mtd.td_oncpu;
426
427 if (!(proc.p_flag & P_SA)) {
428#if 0
428 /* stuff from the ksegrp */
429 kp->ki_slptime = mkg.kg_slptime;
430 kp->ki_pri.pri_class = mkg.kg_pri_class;
431 kp->ki_pri.pri_user = mkg.kg_user_pri;
432 kp->ki_estcpu = mkg.kg_estcpu;
433
429 /* stuff from the ksegrp */
430 kp->ki_slptime = mkg.kg_slptime;
431 kp->ki_pri.pri_class = mkg.kg_pri_class;
432 kp->ki_pri.pri_user = mkg.kg_user_pri;
433 kp->ki_estcpu = mkg.kg_estcpu;
434
434#if 0
435 /* Stuff from the kse */
436 kp->ki_pctcpu = mke.ke_pctcpu;
437 kp->ki_rqindex = mke.ke_rqindex;
438#else
439 kp->ki_pctcpu = 0;
440 kp->ki_rqindex = 0;
441#endif
442 } else {

--- 589 unchanged lines hidden ---
435 /* Stuff from the kse */
436 kp->ki_pctcpu = mke.ke_pctcpu;
437 kp->ki_rqindex = mke.ke_rqindex;
438#else
439 kp->ki_pctcpu = 0;
440 kp->ki_rqindex = 0;
441#endif
442 } else {

--- 589 unchanged lines hidden ---