SCCS-vsn: bin/ps/keyword.c 8.3
SCCS-vsn: bin/ps/nlist.c 8.2
SCCS-vsn: bin/ps/print.c 8.3
SCCS-vsn: bin/ps/ps.c 8.2
SCCS-vsn: lib/libkvm/kvm_proc.c 8.3
SCCS-vsn: sbin/clri/clri.c 8.2
SCCS-vsn: sbin/dump/traverse.c 8.2
SCCS-vsn: sbin/fsck/inode.c 8.2
SCCS-vsn: sbin/fsdb/fsdb.c 8.2
SCCS-vsn: sbin/newfs/mkfs.c 8.2
SCCS-vsn: sbin/quotacheck/quotacheck.c 8.2
SCCS-vsn: usr.bin/gcore/gcore.c 8.2
SCCS-vsn: usr.bin/systat/pigs.c 8.2
SCCS-vsn: usr.bin/w/proc_compare.c 8.2
SCCS-vsn: usr.sbin/mkproto/mkproto.c 8.2
SCCS-vsn: usr.sbin/pstat/pstat.c 8.2
SCCS-vsn: usr.sbin/quot/quot.c 8.2
17 files changed:
-static char sccsid[] = "@(#)keyword.c 8.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)keyword.c 8.3 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
{"re", "RE", NULL, 0, pvar, 3, POFF(p_swtime), ULONG, "d"},
{"rgid", "RGID", NULL, 0, evar, UIDLEN, EOFF(e_pcred.p_rgid),
ULONG, UIDFMT},
{"re", "RE", NULL, 0, pvar, 3, POFF(p_swtime), ULONG, "d"},
{"rgid", "RGID", NULL, 0, evar, UIDLEN, EOFF(e_pcred.p_rgid),
ULONG, UIDFMT},
- {"rlink", "RLINK", NULL, 0, pvar, 8, POFF(p_rlink), KPTR, "x"},
+ {"rlink", "RLINK", NULL, 0, pvar, 8, POFF(p_back), KPTR, "x"},
{"rss", "RSS", NULL, 0, p_rssize, 4},
{"rssize", "", "rsz"},
{"rsz", "RSZ", NULL, 0, rssize, 4},
{"rss", "RSS", NULL, 0, p_rssize, 4},
{"rssize", "", "rsz"},
{"rsz", "RSZ", NULL, 0, rssize, 4},
-static char sccsid[] = "@(#)nlist.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)nlist.c 8.2 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
-static char sccsid[] = "@(#)print.c 8.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)print.c 8.3 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/stat.h>
#include <sys/proc.h>
#include <sys/stat.h>
v = ve->var;
#ifndef NEWVM
(void)printf("%-*s", v->width, KI_PROC(k)->p_logname);
v = ve->var;
#ifndef NEWVM
(void)printf("%-*s", v->width, KI_PROC(k)->p_logname);
(void)printf("%-*s", v->width, KI_EPROC(k)->e_login);
(void)printf("%-*s", v->width, KI_EPROC(k)->e_login);
- if (flag & SSINTR) /* interuptable (long) */
+ if (flag & P_SINTR) /* interuptable (long) */
*cp = p->p_slptime >= MAXSLP ? 'I' : 'S';
else
*cp = 'D';
*cp = p->p_slptime >= MAXSLP ? 'I' : 'S';
else
*cp = 'D';
#ifndef NEWVM
if (p->p_rssize > p->p_maxrss)
*cp++ = '>';
#ifndef NEWVM
if (p->p_rssize > p->p_maxrss)
*cp++ = '>';
else if (flag & SSEQL)
*cp++ = 'S';
#endif
else if (flag & SSEQL)
*cp++ = 'S';
#endif
- if (flag & SWEXIT && p->p_stat != SZOMB)
+ if (flag & P_WEXIT && p->p_stat != SZOMB)
*cp++ = 'E';
#ifdef NEWVM
*cp++ = 'E';
#ifdef NEWVM
#else
if (flag & SVFORK)
#endif
*cp++ = 'V';
#ifdef NEWVM
#else
if (flag & SVFORK)
#endif
*cp++ = 'V';
#ifdef NEWVM
- if (flag & (SSYS|SLOCK|SKEEP|SPHYSIO))
+ 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';
#else
if (flag & (SSYS|SLOCK|SULOCK|SKEEP|SPHYSIO))
#endif
*cp++ = 'L';
if (KI_EPROC(k)->e_flag & EPROC_SLEADER)
*cp++ = 's';
- if ((flag & SCTTY) && KI_EPROC(k)->e_pgid == KI_EPROC(k)->e_tpgid)
+ if ((flag & P_CONTROLT) && KI_EPROC(k)->e_pgid == KI_EPROC(k)->e_tpgid)
*cp++ = '+';
*cp = '\0';
(void)printf("%-*s", v->width, buf);
*cp++ = '+';
*cp = '\0';
(void)printf("%-*s", v->width, buf);
v = ve->var;
(void)printf("%*d", v->width,
#ifndef NEWVM
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 /* 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));
pgtok(KI_EPROC(k)->e_vm.vm_dsize + KI_EPROC(k)->e_vm.vm_ssize +
KI_EPROC(k)->e_vm.vm_tsize));
(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)));
(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)));
/* XXX don't have info about shared */
(void)printf("%*d", v->width, pgtok(KI_EPROC(k)->e_vm.vm_rssize));
/* XXX don't have info about shared */
(void)printf("%*d", v->width, pgtok(KI_EPROC(k)->e_vm.vm_rssize));
v = ve->var;
#ifndef NEWVM
(void)printf("%*d", v->width, pgtok(KI_PROC(k)->p_rssize));
v = ve->var;
#ifndef NEWVM
(void)printf("%*d", v->width, pgtok(KI_PROC(k)->p_rssize));
(void)printf("%*d", v->width, pgtok(KI_EPROC(k)->e_vm.vm_rssize));
(void)printf("%*d", v->width, pgtok(KI_EPROC(k)->e_vm.vm_rssize));
#define fxtofl(fixpt) ((double)(fixpt) / fscale)
/* XXX - I don't like this */
#define fxtofl(fixpt) ((double)(fixpt) / fscale)
/* XXX - I don't like this */
- if (p->p_swtime == 0 || (p->p_flag & SLOAD) == 0)
+ if (p->p_swtime == 0 || (p->p_flag & P_INMEM) == 0)
return (0.0);
if (rawcpu)
return (100.0 * fxtofl(p->p_pctcpu));
return (0.0);
if (rawcpu)
return (100.0 * fxtofl(p->p_pctcpu));
p = KI_PROC(k);
e = KI_EPROC(k);
p = KI_PROC(k);
e = KI_EPROC(k);
- if ((p->p_flag & SLOAD) == 0)
+ 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;
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;
/* 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)/CLSIZE/mempages;
/* 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)/CLSIZE/mempages;
return (100.0 * fracmem);
}
return (100.0 * fracmem);
}
if (KI_PROC(k)->p_maxrss != (RLIM_INFINITY/NBPG))
(void)printf("%*d", v->width, pgtok(KI_PROC(k)->p_maxrss));
else
if (KI_PROC(k)->p_maxrss != (RLIM_INFINITY/NBPG))
(void)printf("%*d", v->width, pgtok(KI_PROC(k)->p_maxrss));
else
(void)printf("%*s", v->width, "-");
}
(void)printf("%*s", v->width, "-");
}
v = ve->var;
#ifndef NEWVM
(void)printf("%*d", v->width, pgtok(KI_EPROC(k)->e_xsize));
v = ve->var;
#ifndef NEWVM
(void)printf("%*d", v->width, pgtok(KI_EPROC(k)->e_xsize));
(void)printf("%*d", v->width, pgtok(KI_EPROC(k)->e_vm.vm_tsize));
(void)printf("%*d", v->width, pgtok(KI_EPROC(k)->e_vm.vm_tsize));
v = ve->var;
(void)printf("%*d", v->width, pgtok(KI_EPROC(k)->e_xrssize));
}
v = ve->var;
(void)printf("%*d", v->width, pgtok(KI_EPROC(k)->e_xrssize));
}
/*
* Generic output routines. Print fields from various prototype
/*
* Generic output routines. Print fields from various prototype
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)ps.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)ps.c 8.2 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
*/
for (i = lineno = 0; i < nentries; i++) {
if (xflg == 0 && (KI_EPROC(&kinfo[i])->e_tdev == NODEV ||
*/
for (i = lineno = 0; i < nentries; i++) {
if (xflg == 0 && (KI_EPROC(&kinfo[i])->e_tdev == NODEV ||
- (KI_PROC(&kinfo[i])->p_flag & SCTTY ) == 0))
+ (KI_PROC(&kinfo[i])->p_flag & P_CONTROLT ) == 0))
continue;
for (vent = vhead; vent; vent = vent->next) {
(vent->var->oproc)(&kinfo[i], vent);
continue;
for (vent = vhead; vent; vent = vent->next) {
(vent->var->oproc)(&kinfo[i], vent);
*/
#if defined(LIBC_SCCS) && !defined(lint)
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)kvm_proc.c 8.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)kvm_proc.c 8.3 (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
/*
#endif /* LIBC_SCCS and not lint */
/*
pgrp.pg_session);
return (-1);
}
pgrp.pg_session);
return (-1);
}
- if ((proc.p_flag & SCTTY) && sess.s_ttyp != NULL) {
+ if ((proc.p_flag & P_CONTROLT) && sess.s_ttyp != NULL) {
if (KREAD(kd, (u_long)sess.s_ttyp, &tty)) {
_kvm_err(kd, kd->program,
"can't read tty at %x", sess.s_ttyp);
if (KREAD(kd, (u_long)sess.s_ttyp, &tty)) {
_kvm_err(kd, kd->program,
"can't read tty at %x", sess.s_ttyp);
break;
case KERN_PROC_TTY:
break;
case KERN_PROC_TTY:
- if ((proc.p_flag&SCTTY) == 0 ||
+ if ((proc.p_flag & P_CONTROLT) == 0 ||
eproc.e_tdev != (dev_t)arg)
continue;
break;
}
eproc.e_tdev != (dev_t)arg)
continue;
break;
}
- bcopy((char *)&proc, (char *)&bp->kp_proc, sizeof(proc));
- bcopy((char *)&eproc, (char *)&bp->kp_eproc, sizeof(eproc));
+ bcopy(&proc, &bp->kp_proc, sizeof(proc));
+ bcopy(&eproc, &bp->kp_eproc, sizeof(eproc));
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)clri.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)clri.c 8.2 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
(void)printf("clearing %d\n", inonum);
/* read in the appropriate block. */
(void)printf("clearing %d\n", inonum);
/* read in the appropriate block. */
- offset = itod(sbp, inonum); /* inode to fs block */
- offset = fsbtodb(sbp, offset); /* fs block to disk block */
- offset *= DEV_BSIZE; /* disk block to disk bytes */
+ offset = ino_to_fsba(sbp, inonum); /* inode to fs blk */
+ offset = fsbtodb(sbp, offset); /* fs blk disk blk */
+ offset *= DEV_BSIZE; /* disk blk to bytes */
/* seek and read the block */
if (lseek(fd, offset, SEEK_SET) < 0)
/* seek and read the block */
if (lseek(fd, offset, SEEK_SET) < 0)
err(1, "%s", fs);
/* get the inode within the block. */
err(1, "%s", fs);
/* get the inode within the block. */
- ip = &ibuf[itoo(sbp, inonum)];
+ ip = &ibuf[ino_to_fsbo(sbp, inonum)];
/* clear the inode, and bump the generation count. */
generation = ip->di_gen + 1;
/* clear the inode, and bump the generation count. */
generation = ip->di_gen + 1;
-static char sccsid[] = "@(#)traverse.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)traverse.c 8.2 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
curino = inum;
if (inum >= minino && inum < maxino)
return (&inoblock[inum - minino]);
curino = inum;
if (inum >= minino && inum < maxino)
return (&inoblock[inum - minino]);
- bread(fsbtodb(sblock, itod(sblock, inum)), (char *)inoblock,
+ bread(fsbtodb(sblock, ino_to_fsba(sblock, inum)), (char *)inoblock,
(int)sblock->fs_bsize);
minino = inum - (inum % INOPB(sblock));
maxino = minino + INOPB(sblock);
(int)sblock->fs_bsize);
minino = inum - (inum % INOPB(sblock));
maxino = minino + INOPB(sblock);
-static char sccsid[] = "@(#)inode.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)inode.c 8.2 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
errexit("bad inode number %d to ginode\n", inumber);
if (startinum == 0 ||
inumber < startinum || inumber >= startinum + INOPB(&sblock)) {
errexit("bad inode number %d to ginode\n", inumber);
if (startinum == 0 ||
inumber < startinum || inumber >= startinum + INOPB(&sblock)) {
- iblk = itod(&sblock, inumber);
+ iblk = ino_to_fsba(&sblock, inumber);
if (pbp != 0)
pbp->b_flags &= ~B_INUSE;
pbp = getdatablk(iblk, sblock.fs_bsize);
if (pbp != 0)
pbp->b_flags &= ~B_INUSE;
pbp = getdatablk(iblk, sblock.fs_bsize);
errexit("bad inode number %d to nextinode\n", inumber);
if (inumber >= lastinum) {
readcnt++;
errexit("bad inode number %d to nextinode\n", inumber);
if (inumber >= lastinum) {
readcnt++;
- dblk = fsbtodb(&sblock, itod(&sblock, lastinum));
+ dblk = fsbtodb(&sblock, ino_to_fsba(&sblock, lastinum));
if (readcnt % readpercg == 0) {
size = partialsize;
lastinum += partialcnt;
if (readcnt % readpercg == 0) {
size = partialsize;
lastinum += partialcnt;
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)fsdb.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)fsdb.c 8.2 (Berkeley) %G%";
/*
* Messy macros that would otherwise clutter up such glamorous code.
*/
/*
* Messy macros that would otherwise clutter up such glamorous code.
*/
-#define itob(i) ((itod(fs, (i)) << FRGSHIFT) + itoo(fs, (i)) * INODE)
+#define itob(i) ((ino_to_fsba(fs, \
+ (i)) << FRGSHIFT) + ino_to_fsbo(fs, (i)) * INODE)
#define min(x, y) ((x) < (y) ? (x) : (y))
#define STRINGSIZE(d) ((long)d->d_reclen - \
((long)&d->d_name[0] - (long)&d->d_ino))
#define min(x, y) ((x) < (y) ? (x) : (y))
#define STRINGSIZE(d) ((long)d->d_reclen - \
((long)&d->d_name[0] - (long)&d->d_ino))
-static char sccsid[] = "@(#)mkfs.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)mkfs.c 8.2 (Berkeley) %G%";
#endif /* not lint */
#include <unistd.h>
#endif /* not lint */
#include <unistd.h>
- c = itog(&sblock, ino);
+ c = ino_to_cg(&sblock, ino);
rdfs(fsbtodb(&sblock, cgtod(&sblock, 0)), sblock.fs_cgsize,
(char *)&acg);
if (acg.cg_magic != CG_MAGIC) {
rdfs(fsbtodb(&sblock, cgtod(&sblock, 0)), sblock.fs_cgsize,
(char *)&acg);
if (acg.cg_magic != CG_MAGIC) {
printf("fsinit: inode value out of range (%d).\n", ino);
exit(32);
}
printf("fsinit: inode value out of range (%d).\n", ino);
exit(32);
}
- d = fsbtodb(&sblock, itod(&sblock, ino));
+ d = fsbtodb(&sblock, ino_to_fsba(&sblock, ino));
rdfs(d, sblock.fs_bsize, buf);
rdfs(d, sblock.fs_bsize, buf);
- buf[itoo(&sblock, ino)] = *ip;
+ buf[ino_to_fsbo(&sblock, ino)] = *ip;
wtfs(d, sblock.fs_bsize, buf);
}
wtfs(d, sblock.fs_bsize, buf);
}
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)quotacheck.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)quotacheck.c 8.2 (Berkeley) %G%";
err("bad inode number %d to nextinode", inumber);
if (inumber >= lastinum) {
readcnt++;
err("bad inode number %d to nextinode", inumber);
if (inumber >= lastinum) {
readcnt++;
- dblk = fsbtodb(&sblock, itod(&sblock, lastinum));
+ dblk = fsbtodb(&sblock, ino_to_fsba(&sblock, lastinum));
if (readcnt % readpercg == 0) {
size = partialsize;
lastinum += partialcnt;
if (readcnt % readpercg == 0) {
size = partialsize;
lastinum += partialcnt;
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)gcore.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)gcore.c 8.2 (Berkeley) %G%";
if (p->p_stat == SZOMB)
err(1, "%d: zombie", pid);
if (p->p_stat == SZOMB)
err(1, "%d: zombie", pid);
- if (p->p_flag & SWEXIT)
+ if (p->p_flag & P_WEXIT)
err(0, "process exiting");
err(0, "process exiting");
- if (p->p_flag & SSYS) /* Swapper or pagedaemon. */
+ if (p->p_flag & P_SYSTEM) /* Swapper or pagedaemon. */
err(1, "%d: system process");
if (corefile == NULL) {
err(1, "%d: system process");
if (corefile == NULL) {
-static char sccsid[] = "@(#)pigs.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)pigs.c 8.2 (Berkeley) %G%";
}
if (nproc > lastnproc) {
free(pt);
}
if (nproc > lastnproc) {
free(pt);
- if ((pt = (struct p_times *) malloc
- ((nproc + 1) * sizeof(struct p_times))) == NULL) {
- error("Out of memory");
- die(0);
- }
-
+ if ((pt =
+ malloc((nproc + 1) * sizeof(struct p_times))) == NULL) {
+ error("Out of memory");
+ die(0);
+ }
pt[i].pt_kp = &kpp[i];
pp = &kpp[i].kp_proc;
pctp = &pt[i].pt_pctcpu;
pt[i].pt_kp = &kpp[i];
pp = &kpp[i].kp_proc;
pctp = &pt[i].pt_pctcpu;
- time = pp->p_time;
- if (time == 0 || (pp->p_flag & SLOAD) == 0)
+ time = pp->p_swtime;
+ if (time == 0 || (pp->p_flag & P_INMEM) == 0)
*pctp = 0;
else
*pctp = ((double) pp->p_pctcpu /
*pctp = 0;
else
*pctp = ((double) pp->p_pctcpu /
- wmove(wnd, 0, 0); wclrtoeol(wnd);
+ wmove(wnd, 0, 0);
+ wclrtoeol(wnd);
mvwaddstr(wnd, 0, 20,
"/0 /10 /20 /30 /40 /50 /60 /70 /80 /90 /100");
}
mvwaddstr(wnd, 0, 20,
"/0 /10 /20 /30 /40 /50 /60 /70 /80 /90 /100");
}
-static char sccsid[] = "@(#)proc_compare.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)proc_compare.c 8.2 (Berkeley) %G%";
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/proc.h>
+
+#include "extern.h"
+
- * Returns 1 if p2 is more active than p1
+ * Returns 1 if p2 is "better" than p1
- * The algorithm for picking the "more active" process is thus:
+ * The algorithm for picking the "interesting" process is thus:
- * 1) Runnable processes are favored over anything
- * else. The runner with the highest cpu
- * utilization is picked (p_cpu). Ties are
+ * 1) Only foreground processes are eligible - implied.
+ * 2) Runnable processes are favored over anything else. The runner
+ * with the highest cpu utilization is picked (p_estcpu). Ties are
* broken by picking the highest pid.
* broken by picking the highest pid.
- * 2) Next, the sleeper with the shortest sleep
- * time is favored. With ties, we pick out
- * just short-term sleepers (p_pri <= PZERO).
- * Further ties are broken by picking the highest
- * pid.
- *
- * NOTE - if you change this, be sure to consider making
- * the change in the kernel too (^T in kern/tty.c).
+ * 3) The sleeper with the shortest sleep time is next. With ties,
+ * we pick out just "short-term" sleepers (P_SINTR == 0).
+ * 4) Further ties are broken by picking the highest pid.
- * TODO - consider whether pctcpu should be used
+ * If you change this, be sure to consider making the change in the kernel
+ * too (^T in kern/tty.c).
+ * TODO - consider whether pctcpu should be used.
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/proc.h>
-
-#include "extern.h"
-
-#define isrun(p) (((p)->p_stat == SRUN) || ((p)->p_stat == SIDL))
-
-#define TESTAB(a, b) ((a)<<1 | (b))
-#define ONLYA 2
-#define ONLYB 1
-#define BOTH 3
+#define ISRUN(p) (((p)->p_stat == SRUN) || ((p)->p_stat == SIDL))
+#define TESTAB(a, b) ((a)<<1 | (b))
+#define ONLYA 2
+#define ONLYB 1
+#define BOTH 3
/*
* see if at least one of them is runnable
*/
/*
* see if at least one of them is runnable
*/
- switch (TESTAB(isrun(p1), isrun(p2))) {
+ switch (TESTAB(ISRUN(p1), ISRUN(p2))) {
case ONLYA:
return (0);
case ONLYB:
case ONLYA:
return (0);
case ONLYB:
/*
* tie - favor one with highest recent cpu utilization
*/
/*
* tie - favor one with highest recent cpu utilization
*/
- if (p2->p_cpu > p1->p_cpu)
+ if (p2->p_estcpu > p1->p_estcpu)
- if (p1->p_cpu > p2->p_cpu)
+ if (p1->p_estcpu > p2->p_estcpu)
return (0);
return (p2->p_pid > p1->p_pid); /* tie - return highest pid */
}
/*
return (0);
return (p2->p_pid > p1->p_pid); /* tie - return highest pid */
}
/*
*/
switch (TESTAB(p1->p_stat == SZOMB, p2->p_stat == SZOMB)) {
case ONLYA:
*/
switch (TESTAB(p1->p_stat == SZOMB, p2->p_stat == SZOMB)) {
case ONLYA:
case ONLYB:
return (0);
case BOTH:
case ONLYB:
return (0);
case BOTH:
- return (p2->p_pid > p1->p_pid); /* tie - return highest pid */
+ return (p2->p_pid > p1->p_pid); /* tie - return highest pid */
* pick the one with the smallest sleep time
*/
if (p2->p_slptime > p1->p_slptime)
* pick the one with the smallest sleep time
*/
if (p2->p_slptime > p1->p_slptime)
/*
* favor one sleeping in a non-interruptible sleep
*/
/*
* favor one sleeping in a non-interruptible sleep
*/
- if (p1->p_flag&SSINTR && (p2->p_flag&SSINTR) == 0)
- return (1);
- if (p2->p_flag&SSINTR && (p1->p_flag&SSINTR) == 0)
- return (0);
- return(p2->p_pid > p1->p_pid); /* tie - return highest pid */
+ if (p1->p_flag & P_SINTR && (p2->p_flag & P_SINTR) == 0)
+ return (1);
+ if (p2->p_flag & P_SINTR && (p1->p_flag & P_SINTR) == 0)
+ return (0);
+ return (p2->p_pid > p1->p_pid); /* tie - return highest pid */
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)mkproto.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)mkproto.c 8.2 (Berkeley) %G%";
#include <sys/param.h>
#include <sys/time.h>
#include <sys/dir.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/dir.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
#include <stdio.h>
union {
#include <stdio.h>
union {
inum = ialloc(&in);
} else {
par = ∈
inum = ialloc(&in);
} else {
par = ∈
+ i = ino_to_fsba(fs, ROOTINO);
rdfs(fsbtodb(fs, i), fs->fs_bsize, (char *)inos);
dip = &inos[ROOTINO % INOPB(fs)];
inum = ROOTINO;
rdfs(fsbtodb(fs, i), fs->fs_bsize, (char *)inos);
dip = &inos[ROOTINO % INOPB(fs)];
inum = ROOTINO;
printf("bad mode %o\n", ip->di_mode);
exit(1);
}
printf("bad mode %o\n", ip->di_mode);
exit(1);
}
- d = fsbtodb(fs, itod(fs, inum));
+ d = fsbtodb(fs, ino_to_fsba(fs, inum));
rdfs(d, (int)fs->fs_bsize, (char *)buf);
rdfs(d, (int)fs->fs_bsize, (char *)buf);
- buf[itoo(fs, inum)] = *ip;
+ buf[ino_to_fsbo(fs, inum)] = *ip;
wtfs(d, (int)fs->fs_bsize, (char *)buf);
}
wtfs(d, (int)fs->fs_bsize, (char *)buf);
}
- c = itog(&sblock, inum);
+ c = ino_to_cg(&sblock, inum);
rdfs(fsbtodb(&sblock, cgtod(&sblock, c)), (int)sblock.fs_cgsize,
(char *)&acg);
if (!cg_chkmagic(&acg)) {
rdfs(fsbtodb(&sblock, cgtod(&sblock, c)), (int)sblock.fs_cgsize,
(char *)&acg);
if (!cg_chkmagic(&acg)) {
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)pstat.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)pstat.c 8.2 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
KGETRET(VTOI(vp), &inode, sizeof(struct inode), "vnode's inode");
flag = ip->i_flag;
KGETRET(VTOI(vp), &inode, sizeof(struct inode), "vnode's inode");
flag = ip->i_flag;
+ if (flag & IN_MODIFIED)
*flags++ = 'Z';
if (flag == 0)
*flags++ = '-';
*flags++ = 'Z';
if (flag == 0)
*flags++ = '-';
return ((struct e_vnode *)vbuf);
}
return ((struct e_vnode *)vbuf);
}
-char hdr[]=" LINE RAW CAN OUT HWT LWT ADDR COL STATE SESS PGID DISC\n";
+char hdr[]=" LINE RAW CAN OUT HWT LWT COL STATE SESS PGID DISC\n";
else
(void)printf("%7s ", name);
(void)printf("%2d %3d ", tp->t_rawq.c_cc, tp->t_canq.c_cc);
else
(void)printf("%7s ", name);
(void)printf("%2d %3d ", tp->t_rawq.c_cc, tp->t_canq.c_cc);
- (void)printf("%3d %4d %3d %8x %3d ", tp->t_outq.c_cc,
- tp->t_hiwat, tp->t_lowat, tp->t_addr, tp->t_col);
+ (void)printf("%3d %4d %3d %3d ", tp->t_outq.c_cc,
+ tp->t_hiwat, tp->t_lowat, tp->t_column);
for (i = j = 0; ttystates[i].flag; i++)
if (tp->t_state&ttystates[i].flag)
state[j++] = ttystates[i].val;
for (i = j = 0; ttystates[i].flag; i++)
if (tp->t_state&ttystates[i].flag)
state[j++] = ttystates[i].val;
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)quot.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)quot.c 8.2 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
}
nfiles = sblock.fs_ipg * sblock.fs_ncg;
for (ino = 0; ino < nfiles; ) {
}
nfiles = sblock.fs_ipg * sblock.fs_ncg;
for (ino = 0; ino < nfiles; ) {
- iblk = fsbtodb(&sblock, itod(&sblock, ino));
+ iblk = fsbtodb(&sblock, ino_to_fsba(&sblock, ino));
bread(fd, (off_t)iblk * dev_bsize, itab, (int)sblock.fs_bsize);
for (j = 0; j < INOPB(&sblock) && ino < nfiles; j++, ino++) {
if (ino < ROOTINO)
bread(fd, (off_t)iblk * dev_bsize, itab, (int)sblock.fs_bsize);
for (j = 0; j < INOPB(&sblock) && ino < nfiles; j++, ino++) {
if (ino < ROOTINO)