Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_proc.c
Show First 20 Lines • Show All 866 Lines • ▼ Show 20 Lines | |||||
static void | static void | ||||
fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp) | fill_kinfo_proc_only(struct proc *p, struct kinfo_proc *kp) | ||||
{ | { | ||||
struct thread *td0; | struct thread *td0; | ||||
struct tty *tp; | struct tty *tp; | ||||
struct session *sp; | struct session *sp; | ||||
struct ucred *cred; | struct ucred *cred; | ||||
struct sigacts *ps; | struct sigacts *ps; | ||||
struct timeval boottime; | |||||
/* For proc_realparent. */ | /* For proc_realparent. */ | ||||
sx_assert(&proctree_lock, SX_LOCKED); | sx_assert(&proctree_lock, SX_LOCKED); | ||||
PROC_LOCK_ASSERT(p, MA_OWNED); | PROC_LOCK_ASSERT(p, MA_OWNED); | ||||
bzero(kp, sizeof(*kp)); | bzero(kp, sizeof(*kp)); | ||||
kp->ki_structsize = sizeof(*kp); | kp->ki_structsize = sizeof(*kp); | ||||
kp->ki_paddr = p; | kp->ki_paddr = p; | ||||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | #endif | ||||
else | else | ||||
kp->ki_sflag = 0; | kp->ki_sflag = 0; | ||||
/* Calculate legacy swtime as seconds since 'swtick'. */ | /* Calculate legacy swtime as seconds since 'swtick'. */ | ||||
kp->ki_swtime = (ticks - p->p_swtick) / hz; | kp->ki_swtime = (ticks - p->p_swtick) / hz; | ||||
kp->ki_pid = p->p_pid; | kp->ki_pid = p->p_pid; | ||||
kp->ki_nice = p->p_nice; | kp->ki_nice = p->p_nice; | ||||
kp->ki_fibnum = p->p_fibnum; | kp->ki_fibnum = p->p_fibnum; | ||||
kp->ki_start = p->p_stats->p_start; | kp->ki_start = p->p_stats->p_start; | ||||
getboottime(&boottime); | |||||
timevaladd(&kp->ki_start, &boottime); | timevaladd(&kp->ki_start, &boottime); | ||||
PROC_STATLOCK(p); | PROC_STATLOCK(p); | ||||
rufetch(p, &kp->ki_rusage); | rufetch(p, &kp->ki_rusage); | ||||
kp->ki_runtime = cputick2usec(p->p_rux.rux_runtime); | kp->ki_runtime = cputick2usec(p->p_rux.rux_runtime); | ||||
calcru(p, &kp->ki_rusage.ru_utime, &kp->ki_rusage.ru_stime); | calcru(p, &kp->ki_rusage.ru_utime, &kp->ki_rusage.ru_stime); | ||||
PROC_STATUNLOCK(p); | PROC_STATUNLOCK(p); | ||||
calccru(p, &kp->ki_childutime, &kp->ki_childstime); | calccru(p, &kp->ki_childutime, &kp->ki_childstime); | ||||
/* Some callers want child times in a single value. */ | /* Some callers want child times in a single value. */ | ||||
▲ Show 20 Lines • Show All 2,148 Lines • Show Last 20 Lines |