summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-08-04 05:37:06 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-08-04 05:37:06 +0000
commit2b19a7d476c4e52c7af403cc6b98cce4a9a792ab (patch)
tree3506e575cfa58422f6277ccf570b58cebec6210b
parentd0eafefda38ac398713867970be8869d686180a4 (diff)
toast non-NEWVM code; freebsd
-rw-r--r--bin/ps/extern.h5
-rw-r--r--bin/ps/keyword.c99
-rw-r--r--bin/ps/nlist.c22
-rw-r--r--bin/ps/print.c91
-rw-r--r--bin/ps/ps.c12
5 files changed, 9 insertions, 220 deletions
diff --git a/bin/ps/extern.h b/bin/ps/extern.h
index 7a16ce37bc4..f519ac8873c 100644
--- a/bin/ps/extern.h
+++ b/bin/ps/extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: extern.h,v 1.2 1996/06/23 14:20:48 deraadt Exp $ */
+/* $OpenBSD: extern.h,v 1.3 1997/08/04 05:37:03 deraadt Exp $ */
/* $NetBSD: extern.h,v 1.10 1995/05/21 13:38:27 mycroft Exp $ */
/*-
@@ -77,9 +77,6 @@ void started __P((KINFO *, VARENT *));
void state __P((KINFO *, VARENT *));
void tdev __P((KINFO *, VARENT *));
void tname __P((KINFO *, VARENT *));
-#ifndef NEWVM
-void trss __P((KINFO *, VARENT *));
-#endif
void tsize __P((KINFO *, VARENT *));
void ucomm __P((KINFO *, VARENT *));
void uname __P((KINFO *, VARENT *));
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c
index 6cc6a19fb4f..ae58881c9b8 100644
--- a/bin/ps/keyword.c
+++ b/bin/ps/keyword.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keyword.c,v 1.7 1997/07/23 19:18:18 kstailey Exp $ */
+/* $OpenBSD: keyword.c,v 1.8 1997/08/04 05:37:03 deraadt Exp $ */
/* $NetBSD: keyword.c,v 1.12.6.1 1996/05/30 21:25:13 cgd Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)keyword.c 8.5 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: keyword.c,v 1.7 1997/07/23 19:18:18 kstailey Exp $";
+static char rcsid[] = "$OpenBSD: keyword.c,v 1.8 1997/08/04 05:37:03 deraadt Exp $";
#endif
#endif /* not lint */
@@ -56,14 +56,8 @@ static char rcsid[] = "$OpenBSD: keyword.c,v 1.7 1997/07/23 19:18:18 kstailey Ex
#include "ps.h"
-#ifdef P_PPWAIT
-#define NEWVM
-#endif
-
-#ifdef NEWVM
#include <sys/ucred.h>
#include <sys/sysctl.h>
-#endif
static VAR *findvar __P((char *));
static int vcmp __P((const void *, const void *));
@@ -97,7 +91,6 @@ int utime(), stime(), ixrss(), idrss(), isrss();
#define USERLEN 8
VAR var[] = {
-#ifdef NEWVM
{"%cpu", "%CPU", NULL, 0, pcpu, 4},
{"%mem", "%MEM", NULL, 0, pmem, 4},
{"acflag", "ACFLG", NULL, 0, pvar, 3, POFF(p_acflag), USHORT, "x"},
@@ -186,94 +179,6 @@ VAR var[] = {
{"vsz", "VSZ", NULL, 0, vsize, 5},
{"wchan", "WCHAN", NULL, LJUST, wchan, 6},
{"xstat", "XSTAT", NULL, 0, pvar, 4, POFF(p_xstat), USHORT, "x"},
-#else
- {"%cpu", "%CPU", NULL, 0, pcpu, 4},
- {"%mem", "%MEM", NULL, 0, pmem, 4},
- {"acflag", "ACFLG", NULL, USER, uvar, 3, UOFF(u_acflag), SHORT, "x"},
- {"acflg", "", "acflag"},
- {"blocked", "", "sigmask"},
- {"caught", "", "sigcatch"},
- {"command", "COMMAND", NULL, COMM|LJUST|USER, command, 16},
- {"cpu", "CPU", NULL, 0, pvar, 3, POFF(p_cpu), ULONG, "d"},
- {"cputime", "", "time"},
- {"f", "F", NULL, 0, pvar, 7, POFF(p_flag), LONG, "x"},
- {"flags", "", "f"},
- {"gid", "GID", NULL, 0, pvar, UIDLEN, POFF(p_gid), USHORT, UIDFMT},
- {"ignored", "", "sigignore"},
- {"inblk", "INBLK", NULL, USER, rvar, 4, ROFF(ru_inblock), LONG, "d"},
- {"inblock", "", "inblk"},
- {"jobc", "JOBC", NULL, 0, evar, 4, EOFF(e_jobc), SHORT, "d"},
- {"ktrace", "KTRACE", NULL, 0, pvar, 8, POFF(p_traceflag), LONG, "x"},
- {"ktracep", "KTRACEP", NULL, 0, pvar, 8, POFF(p_tracep), LONG, "x"},
- {"lim", "LIM", NULL, 0, maxrss, 5},
- {"logname", "LOGNAME", NULL, LJUST, logname, MAXLOGNAME},
- {"lstart", "STARTED", NULL, LJUST|USER, lstarted, 28},
- {"majflt", "MAJFLT", NULL, USER, rvar, 4, ROFF(ru_majflt), LONG, "d"},
- {"minflt", "MINFLT", NULL, USER, rvar, 4, ROFF(ru_minflt), LONG, "d"},
- {"msgrcv", "MSGRCV", NULL, USER, rvar, 4, ROFF(ru_msgrcv), LONG, "d"},
- {"msgsnd", "MSGSND", NULL, USER, rvar, 4, ROFF(ru_msgsnd), LONG, "d"},
- {"ni", "", "nice"},
- {"nice", "NI", NULL, 0, pvar, 2, POFF(p_nice), CHAR, "d"},
- {"nivcsw", "NIVCSW", NULL, USER, rvar, 5, ROFF(ru_nivcsw), LONG, "d"},
- {"nsignals", "", "nsigs"},
- {"nsigs", "NSIGS", NULL, USER, rvar, 4, ROFF(ru_nsignals), LONG, "d"},
- {"nswap", "NSWAP", NULL, USER, rvar, 4, ROFF(ru_nswap), LONG, "d"},
- {"nvcsw", "NVCSW", NULL, USER, rvar, 5, ROFF(ru_nvcsw), LONG, "d"},
- {"nwchan", "WCHAN", NULL, 0, pvar, 6, POFF(p_wchan), KPTR, "x"},
- {"oublk", "OUBLK", NULL, USER, rvar, 4, ROFF(ru_oublock), LONG, "d"},
- {"oublock", "", "oublk"},
- {"p_ru", "P_RU", NULL, 0, pvar, 6, POFF(p_ru), KPTR, "x"},
- {"paddr", "PADDR", NULL, 0, evar, 6, EOFF(e_paddr), KPTR, "x"},
- {"pagein", "PAGEIN", NULL, USER, pagein, 6},
- {"pcpu", "", "%cpu"},
- {"pending", "", "sig"},
- {"pgid", "PGID", NULL, 0, evar, PIDLEN, EOFF(e_pgid), ULONG, PIDFMT},
- {"pid", "PID", NULL, 0, pvar, PIDLEN, POFF(p_pid), LONG, PIDFMT},
- {"pmem", "", "%mem"},
- {"poip", "POIP", NULL, 0, pvar, 4, POFF(p_poip), SHORT, "d"},
- {"ppid", "PPID", NULL, 0, pvar, PIDLEN, POFF(p_ppid), LONG, PIDFMT},
- {"pri", "PRI", NULL, 0, pri, 3},
- {"re", "RE", NULL, 0, pvar, 3, POFF(p_swtime), ULONG, "d"},
- {"rgid", "RGID", NULL, 0, pvar, UIDLEN, POFF(p_rgid), USHORT, UIDFMT},
- {"rlink", "RLINK", NULL, 0, pvar, 8, POFF(p_rlink), KPTR, "x"},
- {"rss", "RSS", NULL, 0, p_rssize, 4},
- {"rssize", "", "rsz"},
- {"rsz", "RSZ", NULL, 0, rssize, 4},
- {"ruid", "RUID", NULL, 0, pvar, UIDLEN, POFF(p_ruid), USHORT, UIDFMT},
- {"ruser", "RUSER", NULL, LJUST, runame, USERLEN},
- {"sess", "SESS", NULL, 0, evar, 6, EOFF(e_sess), KPTR, "x"},
- {"sig", "PENDING", NULL, 0, pvar, 8, POFF(p_sig), LONG, "x"},
- {"sigcatch", "CAUGHT", NULL, 0, pvar, 8, POFF(p_sigcatch), LONG, "x"},
- {"sigignore", "IGNORED",
- NULL, 0, pvar, 8, POFF(p_sigignore), LONG, "x"},
- {"sigmask", "BLOCKED", NULL, 0, pvar, 8, POFF(p_sigmask), LONG, "x"},
- {"sl", "SL", NULL, 0, pvar, 3, POFF(p_slptime), ULONG, "d"},
- {"start", "STARTED", NULL, LJUST|USER, started, 8},
- {"stat", "", "state"},
- {"state", "STAT", NULL, 0, state, 4},
- {"svgid", "SVGID",
- NULL, 0, pvar, UIDLEN, POFF(p_svgid), USHORT, UIDFMT},
- {"svuid", "SVUID",
- NULL, 0, pvar, UIDLEN, POFF(p_svuid), USHORT, UIDFMT},
- {"tdev", "TDEV", NULL, 0, tdev, 4},
- {"time", "TIME", NULL, USER, cputime, 9},
- {"tpgid", "TPGID", NULL, 0, evar, 4, EOFF(e_tpgid), ULONG, PIDFMT},
- {"trs", "TRS", NULL, 0, trss, 3},
- {"tsess", "TSESS", NULL, 0, evar, 6, EOFF(e_tsess), KPTR, "x"},
- {"tsiz", "TSIZ", NULL, 0, tsize, 4},
- {"tt", "TT", NULL, LJUST, tname, 3},
- {"tty", "TTY", NULL, LJUST, longtname, 8},
- {"ucomm", "UCOMM", NULL, LJUST, ucomm, MAXCOMLEN},
- {"uid", "UID", NULL, 0, pvar, UIDLEN, POFF(p_uid),USHORT, UIDFMT},
- {"upr", "UPR", NULL, 0, pvar, 3, POFF(p_usrpri), CHAR, "d"},
- {"uprocp", "UPROCP", NULL, USER, uvar, 6, UOFF(u_procp), KPTR, "x"},
- {"user", "USER", NULL, LJUST, uname, USERLEN},
- {"usrpri", "", "upr"},
- {"vsize", "", "vsz"},
- {"vsz", "VSZ", NULL, 0, vsize, 5},
- {"wchan", "WCHAN", NULL, LJUST, wchan, 6},
- {"xstat", "XSTAT", NULL, 0, pvar, 4, POFF(p_xstat), USHORT, "x"},
-#endif
{""},
};
diff --git a/bin/ps/nlist.c b/bin/ps/nlist.c
index ff402f10829..cad80ec609d 100644
--- a/bin/ps/nlist.c
+++ b/bin/ps/nlist.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nlist.c,v 1.2 1996/06/23 14:20:50 deraadt Exp $ */
+/* $OpenBSD: nlist.c,v 1.3 1997/08/04 05:37:04 deraadt Exp $ */
/* $NetBSD: nlist.c,v 1.11 1995/03/21 09:08:03 cgd Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)nlist.c 8.4 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: nlist.c,v 1.2 1996/06/23 14:20:50 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: nlist.c,v 1.3 1997/08/04 05:37:04 deraadt Exp $";
#endif
#endif /* not lint */
@@ -57,24 +57,15 @@ static char rcsid[] = "$OpenBSD: nlist.c,v 1.2 1996/06/23 14:20:50 deraadt Exp $
#include "ps.h"
-#ifdef P_PPWAIT
-#define NEWVM
-#endif
-
struct nlist psnl[] = {
{"_fscale"},
#define X_FSCALE 0
{"_ccpu"},
#define X_CCPU 1
-#ifdef NEWVM
{"_avail_start"},
#define X_AVAILSTART 2
{"_avail_end"},
#define X_AVAILEND 3
-#else
- {"_ecmx"},
-#define X_ECMX 2
-#endif
{NULL}
};
@@ -92,9 +83,7 @@ int
donlist()
{
int rval;
-#ifdef NEWVM
int tmp;
-#endif
rval = 0;
nlistread = 1;
@@ -107,7 +96,6 @@ donlist()
warnx("fscale: %s", kvm_geterr(kd));
eval = rval = 1;
}
-#ifdef NEWVM
if (kread(X_AVAILEND, mempages)) {
warnx("avail_start: %s", kvm_geterr(kd));
eval = rval = 1;
@@ -118,12 +106,6 @@ donlist()
}
mempages -= tmp;
mempages /= getpagesize();
-#else
- if (kread(X_ECMX, mempages)) {
- warnx("ecmx: %s", kvm_geterr(kd));
- eval = rval = 1;
- }
-#endif
if (kread(X_CCPU, ccpu)) {
warnx("ccpu: %s", kvm_geterr(kd));
eval = rval = 1;
diff --git a/bin/ps/print.c b/bin/ps/print.c
index 94e8c5912fa..364f9eea443 100644
--- a/bin/ps/print.c
+++ b/bin/ps/print.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print.c,v 1.5 1997/08/01 09:48:44 deraadt Exp $ */
+/* $OpenBSD: print.c,v 1.6 1997/08/04 05:37:04 deraadt Exp $ */
/* $NetBSD: print.c,v 1.27 1995/09/29 21:58:12 cgd Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94";
#else
-static char rcsid[] = "$OpenBSD: print.c,v 1.5 1997/08/01 09:48:44 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: print.c,v 1.6 1997/08/04 05:37:04 deraadt Exp $";
#endif
#endif /* not lint */
@@ -48,19 +48,9 @@ static char rcsid[] = "$OpenBSD: print.c,v 1.5 1997/08/01 09:48:44 deraadt Exp $
#include <sys/proc.h>
#include <sys/stat.h>
-#ifdef P_PPWAIT
-#define NEWVM
-#endif
-
-#ifdef NEWVM
#include <sys/ucred.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 <kvm.h>
@@ -183,11 +173,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
@@ -233,37 +219,19 @@ state(k, ve)
}
cp++;
if (flag & P_INMEM) {
-#ifndef NEWVM
- if (p->p_rssize > p->p_maxrss)
- *cp++ = '>';
-#endif
} else
*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->p_holdcnt)
-#else
- if (flag & (SSYS|SLOCK|SULOCK|SKEEP|SPHYSIO))
-#endif
*cp++ = 'L';
if (KI_EPROC(k)->e_flag & EPROC_SLEADER)
*cp++ = 's';
@@ -292,13 +260,8 @@ 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
}
void
@@ -309,13 +272,8 @@ 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
}
void
@@ -460,13 +418,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
@@ -477,14 +430,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
@@ -495,11 +442,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("%*d", v->width, pgtok(KI_EPROC(k)->e_vm.vm_rssize));
-#endif
}
void
@@ -596,18 +539,10 @@ getpmem(k)
e = KI_EPROC(k);
if ((p->p_flag & P_INMEM) == 0)
return (0.0);
-#ifndef NEWVM
- szptudot = USPACE/getpagesize() +
- 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 = USPACE/getpagesize();
/* XXX don't have info about shared */
fracmem = ((float)e->e_vm.vm_rssize + szptudot)/CLSIZE/mempages;
-#endif
return (100.0 * fracmem);
}
@@ -642,11 +577,6 @@ maxrss(k, ve)
VAR *v;
v = ve->var;
-#ifndef NEWVM /* not yet */
- if (KI_PROC(k)->p_maxrss != (RLIM_INFINITY/getpagesize()))
- (void)printf("%*d", v->width, pgtok(KI_PROC(k)->p_maxrss));
- else
-#endif
(void)printf("%*s", v->width, "-");
}
@@ -658,26 +588,9 @@ tsize(k, ve)
VAR *v;
v = ve->var;
-#ifndef NEWVM
- (void)printf("%*d", v->width, pgtok(KI_EPROC(k)->e_xsize));
-#else
(void)printf("%*d", v->width, 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
* structures.
diff --git a/bin/ps/ps.c b/bin/ps/ps.c
index 1546df9998b..d506c2b20a3 100644
--- a/bin/ps/ps.c
+++ b/bin/ps/ps.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ps.c,v 1.8 1997/06/13 00:37:39 michaels Exp $ */
+/* $OpenBSD: ps.c,v 1.9 1997/08/04 05:37:05 deraadt Exp $ */
/* $NetBSD: ps.c,v 1.15 1995/05/18 20:33:25 mycroft Exp $ */
/*-
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: ps.c,v 1.8 1997/06/13 00:37:39 michaels Exp $";
+static char rcsid[] = "$OpenBSD: ps.c,v 1.9 1997/08/04 05:37:05 deraadt Exp $";
#endif
#endif /* not lint */
@@ -72,10 +72,6 @@ static char rcsid[] = "$OpenBSD: ps.c,v 1.8 1997/06/13 00:37:39 michaels Exp $";
#include "ps.h"
-#ifdef P_PPWAIT
-#define NEWVM
-#endif
-
KINFO *kinfo;
struct varent *vhead, *vtail;
@@ -399,12 +395,8 @@ pscomp(a, b)
const void *a, *b;
{
int i;
-#ifdef NEWVM
#define VSIZE(k) (KI_EPROC(k)->e_vm.vm_dsize + KI_EPROC(k)->e_vm.vm_ssize + \
KI_EPROC(k)->e_vm.vm_tsize)
-#else
-#define VSIZE(k) ((k)->ki_p->p_dsize + (k)->ki_p->p_ssize + (k)->ki_e->e_xsize)
-#endif
if (sortby == SORTCPU)
return (getpcpu((KINFO *)b) - getpcpu((KINFO *)a));