plan 9 kernel history: overview | file list | diff list

1992/0428/port/devproc.c (diff list | history)

1992/0423/sys/src/9/port/devproc.c:42,581992/0428/sys/src/9/port/devproc.c:42,59 (short | long | prev | next)
1990/1128    
 *	23 bits of process slot number + 1 
1990/11211    
 *	     in vers, 
 *	32 bits of pid, for consistency checking 
 * If notepg, c->pgrpid.path is pgrp slot, .vers is pgrpid. 
1992/0428    
 * If notepg, c->pgrpid.path is pgrp slot, .vers is noteid. 
1990/0227    
 */ 
#define	NPROC	(sizeof procdir/sizeof(Dirtab)) 
#define	QSHIFT	4	/* location in qid of proc slot # */ 
1990/11211    
#define	QID(q)	(((q).path&0x0000000F)>>0) 
1990/1128    
#define	SLOT(q)	((((q).path&0x07FFFFFF0)>>QSHIFT)-1) 
1990/11211    
#define	PID(q)	((q).vers) 
1990/0227    
 
1992/0428    
#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) 
 
1991/1109    
void	procctlreq(Proc*, char*, int); 
int	procctlmemio(Proc*, ulong, int, void*, int); 
1991/1110    
Chan   *procctlnotepg(Chan*, void*, int); 
Chan   *proctext(Chan*, Proc*); 
Segment *txt2data(Proc*, Segment*); 
int	procstopped(void*); 
1992/0423/sys/src/9/port/devproc.c:171,1771992/0428/sys/src/9/port/devproc.c:172,178
1990/1115    
		if(omode!=OWRITE || pg->pgrpid==1)	/* easy to do by mistake */ 
1990/11211    
			error(Eperm); 
		c->pgrpid.path = pg->index+1; 
		c->pgrpid.vers = pg->pgrpid; 
1992/0428    
		c->pgrpid.vers = p->noteid; 
1990/1110    
		break; 
1990/0227    
	default: 
1992/0114    
		pprint("procopen %lux\n", c->qid); 
1992/0423/sys/src/9/port/devproc.c:386,3941992/0428/sys/src/9/port/devproc.c:387,395
1990/1110    
 
1990/1126    
	p = proctab(SLOT(c->qid)); 
1991/1109    
 
	/* Use the remembered pgrp id in the channel rather than the process pgrpid */ 
1990/1110    
	if(QID(c->qid) == Qnotepg){ 
1991/1109    
		procctlnotepg(c, va, n); 
1992/0428    
	/* Use the remembered noteid in the channel rather than the process pgrpid */ 
	if(QID(c->qid) == Qnotepg) { 
		pgrpnote(NOTEID(c->pgrpid), va, n, NUser); 
1990/1110    
		return n; 
	} 
 
1992/0423/sys/src/9/port/devproc.c:507,5321992/0428/sys/src/9/port/devproc.c:508,513
1991/1110    
	poperror(); 
 
	return tc; 
} 
                 
Chan * 
1991/1109    
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 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)