diff options
author | mckusick <mckusick@FreeBSD.org> | 2000-12-12 07:25:57 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 2000-12-12 07:25:57 +0000 |
commit | cba301121bc106aaff382428a55f31fef30844e6 (patch) | |
tree | 910e5652e5d16d5d0d4e8480f7e386aaf0ca310e /usr.bin/w/w.c | |
parent | d577ae457b219ac16b4e152a40ae4d7474c4622f (diff) | |
download | FreeBSD-src-cba301121bc106aaff382428a55f31fef30844e6.zip FreeBSD-src-cba301121bc106aaff382428a55f31fef30844e6.tar.gz |
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.
Diffstat (limited to 'usr.bin/w/w.c')
-rw-r--r-- | usr.bin/w/w.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c index d91aa8c..0ead030 100644 --- a/usr.bin/w/w.c +++ b/usr.bin/w/w.c @@ -114,7 +114,7 @@ struct entry { struct kinfo_proc *dkp; /* debug option proc list */ } *ep, *ehead = NULL, **nextp = &ehead; -#define debugproc(p) *((struct kinfo_proc **)&(p)->kp_eproc.e_spare[0]) +#define debugproc(p) *((struct kinfo_proc **)&(p)->ki_spare[0]) static void pr_header __P((time_t *, int)); static struct stat *ttystat __P((char *, int)); @@ -273,27 +273,23 @@ main(argc, argv) if ((kp = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nentries)) == NULL) err(1, "%s", kvm_geterr(kd)); for (i = 0; i < nentries; i++, kp++) { - struct proc *pr = &kp->kp_proc; - struct eproc *e; - - if (pr->p_stat == SIDL || pr->p_stat == SZOMB) + if (kp->ki_stat == SIDL || kp->ki_stat == SZOMB) continue; - e = &kp->kp_eproc; for (ep = ehead; ep != NULL; ep = ep->next) { - if (ep->tdev == e->e_tdev) { + if (ep->tdev == kp->ki_tdev) { /* * proc is associated with this terminal */ - if (ep->kp == NULL && e->e_pgid == e->e_tpgid) { + if (ep->kp == NULL && kp->ki_pgid == kp->ki_tpgid) { /* * Proc is 'most interesting' */ - if (proc_compare(&ep->kp->kp_proc, pr)) + if (proc_compare(ep->kp, kp)) ep->kp = kp; } /* * Proc debug option info; add to debug - * list using kinfo_proc kp_eproc.e_spare + * list using kinfo_proc ki_spare[0] * as next pointer; ptr to ptr avoids the * ptr = long assumption. */ @@ -318,7 +314,7 @@ main(argc, argv) continue; } ep->args = fmt_argv(kvm_getargv(kd, ep->kp, argwidth), - ep->kp->kp_proc.p_comm, MAXCOMLEN); + ep->kp->ki_comm, MAXCOMLEN); if (ep->args == NULL) err(1, NULL); } @@ -389,11 +385,11 @@ main(argc, argv) char *ptr; ptr = fmt_argv(kvm_getargv(kd, dkp, argwidth), - dkp->kp_proc.p_comm, MAXCOMLEN); + dkp->ki_comm, MAXCOMLEN); if (ptr == NULL) ptr = "-"; (void)printf("\t\t%-9d %s\n", - dkp->kp_proc.p_pid, ptr); + dkp->ki_pid, ptr); } } (void)printf("%-*.*s %-*.*s %-*.*s ", |