diff options
Diffstat (limited to 'bin/ps/print.c')
-rw-r--r-- | bin/ps/print.c | 102 |
1 files changed, 4 insertions, 98 deletions
diff --git a/bin/ps/print.c b/bin/ps/print.c index 072d0fc..514e831 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: print.c,v 1.20 1997/04/16 16:08:11 jdp Exp $ + * $Id: print.c,v 1.21 1997/04/29 05:26:05 jkh Exp $ */ #ifndef lint @@ -43,20 +43,10 @@ static char const sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94"; #include <sys/proc.h> #include <sys/stat.h> -#ifdef P_PPWAIT -#define NEWVM -#endif - -#ifdef NEWVM #include <sys/ucred.h> #include <sys/user.h> #include <sys/sysctl.h> #include <vm/vm.h> -#else -#include <machine/pte.h> -#include <sys/vmparam.h> -#include <sys/vm.h> -#endif #include <err.h> #include <math.h> @@ -166,11 +156,7 @@ logname(k, ve) VAR *v; v = ve->var; -#ifndef NEWVM - (void)printf("%-*s", v->width, KI_PROC(k)->p_logname); -#else (void)printf("%-*s", v->width, KI_EPROC(k)->e_login); -#endif } void @@ -215,38 +201,19 @@ state(k, ve) *cp = '?'; } cp++; - if (flag & P_INMEM) { -#ifndef NEWVM - if (p->p_rssize > p->p_maxrss) - *cp++ = '>'; -#endif - } else + if (!(flag & P_INMEM)) *cp++ = 'W'; if (p->p_nice < NZERO) *cp++ = '<'; else if (p->p_nice > NZERO) *cp++ = 'N'; -#ifndef NEWVM - if (flag & SUANOM) - *cp++ = 'A'; - else if (flag & SSEQL) - *cp++ = 'S'; -#endif if (flag & P_TRACED) *cp++ = 'X'; if (flag & P_WEXIT && p->p_stat != SZOMB) *cp++ = 'E'; -#ifdef NEWVM if (flag & P_PPWAIT) -#else - if (flag & SVFORK) -#endif *cp++ = 'V'; -#ifdef NEWVM if (flag & (P_SYSTEM | P_NOSWAP | P_PHYSIO)) -#else - if (flag & (SSYS|SLOCK|SULOCK|SKEEP|SPHYSIO)) -#endif *cp++ = 'L'; if (KI_EPROC(k)->e_flag & EPROC_SLEADER) *cp++ = 's'; @@ -275,24 +242,15 @@ uname(k, ve) VAR *v; v = ve->var; -#ifndef NEWVM - (void)printf("%-*s", - (int)v->width, user_from_uid(KI_PROC(k)->p_uid, 0)); -#else (void)printf("%-*s", (int)v->width, user_from_uid(KI_EPROC(k)->e_ucred.cr_uid, 0)); -#endif } int s_uname(k) KINFO *k; { -#ifndef NEWVM - return (strlen(user_from_uid(KI_PROC(k)->p_uid, 0))); -#else return (strlen(user_from_uid(KI_EPROC(k)->e_ucred.cr_uid, 0))); -#endif } void @@ -303,24 +261,15 @@ runame(k, ve) VAR *v; v = ve->var; -#ifndef NEWVM - (void)printf("%-*s", - (int)v->width, user_from_uid(KI_PROC(k)->p_ruid, 0)); -#else (void)printf("%-*s", (int)v->width, user_from_uid(KI_EPROC(k)->e_pcred.p_ruid, 0)); -#endif } int s_runame(k) KINFO *k; { -#ifndef NEWVM - return (strlen(user_from_uid(KI_PROC(k)->p_ruid, 0))); -#else return (strlen(user_from_uid(KI_EPROC(k)->e_pcred.p_ruid, 0))); -#endif } void @@ -462,13 +411,8 @@ vsize(k, ve) v = ve->var; (void)printf("%*d", v->width, -#ifndef NEWVM - pgtok(KI_PROC(k)->p_dsize + - KI_PROC(k)->p_ssize + KI_EPROC(k)->e_xsize)); -#else pgtok(KI_EPROC(k)->e_vm.vm_dsize + KI_EPROC(k)->e_vm.vm_ssize + KI_EPROC(k)->e_vm.vm_tsize)); -#endif } void @@ -479,14 +423,8 @@ rssize(k, ve) VAR *v; v = ve->var; -#ifndef NEWVM - (void)printf("%*d", v->width, - pgtok(KI_PROC(k)->p_rssize + (KI_EPROC(k)->e_xccount ? - (KI_EPROC(k)->e_xrssize / KI_EPROC(k)->e_xccount) : 0))); -#else /* XXX don't have info about shared */ (void)printf("%*d", v->width, pgtok(KI_EPROC(k)->e_vm.vm_rssize)); -#endif } void @@ -497,11 +435,7 @@ p_rssize(k, ve) /* doesn't account for text */ VAR *v; v = ve->var; -#ifndef NEWVM - (void)printf("%*d", v->width, pgtok(KI_PROC(k)->p_rssize)); -#else (void)printf("%*ld", v->width, (long)pgtok(KI_EPROC(k)->e_vm.vm_rssize)); -#endif } void @@ -598,17 +532,10 @@ getpmem(k) e = KI_EPROC(k); if ((p->p_flag & P_INMEM) == 0) return (0.0); -#ifndef NEWVM - szptudot = UPAGES + clrnd(ctopt(p->p_dsize + p->p_ssize + e->e_xsize)); - fracmem = ((float)p->p_rssize + szptudot)/CLSIZE/mempages; - if (p->p_textp && e->e_xccount) - fracmem += ((float)e->e_xrssize)/CLSIZE/e->e_xccount/mempages; -#else /* XXX want pmap ptpages, segtab, etc. (per architecture) */ szptudot = UPAGES; /* XXX don't have info about shared */ fracmem = ((float)e->e_vm.vm_rssize + szptudot)/mempages; -#endif return (100.0 * fracmem); } @@ -643,12 +570,8 @@ maxrss(k, ve) VAR *v; v = ve->var; -#ifndef NEWVM /* not yet */ - if (KI_PROC(k)->p_maxrss != (RLIM_INFINITY/PAGE_SIZE)) - (void)printf("%*d", v->width, pgtok(KI_PROC(k)->p_maxrss)); - else -#endif - (void)printf("%*s", v->width, "-"); + /* XXX not yet */ + (void)printf("%*s", v->width, "-"); } void @@ -659,25 +582,8 @@ tsize(k, ve) VAR *v; v = ve->var; -#ifndef NEWVM - (void)printf("%*d", v->width, pgtok(KI_EPROC(k)->e_xsize)); -#else (void)printf("%*ld", v->width, (long)pgtok(KI_EPROC(k)->e_vm.vm_tsize)); -#endif -} - -#ifndef NEWVM -void -trss(k, ve) - KINFO *k; - VARENT *ve; -{ - VAR *v; - - v = ve->var; - (void)printf("%*d", v->width, pgtok(KI_EPROC(k)->e_xrssize)); } -#endif /* * Generic output routines. Print fields from various prototype |