Plan 9 from Bell Labs’s /usr/web/sources/extra/9hist/port/devproc.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


## diffname port/devproc.c 1990/0227
## diff -e /dev/null /n/bootesdump/1990/0227/sys/src/9/mips/devproc.c
0a
#include	"u.h"
#include	"lib.h"
#include	"mem.h"
#include	"dat.h"
#include	"fns.h"
#include	"errno.h"

#include	"devtab.h"

enum{
	Qdir,
	Qctl,
	Qmem,
	Qnote,
	Qproc,
	Qstatus,
	Qtext,
};

Dirtab procdir[]={
	"ctl",		Qctl,		0,			0600,
	"mem",		Qmem,		0,			0600,
	"note",		Qnote,		0,			0600,
	"proc",		Qproc,		sizeof(Proc),		0600,
	"status",	Qstatus,	NAMELEN+12+6*12,	0600,
	"text",		Qtext,		0,			0600,
};

/*
 * Qids are, from bottom to top:
 *	 4 bits of file type (qids above)
 *	12 bits of process slot number + 1
 *	15 bits of pid, for consistency checking
 */
#define	NPROC	(sizeof procdir/sizeof(Dirtab))
#define	QSHIFT	4	/* location in qid of proc slot # */
#define	PIDSHIFT 16	/* location in qid of pid */
#define	PIDMASK	0x7FFF	/* low bits of pid used in qid */
#define	QID(q)	(((q)&0x0000000F)>>0)
#define	SLOT(q)	((((q)&0x0000FFF0)>>QSHIFT)-1)
#define	PID(q)	(((q)&0x7FFF0000)>>PIDSHIFT)

int
procgen(Chan *c, Dirtab *tab, int ntab, int s, Dir *dp)
{
	Proc *p;
	char buf[NAMELEN];
	ulong pid;

	if(c->qid == CHDIR){
		if(s >= conf.nproc)
			return -1;
		p = proctab(s);
		pid = p->pid;
		if(pid == 0)
			return 0;
		sprint(buf, "%d", pid);
		devdir(c, CHDIR|(pid<<PIDSHIFT)|((s+1)<<QSHIFT), buf, 0, CHDIR|0500, dp);
		return 1;
	}
	if(s >= NPROC)
		return -1;
	if(tab)
		panic("procgen");
	tab = &procdir[s];
	devdir(c, (~CHDIR)&(c->qid|tab->qid), tab->name, tab->length, tab->perm, dp);
	return 1;
}

void
procinit(void)
{
	if(conf.nproc >= (1<<(16-QSHIFT))-1)
		print("warning: too many procs for devproc\n");
}

void
procreset(void)
{
}

Chan*
procattach(char *spec)
{
	return devattach('p', spec);
}

Chan*
procclone(Chan *c, Chan *nc)
{
	return devclone(c, nc);
}

int
procwalk(Chan *c, char *name)
{
	return devwalk(c, name, 0, 0, procgen);
}

void
procstat(Chan *c, char *db)
{
	devstat(c, db, 0, 0, procgen);
}

Chan *
procopen(Chan *c, int omode)
{
	Proc *p;
	Orig *o;
	Chan *tc;

	p = proctab(SLOT(c->qid));
	if((p->pid&PIDMASK) != PID(c->qid))
    Died:
		error(0, Eprocdied);
	omode = openmode(omode);

	switch(QID(c->qid)){
	case Qtext:
		o = p->seg[TSEG].o;
		if(o==0 || p->state==Dead)
			goto Died;
		tc = o->chan;
		if(tc == 0)
			goto Died;
		if(incref(tc) == 0){
    Close:
			close(tc);
			goto Died;
		}
		if(!(tc->flag&COPEN) || tc->mode!=OREAD)
			goto Close;
		if((p->pid&PIDMASK) != PID(c->qid))
			goto Close;
		qlock(tc);
		tc->offset = 0;
		qunlock(tc);
		return tc;
	case Qctl:
	case Qnote:
		break;
	case Qdir:
	case Qmem:
	case Qproc:
	case Qstatus:
		if(omode!=OREAD)
			error(0, Eperm);
		break;
	default:
		pprint("unknown qid in devopen\n");
		error(0, Egreg);
	}
	/*
	 * Affix pid to qid
	 */
	if(p->state != Dead)
		c->qid |= (p->pid&PIDMASK)<<PIDSHIFT;
	c->mode = omode;
	c->flag |= COPEN;
	c->offset = 0;
	return c;
}

void
proccreate(Chan *c, char *name, int omode, ulong perm)
{
	error(0, Eperm);
}

void
procremove(Chan *c)
{
	error(0, Eperm);
}

void
procwstat(Chan *c, char *db)
{
	error(0, Eperm);
}

void
procclose(Chan * c)
{
}

long
procread(Chan *c, void *va, long n)
{
	char *a = va, *b;
	char statbuf[2*NAMELEN+12+6*12];
	Proc *p;
	Seg *s;
	Orig *o;
	Page *pg;
	int i;
	long l;
	long pid;
	User *up;

	if(c->qid & CHDIR)
		return devdirread(c, a, n, 0, 0, procgen);

	/*
	 * BUG: should lock(&p->debug)?
	 */
	p = proctab(SLOT(c->qid));
	if((p->pid&PIDMASK) != PID(c->qid))
		error(0, Eprocdied);

	switch(QID(c->qid)){
	case Qmem:
		/*
		 * One page at a time
		 */
		if(((c->offset+n)&~(BY2PG-1)) != (c->offset&~(BY2PG-1)))
			n = BY2PG - (c->offset&(BY2PG-1));
		s = seg(p, c->offset);
		if(s){
			o = s->o;
			if(o == 0)
				error(0, Eprocdied);
			lock(o);
			if(s->o!=o || (p->pid&PIDMASK)!=PID(c->qid)){
				unlock(o);
				error(0, Eprocdied);
			}
			if(seg(p, c->offset) != s){
				unlock(o);
				error(0, Egreg);
			}
			pg = o->pte[(c->offset-o->va)>>PGSHIFT].page;
			unlock(o);
			if(pg == 0){
				pprint("nonresident page (complain to rob)\n");
				memset(a, 0, n);
			}else{
				b = (char*)(pg->pa|KZERO);
				memcpy(a, b+(c->offset&(BY2PG-1)), n);
			}
			return n;
		}

		/* u area */
		if(c->offset>=USERADDR && c->offset<=USERADDR+BY2PG){
			if(c->offset+n > USERADDR+BY2PG)
				n = USERADDR+BY2PG - c->offset;
			pg = p->upage;
			if(pg==0 || (p->pid&PIDMASK)!=PID(c->qid))
				error(0, Eprocdied);
			b = (char*)(pg->pa|KZERO);
			memcpy(a, b+(c->offset-USERADDR), n);
			return n;
		}

		/* kernel memory.  BUG: shouldn't be so easygoing. BUG: mem mapping? */
		if(c->offset>=KZERO && c->offset<KZERO+conf.npage*BY2PG){
			if(c->offset+n > KZERO+conf.npage*BY2PG)
				n = KZERO+conf.npage*BY2PG - c->offset;
			memcpy(a, (char*)c->offset, n);
			return n;
		}
		return 0;
		break;

	case Qnote:
		lock(&p->debug);
		if(waserror()){
			unlock(&p->debug);
			nexterror();
		}
		if((p->pid&PIDMASK) != PID(c->qid))
			error(0, Eprocdied);
		up = (User*)(p->upage->pa|KZERO);
		if(up->p != p){
			pprint("note read u/p mismatch");
			error(0, Egreg);
		}
		if(n < ERRLEN)
			error(0, Etoosmall);
		if(up->nnote == 0)
			n = 0;
		else{
			memcpy(va, up->note[0].msg, ERRLEN);
			up->nnote--;
			memcpy(&up->note[0], &up->note[1], up->nnote*sizeof(Note));
			n = ERRLEN;
		}
		unlock(&p->debug);
		return n;

	case Qproc:
		if(c->offset >= sizeof(Proc))
			return 0;
		if(c->offset+n > sizeof(Proc))
			n = sizeof(Proc) - c->offset;
		memcpy(a, ((char*)p)+c->offset, n);
		return n;

	case Qstatus:
		if(c->offset >= sizeof statbuf)
			return 0;
		if(c->offset+n > sizeof statbuf)
			n = sizeof statbuf - c->offset;
		sprint(statbuf, "%-27s %-27s %-11s ", p->text, p->pgrp->user, statename[p->state]);
		for(i=0; i<6; i++){
			l = p->time[i];
			if(i == TReal)
				l = MACHP(0)->ticks - l;
			l *= MS2HZ;
			readnum(0, statbuf+2*NAMELEN+12+NUMSIZE*i, NUMSIZE, l, NUMSIZE);
		}
		memcpy(a, statbuf+c->offset, n);
		return n;
	}
	error(0, Egreg);
}


long
procwrite(Chan *c, void *va, long n)
{
	Proc *p;
	User *up;
	char buf[ERRLEN];

	if(c->qid & CHDIR)
		error(0, Eisdir);
	p = proctab(SLOT(c->qid));
	lock(&p->debug);
	if(waserror()){
		unlock(&p->debug);
		nexterror();
	}
	if((p->pid&PIDMASK) != PID(c->qid))
    Died:
		error(0, Eprocdied);

	switch(QID(c->qid)){
	case Qctl:
		if(p->state==Broken && n>=4 && strncmp(va, "exit", 4)==0)
			ready(p);
		else
			error(0, Ebadctl);
		break;
	case Qnote:
		up = (User*)(p->upage->pa|KZERO);
		if(up->p != p){
			pprint("note write u/p mismatch");
			error(0, Egreg);
		}
		if(n >= ERRLEN-1)
			error(0, Etoobig);
		if(n>=4 && strncmp(va, "sys:", 4)==0)
			error(0, Ebadarg);
		memcpy(buf, va, n);
		buf[n] = 0;
		if(!postnote(p, 0, buf, NUser))
			error(0, Enonote);
		break;
	default:
		pprint("unknown qid in procwrite\n");
		error(0, Egreg);
	}
	unlock(&p->debug);
	return n;
}

void
procuserstr(Error *e, char *buf)
{
	consuserstr(e, buf);
}

void
procerrstr(Error *e, char *buf)
{
	rooterrstr(e, buf);
}
.
## diffname port/devproc.c 1990/03081
## diff -e /n/bootesdump/1990/0227/sys/src/9/mips/devproc.c /n/bootesdump/1990/03081/sys/src/9/mips/devproc.c
158a
   done:
.
112a
	if(c->qid == CHDIR){
		if(omode != OREAD)
			error(0, Eperm);
		goto done;
	}
.
84a
	Chan *c;
.
## diffname port/devproc.c 1990/0424
## diff -e /n/bootesdump/1990/03081/sys/src/9/mips/devproc.c /n/bootesdump/1990/0424/sys/src/9/mips/devproc.c
152a
		if(omode!=OREAD)
			error(0, Eperm);
		break;
	case Qmem:
.
150d
## diffname port/devproc.c 1990/0614
## diff -e /n/bootesdump/1990/0424/sys/src/9/mips/devproc.c /n/bootesdump/1990/0614/sys/src/9/mips/devproc.c
362a
		kunmap(k);
.
359a
			kunmap(k);
.
358c
		k = kmap(p->upage);
		up = (User*)VA(k);
.
335a
	KMap *k;
.
321c
			l = TK2MS(l);
.
299a
		kunmap(k);
.
286a
			kunmap(k);
.
285c
		k = kmap(p->upage);
		up = (User*)VA(k);
.
268,270c
		if(c->offset>=KZERO && c->offset<KZERO+conf.npage0*BY2PG){
			if(c->offset+n > KZERO+conf.npage0*BY2PG)
				n = KZERO+conf.npage0*BY2PG - c->offset;
.
263a
			kunmap(k);
.
262c
			k = kmap(pg);
			b = (char*)VA(k);
.
250a
				kunmap(k);
.
249c
				k = kmap(pg);
				b = (char*)VA(k);
.
246c
				pprint("nonresident page addr %lux (complain to rob)\n", c->offset);
.
243c
			pte = &o->pte[(c->offset-o->va)>>PGSHIFT];
			if(s->mod){
				opte = pte;
				while(pte = pte->nextmod)	/* assign = */
					if(pte->proc == p)
						break;
				if(pte == 0)
					pte = opte;
			}
			pg = pte->page;
.
206a
	KMap *k;
	PTE *pte, *opte;
.
155,158d
149a
	case Qmem:
.
## diffname port/devproc.c 1990/0914
## diff -e /n/bootesdump/1990/0614/sys/src/9/mips/devproc.c /n/bootesdump/1990/0914/sys/src/9/mips/devproc.c
282a
			memcpy(a, (char*)c->offset, n);
			return n;
		} else if(c->offset>=UNCACHED && c->offset<UNCACHED+conf.npage0*BY2PG){
			if(c->offset+n > UNCACHED+conf.npage0*BY2PG)
				n = UNCACHED+conf.npage0*BY2PG - c->offset;
.
6a
#include 	"io.h"
.
## diffname port/devproc.c 1990/1110
## diff -e /n/bootesdump/1990/0914/sys/src/9/mips/devproc.c /n/bootesdump/1990/1110/sys/src/9/mips/devproc.c
361a

	/*
	 * Special case: don't worry about process, just use remembered group
	 */
	if(QID(c->qid) == Qnotepg){
		pg = pgrptab(SLOT(c->pgrpid));
		lock(&pg->debug);
		if(waserror()){
			unlock(&pg->debug);
			nexterror();
		}
		if((pg->pgrpid&PIDMASK) != PID(c->pgrpid)){
			unlock(&pg->debug);
  	  		goto Died;
		}
		pgrpnote(pg, va, n, NUser);
		unlock(&pg->debug);
		return n;
	}

.
355a
	Pgrp *pg;
.
286c
		}else if(c->offset>=UNCACHED && c->offset<UNCACHED+conf.npage0*BY2PG){
			/* BUT mips only TAKE IT OUT */
.
267c
		if(c->offset>=USERADDR && c->offset<USERADDR+BY2PG){
.
154c
		if(omode != OREAD)
.
149a

	case Qnotepg:
		if(omode != OWRITE)
			error(0, Eperm);
		c->pgrpid = (pg->pgrpid<<PIDSHIFT)|((pg->index+1)<<QSHIFT);
		break;

.
120a
	pg = p->pgrp;
.
111a
	Pgrp *pg;
.
24a
	"notepg",	Qnotepg,	0,			0200,
.
15a
	Qnotepg,
.
8a
/* BUG mips only TAKE IT OUT */
#include	"io.h"

.
7d
## diffname port/devproc.c 1990/1115
## diff -e /n/bootesdump/1990/1110/sys/src/9/mips/devproc.c /n/bootesdump/1990/1115/sys/src/9/mips/devproc.c
158c
		if(omode!=OWRITE || pg->pgrpid==1)	/* easy to do by mistake */
.
## diffname port/devproc.c 1990/11211
## diff -e /n/bootesdump/1990/1115/sys/src/9/mips/devproc.c /n/bootesdump/1990/11211/sys/src/9/mips/devproc.c
438,449d
434c
		error(Egreg);
.
430c
			error(Enonote);
.
426c
			error(Ebadarg);
.
424c
			error(Etoobig);
.
420c
			error(Egreg);
.
412c
			error(Ebadctl);
.
405c
		error(Eprocdied);
.
403c
	if(p->pid != PID(c->qid))
.
388c
		if(pg->pgrpid != c->pgrpid.vers){
.
382c
		pg = pgrptab(c->pgrpid.path-1);
.
375,376c
	if(c->qid.path & CHDIR)
		error(Eisdir);
.
362c
	error(Egreg);
.
325c
			error(Etoosmall);
.
322c
			error(Egreg);
.
315,316c
		if(p->pid != PID(c->qid))
			error(Eprocdied);
.
299,304d
284,285c
			if(pg==0 || p->pid!=PID(c->qid))
				error(Eprocdied);
.
254c
				error(Egreg);
.
250c
				error(Eprocdied);
.
248c
			if(s->o!=o || p->pid!=PID(c->qid)){
.
246c
				error(Eprocdied);
.
232,233c
	if(p->pid != PID(c->qid))
		error(Eprocdied);
.
225c
	if(c->qid.path & CHDIR)
.
201c
	error(Eperm);
.
195c
	error(Eperm);
.
189c
	error(Eperm);
.
178c
		c->qid.vers = p->pid;
.
172c
		error(Egreg);
.
168c
			error(Eperm);
.
159,160c
			error(Eperm);
		c->pgrpid.path = pg->index+1;
		c->pgrpid.vers = pg->pgrpid;
.
147c
		if(p->pid != PID(c->qid))
.
129c
		error(Eprocdied);
.
127c
	if(p->pid != PID(c->qid))
.
122c
			error(Eperm);
.
120c
	if(c->qid.path == CHDIR){
.
71c
	devdir(c, (Qid){(~CHDIR)&(c->qid.path|tab->qid.path), c->qid.vers},
		tab->name, tab->length, tab->perm, dp);
.
63c
		devdir(c, (Qid){CHDIR|((s+1)<<QSHIFT), pid}, buf, 0, CHDIR|0500, dp);
.
55c
	if(c->qid.path == CHDIR){
.
42,46c
#define	QID(q)	(((q).path&0x0000000F)>>0)
#define	SLOT(q)	((((q).path&0x0FFFFFFF0)>>QSHIFT)-1)
#define	PID(q)	((q).vers)
.
37,38c
 *	24 bits of process slot number + 1
 *	     in vers,
 *	32 bits of pid, for consistency checking
 * If notepg, c->pgrpid.path is pgrp slot, .vers is pgrpid.
.
35c
 * Qids are, in path:
.
25,31c
	"ctl",		{Qctl},		0,			0600,
	"mem",		{Qmem},		0,			0600,
	"note",		{Qnote},	0,			0600,
	"notepg",	{Qnotepg},	0,			0200,
	"proc",		{Qproc},	sizeof(Proc),		0600,
	"status",	{Qstatus},	NAMELEN+12+6*12,	0600,
	"text",		{Qtext},	0,			0600,
.
## diffname port/devproc.c 1990/1126
## diff -e /n/bootesdump/1990/11211/sys/src/9/mips/devproc.c /n/bootesdump/1990/1126/sys/src/9/mips/devproc.c
393d
373a
	p = proctab(SLOT(c->qid));
.
## diffname port/devproc.c 1990/1128
## diff -e /n/bootesdump/1990/1126/sys/src/9/mips/devproc.c /n/bootesdump/1990/1128/sys/src/9/mips/devproc.c
45c
#define	SLOT(q)	((((q).path&0x07FFFFFF0)>>QSHIFT)-1)
.
37c
 *	23 bits of process slot number + 1
.
8,10d
## diffname port/devproc.c 1991/0212
## diff -e /n/bootesdump/1990/1210/sys/src/9/mips/devproc.c /n/bootesdump/1991/0212/sys/src/9/port/devproc.c
387c
		qunlock(&pg->debug);
.
383c
			qunlock(&pg->debug);
.
379c
			qunlock(&pg->debug);
.
377c
		qlock(&pg->debug);
.
## diffname port/devproc.c 1991/0318
## diff -e /n/bootesdump/1991/0212/sys/src/9/port/devproc.c /n/bootesdump/1991/0318/sys/src/9/port/devproc.c
420c
		memmove(buf, va, n);
.
352c
		memmove(a, statbuf+c->offset, n);
.
336c
		memmove(a, ((char*)p)+c->offset, n);
.
324c
			memmove(&up->note[0], &up->note[1], up->nnote*sizeof(Note));
.
322c
			memmove(va, up->note[0].msg, ERRLEN);
.
296c
			memmove(a, (char*)c->offset, n);
.
287c
			memmove(a, b+(c->offset-USERADDR), n);
.
277d
272c
				memmove(a, b+(c->offset&(BY2PG-1)), n);
.
## diffname port/devproc.c 1991/0411
## diff -e /n/bootesdump/1991/0318/sys/src/9/port/devproc.c /n/bootesdump/1991/0411/sys/src/9/port/devproc.c
359c
procwrite(Chan *c, void *va, long n, ulong offset)
.
351c
		memmove(a, statbuf+offset, n);
.
341,342c
		if(offset+n > sizeof statbuf)
			n = sizeof statbuf - offset;
.
339c
		if(offset >= sizeof statbuf)
.
333,335c
		if(offset+n > sizeof(Proc))
			n = sizeof(Proc) - offset;
		memmove(a, ((char*)p)+offset, n);
.
331c
		if(offset >= sizeof(Proc))
.
292,295c
		if(offset>=KZERO && offset<KZERO+conf.npage0*BY2PG){
			if(offset+n > KZERO+conf.npage0*BY2PG)
				n = KZERO+conf.npage0*BY2PG - offset;
			memmove(a, (char*)offset, n);
.
286c
			memmove(a, b+(offset-USERADDR), n);
.
278,280c
		if(offset>=USERADDR && offset<USERADDR+BY2PG){
			if(offset+n > USERADDR+BY2PG)
				n = USERADDR+BY2PG - offset;
.
272c
				memmove(a, b+(offset&(BY2PG-1)), n);
.
267c
				pprint("nonresident page addr %lux (complain to rob)\n", offset);
.
255c
			pte = &o->pte[(offset-o->va)>>PGSHIFT];
.
251c
			if(seg(p, offset) != s){
.
239,241c
		if(((offset+n)&~(BY2PG-1)) != (offset&~(BY2PG-1)))
			n = BY2PG - (offset&(BY2PG-1));
		s = seg(p, offset);
.
209c
procread(Chan *c, void *va, long n, ulong offset)
.
149c
		qunlock(&tc->rdl);
.
147c
		qlock(&tc->rdl);
.
## diffname port/devproc.c 1991/0419
## diff -e /n/bootesdump/1991/0411/sys/src/9/port/devproc.c /n/bootesdump/1991/0419/sys/src/9/port/devproc.c
103a
Chan*
procclwalk(Chan *c, char *name)
{
	return devclwalk(c, name);
}

.
## diffname port/devproc.c 1991/0427
## diff -e /n/bootesdump/1991/0419/sys/src/9/port/devproc.c /n/bootesdump/1991/0427/sys/src/9/port/devproc.c
104,109d
## diffname port/devproc.c 1991/0605
## diff -e /n/bootesdump/1991/0427/sys/src/9/port/devproc.c /n/bootesdump/1991/0605/sys/src/9/port/devproc.c
146a

.
144a

.
137a

.
134a

.
133c
		if(o==0 || p->state==Dead) 
.
## diffname port/devproc.c 1991/0614
## diff -e /n/bootesdump/1991/0605/sys/src/9/port/devproc.c /n/bootesdump/1991/0614/sys/src/9/port/devproc.c
431a
	poperror();
.
389a
		poperror();
.
330a
		poperror();
.
## diffname port/devproc.c 1991/0705
## diff -e /n/bootesdump/1991/0614/sys/src/9/port/devproc.c /n/bootesdump/1991/0705/sys/src/9/port/devproc.c
410,411c
		if(n >= 4 && strncmp(va, "stop", 4) == 0) {
			p->procctl = Proc_stopme;
			break;
		}
		else
		if(n >= 5 && strncmp(va, "start", 5) == 0) {
			if(p->state == Stopped) {
				ready(p);
				break;
			}
			errors("not stopped");
		}
		else
		if(n >= 4 && strncmp(va, "kill", 4) == 0) {
			p->procctl = Proc_exitme;
			break;
		}
		error(Ebadctl);
.
407,408c
		if(n >= 4 && strncmp(va, "exit", 4) == 0) {
			if(p->state == Broken) {
				ready(p);
				break;
			}
		}
.
357a
	case Qsegment:
		j = 0;
		for(i = 0; i < NSEG; i++)
			if(sg = p->seg[i])
				j += sprint(&statbuf[j], "%-6s %c %.8lux %.8lux %4d\n",
				sname[sg->type&SG_TYPE], sg->type&SG_RONLY ? 'R' : ' ',
				sg->base, sg->top, sg->ref);
		if(offset >= j)
			return 0;
		if(offset+n > j)
			n = j-offset;
		memmove(a, &statbuf[offset], n);
		return n;
.
278a
			qlock(&s->lk);
			s->steal--;
			qunlock(&s->lk);
.
255,270c

			soff = offset-s->base;
			pte = s->map[soff/PTEMAPMEM];
			pg = 0;
			if(pte)
				pg = pte->pages[(soff&(PTEMAPMEM-1))/BY2PG];

			s->steal++;
			qunlock(&s->lk);
			if(pagedout(pg)){
.
250,253d
247,248c
			if(p->pid!=PID(c->qid)){
				qunlock(&s->lk);
.
245c
		s = seg(p, offset, 1);
.
226a
	ulong soff;
	Segment *sg;
.
222,223c
	int i, j;
.
218,219c
	Pte *pte;
	Segment *s;
.
216c
	char statbuf[NSEG*32];
.
156a
	case Qsegment:
.
136c
		tc = s->image->c;
.
132,133c
		s = p->seg[TSEG];
		if(s==0 || p->state==Dead || s->image==0) 
.
115c
	Segment *s;
.
68c
	path = c->qid.path&~(CHDIR|((1<<QSHIFT)-1));	/* slot component */
	devdir(c, (Qid){path|tab->qid.path, c->qid.vers},
.
50c
	ulong pid, path;
.
30a
char *sname[]={ 			/* Segment type from portdat.h */
	"Text", 
	"Data", 
	"Bss", 
	"Stack", 
	"Shared", 
	"Phys",
};

.
26a
	"segment",	{Qsegment},	0,			0400,
.
16a
	Qsegment,
.
## diffname port/devproc.c 1991/0712
## diff -e /n/bootesdump/1991/0705/sys/src/9/port/devproc.c /n/bootesdump/1991/0712/sys/src/9/port/devproc.c
361c
			readnum(0, statbuf+j+NUMSIZE*i, NUMSIZE, l, NUMSIZE);
.
353,355c
		if(offset+n > STATSIZE)
			n = STATSIZE - offset;
		j = sprint(statbuf, "%-27s %-27s %-11s ",
			p->text, p->pgrp->user, statename[p->state]);
.
351c
		if(offset >= STATSIZE)
.
29c
	"status",	{Qstatus},	STATSIZE,		0600,
.
21a
#define	STATSIZE	(2*NAMELEN+12+6*12)
.
## diffname port/devproc.c 1991/0724
## diff -e /n/bootesdump/1991/0712/sys/src/9/port/devproc.c /n/bootesdump/1991/0724/sys/src/9/port/devproc.c
276c
				pprint("nonresident page addr %lux (complain to philw)\n", offset);
.
## diffname port/devproc.c 1991/0807
## diff -e /n/bootesdump/1991/0724/sys/src/9/port/devproc.c /n/bootesdump/1991/0807/sys/src/9/port/devproc.c
30c
	"status",	{Qstatus},	STATSIZE,		0400,
.
## diffname port/devproc.c 1991/0926
## diff -e /n/bootesdump/1991/0807/sys/src/9/port/devproc.c /n/bootesdump/1991/0926/sys/src/9/port/devproc.c
357c
			p->text, p->pgrp->user, p->psstate ? p->psstate : statename[p->state]);
.
## diffname port/devproc.c 1991/1011
## diff -e /n/bootesdump/1991/0926/sys/src/9/port/devproc.c /n/bootesdump/1991/1011/sys/src/9/port/devproc.c
113a
	if(name[0] == '.' && name[1] == '.' &&
	   name[2] == '\0') {
		c->qid.path = Qdir|CHDIR;
		return 1;
	}

.
## diffname port/devproc.c 1991/1025
## diff -e /n/bootesdump/1991/1011/sys/src/9/port/devproc.c /n/bootesdump/1991/1025/sys/src/9/port/devproc.c
315a
		if(offset>=KZERO && offset<KZERO+conf.base1+conf.npage1*BY2PG){
			if(offset+n > KZERO+conf.base1+conf.npage1*BY2PG)
				n = KZERO+conf.base1+conf.npage1*BY2PG - offset;
			memmove(a, (char*)offset, n);
			return n;
		}
.
## diffname port/devproc.c 1991/1105
## diff -e /n/bootesdump/1991/1025/sys/src/9/port/devproc.c /n/bootesdump/1991/1105/sys/src/9/port/devproc.c
369c
			p->text, p->user, p->psstate ? p->psstate : statename[p->state]);
.
## diffname port/devproc.c 1991/1106
## diff -e /n/bootesdump/1991/1105/sys/src/9/port/devproc.c /n/bootesdump/1991/1106/sys/src/9/port/devproc.c
114,115c
	if(strcmp(name, "..") == 0) {
.
## diffname port/devproc.c 1991/1107
## diff -e /n/bootesdump/1991/1106/sys/src/9/port/devproc.c /n/bootesdump/1991/1107/sys/src/9/port/devproc.c
171d
169d
## diffname port/devproc.c 1991/1108
## diff -e /n/bootesdump/1991/1107/sys/src/9/port/devproc.c /n/bootesdump/1991/1108/sys/src/9/port/devproc.c
458a
			postnote(p, 0, "sys: killed", NExit);
.
## diffname port/devproc.c 1991/1109
## diff -e /n/bootesdump/1991/1108/sys/src/9/port/devproc.c /n/bootesdump/1991/1109/sys/src/9/port/devproc.c
487a
	return n;
}

Chan *
procctlnotepg(Chan *c, void *va, int n)
{
	Pgrp *pg;

	pg = pgrptab(c->pgrpid.path-1);
	qlock(&pg->debug);
	if(waserror()){
		qunlock(&pg->debug);
		nexterror();
	}
	if(pg->pgrpid != c->pgrpid.vers){
		qunlock(&pg->debug);
		error(Eprocdied);
	}
	pgrpnote(pg, va, n, NUser);
	poperror();
	qunlock(&pg->debug);
}

void
procctlreq(Proc *p, char *va, int n)
{
	if(n >= 4) {
		if(strncmp(va, "exit", 4) == 0) {
			if(p->state == Broken)
				ready(p);
			return;
		}
		if(strncmp(va, "stop", 4) == 0) {
			p->procctl = Proc_stopme;
			return;
		}
		if(strncmp(va, "kill", 4) == 0) {
			postnote(p, 0, "sys: killed", NExit);
			p->procctl = Proc_exitme;
			return;
		}
	}

	if(n >= 5 && strncmp(va, "start", 5) == 0) {
		if(p->state != Stopped)
			errors("not stopped");
		ready(p);
		return;
	}
	error(Ebadctl);
}

int
procctlmemio(Proc *p, ulong offset, int n, void *va, int read)
{
	Pte **pte;
	Page *pg;
	KMap *k;
	Segment *ps, *s;
	ulong soff;
	int i;
	char *a = va, *b;

	s = seg(p, offset, 1);
	if(s == 0)
		errors("not in address space");

	/* Revert a text segment to data */
	if(read == 0 && (s->type&SG_TYPE) == SG_TEXT) {
		ps = newseg(SG_DATA, s->base, s->size);
		ps->image = s->image;
		incref(ps->image);
		ps->fstart = s->fstart;
		ps->flen = s->flen;

		for(i = 0; i < NSEG; i++)
			if(p->seg[i] == s)
				break;
		if(p->seg[i] != s)
			panic("segment gone");

		qunlock(&s->lk);
		putseg(s);
		p->seg[i] = ps;
	}
	else
		qunlock(&s->lk);

Again:
	s = seg(p, offset, 1);
	if(s == 0)
		errors("not in address space");

	s->steal++;
	soff = offset-s->base;
	pte = &s->map[soff/PTEMAPMEM];
	if(*pte == 0) {
		if(waserror()) {
			s->steal--;
			nexterror();
		}
		if(fixfault(s, offset, read, 0) != 0) {
			s->steal--;
			poperror();
			goto Again;
		}
		poperror();
		if(*pte == 0)
			panic("procctlmemio"); 
	}
	pg = (*pte)->pages[(soff&(PTEMAPMEM-1))/BY2PG];
	if(pagedout(pg)) {
		if(waserror()) {
			s->steal--;
			nexterror();
		}
		if(fixfault(s, offset, read, 0) != 0) {
			s->steal--;
			poperror();
			goto Again;
		}
		poperror();
		pg = (*pte)->pages[(soff&(PTEMAPMEM-1))/BY2PG];
		if(pg == 0)
			panic("procctlmemio1");
	}

	k = kmap(pg);
	b = (char*)VA(k);
	memmove(a, b+(offset&(BY2PG-1)), n);
	kunmap(k);

	s->steal--;
	qunlock(&s->lk);
.
438,463c
		procctlreq(p, va, n);
		return n;
.
436a
	case Qmem:
		return procctlmemio(p, offset, n, va, 0);
.
433d
411,423c
		procctlnotepg(c, va, n);
.
407,409c

	/* Use the remembered pgrp id in the channel rather than the process pgrpid */
.
398d
321a
		return procctlmemio(p, offset, n, va, 1);

.
319,320d
313c

		if(offset >= KZERO && offset < KZERO+conf.base1+conf.npage1*BY2PG){
.
306,307c
		if(offset >= KZERO && offset < KZERO+conf.npage0*BY2PG){
.
270,293c
		if(offset >= USERADDR && offset < USERADDR+BY2PG) {
.
263,268d
249,251d
243d
235,236d
221c
	Proc *p;
	Dir d;

	convM2D(db, &d);
	p = proctab(SLOT(c->qid));
	if(p->pid != PID(c->qid))
		error(Eprocdied);

	if(strcmp(u->p->user, p->user) != 0 && strcmp(u->p->user, eve) != 0)
		error(Eperm);

	p->procmode = d.mode&0777;
.
81,82c

	p = proctab(SLOT(c->qid));
	perm = tab->perm;
	if(perm == 0)
		perm = p->procmode;

	devdir(c, (Qid){path|tab->qid.path, c->qid.vers}, tab->name, tab->length, p->user, perm, dp);
.
72c
		devdir(c, (Qid){CHDIR|((s+1)<<QSHIFT), pid}, buf, 0, p->user, CHDIR|0500, dp);
.
62c
	ulong pid, path, perm;
.
56a
void	procctlreq(Proc*, char*, int);
int	procctlmemio(Proc*, ulong, int, void*, int);
Chan   *procctlnotepg(Chan*, void *va, int n);

.
34,41c
/* Segment type from portdat.h */
char *sname[]={ "Text", "Data", "Bss", "Stack", "Shared", "Phys" };
.
31c
	"text",		{Qtext},	0,			0000,
.
28c
	"proc",		{Qproc},	sizeof(Proc),		0000,
.
24,26c
	"ctl",		{Qctl},		0,			0000,
	"mem",		{Qmem},		0,			0000,
	"note",		{Qnote},	0,			0000,
.
6a
#include	"fcall.h"
.
## diffname port/devproc.c 1991/1110
## diff -e /n/bootesdump/1991/1109/sys/src/9/port/devproc.c /n/bootesdump/1991/1110/sys/src/9/port/devproc.c
565a
}

Segment *
txt2data(Proc *p, Segment *s)
{
	Segment *ps;
	int i;

	ps = newseg(SG_DATA, s->base, s->size);
	ps->image = s->image;
	incref(ps->image);
	ps->fstart = s->fstart;
	ps->flen = s->flen;
	ps->flushme = 1;

	for(i = 0; i < NSEG; i++)
		if(p->seg[i] == s)
			break;
	if(p->seg[i] != s)
		panic("segment gone");

	qunlock(&s->lk);
	putseg(s);
	qlock(&ps->lk);
	p->seg[i] = ps;

	return ps;
.
564a

	if(read == 0)
		p->newtlb = 1;

.
560c
	if(read == 1)
		memmove(a, b+(offset&(BY2PG-1)), n);
	else
		memmove(b+(offset&(BY2PG-1)), a, n);

.
512,523d
506,510c
	if(read == 0 && (s->type&SG_TYPE) == SG_TEXT)
		s = txt2data(p, s);
.
498,504c
	if(offset+n >= s->top)
		n = s->top-offset;
.
493a
Again:
.
491d
489c
	Segment *s;
.
483a
procstopped(void *a)
{
	Proc *p = a;
	return p->state == Stopped;
}

int
.
479a

.
473a
	if(n >= 8 && strncmp(va, "waitstop", 8) == 0) {
		procstopwait(p, 0);
		return;
	}
 
	if(n >= 9 && strncmp(va, "startstop", 9) == 0) {
		if(p->state != Stopped)
			errors("not stopped");
		p->procctl = Proc_traceme;
		ready(p);
		procstopwait(p, Proc_traceme);
		return;
	}
.
471a
		if(strncmp(va, "hang", 4) == 0) {
			p->hang = 1;
			return;
		}
.
464c
			procstopwait(p, Proc_stopme);
.
454a
procstopwait(Proc *p, int ctl)
{
	int pid;

	if(p->pdbg)
		errors("debugged already");
	if(procstopped(p))
		return;

	if(ctl != 0)
		p->procctl = ctl;
	p->pdbg = u->p;
	pid = p->pid;
	unlock(&p->debug);
	u->p->psstate = "Stopwait";
	if(waserror()) {
		p->pdbg = 0;
		lock(&p->debug);
		nexterror();
	}
	sleep(&u->p->sleep, procstopped, p);
	poperror();
	lock(&p->debug);
	if(p->pid != pid)
		error(Eprocdied);
}

void
.
434a
proctext(Chan *c, Proc *p)
{
	Chan *tc;
	Image *i;
	Segment *s;

	s = p->seg[TSEG];
	if(s==0 || p->state==Dead)
		error(Eprocdied);

	lock(s);
	i = s->image;
	if(i == 0) {
		unlock(s);
		error(Eprocdied);
	}
	unlock(s);

	lock(i);
	if(waserror()) {
		unlock(i);
		nexterror();
	}

	tc = i->c;
	if(tc == 0)
		error(Eprocdied);

	if(incref(tc) == 1 || (tc->flag&COPEN) == 0 || tc->mode!=OREAD) {
		close(tc);
		error(Eprocdied);
	}

	if(p->pid != PID(c->qid))
		error(Eprocdied);

	unlock(i);
	poperror();

	return tc;
}

Chan *
.
424a

.
406c
		break;

.
403c
		if(p->state != Stopped)
			errors("not stopped");

		if(offset >= USERADDR && offset < USERADDR+BY2PG) {
			pg = p->upage;
			if(pg==0 || p->pid!=PID(c->qid))
				error(Eprocdied);
			k = kmap(pg);
			b = (char*)VA(k);
			pxu = (User*)b;
			if(offset < (ulong)pxu->dbgreg || offset+n >= (ulong)pxu->dbgreg+sizeof(Ureg)) {
				kunmap(k);
				errors("bad u-area address");
			}
			ur = (Ureg*)(b+((ulong)pxu->dbgreg-USERADDR));
			setregisters(ur, (char*)pxu+(offset-USERADDR), a, n);
			kunmap(k);
		}
		else
			n = procctlmemio(p, offset, n, va, 0);
		break;

.
380a
	Ureg *ur;
	User *pxu;
	Page *pg;
	char *a = va, *b;
.
355a

.
293,299d
286,290c
		if(offset >= KZERO) {
			if(offset < KZERO+conf.npage0*BY2PG){
				if(offset+n > KZERO+conf.npage0*BY2PG)
					n = KZERO+conf.npage0*BY2PG - offset;
				memmove(a, (char*)offset, n);
				return n;
			}
			if(offset < KZERO+conf.base1+conf.npage1*BY2PG){
				if(offset+n > KZERO+conf.base1+conf.npage1*BY2PG)
					n = KZERO+conf.base1+conf.npage1*BY2PG - offset;
				memmove(a, (char*)offset, n);
				return n;
			}
.
267,272d
198,200c

	/* Affix pid to qid */
.
188d
176a
	case Qmem:
.
174a

.
173a

.
154,172c
		tc = proctext(c, p);
.
149a

.
148d
54c
Chan   *procctlnotepg(Chan*, void*, int);
Chan   *proctext(Chan*, Proc*);
Segment *txt2data(Proc*, Segment*);
int	procstopped(void*);
.
7a
#include	"ureg.h"
.
## diffname port/devproc.c 1991/1111
## diff -e /n/bootesdump/1991/1110/sys/src/9/port/devproc.c /n/bootesdump/1991/1111/sys/src/9/port/devproc.c
408c
		else	/* Try user memory segments */
.
404,405c
			ur = (Ureg*)(b+((ulong)ur-USERADDR));
			setregisters(ur, b+(offset-USERADDR), a, n);
.
400c
			hi = offset+n;
			/* Check for floating point registers */
			if(offset >= (ulong)&u->fpsave && hi <= (ulong)&u->fpsave+sizeof(FPsave)){
				memmove(b+(offset-USERADDR), a, n);
				break;
			}
			/* Check user register set for process at kernel entry */
			ur = pxu->dbgreg;
			if(offset < (ulong)ur || hi > (ulong)ur+sizeof(Ureg)) {
.
367a
	ulong hi;
.
308a
		if(up->nnote == 0)
			p->notepending = 0;
.
## diffname port/devproc.c 1991/1112
## diff -e /n/bootesdump/1991/1111/sys/src/9/port/devproc.c /n/bootesdump/1991/1112/sys/src/9/port/devproc.c
589,590c
	else
		error(Ebadctl);
.
587d
583c
	else if(strncmp(buf, "start", 5) == 0) {
.
581d
574,575c
	else if(strncmp(buf, "stop", 4) == 0)
		procstopwait(p, Proc_stopme);
	else if(strncmp(buf, "kill", 4) == 0) {
		if(p->state == Stopped)
			ready(p);
		postnote(p, 0, "sys: killed", NExit);
		p->procctl = Proc_exitme;
	}
	else if(strncmp(buf, "hang", 4) == 0)
		p->hang = 1;
	else if(strncmp(buf, "waitstop", 8) == 0)
		procstopwait(p, 0);
	else if(strncmp(buf, "startstop", 9) == 0) {
.
570,572c
	if(n > NAMELEN)
		n = NAMELEN;
	strncpy(buf, va, n);

	if(strncmp(buf, "exit", 4) == 0) {
		if(p->state == Broken)
			ready(p);
.
549,568c
	char buf[NAMELEN];
.
463c
	if(s == 0)
		errors("no text segment");
	if(p->state==Dead)
.
427a
		if(p->kp)
			errors("can' t note kproc");
.
351a
		if(n == 0 && offset == 0)
			errors("no segments");
.
214a
	if(c->qid.path&CHDIR)
		error(Eperm);

.
190,194c

	return devopen(c, omode, 0, 0, procgen);
;
.
175,181d
166a
	case Qproc:
	case Qstatus:
.
157a
		if(omode != OREAD)
			error(Eperm);
.
144,148c
	if(c->qid.path & CHDIR)
		return devopen(c, omode, 0, 0, procgen);

.
75c
		devdir(c, (Qid){CHDIR|((s+1)<<QSHIFT), pid}, buf, 0, p->user, CHDIR|0555, dp);
.
31,32c
	"segment",	{Qsegment},	0,			0444,
	"status",	{Qstatus},	STATSIZE,		0444,
.
29c
	"notepg",	{Qnotepg},	0,			0000,
.
## diffname port/devproc.c 1991/1113
## diff -e /n/bootesdump/1991/1112/sys/src/9/port/devproc.c /n/bootesdump/1991/1113/sys/src/9/port/devproc.c
634,650c
	poperror();
	pte = s->map[soff/PTEMAPMEM];
	if(pte == 0)
		panic("procctlmemio"); 
	pg = pte->pages[(soff&(PTEMAPMEM-1))/BY2PG];
	if(pagedout(pg))
		panic("procctlmemio1"); 
		
.
631,632c
		s->steal--;
.
625,629c
		if(fixfault(s, offset, read, 0) == 0)
			break;
.
617,620c
		s->steal++;
		soff = offset-s->base;
.
614,615c
		if((s->type&SG_TYPE) == SG_TEXT)
			s = txt2data(p, s);
.
611,612c
		if(offset+n >= s->top)
			n = s->top-offset;
.
606,609c
	for(;;) {
		s = seg(p, offset, 1);
		if(s == 0)
			errors("not in address space");
.
599c
	Pte *pte;
.
109d
## diffname port/devproc.c 1991/1115
## diff -e /n/bootesdump/1991/1113/sys/src/9/port/devproc.c /n/bootesdump/1991/1115/sys/src/9/port/devproc.c
223a
	USED(c);
.
197a
	USED(c);
.
191a
	USED(c, name, omode, perm);
.
## diffname port/devproc.c 1991/1116
## diff -e /n/bootesdump/1991/1115/sys/src/9/port/devproc.c /n/bootesdump/1991/1116/sys/src/9/port/devproc.c
429c
			errors("can't note kproc");
.
## diffname port/devproc.c 1991/1117
## diff -e /n/bootesdump/1991/1116/sys/src/9/port/devproc.c /n/bootesdump/1991/1117/sys/src/9/port/devproc.c
568,569c
		else{
			if(p->state == Stopped)
				ready(p);
			postnote(p, 0, "sys: killed", NExit);
			p->procctl = Proc_exitme;
		}
.
566c
		if(p->state == Broken)
.
559,563c
	if(strncmp(buf, "stop", 4) == 0)
.
## diffname port/devproc.c 1991/1124
## diff -e /n/bootesdump/1991/1117/sys/src/9/port/devproc.c /n/bootesdump/1991/1124/sys/src/9/port/devproc.c
396c
		if(offset >= USERADDR && offset <= USERADDR+BY2PG-1) {
.
252,253c
		/* ugly math: USERADDR+BY2PG may be == 0 */
		if(offset >= USERADDR && offset <= USERADDR+BY2PG-1) {
			if(offset+n >= USERADDR+BY2PG-1)
.
## diffname port/devproc.c 1991/1216
## diff -e /n/bootesdump/1991/1124/sys/src/9/port/devproc.c /n/bootesdump/1991/1216/sys/src/9/port/devproc.c
546c
	qlock(&p->debug);
.
541c
		qlock(&p->debug);
.
537c
	qunlock(&p->debug);
.
454c
	qunlock(&p->debug);
.
386c
		qunlock(&p->debug);
.
384c
	qlock(&p->debug);
.
312c
		qunlock(&p->debug);
.
286c
			qunlock(&p->debug);
.
284c
		qlock(&p->debug);
.
## diffname port/devproc.c 1991/1231
## diff -e /n/bootesdump/1991/1216/sys/src/9/port/devproc.c /n/bootesdump/1991/1231/sys/src/9/port/devproc.c
441,442d
## diffname port/devproc.c 1992/0111
## diff -e /n/bootesdump/1991/1231/sys/src/9/port/devproc.c /n/bootesdump/1992/0111/sys/src/9/port/devproc.c
6c
#include	"../port/error.h"
.
## diffname port/devproc.c 1992/0114
## diff -e /n/bootesdump/1992/0111/sys/src/9/port/devproc.c /n/bootesdump/1992/0114/sys/src/9/port/devproc.c
610c
			error(Ebadarg);
.
583c
			error(Ebadctl);
.
576c
			error(Ebadctl);
.
527c
		error(Einuse);
.
465c
		error(Enonexist);
.
444c
			exhausted("notes");
.
430c
			error(Eperm);
.
414c
				error(Ebadarg);
.
395c
			error(Ebadctl);
.
352c
			exhausted("segments");
.
177c
		pprint("procopen %lux\n", c->qid);
.
## diffname port/devproc.c 1992/0128
## diff -e /n/bootesdump/1992/0114/sys/src/9/port/devproc.c /n/bootesdump/1992/0128/sys/src/9/port/devproc.c
266a
			/* prevent users reading authentication crypt keys */
			if(offset >= pgrpalloc.cryptbase)
			if(offset < pgrpalloc.crypttop)
				error(Eperm);
			/* validate physical kernel addresses */
.
## diffname port/devproc.c 1992/0321
## diff -e /n/bootesdump/1992/0128/sys/src/9/port/devproc.c /n/bootesdump/1992/0321/sys/src/9/port/devproc.c
2c
#include	"../port/lib.h"
.
## diffname port/devproc.c 1992/0328
## diff -e /n/bootesdump/1992/0321/sys/src/9/port/devproc.c /n/bootesdump/1992/0328/sys/src/9/port/devproc.c
332a
if((p->state < Dead) || (p->state > Rendezvous))
    panic("p->state=#%lux, p->psstate=#%lux\n", p->state, p->psstate);
.
## diffname port/devproc.c 1992/0423
## diff -e /n/bootesdump/1992/0328/sys/src/9/port/devproc.c /n/bootesdump/1992/0423/sys/src/9/port/devproc.c
643c

	l = BY2PG - (offset&(BY2PG-1));
	if(n > l)
		n = l;

.
611c
	ulong soff, l;
.
334c
	panic("p->state=#%lux, p->psstate=#%lux\n", p->state, p->psstate);


.
332a

/* Assertion for deref of psstate which causes faults */
.
## diffname port/devproc.c 1992/0428
## diff -e /n/bootesdump/1992/0423/sys/src/9/port/devproc.c /n/bootesdump/1992/0428/sys/src/9/port/devproc.c
510,529d
389,391c
	/* Use the remembered noteid in the channel rather than the process pgrpid */
	if(QID(c->qid) == Qnotepg) {
		pgrpnote(NOTEID(c->pgrpid), va, n, NUser);
.
174c
		c->pgrpid.vers = p->noteid;
.
55d
52a
#define	QID(q)		(((q).path&0x0000000F)>>0)
#define	SLOT(q)		((((q).path&0x07FFFFFF0)>>QSHIFT)-1)
#define	PID(q)		((q).vers)
#define	NOTEID(q)	((q).vers)

.
49,51d
45c
 * If notepg, c->pgrpid.path is pgrp slot, .vers is noteid.
.
## diffname port/devproc.c 1992/0430
## diff -e /n/bootesdump/1992/0428/sys/src/9/port/devproc.c /n/bootesdump/1992/0430/sys/src/9/port/devproc.c
37c
char *sname[]={ "Text", "Data", "Bss", "Stack", "Shared", "Phys", "Shdata" };
.
## diffname port/devproc.c 1992/0520
## diff -e /n/bootesdump/1992/0430/sys/src/9/port/devproc.c /n/bootesdump/1992/0520/sys/src/9/port/devproc.c
368a
	return 0;		/* not reached */
.
## diffname port/devproc.c 1992/0527
## diff -e /n/bootesdump/1992/0520/sys/src/9/port/devproc.c /n/bootesdump/1992/0527/sys/src/9/port/devproc.c
457c
			error("note not posted");
.
## diffname port/devproc.c 1992/0611
## diff -e /n/bootesdump/1992/0527/sys/src/9/port/devproc.c /n/bootesdump/1992/0611/sys/src/9/port/devproc.c
187d
## diffname port/devproc.c 1992/0619
## diff -e /n/bootesdump/1992/0611/sys/src/9/port/devproc.c /n/bootesdump/1992/0619/sys/src/9/port/devproc.c
267,270d
7d
## diffname port/devproc.c 1992/0628
## diff -e /n/bootesdump/1992/0619/sys/src/9/port/devproc.c /n/bootesdump/1992/0628/sys/src/9/port/devproc.c
273,275c
			if(offset >= conf.base0 && offset < conf.npage0){
				if(offset+n > conf.npage0)
					n = conf.npage0 - offset;
				memmove(a, (char*)offset, n);
				return n;
			}
			if(offset >= conf.base1 && offset < conf.npage1){
				if(offset+n > conf.npage1)
					n = conf.npage1 - offset;
.
267,269c
			if(offset < (ulong)end) {
				if(offset+n > (ulong)end)
					n = (ulong)end - offset;
.
## diffname port/devproc.c 1992/0711
## diff -e /n/bootesdump/1992/0628/sys/src/9/port/devproc.c /n/bootesdump/1992/0711/sys/src/9/port/devproc.c
238d
140d
66a
	USED(ntab);
.
## diffname port/devproc.c 1992/0814
## diff -e /n/bootesdump/1992/0711/sys/src/9/port/devproc.c /n/bootesdump/1992/0814/sys/src/9/port/devproc.c
347a
		/* ignore stack, which is mostly non-existent */
		l = 0;
		for(i=1; i<NSEG; i++){
			s = p->seg[i];
			if(s)
				l += s->top - s->base;
		}
		readnum(0, statbuf+j+NUMSIZE*6, NUMSIZE, l>>10, NUMSIZE);
.
235a
	Segment *s;
.
23c
#define	STATSIZE	(2*NAMELEN+12+7*12)
.
## diffname port/devproc.c 1992/0824
## diff -e /n/bootesdump/1992/0814/sys/src/9/port/devproc.c /n/bootesdump/1992/0824/sys/src/9/port/devproc.c
664a
	Segment *ps;
.
663d
603d
600a
	KMap *k;
.
427c
			if(offset >= (ulong)&u->fpsave &&
			   hi <= (ulong)&u->fpsave+sizeof(FPsave)){
.
335,339d
265a
			/* Protect crypt key memory */
			if(offset >= palloc.cmembase && offset < palloc.cmemtop)
				error(Eperm);

.
175a

.
173c
		c->pgrpid.path = pg->pgrpid+1;
.
171c
		if(omode!=OWRITE || pg->pgrpid == 1)
.
159d
91c
	qid = (Qid){path|tab->qid.path, c->qid.vers};
	devdir(c, qid, tab->name, tab->length, p->user, perm, dp);
.
82a

.
76c
		qid = (Qid){CHDIR|((s+1)<<QSHIFT), pid};
		devdir(c, qid, buf, 0, p->user, CHDIR|0555, dp);
.
62a
	Qid qid;
.
56,57c
Chan*	proctext(Chan*, Proc*);
Segment* txt2data(Proc*, Segment*);
.
24c
Dirtab procdir[] =
{
.
## diffname port/devproc.c 1992/0907
## diff -e /n/bootesdump/1992/0824/sys/src/9/port/devproc.c /n/bootesdump/1992/0907/sys/src/9/port/devproc.c
344,346c
		sps = p->psstate;
		if(sps == 0)
			sps = statename[p->state];
		j = sprint(statbuf, "%-27s %-27s %-11s ", p->text, p->user, sps);

		for(i = 0; i < 6; i++) {
.
236c
	char *a = va, *b, *sps;
.
## diffname port/devproc.c 1992/1103
## diff -e /n/bootesdump/1992/0907/sys/src/9/port/devproc.c /n/bootesdump/1992/1103/sys/src/9/port/devproc.c
347c
		memset(statbuf, ' ', sizeof statbuf);
		memmove(statbuf+0*NAMELEN, p->text, strlen(p->text));
		memmove(statbuf+1*NAMELEN, p->user, strlen(p->user));
		memmove(statbuf+2*NAMELEN, sps, strlen(sps));
		j = 2*NAMELEN + 12;
.
## diffname port/devproc.c 1992/1104
## diff -e /n/bootesdump/1992/1103/sys/src/9/port/devproc.c /n/bootesdump/1992/1104/sys/src/9/port/devproc.c
694a

	return ps;
}

Segment*
data2txt(Segment *s)
{
	Segment *ps;

	ps = newseg(SG_TEXT, s->base, s->size);
	ps->image = s->image;
	incref(ps->image);
	ps->fstart = s->fstart;
	ps->flen = s->flen;
	ps->flushme = 1;
.
672c
Segment*
.
## diffname port/devproc.c 1992/1118
## diff -e /n/bootesdump/1992/1104/sys/src/9/port/devproc.c /n/bootesdump/1992/1118/sys/src/9/port/devproc.c
576c
		else {
.
## diffname port/devproc.c 1992/1206
## diff -e /n/bootesdump/1992/1118/sys/src/9/port/devproc.c /n/bootesdump/1992/1206/sys/src/9/port/devproc.c
576,578c
			break;
		default:
.
574c
		switch(p->state) {
		case Broken:
			unbreak(p);
			break;
		case Stopped:
			postnote(p, 0, "sys: killed", NExit);
			p->procctl = Proc_exitme;
.
## diffname port/devproc.c 1993/0122
## diff -e /n/bootesdump/1992/1206/sys/src/9/port/devproc.c /n/bootesdump/1993/0122/sys/src/9/port/devproc.c
272c
			if(offset < palloc.cmemtop && offset+n > palloc.cmembase)
.
## diffname port/devproc.c 1993/0309
## diff -e /n/bootesdump/1993/0122/sys/src/9/port/devproc.c /n/bootesdump/1993/0309/sys/src/9/port/devproc.c
385a

	case Qwait:
		if(n < sizeof(Waitmsg))
			error(Etoosmall);

		if(!canqlock(&p->qwaitr))
			error(Einuse);

		if(waserror()) {
			qunlock(&p->qwaitr);
			nexterror();
		}

		lock(&p->exl);
		while(p->waitq == 0) {
			unlock(&p->exl);
			sleep(&p->waitr, haswaitq, p);
			lock(&p->exl);
		}
		wq = p->waitq;
		p->waitq = wq->next;
		p->nwait--;
		unlock(&p->exl);

		qunlock(&p->qwaitr);
		poperror();
		memmove(a, &wq->w, sizeof(Waitmsg));
		free(wq);
		return sizeof(Waitmsg);
.
245a
	Waitq *wq;
.
171a
	case Qwait:
.
160,161d
33a
	"wait",		{Qwait},	0,			0400,
.
20a
	Qwait,
.
## diffname port/devproc.c 1993/0311
## diff -e /n/bootesdump/1993/0309/sys/src/9/port/devproc.c /n/bootesdump/1993/0311/sys/src/9/port/devproc.c
401a
		if(u->p == p && p->nchild == 0 && p->waitq == 0) {
			unlock(&p->exl);
			error(Enochild);
		}
.
98c
	devdir(c, qid, tab->name, len, p->user, perm, dp);
.
96a
	len = tab->length;
	if(QID(c->qid) == Qwait)
		len = p->nwait * sizeof(Waitmsg);

.
69c
	ulong pid, path, perm, len;
.
## diffname port/devproc.c 1993/0318
## diff -e /n/bootesdump/1993/0311/sys/src/9/port/devproc.c /n/bootesdump/1993/0318/sys/src/9/port/devproc.c
628a
	else if(strncmp(buf, "nohang", 6) == 0)
		p->hang = 0;
.
## diffname port/devproc.c 1993/0404
## diff -e /n/bootesdump/1993/0318/sys/src/9/port/devproc.c /n/bootesdump/1993/0404/sys/src/9/port/devproc.c
674c
		if(read == 0 && (s->type&SG_TYPE) == SG_TEXT)
.
## diffname port/devproc.c 1993/0501
## diff -e /n/bootesdump/1993/0404/sys/src/9/port/devproc.c /n/fornaxdump/1993/0501/sys/src/brazil/port/devproc.c
674c
		if((s->type&SG_TYPE) == SG_TEXT)
.
640c
	else
	if(strncmp(buf, "start", 5) == 0) {
.
633c
	else
	if(strncmp(buf, "startstop", 9) == 0) {
.
631c
	else
	if(strncmp(buf, "waitstop", 8) == 0)
.
629c
	else
	if(strncmp(buf, "nohang", 6) == 0)
.
627c
	else
	if(strncmp(buf, "hang", 4) == 0)
.
612c
	else
	if(strncmp(buf, "kill", 4) == 0) {
.
594c
	sleep(&up->sleep, procstopped, p);
.
588c
	up->psstate = "Stopwait";
.
585c
	p->pdbg = up;
.
503,510d
468,493c
		n = procctlmemio(p, offset, n, va, 0);
.
449c
	/* Use the remembered noteid in the channel rather
	 * than the process pgrpid
	 */
.
438,442d
435,436d
430a
	pg = up->pgrp;
	rlock(&pg->ns);

	nxt = 0;
	last = 0;
	bestmid = ~0;
	if(mw->mh)
		last = mw->cm->mountid;

	he = &pg->mnthash[MNTHASH];
	for(h = pg->mnthash; h < he; h++) {
		for(f = *h; f; f = f->hash) {
			for(t = f->mount; t; t = t->next) {
				if(mw->mh == 0 ||
				  (t->mountid > last && t->mountid < bestmid)) {
					mw->cm = t;
					mw->mh = f;
					bestmid = mw->cm->mountid;
					nxt = 1;
				}
			}
		}
	}
	if(nxt == 0)
		mw->mh = 0;

	runlock(&pg->ns);
}

.
429a
void
mntscan(Mntwalk *mw)
{
	Pgrp *pg;
	Mount *t;
	int nxt;
	ulong last, bestmid;
	Mhead **h, **he, *f;
.
424a

	case Qns:
		mw = c->aux;
		mntscan(mw);
		if(mw->mh == 0)
			return 0;
		if(n < NAMELEN+11)
			error(Etoosmall);
		i = sprint(a, "%s %d ", mw->cm->spec, mw->cm->flag);
		n -= i;
		a += i;
		i = ptpath(mw->mh->from->path, a, n);
		n -= i;
		a += i;
		if(n > 0) {
			*a++ = ' ';
			n--;
		}
		a += ptpath(mw->cm->to->path, a, n);
		return a - (char*)va;
.
406c
		if(up == p && p->nchild == 0 && p->waitq == 0) {
.
331d
329c
		if(p->nnote == 0)
.
323,326c
		else {
			memmove(va, p->note[0].msg, ERRLEN);
			p->nnote--;
			memmove(p->note, p->note+1, p->nnote*sizeof(Note));
.
321c
		if(p->nnote == 0)
.
312,318d
278c
			if(offset >= palloc.cmembase&&offset < palloc.cmemtop)
.
262,275d
251a
	Mntwalk *mw;
	Segment *sg, *s;
	char *a = va, *sps;
	char statbuf[NSEG*32];
.
248,250d
244,246d
241,242c
	long l;
.
235c
	if(QID(c->qid) == Qns)
		free(c->aux);
.
226c
	if(strcmp(up->user, p->user) != 0 && strcmp(up->user, eve) != 0)
.
178a
	case Qns:
		c->aux = malloc(sizeof(Mntwalk));
		break;

.
165a
		if(omode != OREAD)
			error(Eperm);
.
61a
void	mntscan(Mntwalk*);
.
35a
	"ns",		{Qns},		0,			0400,
.
21a
	Qns,
.
11c
enum
{
.
## diffname port/devproc.c 1993/0818
## diff -e /n/fornaxdump/1993/0501/sys/src/brazil/port/devproc.c /n/fornaxdump/1993/0818/sys/src/brazil/port/devproc.c
506a
		break;

	case Qregs:
		if(offset >= sizeof(Ureg))
			return 0;
		if(offset+n > sizeof(Ureg))
			n = sizeof(Ureg) - offset;
		setregisters(p->dbgreg, (char*)(p->dbgreg)+offset, va, n);
		break;

	case Qfpregs:
		if(offset >= sizeof(FPsave))
			return 0;
		if(offset+n > sizeof(FPsave))
			n = sizeof(FPsave) - offset;
		memmove((uchar*)&p->fpsave+offset, va, n);
.
369a
		}
.
365,368c
		for(i = 0; i < NSEG; i++) {
			sg = p->seg[i];
			if(sg == 0)
				continue;
			j += sprint(&statbuf[j], "%-6s %c %.8lux %.8lux %4d\n",
				sname[sg->type&SG_TYPE],
				sg->type&SG_RONLY ? 'R' : ' ',
.
325,327c
		if(offset+n > rsize)
			n = rsize - offset;
		memmove(a, rptr+offset, n);
.
322,323c
	case Qregs:
		rptr = (uchar*)p->dbgreg;
		rsize = sizeof(Ureg);
		goto regread;

	case Qkregs:
		memset(&kur, 0, sizeof(Ureg));
		kur.pc = p->sched.pc;
		kur.sp = p->sched.sp;
		rptr = (uchar*)&kur;
		rsize = sizeof(Ureg);
		goto regread;

	case Qfpregs:
		rptr = (uchar*)&p->fpsave;
		rsize = sizeof(FPsave);
	regread:
		if(offset >= rsize)
.
296,297d
294a
		if(offset >= conf.base0 && offset < conf.npage0){
			if(offset+n > conf.npage0)
				n = conf.npage0 - offset;
			memmove(a, (char*)offset, n);
			break;
		}
		if(offset >= conf.base1 && offset < conf.npage1){
			if(offset+n > conf.npage1)
				n = conf.npage1 - offset;
			memmove(a, (char*)offset, n);
			break;
		}
		error(Ebadarg);
.
275,293c
		/* Protect crypt key memory */
		if(offset >= palloc.cmembase&&offset < palloc.cmemtop)
			error(Eperm);

		/* validate physical kernel addresses */
		if(offset < (ulong)end) {
			if(offset+n > (ulong)end)
				n = (ulong)end - offset;
			memmove(a, (char*)offset, n);
			break;
.
270,273c
		if(offset < KZERO)
			return procctlmemio(p, offset, n, va, 1);
.
256a
	int i, j, rsize;
.
255a
	Ureg kur;
	uchar *rptr;
.
254d
185a
		if(omode != OREAD)
			error(Eperm);
.
182a
	case Qregs:
	case Qfpregs:
.
179,180d
175a
	case Qkregs:
	case Qsegment:
		if(omode != OREAD)
			error(Eperm);
		break;

.
38d
33c
	"ns",		{Qns},		0,			0400,
	"regs",		{Qregs},	sizeof(Ureg),		0000,
.
29a
	"fpregs",	{Qfpregs},	sizeof(FPsave),		0000,
	"kregs",	{Qkregs},	sizeof(Ureg),		0000,
.
23d
18c
	Qns,
	Qregs,
.
14a
	Qdir,
	Qfpregs,
	Qkregs,
.
13d
## diffname port/devproc.c 1993/0828
## diff -e /n/fornaxdump/1993/0818/sys/src/brazil/port/devproc.c /n/fornaxdump/1993/0828/sys/src/brazil/port/devproc.c
334a

	case Qproc:

		return readnum(offset, va, n, (ulong)p, NUMSIZE);
.
179a
	case Qproc:
{
Segment *sg;
int i, j;
Page **src;
Pte *old;
		for(i = 0; i < MAXMACH; i++)
			print("%d ", p->pidonmach[i]);
		print("\n");
		for(i = 0; i < NSEG; i++) {
			sg = p->seg[i];
			if(sg == 0)
				continue;
			print("%-6s %c %.8lux %.8lux %4d\n",
				sname[sg->type&SG_TYPE],
				sg->type&SG_RONLY ? 'R' : ' ',
				sg->base, sg->top, sg->ref);

			for(j = 0; j < SEGMAPSIZE; j++) {
				old = sg->map[j];
				if(old == 0)
					continue;
				print("\t%d: %lux\n", j, old);
				for(src = old->first; src <= old->last; src++) {
					if(*src == 0)
						continue;

					print("\t\t%lux %lux\n", (*src)->va, (*src)->pa);
				}
				prflush();
			}
		}
}
.
37a
	"proc",		{Qproc},	0,			0400,
.
20a
	Qproc,
.
## diffname port/devproc.c 1993/0902
## diff -e /n/fornaxdump/1993/0828/sys/src/brazil/port/devproc.c /n/fornaxdump/1993/0902/sys/src/brazil/port/devproc.c
183,214d
## diffname port/devproc.c 1993/0908
## diff -e /n/fornaxdump/1993/0902/sys/src/brazil/port/devproc.c /n/fornaxdump/1993/0908/sys/src/brazil/port/devproc.c
351a
		kur.r31 = (ulong)sched;
.
311c
			return n;
.
305c
			return n;
.
299c
			return n;
.
## diffname port/devproc.c 1993/1013
## diff -e /n/fornaxdump/1993/0908/sys/src/brazil/port/devproc.c /n/fornaxdump/1993/1013/sys/src/brazil/port/devproc.c
260c
	if(QID(c->qid) == Qns && c->aux != 0)
.
253a
	convM2D(db, &d);
.
246d
## diffname port/devproc.c 1993/1018
## diff -e /n/fornaxdump/1993/1013/sys/src/brazil/port/devproc.c /n/fornaxdump/1993/1018/sys/src/brazil/port/devproc.c
581c
	case Qnoteid:
		id = atoi((char*)va);
		if(id == p->pid) {
			p->noteid = id;
			break;
		}
		t = proctab(0);
		for(et = t+conf.nproc; t < et; t++) {
			if(id == t->noteid) {
				if(strcmp(p->user, t->user) != 0)
					error(Eperm);
				p->noteid = id;
				break;
			}
		}
		if(p->noteid != id)
			error(Ebadarg);
		break;
.
519c
	int id;
	Proc *p, *t, *et;
.
472a
	case Qnoteid:
		return readnum(offset, va, n, p->noteid, NUMSIZE);
.
190a
	case Qnoteid:
.
36a
	"noteid",	{Qnoteid},	0,			0666,
.
18a
	Qnoteid,
.
## diffname port/devproc.c 1993/1022
## diff -e /n/fornaxdump/1993/1018/sys/src/brazil/port/devproc.c /n/fornaxdump/1993/1022/sys/src/brazil/port/devproc.c
353,355c
		setkernur(&kur, p);
.
## diffname port/devproc.c 1993/1031
## diff -e /n/fornaxdump/1993/1022/sys/src/brazil/port/devproc.c /n/fornaxdump/1993/1031/sys/src/brazil/port/devproc.c
586c
		id = atoi(a);
.
525a
	a = va;
.
524c
	char *a, buf[ERRLEN];
.
1c
 #include	"u.h"
.
## diffname port/devproc.c 1993/1201
## diff -e /n/fornaxdump/1993/1031/sys/src/brazil/port/devproc.c /n/fornaxdump/1993/1201/sys/src/brazil/port/devproc.c
848a
}

static char *counter[Pcounter];
int ncounter;

int
proccounter(char *name)
{
	if(ncounter >= Pcounter)
		panic("too many process counters");
	counter[ncounter] = name;
	return ncounter++;
}

ulong
readcounters(Proc *p, ulong offset, void *va, int n)
{
	char *bp;
	int i, j, m;
	extern char *sysctab[];

	bp = smalloc((NSYSCALL+ncounter)*(NAMELEN+8));
	m = 0;
	for(i = 0; i < Pcounter; i++)
		if(counter[i])
			m += sprint(bp+m, "%s\t%8d\n", counter[i], p->counter[i]);
	j = 0;
	for(i = 0; i < NSYSCALL; i++)
		j += p->syscall[i];
	m += sprint(bp+m, "syscall\t%8d\n", j);
	for(i = 0; i < NSYSCALL; i++)
		if(p->syscall[i])
			m += sprint(bp+m, "%s\t%8d\n", sysctab[i], p->syscall[i]);
	n = readstr(offset, va, n, bp);
	free(bp);
	memset(p->counter, 0, sizeof(p->counter));
	memset(p->syscall, 0, sizeof(p->syscall));
	return n;
.
368a
	case Qcounters:
		return readcounters(p, offset, va, n);

.
343d
190a
	case Qcounters:
.
120a
	/* standard counters - this ordering is important */
	proccounter("sched");
	proccounter("fault");
	proccounter("tlbmiss");

.
73a
ulong	readcounters(Proc*, ulong, void*, int);
.
32a
	"counters",	{Qcounters},	0,			0444,
.
25a
	Qcounters,
.
## diffname port/devproc.c 1993/1202
## diff -e /n/fornaxdump/1993/1201/sys/src/brazil/port/devproc.c /n/fornaxdump/1993/1202/sys/src/brazil/port/devproc.c
154c
		c->qid.path = CHDIR;
.
## diffname port/devproc.c 1993/1204
## diff -e /n/fornaxdump/1993/1202/sys/src/brazil/port/devproc.c /n/fornaxdump/1993/1204/sys/src/brazil/port/devproc.c
745a
	}
	else
	if(strncmp(buf, "cpu ", 4) == 0) {
		i = strtoul(buf+4, 0, 0);
		if(i < 0 || i >= conf.nmach)
			error(Ebadctl);
		p->mp = MACHP(i);
.
699a
	int i;
.
## diffname port/devproc.c 1993/1212
## diff -e /n/fornaxdump/1993/1204/sys/src/brazil/port/devproc.c /n/fornaxdump/1993/1212/sys/src/brazil/port/devproc.c
747,753d
701a
	extern int pfthreshold;
.
700d
## diffname port/devproc.c 1993/1218
## diff -e /n/fornaxdump/1993/1212/sys/src/brazil/port/devproc.c /n/fornaxdump/1993/1218/sys/src/brazil/port/devproc.c
816a

	qunlock(&s->lk);
.
813d
811a
	/* Ensure the process sees text page changes */
	if(s->flushme)
		memset(pg->cachectl, PG_TXTFLUSH, sizeof(pg->cachectl));

.
## diffname port/devproc.c 1994/0101
## diff -e /n/fornaxdump/1993/1218/sys/src/brazil/port/devproc.c /n/fornaxdump/1994/0101/sys/src/brazil/port/devproc.c
821,822d
## diffname port/devproc.c 1994/0107
## diff -e /n/fornaxdump/1994/0101/sys/src/brazil/port/devproc.c /n/fornaxdump/1994/0107/sys/src/brazil/port/devproc.c
1c
#include	"u.h"
.
## diffname port/devproc.c 1994/0215
## diff -e /n/fornaxdump/1994/0107/sys/src/brazil/port/devproc.c /n/fornaxdump/1994/0215/sys/src/brazil/port/devproc.c
37c
	"kregs",	{Qkregs},	sizeof(Ureg),		0400,
.
## diffname port/devproc.c 1994/0219
## diff -e /n/fornaxdump/1994/0215/sys/src/brazil/port/devproc.c /n/fornaxdump/1994/0219/sys/src/brazil/port/devproc.c
299c
		if(offset < KZERO
		|| (offset >= USTKTOP-USTKSIZE && offset < USTKTOP))
.
## diffname port/devproc.c 1994/0331
## diff -e /n/fornaxdump/1994/0219/sys/src/brazil/port/devproc.c /n/fornaxdump/1994/0331/sys/src/brazil/port/devproc.c
37c
	"kregs",	{Qkregs},	sizeof(Ureg),		0000,
.
## diffname port/devproc.c 1994/0407
## diff -e /n/fornaxdump/1994/0331/sys/src/brazil/port/devproc.c /n/fornaxdump/1994/0407/sys/src/brazil/port/devproc.c
895c
	for(i = 0; i < nsyscall; i++)
.
892c
	for(i = 0; i < nsyscall; i++)
.
886c
	bp = smalloc((nsyscall+ncounter)*(NAMELEN+8));
.
## diffname port/devproc.c 1994/0409
## diff -e /n/fornaxdump/1994/0407/sys/src/brazil/port/devproc.c /n/fornaxdump/1994/0409/sys/src/brazil/port/devproc.c
778c
		if(!read && (s->type&SG_TYPE) == SG_TEXT)
.
## diffname port/devproc.c 1994/0612
## diff -e /n/fornaxdump/1994/0409/sys/src/brazil/port/devproc.c /n/fornaxdump/1994/0612/sys/src/brazil/port/devproc.c
865,902d
378,380d
199d
124,128d
76d
34d
26d
## diffname port/devproc.c 1994/0613
## diff -e /n/fornaxdump/1994/0612/sys/src/brazil/port/devproc.c /n/fornaxdump/1994/0613/sys/src/brazil/port/devproc.c
499,501c
	for(i = 0; i < MNTHASH; i++) {
		for(f = pg->mnthash[i]; f; f = f->hash) {
.
495a

	last = 0;
.
494d
488d
486c
	Mhead *f;
	int nxt, i;
.
## diffname port/devproc.c 1994/0814
## diff -e /n/fornaxdump/1994/0613/sys/src/brazil/port/devproc.c /n/fornaxdump/1994/0814/sys/src/brazil/port/devproc.c
313a
			memmove(a, (char*)offset, n);
			return n;
		}
		if(offset >= crasharea && offset < crashend){
			if(offset+n > crashend)
				n = crashend - offset;
.
51a
/* where to put crash information when memory isn't wiped */
ulong crasharea;
ulong crashend;

.
## diffname port/devproc.c 1994/0816
## diff -e /n/fornaxdump/1994/0814/sys/src/brazil/port/devproc.c /n/fornaxdump/1994/0816/sys/src/brazil/port/devproc.c
700d
## diffname port/devproc.c 1994/0817
## diff -e /n/fornaxdump/1994/0816/sys/src/brazil/port/devproc.c /n/fornaxdump/1994/0817/sys/src/brazil/port/devproc.c
744a
	}
	else
	if(strncmp(buf, "pri", 3) == 0){
		if(n < 4)
			error(Ebadarg);
		i = atoi(buf+4);
		if(i < 0 || i >= Nrq)
			error(Ebadarg);
		p->basepri = i;
.
699a
	int i;
.
321,326d
52,55d
## diffname port/devproc.c 1994/0914
## diff -e /n/fornaxdump/1994/0817/sys/src/brazil/port/devproc.c /n/fornaxdump/1994/0914/sys/src/brazil/port/devproc.c
743c
			error(Ebadctl);
.
740c
			error(Ebadctl);
.
## diffname port/devproc.c 1994/0915
## diff -e /n/fornaxdump/1994/0914/sys/src/brazil/port/devproc.c /n/fornaxdump/1994/0915/sys/src/brazil/port/devproc.c
742,743c
		if(i < 0)
			i = 0;
		if(i >= Nrq)
			i = Nrq - 1;
		if(i < p->basepri && !iseve())
			error(Eperm);
.
398a
		readnum(0, statbuf+j+NUMSIZE*7, NUMSIZE, p->basepri, NUMSIZE);
		readnum(0, statbuf+j+NUMSIZE*8, NUMSIZE, p->priority, NUMSIZE);
.
30c
#define	STATSIZE	(2*NAMELEN+12+9*12)
.
## diffname port/devproc.c 1995/0102
## diff -e /n/fornaxdump/1994/0915/sys/src/brazil/port/devproc.c /n/fornaxdump/1995/0102/sys/src/brazil/port/devproc.c
746,750c
		if(i >= NiceMax)
			i = NiceMax - 1;
		p->nice = i;
	}
	else
	if(strncmp(buf, "wired", 5) == 0){
		if(n < 6)
			error(Ebadctl);
		i = atoi(buf+6);
		if(i)
			procwired(p);
.
743c
		i = NiceNormal+atoi(buf+4);
.
399,400c
		readnum(0, statbuf+j+NUMSIZE*7, NUMSIZE, p->nice, NUMSIZE);
		readnum(0, statbuf+j+NUMSIZE*8, NUMSIZE, p->pri, NUMSIZE);
.
## diffname port/devproc.c 1995/0103
## diff -e /n/fornaxdump/1995/0102/sys/src/brazil/port/devproc.c /n/fornaxdump/1995/0103/sys/src/brazil/port/devproc.c
743c
		i = NiceNormal+atoi(buf+5);
.
740,741c
	if(strncmp(buf, "nice", 4) == 0){
		if(n < 5)
.
## diffname port/devproc.c 1995/0105
## diff -e /n/fornaxdump/1995/0103/sys/src/brazil/port/devproc.c /n/fornaxdump/1995/0105/sys/src/brazil/port/devproc.c
816,819c
		memmove(a, b, n);
	else {
		memmove(b, a, n);
		dcflush(b, n);
	}
.
814a
	b += offset&(BY2PG-1);
.
## diffname port/devproc.c 1995/0106
## diff -e /n/fornaxdump/1995/0105/sys/src/brazil/port/devproc.c /n/fornaxdump/1995/0106/sys/src/brazil/port/devproc.c
820,821d
818c
	else
.
## diffname port/devproc.c 1995/0108
## diff -e /n/fornaxdump/1995/0106/sys/src/brazil/port/devproc.c /n/fornaxdump/1995/0108/sys/src/brazil/port/devproc.c
612a
}

long
procbwrite(Chan *c, Block *bp, ulong offset)
{
	return devbwrite(c, bp, offset);
.
482a
Block*
procbread(Chan *c, long n, ulong offset)
{
	return devbread(c, n, offset);
}

.
## diffname port/devproc.c 1995/0110
## diff -e /n/fornaxdump/1995/0108/sys/src/brazil/port/devproc.c /n/fornaxdump/1995/0110/sys/src/brazil/port/devproc.c
758,760c
		if(i >= Nrq)
			i = Nrq - 1;
		if(i < p->basepri && !iseve())
			error(Eperm);
		p->basepri = i;
.
755c
		i = atoi(buf+4);
.
752,753c
	if(strncmp(buf, "pri", 3) == 0){
		if(n < 4)
.
399,400c
		readnum(0, statbuf+j+NUMSIZE*7, NUMSIZE, p->basepri, NUMSIZE);
		readnum(0, statbuf+j+NUMSIZE*8, NUMSIZE, p->priority, NUMSIZE);
.
## diffname port/devproc.c 1995/0212
## diff -e /n/fornaxdump/1995/0110/sys/src/brazil/port/devproc.c /n/fornaxdump/1995/0212/sys/src/brazil/port/devproc.c
344c
		if(offset >= sizeof(Proc))
			return 0;
		if(offset+n > sizeof(Proc))
			n = sizeof(Proc) - offset;
		memmove(a, ((char*)p)+offset, n);
		return n;
.
## diffname port/devproc.c 1995/0319
## diff -e /n/fornaxdump/1995/0212/sys/src/brazil/port/devproc.c /n/fornaxdump/1995/0319/sys/src/brazil/port/devproc.c
755a
	else
	if(strncmp(buf, "closefgrp", 9) == 0)
		procctlfgrp(p->fgrp);
.
709a
	char buf[NAMELEN];
.
708d
705a
procctlfgrp(Fgrp *f)
{
	int i;
	Chan *c;

	lock(f);
	f->ref++;
	for(i = 0; i < f->maxfd; i++) {
		c = f->fd[i];
		if(c != 0) {
			f->fd[i] = 0;
			unlock(f);
			close(c);
			lock(f);
		}
	}
	unlock(f);
	closefgrp(f);
}


void
.
## diffname port/devproc.c 1995/0804
## diff -e /n/fornaxdump/1995/0319/sys/src/brazil/port/devproc.c /n/fornaxdump/1995/0804/sys/src/brazil/port/devproc.c
236d
234c
procremove(Chan*)
.
229d
227c
proccreate(Chan*, char*, int, ulong)
.
83d
76c
procgen(Chan *c, Dirtab *tab, int, int s, Dir *dp)
.
## diffname port/devproc.c 1996/0121
## diff -e /n/fornaxdump/1995/0804/sys/src/brazil/port/devproc.c /n/fornaxdump/1996/0121/sys/src/brazil/port/devproc.c
445a
			if(p->pid != pid)
				error(Eprocdied);
.
442a
		pid = p->pid;
.
275a
	int i, j, rsize, pid;
.
273d
## diffname port/devproc.c 1996/0223
## diff -e /n/fornaxdump/1996/0121/sys/src/brazil/port/devproc.c /n/fornaxdump/1996/0223/sys/src/brazil/port/devproc.c
9d
## diffname port/devproc.c 1996/0303
## diff -e /n/fornaxdump/1996/0223/sys/src/brazil/port/devproc.c /n/fornaxdump/1996/0303/sys/src/brazil/port/devproc.c
799a
	}
	else
	if(strncmp(buf, "profile", 7) == 0) {
		s = p->seg[TSEG];
		if(s == 0 || (s->type&SG_TYPE) != SG_TEXT)
			error(Ebadctl);
		if(s->profile != 0)
			free(s->profile);
		npc = (s->top-s->base)>>LRESPROF;
		s->profile = malloc(npc*sizeof(*s->profile));
		if(s->profile == 0)
			error(Enomem);
.
794c
	if(strncmp(buf, "wired", 5) == 0) {
.
781c
	if(strncmp(buf, "pri", 3) == 0) {
.
729c
	Segment *s;
	int i, npc;
.
413a
				sg->profile ? 'P' : ' ',
.
411c
			j += sprint(statbuf+j, "%-6s %c%c %.8lux %.8lux %4d\n",
.
313a
	case Qprofile:
		s = p->seg[TSEG];
		if(s == 0 || s->profile == 0)
			error("profile is off");
		i = (s->top-s->base)>>LRESPROF;
		i *= sizeof(*s->profile);
		if(offset >= i)
			return 0;
		if(offset+n > i)
			n = i - offset;
		memmove(a, ((char*)s->profile)+offset, n);
		return n;
.
184a
	case Qprofile:
.
109a
		break;
	case Qprofile:
		q = p->seg[TSEG];
		if(q && q->profile) {
			len = (q->top-q->base)>>LRESPROF;
			len *= sizeof(*q->profile);
		}
		break;
	}
.
108c
	switch(QID(c->qid)) {
	case Qwait:
.
78a
	Segment *q;
.
45a
	"profile",	{Qprofile},	0,			0400,
.
26a
	Qprofile,
.
9d
## diffname port/devproc.c 1997/0327
## diff -e /n/fornaxdump/1996/0303/sys/src/brazil/port/devproc.c /n/emeliedump/1997/0327/sys/src/brazil/port/devproc.c
743c
			cclose(c);
.
689c
		cclose(tc);
.
657c
Chan*
.
651,655c
Dev procdevtab = {
	devreset,
	procinit,
	procattach,
	devclone,
	procwalk,
	procstat,
	procopen,
	devcreate,
	procclose,
	procread,
	devbread,
	procwrite,
	devbwrite,
	devremove,
	procwstat,
};
.
557c
static long
.
513,518d
276c
static long
.
269c
static void
.
237,249c
static void
.
169c
static Chan*
.
163c
static void
.
146,152c
static int
.
135,140c
static Chan*
.
128c
static void
.
96c
	if(s >= nelem(procdir))
.
75c
static int
.
60d
## diffname port/devproc.c 1997/0408
## diff -e /n/emeliedump/1997/0327/sys/src/brazil/port/devproc.c /n/emeliedump/1997/0408/sys/src/brazil/port/devproc.c
621a
	'p',
	"proc",

.
## diffname port/devproc.c 1997/0516
## diff -e /n/emeliedump/1997/0408/sys/src/brazil/port/devproc.c /n/emeliedump/1997/0516/sys/src/brazil/port/devproc.c
50c
char *sname[]={ "Text", "Data", "Bss", "Stack", "Shared", "Phys", "Shdata", "Map" };
.
## diffname port/devproc.c 1997/1203
## diff -e /n/emeliedump/1997/0516/sys/src/brazil/port/devproc.c /n/emeliedump/1997/1203/sys/src/brazil/port/devproc.c
470c
		i = sprint(a, "%.*s %d ", NAMELEN, mw->cm->spec, mw->cm->flag);
.
## diffname port/devproc.c 1997/1206
## diff -e /n/emeliedump/1997/1203/sys/src/brazil/port/devproc.c /n/emeliedump/1997/1206/sys/src/brazil/port/devproc.c
568a
		if(p->dbgreg == 0)
			error(Enoreg);
.
363a
		if(rptr == 0)
			error(Enoreg);
.
## diffname port/devproc.c 1997/1208
## diff -e /n/emeliedump/1997/1206/sys/src/brazil/port/devproc.c /n/emeliedump/1997/1208/sys/src/brazil/port/devproc.c
891a
	poperror();
.
888c
		memmove(a, b, n);	/* This can fault */
.
884a
	if(waserror()) {
		s->steal--;
		kunmap(k);
		nexterror();
	}
.
## diffname port/devproc.c 1998/0310
## diff -e /n/emeliedump/1997/1208/sys/src/brazil/port/devproc.c /n/emeliedump/1998/0310/sys/src/brazil/port/devproc.c
485a
	case Qfd:
		return procfds(p->fgrp, va, n, offset);
.
244a
static int
procfds(Fgrp *f, char *va, int count, long offset)
{
	Chan *c;
	int n, i;

	n = 0;
	for(i = 0; i <= f->maxfd; i++) {
		c = f->fd[i];
		if(c == nil)
			continue;
		n += snprint(va+n, count-n, "%3d %.2s %.8lux.%.8d %8d ",
			i,
			&"r w rw"[(c->mode&3)<<1],
			c->qid.path, c->qid.vers,
			c->offset);
		n += ptpath(c->path, va+n, count-n);
		n += snprint(va+n, count-n, "\n");
		if(offset > 0) {
			offset -= n;
			if(offset < 0) {
				memmove(va, va+n+offset, -offset);
				n = -offset;
			}
			else
				n = 0;
		}
	}
	return n;
}

.
185a
	case Qfd:
.
62,63c
#define	QID(q)		(((q).path&0x0000001F)>>0)
#define	SLOT(q)		((((q).path&0x07FFFFFE0)>>QSHIFT)-1)
.
60c
#define	QSHIFT	5	/* location in qid of proc slot # */
.
32a
	"fd",		{Qfd},		0,			0000,
.
26a
	Qfd,
.
## diffname port/devproc.c 1998/0319
## diff -e /n/emeliedump/1998/0310/sys/src/brazil/port/devproc.c /n/emeliedump/1998/0319/sys/src/brazil/port/devproc.c
570a
	ulong offset = off;
.
566c
procwrite(Chan *c, void *va, long n, vlong off)
.
298a
	ulong offset = off;
.
287c
procread(Chan *c, void *va, long n, vlong off)
.
## diffname port/devproc.c 1998/0425
## diff -e /n/emeliedump/1998/0319/sys/src/brazil/port/devproc.c /n/emeliedump/1998/0425/sys/src/brazil/port/devproc.c
522c
		return procfds(p, va, n, offset);
.
275a
	unlock(f);
	qunlock(&p->debug);
	poperror();

.
253a
	f = p->fgrp;
	if(f == nil)
		return 0;
	if(waserror()){
		unlock(f);
		qunlock(&p->debug);
		nexterror();
	}

	qlock(&p->debug);
	lock(f);
.
250a
	Fgrp *f;
.
249c
procfds(Proc *p, char *va, int count, long offset)
.
## diffname port/devproc.c 1998/0512
## diff -e /n/emeliedump/1998/0425/sys/src/brazil/port/devproc.c /n/emeliedump/1998/0512/sys/src/brazil/port/devproc.c
932c
		panic("procctlmemio1");
.
929c
		panic("procctlmemio");
.
## diffname port/devproc.c 1998/0825
## diff -e /n/emeliedump/1998/0512/sys/src/brazil/port/devproc.c /n/emeliedump/1998/0825/sys/src/brazil/port/devproc.c
465c
			j += sprint(statbuf+j, "%-6s %c%c %.8lux %.8lux %4ld\n",
.
271c
		n += snprint(va+n, count-n, "%3d %.2s %.8lux.%.8lud %8lld ",
.
92c
		sprint(buf, "%lud", pid);
.
## diffname port/devproc.c 1998/1130
## diff -e /n/emeliedump/1998/0825/sys/src/brazil/port/devproc.c /n/emeliedump/1998/1130/sys/src/brazil/port/devproc.c
553c
	pg = p->pgrp;
.
545c
mntscan(Mntwalk *mw, Proc *p)
.
518c
		mntscan(mw, p);
.
74c
void	mntscan(Mntwalk*, Proc*);
.
41c
	"ns",		{Qns},		0,			0444,
.
## diffname port/devproc.c 1999/0108
## diff -e /n/emeliedump/1998/1130/sys/src/brazil/port/devproc.c /n/emeliedump/1999/0108/sys/src/brazil/port/devproc.c
987a
	qunlock(&p->seglock);
.
977a
	qlock(&p->seglock);
.
## diffname port/devproc.c 1999/0224
## diff -e /n/emeliedump/1999/0108/sys/src/brazil/port/devproc.c /n/emeliedump/1999/0224/sys/src/brazil/port/devproc.c
859c
		if(i > p->basepri && !iseve())
.
## diffname port/devproc.c 1999/0629
## diff -e /n/emeliedump/1999/0224/sys/src/brazil/port/devproc.c /n/emeliedump/1999/0629/sys/src/brazil/port/devproc.c
533,534c
		int2flag(mw->cm->flag, flag);
		if(strcmp(mw->cm->to->name->s, "#M") == 0){
			srv = srvname(mw->cm->to->mchan);
			i = snprint(a, n, "mount %s %s %s %.*s\n", flag,
				srv==nil? mw->cm->to->mchan->name->s : srv,
				mw->mh->from->name->s, NAMELEN, mw->cm->spec);
			free(srv);
		}else
			i = snprint(a, n, "bind %s %s %s\n", flag,
				mw->cm->to->name->s, mw->mh->from->name->s);
		return i;

.
521,531c
		mntscan(mw, p);
		if(mw->mh == 0){
			mw->cddone = 1;
			i = snprint(a, n, "cd %s\n", p->dot->name->s);
			return i;
.
518,519c
		if(mw->cddone)
.
314c
	char statbuf[NSEG*32], *srv, flag[10];
.
301a
static void
int2flag(int flag, char *s)
{
	if(flag == 0){
		*s = '\0';
		return;
	}
	*s++ = '-';
	if(flag & MAFTER)
		*s++ = 'a';
	if(flag & MBEFORE)
		*s++ = 'b';
	if(flag & MCREATE)
		*s++ = 'c';
	if(flag & MCACHE)
		*s++ = 'C';
	if(flag & MRECOV)
		*s++ = 'r';
	*s = '\0';
}

.
276c
		n += readstr(0, va+n, count-n, c->name->s);
.
273a
			devtab[c->type]->dc, c->dev,
.
271c
		n += snprint(va+n, count-n, "%3d %.2s %C %4ld %.8lux.%.8lud %8lld ",
.
266c
	n = readstr(0, va, count, p->dot->name->s);
	n += snprint(va+n, count-n, "\n");
.
27d
12a
	Qfd,
.
## diffname port/devproc.c 1999/0709
## diff -e /n/emeliedump/1999/0629/sys/src/brazil/port/devproc.c /n/emeliedump/1999/0709/sys/src/brazil/port/devproc.c
245a

	poperror();
	qunlock(&p->debug);
.
237a
	if(waserror()){
		qunlock(&p->debug);
		nexterror();
	}
	qlock(&p->debug);

.
224a
	/* make sure the process slot didn't get reallocated while we were playing */
	coherence();
	if(p->pid != pid)
		error(Eprocdied);

.
171c
	pid = PID(c->qid);
	if(p->pid != pid)
.
164a
	int pid;
.
## diffname port/devproc.c 1999/0711
## diff -e /n/emeliedump/1999/0709/sys/src/brazil/port/devproc.c /n/emeliedump/1999/0711/sys/src/brazil/port/devproc.c
910,911c
		procwired(p, i);
.
## diffname port/devproc.c 1999/0724
## diff -e /n/emeliedump/1999/0711/sys/src/brazil/port/devproc.c /n/emeliedump/1999/0724/sys/src/brazil/port/devproc.c
257a
	if(strcmp(d.uid, p->user) != 0){
		if(strcmp(up->user, eve) != 0)
			error(Eperm);
		else {
			strncpy(p->user, d.uid, sizeof(p->user));
			p->user[sizeof(p->user)-1] = 0;
		}
	}
.
## diffname port/devproc.c 1999/1104
## diff -e /n/emeliedump/1999/0724/sys/src/brazil/port/devproc.c /n/emeliedump/1999/1104/sys/src/9/port/devproc.c
898c
	if(strncmp(buf, "closefiles", 10) == 0)
.
844d
36c
	"kregs",	{Qkregs},	sizeof(Ureg),		0400,
.
## diffname port/devproc.c 1999/1105
## diff -e /n/emeliedump/1999/1104/sys/src/9/port/devproc.c /n/emeliedump/1999/1105/sys/src/9/port/devproc.c
344,345d
## diffname port/devproc.c 1999/1230
## diff -e /n/emeliedump/1999/1105/sys/src/9/port/devproc.c /n/emeliedump/1999/1230/sys/src/9/port/devproc.c
145,149d
84a
	if(s == DEVDOTDOT){
		c->qid.path = CHDIR;
		devdir(c, c->qid, "#p", 0, eve, 0555, dp);
		return 1;
	}

.
## diffname port/devproc.c 2000/0107
## diff -e /n/emeliedump/1999/1230/sys/src/9/port/devproc.c /n/emeliedump/2000/0107/sys/src/9/port/devproc.c
36c
	"kregs",	{Qkregs},	sizeof(Ureg),		0440,
.
## diffname port/devproc.c 2000/0108
## diff -e /n/emeliedump/2000/0107/sys/src/9/port/devproc.c /n/emeliedump/2000/0108/sys/src/9/port/devproc.c
377c
		if(offset+n >= palloc.cmembase && offset < palloc.cmemtop)
.
## diffname port/devproc.c 2000/0325
## diff -e /n/emeliedump/2000/0108/sys/src/9/port/devproc.c /n/emeliedump/2000/0325/sys/src/9/port/devproc.c
586a
		if(p->fgrp == nil)
			error(Ebadusefd);
.
562a
		if(p->pgrp == nil)
			error(Ebadusefd);
.
## diffname port/devproc.c 2000/0331
## diff -e /n/emeliedump/2000/0325/sys/src/9/port/devproc.c /n/emeliedump/2000/0331/sys/src/9/port/devproc.c
901a
		qunlock(&p->debug);
		poperror();
	}
.
900c
	if(strncmp(buf, "closefiles", 10) == 0){
		qlock(&p->debug);
		if(waserror()){
			qunlock(&p->debug);
			nexterror();
		}
		if(p->fgrp == nil)
			error(Eprocdied);
.
589,590d
583a
		qunlock(&p->debug);
		poperror();
.
571a
			qunlock(&p->debug);
			poperror();
.
567a
		}
.
566c
		if(mw->cddone){
			qunlock(&p->debug);
			poperror();
.
563,564c
		qlock(&p->debug);
		if(waserror()){
			qunlock(&p->debug);
			nexterror();
		}
		if(p->pgrp == nil || p->pid != PID(c->qid))
			error(Eprocdied);
.
289,290d
282a
	}
	lock(f);
.
281c
	if(f == nil){
		qunlock(&p->debug);
.
279a
	qlock(&p->debug);
.
233c
	tc = devopen(c, omode, 0, 0, procgen);
	qunlock(&p->debug);
	poperror();

	return tc;
.
212a
		pg = p->pgrp;
		if(pg == nil)
			error(Eprocdied);
.
184a
		qunlock(&p->debug);
		poperror();
.
172c
	qlock(&p->debug);
	if(waserror()){
		qunlock(&p->debug);
		nexterror();
	}
.
## diffname port/devproc.c 2000/0815
## diff -e /n/emeliedump/2000/0331/sys/src/9/port/devproc.c /n/emeliedump/2000/0815/sys/src/9/port/devproc.c
114a
	else	/* just copy read bits */
		perm |= p->procmode & 0444;
.
39c
	"noteid",	{Qnoteid},	0,			0664,
.
## diffname port/devproc.c 2001/0315
## diff -e /n/emeliedump/2000/0815/sys/src/9/port/devproc.c /n/emeliedump/2001/0315/sys/src/9/port/devproc.c
950a
		p->fixedpri = 0;
	}
	else
	if(strncmp(buf, "fixedpri", 8) == 0) {
		if(n < 9)
			error(Ebadctl);
		i = atoi(buf+9);
		if(i < 0)
			i = 0;
		if(i >= Nrq)
			i = Nrq - 1;
		if(i > p->basepri && !iseve())
			error(Eperm);
		p->basepri = i;
		p->fixedpri = 1;
.
## diffname port/devproc.c 2001/0317
## diff -e /n/emeliedump/2001/0315/sys/src/9/port/devproc.c /n/emeliedump/2001/0317/sys/src/9/port/devproc.c
927,938c
	if(strncmp(buf, "closefiles", 10) == 0)
		procctlclosefiles(p);
.
871a

	qunlock(&p->debug);
.
866a
			qlock(&p->debug);
.
865a
			qunlock(&p->debug);
.
858a
	qlock(&p->debug);
	f = p->fgrp;
	if(f == nil){
		qunlock(&p->debug);
		error(Eprocdied);
	}

.
857a
	Fgrp *f;
.
854c
procctlclosefiles(Proc *p)
.
## diffname port/devproc.c 2001/0319
## diff -e /n/emeliedump/2001/0317/sys/src/9/port/devproc.c /n/emeliedump/2001/0319/sys/src/9/port/devproc.c
882,883d
865d
862,863c
	if(f == nil)
.
860d
## diffname port/devproc.c 2001/0320
## diff -e /n/emeliedump/2001/0319/sys/src/9/port/devproc.c /n/emeliedump/2001/0320/sys/src/9/port/devproc.c
322,330c
		offset = procoffset(offset, va, &n);
.
309a
	offset = procoffset(offset, va, &n);
.
287a
static long
procoffset(long offset, char *va, int *np)
{
	if(offset > 0) {
		offset -= *np;
		if(offset < 0) {
			memmove(va, va+*np+offset, -offset);
			*np = -offset;
		}
		else
			*np = 0;
	}
	return offset;
}

.
## diffname port/devproc.c 2001/0408
## diff -e /n/emeliedump/2001/0320/sys/src/9/port/devproc.c /n/emeliedump/2001/0408/sys/src/9/port/devproc.c
260a
	nonone(p);
.
220a
		nonone(p);
.
211a
		nonone(p);
.
161a
/*
 *  none can't read or write state on other
 *  processes.  This is to contain access of
 *  servers running as none should they be
 *  subverted by, for example, a stack attack.
 */
static void
nonone(Proc *p)
{
	if(p == up)
		return;
	if(strcmp(up->user, "none") != 0)
		return;
	if(iseve())
		return;
	error(Eperm);
}

.
## diffname port/devproc.c 2001/0424
## diff -e /n/emeliedump/2001/0408/sys/src/9/port/devproc.c /n/emeliedump/2001/0424/sys/src/9/port/devproc.c
52c
char *sname[]={ "Text", "Data", "Bss", "Stack", "Shared", "Phys", "Shdata" };
.
## diffname port/devproc.c 2001/0425
## diff -e /n/emeliedump/2001/0424/sys/src/9/port/devproc.c /n/emeliedump/2001/0425/sys/src/9/port/devproc.c
52c
char *sname[]={ "Text", "Data", "Bss", "Stack", "Shared", "Phys" };
.
## diffname port/devproc.c 2001/0503
## diff -e /n/emeliedump/2001/0425/sys/src/9/port/devproc.c /n/emeliedump/2001/0503/sys/src/9/port/devproc.c
52c
static char *sname[]={ "Text", "Data", "Bss", "Stack", "Shared", "Phys" };
.
## diffname port/devproc.c 2001/0510
## diff -e /n/emeliedump/2001/0503/sys/src/9/port/devproc.c /n/emeliedump/2001/0510/sys/src/9/port/devproc.c
153c
	int s;
	int pid;

	if(c->qid.path == CHDIR && name[0] != '.'){
		/* this is a hack to speed walks through a large directory */
		pid = strtol(name, &name, 0);
		if(pid < 0 || *name != 0)
			return 0;
		s = procindex(pid);
		if(s < 0)
			return 0;
		c->qid = (Qid){CHDIR|((s+1)<<QSHIFT), pid};
		return 1;
	} else
		return devwalk(c, name, 0, 0, procgen);
.
## diffname port/devproc.c 2001/0511
## diff -e /n/emeliedump/2001/0510/sys/src/9/port/devproc.c /n/emeliedump/2001/0511/sys/src/9/port/devproc.c
430a
	case Qargs:
		j = procargs(p, statbuf, sizeof statbuf);
		if(offset >= j)
			return 0;
		if(offset+n > j)
			n = j-offset;
		memmove(a, &statbuf[offset], n);
		return n;

.
407a
static int
procargs(Proc *p, char *buf, int nbuf)
{
	int j, k, m;
	char *a;
	int n;

	a = p->args;
	n = p->nargs;	
	for(j = 0; j < nbuf - 1; j += m){
		if(n == 0)
			break;
		if(j != 0)
			buf[j++] = ' ';
		m = snprint(buf+j, nbuf-j, "%q",  a);
		k = strlen(a) + 1;
		a += k;
		n -= k;
	}
	return j;
}

.
235a
	case Qargs:
.
32a
	"args",	{Qargs},		0,			0440,
.
11a
	Qargs,
.
## diffname port/devproc.c 2001/0522
## diff -e /n/emeliedump/2001/0511/sys/src/9/port/devproc.c /n/emeliedump/2001/0522/sys/src/9/port/devproc.c
161c
		if(pid <= 0 || *name != 0)
.
13a
	Qargs,
.
12d
## diffname port/devproc.c 2001/0527
## diff -e /n/emeliedump/2001/0522/sys/src/9/port/devproc.c /n/emeliedump/2001/0527/sys/src/9/port/devproc.c
965,967c
	kstrcpy(buf, va, sizeof buf);
.
963c
	char buf[64];
.
843d
802c
		if(n >= ERRMAX-1)
.
748c
	if(c->qid.type & QTDIR)
.
744c
	char *a, buf[ERRMAX];
.
683c
				mw->mh->from->name->s, mw->cm->spec? mw->cm->spec : "");
.
681c
			i = snprint(a, n, "mount %s %s %s %s\n", flag,
.
678c
		int2flag(mw->cm->mflag, flag);
.
574,577c
		memmove(statbuf+0*KNAMELEN, p->text, strlen(p->text));
		memmove(statbuf+1*KNAMELEN, p->user, strlen(p->user));
		memmove(statbuf+2*KNAMELEN, sps, strlen(sps));
		j = 2*KNAMELEN + 12;
.
523c
			n = m;
.
520c
			m = strlen(p->note[0].msg) + 1;
			if(m > n)
				m = n;
			memmove(va, p->note[0].msg, m);
			((char*)va)[m-1] = '\0';
.
515c
		if(n < 1)	/* must accept at least the '\0' */
.
493a

.
462c
		memmove(a, &p->genbuf[offset], n);
.
457c
		j = procargs(p, p->genbuf, sizeof p->genbuf);
.
448c
	if(c->qid.type & QTDIR)
.
435a
	int m;
.
372c
			c->qid.path, w, c->qid.vers, c->qid.type,
.
368c
		ww = sprint(buf, "%lud", c->qid.vers);
		if(ww > w)
			w = ww;
	}
	for(i = 0; i <= f->maxfd; i++) {
		c = f->fd[i];
		if(c == nil)
			continue;
		n += snprint(va+n, count-n, "%3d %.2s %C %4ld (%.16llux %*lud %.2ux) %8lld ",
.
363a
	/* compute width of qid.path */
	w = 0;
.
346c
	int n, i, w, ww;
	char buf[32];
.
325a

.
323a
	return n;
.
320d
318a
		p->procmode = d->mode&0777;
.
311,317c
	d = smalloc(sizeof(Dir)+n);
	n = convM2D(db, n, &d[0], (char*)&d[1]);
	if(n > 0){
		if(strcmp(d->uid, "") != 0 && strcmp(d->uid, p->user) != 0){
			if(strcmp(up->user, eve) != 0)
				error(Eperm);
			else
				kstrdup(&p->user, d->uid);
.
294c
	if(c->qid.type&QTDIR)
.
292c
	Dir *d;
.
288,289c
static int
procwstat(Chan *c, uchar *db, int n)
.
204c
	if(c->qid.type & QTDIR)
.
175c
	return devstat(c, db, n, 0, 0, procgen);
.
172,173c
static int
procstat(Chan *c, uchar *db, int n)
.
155,169c
	return devwalk(c, nc, name, nname, 0, 0, procgen);
.
152,153c
static Walkqid*
procwalk(Chan *c, Chan *nc, char **name, int nname)
.
134c
	mkqid(&qid, path|tab->qid.path, c->qid.vers, QTFILE);
.
111c
	path = c->qid.path&~(((1<<QSHIFT)-1));	/* slot component */
.
100,102c
		sprint(up->genbuf, "%lud", pid);
		mkqid(&qid, (s+1)<<QSHIFT, pid, QTDIR);
		devdir(c, qid, up->genbuf, 0, p->user, DMDIR|0555, dp);
.
93,95c
	if(c->qid.path == Qdir){
		if(name != nil){
			/* ignore s and use name to find pid */
			pid = strtol(name, &name, 0);
			if(pid==0 || name[0]!='\0')
				return -1;
			s = procindex(pid);
			if(s < 0)
				return -1;
		}else
			if(s >= conf.nproc)
				return -1;
.
88,89c
		mkqid(&qid, Qdir, 0, QTDIR);
		devdir(c, qid, "#p", 0, eve, 0555, dp);
.
84d
79c
procgen(Chan *c, char *name, Dirtab *tab, int, int s, Dir *dp)
.
66,67c
#define	QID(q)		((((ulong)(q).path)&0x0000001F)>>0)
#define	SLOT(q)		(((((ulong)(q).path)&0x07FFFFFE0)>>QSHIFT)-1)
.
54c
static char *sname[]={ "Text", "Data", "Bss", "Stack", "Shared", "Phys", };
.
38c
	"kregs",	{Qkregs},	sizeof(Ureg),		0400,
.
36c
	"fd",		{Qfd},		0,			0444,
.
31c
#define	STATSIZE	(2*KNAMELEN+12+9*12)
/*
 * Status, fd, and ns are left fully readable (0444) because of their use in debugging,
 * particularly on shared servers.
 * Arguably, ns and fd shouldn't be readable; if you'd prefer, change them to 0000
 */
.
13a
	Qctl,
.
11d
## diffname port/devproc.c 2001/0717
## diff -e /n/emeliedump/2001/0527/sys/src/9/port/devproc.c /n/emeliedump/2001/0717/sys/src/9/port/devproc.c
982a
	if(p->kp)	/* no ctl requests to kprocs */
		error(Eperm);

.
## diffname port/devproc.c 2001/0803
## diff -e /n/emeliedump/2001/0717/sys/src/9/port/devproc.c /n/emeliedump/2001/0803/sys/src/9/port/devproc.c
1032a
	if(strncmp(buf, "close", 5) == 0){
		if(n < 6)
			error(Ebadctl);
		procctlclosefiles(p, 0, atoi(buf+6));
	}else
.
1031c
		procctlclosefiles(p, 1, 0);
.
961,971c
	if(all)
		for(i = 0; i < f->maxfd; i++)
			procctlcloseone(p, f, i);
	else
		procctlcloseone(p, f, fd);
.
952d
949c
procctlclosefiles(Proc *p, int all, int fd)
.
947a
static void
procctlcloseone(Proc *p, Fgrp *f, int fd)
{
	Chan *c;

	c = f->fd[fd];
	if(c == nil)
		return;
	f->fd[fd] = nil;
	unlock(f);
	qunlock(&p->debug);
	cclose(c);
	qlock(&p->debug);
	lock(f);
}

.
381,388c
		n += procfdprint(c, i, w, va+n, count-n);
.
373c
		ww = procqidwidth(c);
.
349d
343a
procqidwidth(Chan *c)
{
	char buf[32];

	return sprint(buf, "%lud", c->qid.vers);
}

int
procfdprint(Chan *c, int fd, int w, char *s, int ns)
{
	int n;

	if(w == 0)
		w = procqidwidth(c);
	n = snprint(s, ns, "%3d %.2s %C %4ld (%.16llux %*lud %.2ux) %5ld %8lld %s\n",
		fd,
		&"r w rw"[(c->mode&3)<<1],
		devtab[c->type]->dc, c->dev,
		c->qid.path, w, c->qid.vers, c->qid.type,
		c->iounit, c->offset, c->name->s);
	return n;
}

static int
.
## diffname port/devproc.c 2001/0819
## diff -e /n/emeliedump/2001/0803/sys/src/9/port/devproc.c /n/emeliedump/2001/0819/sys/src/9/port/devproc.c
689c
		return n;
.
687c
		n = snprint(a, n, "%d %lud %lud %lud %q",
			wq->w.pid,
			wq->w.time[TUser], wq->w.time[TSys], wq->w.time[TReal],
			wq->w.msg);
.
656,658d
136c
		len = p->nwait;	/* incorrect size, but >0 means there's something to read */
.
## diffname port/devproc.c 2001/0831
## diff -e /n/emeliedump/2001/0819/sys/src/9/port/devproc.c /n/emeliedump/2001/0831/sys/src/9/port/devproc.c
322a
	free(d);
.
298a
		free(d);
.
297a
	d = nil;
.
## diffname port/devproc.c 2001/1003
## diff -e /n/emeliedump/2001/0831/sys/src/9/port/devproc.c /n/emeliedump/2001/1003/sys/src/9/port/devproc.c
946c
	if(procstopped(p) || p->state == Broken)
.
## diffname port/devproc.c 2001/1017
## diff -e /n/emeliedump/2001/1003/sys/src/9/port/devproc.c /n/emeliedump/2001/1017/sys/src/9/port/devproc.c
113a
		/*
		 * String comparison is done in devwalk so name must match its formatted pid
		*/
		if(name != nil && strcmp(name, up->genbuf) != 0)
			return -1;
.
100,101c
			pid = strtol(name, &ename, 10);
			if(pid==0 || ename[0]!='\0')
.
87a
	char *ename;
.
## diffname port/devproc.c 2001/1106
## diff -e /n/emeliedump/2001/1017/sys/src/9/port/devproc.c /n/emeliedump/2001/1106/sys/src/9/port/devproc.c
328a
	if(d->mode != ~0UL)
		p->procmode = d->mode&0777;
.
320,327c
	if(n == 0)
		error(Eshortstat);
	if(!emptystr(d->uid) && strcmp(d->uid, p->user) != 0){
		if(strcmp(up->user, eve) != 0)
			error(Eperm);
		else
			kstrdup(&p->user, d->uid);
.
## diffname port/devproc.c 2001/1117
## diff -e /n/emeliedump/2001/1106/sys/src/9/port/devproc.c /n/emeliedump/2001/1117/sys/src/9/port/devproc.c
1072a
	if(strncmp(buf, "private", 7) == 0)
		p->privatemem = 1;
	else
.
520a
		/* conf.base* and conf.npage* are set by xinit to refer to kernel allocation, not user pages */
.
510,514c
		/* validate kernel addresses */
.
247d
242a
	case Qmem:
		if(p->privatemem)
			error(Eperm);
		/* fall through */
.
## diffname port/devproc.c 2001/1118
## diff -e /n/emeliedump/2001/1117/sys/src/9/port/devproc.c /n/emeliedump/2001/1118/sys/src/9/port/devproc.c
1122,1123c

	poperror();
	free(cb);
.
1120a
		break;
	case PCstart:
		if(p->state != Stopped)
			error(Ebadctl);
		ready(p);
		break;
	case PCstartstop:
		if(p->state != Stopped)
			error(Ebadctl);
		p->procctl = Proc_traceme;
		ready(p);
		procstopwait(p, Proc_traceme);
		break;
	case PCstop:
		procstopwait(p, Proc_stopme);
		break;
	case PCwaitstop:
		procstopwait(p, 0);
		break;
	case PCwired:
		procwired(p, atoi(cb->f[1]));
		break;
.
1088,1111c
		break;
	case PCprivate:
		p->privatemem = 1;
		break;
	case PCprofile:
.
1047,1079c
		break;
	case PCpri:
		i = atoi(cb->f[1]);
.
1040,1045c
		break;
	case PCnohang:
.
1023,1026c
	if(cb->nf <= 0)
		error(Ebadctl);

	ct = lookupcmd(cb, proccmd, nelem(proccmd));

	switch(ct->index){
	case PCclose:
		procctlclosefiles(p, 0, atoi(cb->f[1]));
		break;
	case PCclosefiles:
		procctlclosefiles(p, 1, 0);
		break;
	case PCfixedpri:
		i = atoi(cb->f[1]);
		if(i < 0)
			i = 0;
		if(i >= Nrq)
			i = Nrq - 1;
		if(i > p->basepri && !iseve())
			error(Eperm);
		p->basepri = i;
		p->fixedpri = 1;
		break;
	case PChang:
		p->hang = 1;
		break;
	case PCkill:
.
1021c
	cb = parsecmd(va, n);
	if(waserror()){
		free(cb);
		nexterror();
	}
.
1016c
	Cmdbuf *cb;
	Cmdtab *ct;
.
57a
Cmdtab proccmd[] = {
	PCclose,		"close",		2,
	PCclosefiles,	"closefiles",	1,
	PCfixedpri,	"fixedpri",		2,
	PChang,		"hang",		1,
	PCnohang,	"nohang",		1,
	PCkill,		"kill",		1,
	PCpri,		"pri",			2,
	PCprivate,		"private",		1,
	PCprofile,		"profile",		1,
	PCstart,		"start",		1,
	PCstartstop,	"startstop",	1,
	PCstop,		"stop",		1,
	PCwaitstop,	"waitstop",	1,
	PCwired,		"wired",		2,
};

.
30a
enum
{
	PCclose,
	PCclosefiles,
	PCfixedpri,
	PChang,
	PCkill,
	PCnohang,
	PCpri,
	PCprivate,
	PCprofile,
	PCstart,
	PCstartstop,
	PCstop,
	PCwaitstop,
	PCwired,
};

.
## diffname port/devproc.c 2001/1119
## diff -e /n/emeliedump/2001/1118/sys/src/9/port/devproc.c /n/emeliedump/2001/1119/sys/src/9/port/devproc.c
1150c
	case CMwired:
.
1147c
	case CMwaitstop:
.
1144c
	case CMstop:
.
1137c
	case CMstartstop:
.
1132c
	case CMstart:
.
1121c
	case CMprofile:
.
1118c
	case CMprivate:
.
1107c
	case CMpri:
.
1104c
	case CMnohang:
.
1089c
	case CMkill:
.
1086c
	case CMhang:
.
1075c
	case CMfixedpri:
.
1072c
	case CMclosefiles:
.
1069c
	case CMclose:
.
77,90c
	CMclose,		"close",		2,
	CMclosefiles,	"closefiles",	1,
	CMfixedpri,	"fixedpri",		2,
	CMhang,		"hang",		1,
	CMnohang,	"nohang",		1,
	CMkill,		"kill",		1,
	CMpri,		"pri",			2,
	CMprivate,	"private",		1,
	CMprofile,	"profile",		1,
	CMstart,		"start",		1,
	CMstartstop,	"startstop",	1,
	CMstop,		"stop",		1,
	CMwaitstop,	"waitstop",	1,
	CMwired,		"wired",		2,
.
33,46c
	CMclose,
	CMclosefiles,
	CMfixedpri,
	CMhang,
	CMkill,
	CMnohang,
	CMpri,
	CMprivate,
	CMprofile,
	CMstart,
	CMstartstop,
	CMstop,
	CMwaitstop,
	CMwired,
.
## diffname port/devproc.c 2001/1120
## diff -e /n/emeliedump/2001/1119/sys/src/9/port/devproc.c /n/emeliedump/2001/1120/sys/src/9/port/devproc.c
1062,1064d
75a
static
.
## diffname port/devproc.c 2002/0109
## diff -e /n/emeliedump/2001/1120/sys/src/9/port/devproc.c /n/emeliedump/2002/0109/sys/src/9/port/devproc.c
922a
	devshutdown,
.
## diffname port/devproc.c 2002/0201
## diff -e /n/emeliedump/2002/0109/sys/src/9/port/devproc.c /n/emeliedump/2002/0201/sys/src/9/port/devproc.c
284,285d
279a
	case Qnote:
	case Qctl:
.
## diffname port/devproc.c 2002/0421
## diff -e /n/emeliedump/2002/0201/sys/src/9/port/devproc.c /n/emeliedump/2002/0421/sys/src/9/port/devproc.c
458a

	/* copy result to user space, now that locks are released */
	memmove(va, buf, n);
.
453,454c
		n += procfdprint(c, i, w, a+n, count-n);
		offset = procoffset(offset, a, &n);
.
436,438c
	n = readstr(0, a, count, p->dot->name->s);
	n += snprint(a+n, count-n, "\n");
	offset = procoffset(offset, a, &n);
.
422a
	/* print to buf to avoid holding fgrp lock while writing to user space */
	if(count > sizeof buf)
		count = sizeof buf;
	a = buf;

.
421a
	char *a;
.
420a
	char buf[256];
.
## diffname port/devproc.c 2002/0430
## diff -e /n/emeliedump/2002/0421/sys/src/9/port/devproc.c /n/emeliedump/2002/0430/sys/src/9/port/devproc.c
558a
		if(!iseve())
			error(Eperm);

.
## diffname port/devproc.c 2002/0502
## diff -e /n/emeliedump/2002/0430/sys/src/9/port/devproc.c /n/emeliedump/2002/0502/sys/src/9/port/devproc.c
1117a
		break;
	case CMnoswap:
		p->noswap = 1;
.
82a
	CMnoswap,	"noswap",		1,
.
38a
	CMnoswap,
.
## diffname port/devproc.c 2002/1025
## diff -e /n/emeliedump/2002/0502/sys/src/9/port/devproc.c /n/emeliedump/2002/1025/sys/src/9/port/devproc.c
93c
	CMwired,	"wired",	2,
.
86,89c
	CMpri,		"pri",		2,
	CMprivate,	"private",	1,
	CMprofile,	"profile",	1,
	CMstart,	"start",	1,
.
83,84c
	CMnohang,	"nohang",	1,
	CMnoswap,	"noswap",	1,
.
81c
	CMfixedpri,	"fixedpri",	2,
.
79c
	CMclose,	"close",	2,
.
58c
	"args",		{Qargs},	0,			0440,
.
## diffname port/devproc.c 2002/1026
## diff -e /n/emeliedump/2002/1025/sys/src/9/port/devproc.c /n/emeliedump/2002/1026/sys/src/9/port/devproc.c
865a
	case Qargs:
		if(n == 0)
			error(Eshort);
		if(n >= ERRMAX)
			error(Etoobig);
		arg = malloc(n+1);
		if(arg == nil)
			error(Enomem);
		memmove(arg, va, n);
		m = n;
		if(arg[m-1] != 0)
			arg[m++] = 0;
		free(p->args);
		p->nargs = m;
		p->args = arg;
		break;

.
840c
	char *a, *arg, buf[ERRMAX];
.
838c
	int id, m;
.
548a
		qunlock(&p->debug);
.
547a
		qlock(&p->debug);
.
511c
		if(n <= 0)
.
58c
	"args",	{Qargs},		0,			0660,
.
## diffname port/devproc.c 2002/1029
## diff -e /n/emeliedump/2002/1026/sys/src/9/port/devproc.c /n/emeliedump/2002/1029/sys/src/9/port/devproc.c
58c
	"args",		{Qargs},	0,			0660,
.
## diffname port/devproc.c 2002/1104
## diff -e /n/emeliedump/2002/1029/sys/src/9/port/devproc.c /n/emeliedump/2002/1104/sys/src/9/port/devproc.c
882a
		p->setargs = 1;
.
509c
	if(p->setargs){
		snprint(buf, nbuf, "%s [%s]", p->text, p->args);
		return strlen(buf);
	}
	n = p->nargs;
.
## diffname port/devproc.c 2003/0214
## diff -e /n/emeliedump/2002/1104/sys/src/9/port/devproc.c /n/emeliedump/2003/0214/sys/src/9/port/devproc.c
1192a
		break;
	case CMfair:
		if(!iseve())
			error(Eperm);
		unfair = 0;
		break;
	case CMunfair:
		if(!iseve())
			error(Eperm);
		unfair = 1;
.
120a
extern int unfair;

.
93a
	CMfair,	"fair",	1,
	CMunfair,	"unfair",	1,
.
47a
	CMfair,
	CMunfair,
.
## diffname port/devproc.c 2003/0226
## diff -e /n/emeliedump/2003/0214/sys/src/9/port/devproc.c /n/emeliedump/2003/0226/sys/src/9/port/devproc.c
1200,1209d
## diffname port/devproc.c 2003/0228
## diff -e /n/emeliedump/2003/0226/sys/src/9/port/devproc.c /n/emeliedump/2003/0228/sys/src/9/port/devproc.c
1162,1163c
		procpriority(p, pri, 0);
		break;
	case CMfixedpri:
		if(!iseve())
			error(Eperm);
		procpriority(p, atoi(cb->f[1]), 1);
.
1155,1160c
		pri = atoi(cb->f[1]);
		if(pri > PriNormal && !iseve())
.
1119,1129d
1097c
	int npc, pri;
.
## diffname port/devproc.c 2003/0316
## diff -e /n/emeliedump/2003/0228/sys/src/9/port/devproc.c /n/emeliedump/2003/0316/sys/src/9/port/devproc.c
1152c
		procpriority(p, pri, 1);
.
1150c
		pri = atoi(cb->f[1]);
		if(pri > PriNormal && !iseve())
.

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.