Kill #ifndef NEWVM etc. It affected a lot of other things besides

VM structure (eg: credentials etc) and it's highly unlikely we'll ever
get to see the "tainted" BSD<=4.3 VM code in public use.  Although it
indicated the way some things used to be done, it obfuscates things too
much.
This commit is contained in:
Peter Wemm 1997-08-03 08:25:01 +00:00
parent 3fc9295da7
commit 940cca66e2
4 changed files with 7 additions and 130 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)extern.h 8.3 (Berkeley) 4/2/94
* $Id: extern.h,v 1.5 1997/02/22 14:04:59 peter Exp $
* $Id: extern.h,v 1.6 1997/04/29 05:26:04 jkh Exp $
*/
struct kinfo;
@ -75,9 +75,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 *));

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
* $Id: nlist.c,v 1.8 1997/02/22 14:05:04 peter Exp $
*/
#ifndef lint
@ -51,24 +51,15 @@ static char const sccsid[] = "@(#)nlist.c 8.4 (Berkeley) 4/2/94";
#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}
};
@ -86,9 +77,7 @@ int
donlist()
{
int rval;
#ifdef NEWVM
int tmp;
#endif
rval = 0;
nlistread = 1;
@ -101,7 +90,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;
@ -112,12 +100,6 @@ donlist()
}
mempages -= tmp;
mempages /= PAGE_SIZE;
#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;

View File

@ -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,26 +582,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("%*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
* structures.

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ps.c,v 1.19 1997/04/29 05:26:05 jkh Exp $
* $Id: ps.c,v 1.20 1997/06/06 06:40:06 charnier Exp $
*/
#ifndef lint
@ -68,10 +68,6 @@ static char const sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94";
#include "ps.h"
#ifdef P_PPWAIT
#define NEWVM
#endif
KINFO *kinfo;
struct varent *vhead, *vtail;
@ -476,12 +472,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));