From c5db6a188fb2cea5b4c4fa2d32862341c74b4293 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 17 Nov 1999 12:49:22 +0000 Subject: [PATCH] Add e_stats (p->p_stats, from struct user->u_stats) to eproc so it's fetchable via sysctl. This saves ps having to read the u-area for stats. Be sure to recompile libkvm, ps, w, top and the usual suspects. --- sys/kern/kern_proc.c | 4 +++- sys/sys/user.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 4c3ee1cfa2c1..124bf02be123 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -449,7 +449,7 @@ fill_eproc(p, ep) if (p->p_ucred) ep->e_ucred = *p->p_ucred; } - if (p->p_procsig){ + if (p->p_procsig) { ep->e_procsig = *p->p_procsig; } if (p->p_stat != SIDL && p->p_stat != SZOMB && p->p_vmspace != NULL) { @@ -457,6 +457,8 @@ fill_eproc(p, ep) ep->e_vm = *vm; ep->e_vm.vm_rssize = vmspace_resident_count(vm); /*XXX*/ } + if ((p->p_flag & P_INMEM) && p->p_stats) + ep->e_stats = *p->p_stats; if (p->p_pptr) ep->e_ppid = p->p_pptr->p_pid; if (p->p_pgrp) { diff --git a/sys/sys/user.h b/sys/sys/user.h index 62ea5c53069a..9a4b9ecc9a41 100644 --- a/sys/sys/user.h +++ b/sys/sys/user.h @@ -71,6 +71,7 @@ struct kinfo_proc { struct ucred e_ucred; /* current credentials */ struct procsig e_procsig; /* shared signal structure */ struct vmspace e_vm; /* address space */ + struct pstats e_stats; /* process stats */ pid_t e_ppid; /* parent process id */ pid_t e_pgid; /* process group id */ short e_jobc; /* job control counter */