From 1f7d2501824fda6eed4bd2c81b4af3ee052c451a Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Tue, 12 Dec 2000 07:25:57 +0000 Subject: Change the proc information returned from the kernel so that it no longer contains kernel specific data structures, but rather only scalar values and structures that are already part of the kernel/user interface, specifically rusage and rtprio. It no longer contains proc, session, pcred, ucred, procsig, vmspace, pstats, mtx, sigiolst, klist, callout, pasleep, or mdproc. If any of these changed in size, ps, w, fstat, gcore, systat, and top would all stop working. The new structure has over 200 bytes of unassigned space for future values to be added, yet is nearly 100 bytes smaller per entry than the structure that it replaced. --- usr.bin/systat/pigs.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'usr.bin/systat') diff --git a/usr.bin/systat/pigs.c b/usr.bin/systat/pigs.c index 3443ede94d119..1086920ae40ab 100644 --- a/usr.bin/systat/pigs.c +++ b/usr.bin/systat/pigs.c @@ -44,7 +44,6 @@ static char sccsid[] = "@(#)pigs.c 8.2 (Berkeley) 9/23/93"; #include #include #include -#include #include #include @@ -91,7 +90,6 @@ void showpigs() { register int i, j, y, k; - struct eproc *ep; float total; int factor; char *uname, *pname, pidname[30]; @@ -120,9 +118,9 @@ showpigs() pname = ""; } else { - ep = &pt[k].pt_kp->kp_eproc; - uname = (char *)user_from_uid(ep->e_ucred.cr_uid, 0); - pname = pt[k].pt_kp->kp_proc.p_comm; + uname = (char *) + user_from_uid(pt[k].pt_kp->ki_uid, 0); + pname = pt[k].pt_kp->ki_comm; } wmove(wnd, y, 0); wclrtoeol(wnd); @@ -174,7 +172,6 @@ fetchpigs() { register int i; register float time; - register struct proc *pp; register float *pctp; struct kinfo_proc *kpp; long ctime[CPUSTATES]; @@ -203,13 +200,12 @@ fetchpigs() */ for (i = 0; i < nproc; i++) { pt[i].pt_kp = &kpp[i]; - pp = &kpp[i].kp_proc; pctp = &pt[i].pt_pctcpu; - time = pp->p_swtime; - if (time == 0 || (pp->p_flag & P_INMEM) == 0) + time = kpp[i].ki_swtime; + if (time == 0 || (kpp[i].ki_flag & P_INMEM) == 0) *pctp = 0; else - *pctp = ((double) pp->p_pctcpu / + *pctp = ((double) kpp[i].ki_pctcpu / fscale) / (1.0 - exp(time * lccpu)); } /* -- cgit v1.3