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

1990/11211/gnot/devenv.c (diff list | history)

1990/0802/sys/src/9/gnot/devenv.c:155,1611990/11211/sys/src/9/gnot/devenv.c:155,161 (short | long | prev | next)
1990/03091    
	envalloc.vfree = p1; 
	if(envalloc.end-envalloc.vfree < n){ 
		print("env compact failed\n"); 
		error(0, Enoenv); 
1990/11211    
		error(Enoenv); 
1990/03091    
	} 
} 
 
1990/0802/sys/src/9/gnot/devenv.c:173,1791990/11211/sys/src/9/gnot/devenv.c:173,179
1990/03091    
	ne = envalloc.efree; 
	if(!ne){ 
		print("out of envs\n"); 
		error(0, Enoenv); 
1990/11211    
		error(Enoenv); 
1990/03091    
	} 
	envalloc.efree = ne->next; 
	lock(ne); 
1990/0802/sys/src/9/gnot/devenv.c:224,2301990/11211/sys/src/9/gnot/devenv.c:224,230
1990/03091    
			ans = 0; 
		else{ 
			lock(e); 
			devdir(c, s+1, e->name, e->val? e->val->len : 0, 0666, dp); 
1990/11211    
			devdir(c, (Qid){s+1,0}, e->name, e->val? e->val->len : 0, 0666, dp); 
1990/03091    
			unlock(e); 
			ans = 1; 
		} 
1990/0802/sys/src/9/gnot/devenv.c:244,2531990/11211/sys/src/9/gnot/devenv.c:244,253
1990/03091    
{ 
	Pgrp *pg; 
 
	if(!(c->qid&CHDIR)){ 
1990/11211    
	if(!(c->qid.path&CHDIR)){ 
1990/03091    
		pg = u->p->pgrp; 
		lock(pg); 
		pg->etab[c->qid-1].chref++; 
1990/11211    
		pg->etab[c->qid.path-1].chref++; 
1990/03091    
		unlock(pg); 
	} 
	return devclone(c, nc); 
1990/0802/sys/src/9/gnot/devenv.c:259,2681990/11211/sys/src/9/gnot/devenv.c:259,268
1990/03091    
	Pgrp *pg; 
 
	if(devwalk(c, name, 0, 0, envgen)){ 
		if(!(c->qid&CHDIR)){ 
1990/11211    
		if(!(c->qid.path&CHDIR)){ 
1990/03091    
			pg = u->p->pgrp; 
			lock(pg); 
			pg->etab[c->qid-1].chref++; 
1990/11211    
			pg->etab[c->qid.path-1].chref++; 
1990/03091    
			unlock(pg); 
			return 1; 
		} 
1990/0802/sys/src/9/gnot/devenv.c:284,2981990/11211/sys/src/9/gnot/devenv.c:284,298
1990/03091    
	Pgrp *pg; 
 
	if(omode & (OWRITE|OTRUNC)){ 
		if(c->qid & CHDIR) 
			error(0, Eperm); 
1990/11211    
		if(c->qid.path & CHDIR) 
			error(Eperm); 
1990/03091    
		pg = u->p->pgrp; 
		lock(pg); 
		ep = &pg->etab[c->qid-1]; 
1990/11211    
		ep = &pg->etab[c->qid.path-1]; 
1990/03091    
		e = ep->env; 
		if(!e){ 
			unlock(pg); 
			error(0, Egreg); 
1990/11211    
			error(Egreg); 
1990/03091    
		} 
		lock(&envalloc); 
		lock(e); 
1990/0802/sys/src/9/gnot/devenv.c:333,3401990/11211/sys/src/9/gnot/devenv.c:333,340
1990/03091    
	Pgrp *pg; 
	int i; 
 
	if(c->qid != CHDIR) 
		error(0, Eperm); 
1990/11211    
	if(c->qid.path != CHDIR) 
		error(Eperm); 
1990/03091    
	pg = u->p->pgrp; 
	lock(pg); 
	lock(&envalloc); 
1990/0802/sys/src/9/gnot/devenv.c:346,3521990/11211/sys/src/9/gnot/devenv.c:346,352
1990/03091    
	e = envalloc.efree; 
	if(e == 0){ 
		print("out of envs\n"); 
		error(0,Enoenv); 
1990/11211    
		error(Enoenv); 
1990/03091    
	} 
	envalloc.efree = e->next; 
	e->next = 0; 
1990/0802/sys/src/9/gnot/devenv.c:358,3681990/11211/sys/src/9/gnot/devenv.c:358,368
1990/03091    
				break; 
		if(i == pg->nenv){ 
			print("out of pgroup envs\n"); 
			error(0, Enoenv); 
1990/11211    
			error(Enoenv); 
1990/03091    
		} 
	}else 
		i = pg->nenv++; 
	c->qid = i+1; 
1990/11211    
	c->qid.path = i+1; 
1990/03091    
	pg->etab[i].env = e; 
	pg->etab[i].chref = 1; 
	unlock(&envalloc); 
1990/0802/sys/src/9/gnot/devenv.c:380,3941990/11211/sys/src/9/gnot/devenv.c:380,394
1990/03091    
	Envp *ep; 
	Pgrp *pg; 
 
	if(c->qid & CHDIR) 
		error(0, Eperm); 
1990/11211    
	if(c->qid.path & CHDIR) 
		error(Eperm); 
1990/03091    
	pg = u->p->pgrp; 
	lock(pg); 
	ep = &pg->etab[c->qid-1]; 
1990/11211    
	ep = &pg->etab[c->qid.path-1]; 
1990/03091    
	e = ep->env; 
	if(!e){ 
		unlock(pg); 
		error(0, Enonexist); 
1990/11211    
		error(Enonexist); 
1990/03091    
	} 
	ep->env = 0; 
	ep->chref--; 
1990/0802/sys/src/9/gnot/devenv.c:401,4071990/11211/sys/src/9/gnot/devenv.c:401,407
1990/03091    
{	int dumpenv(void); 
	dumpenv();  /*DEBUG*/ 
	print("envwstat\n"); 
	error(0, Egreg); 
1990/11211    
	error(Egreg); 
1990/03091    
} 
 
void 
1990/0802/sys/src/9/gnot/devenv.c:409,4191990/11211/sys/src/9/gnot/devenv.c:409,419
1990/03091    
{ 
	Pgrp *pg; 
 
	if(c->qid & CHDIR) 
1990/11211    
	if(c->qid.path & CHDIR) 
1990/03091    
		return; 
	pg = u->p->pgrp; 
	lock(pg); 
	pg->etab[c->qid-1].chref--; 
1990/11211    
	pg->etab[c->qid.path-1].chref--; 
1990/03091    
	unlock(pg); 
} 
 
1990/0802/sys/src/9/gnot/devenv.c:444,4571990/11211/sys/src/9/gnot/devenv.c:444,457
1990/03091    
	Pgrp *pg; 
	char *a = va; 
 
	if(c->qid & CHDIR) 
1990/11211    
	if(c->qid.path & CHDIR) 
1990/03091    
		return devdirread(c, a, n, 0, 0, envgen); 
	pg = u->p->pgrp; 
	lock(pg); 
	e = pg->etab[c->qid-1].env; 
1990/11211    
	e = pg->etab[c->qid.path-1].env; 
1990/03091    
	if(!e){ 
		unlock(pg); 
		error(0, Eio); 
1990/11211    
		error(Eio); 
1990/03091    
	} 
	lock(e); 
	ev = e->val; 
1990/0802/sys/src/9/gnot/devenv.c:481,4901990/11211/sys/src/9/gnot/devenv.c:481,490
1990/03091    
		return 0; 
	pg = u->p->pgrp; 
	lock(pg); 
	e = pg->etab[c->qid-1].env; /* caller checks for CHDIR */ 
1990/11211    
	e = pg->etab[c->qid.path-1].env; /* caller checks for CHDIR */ 
1990/03091    
	if(!e){ 
		unlock(pg); 
		error(0, Eio); 
1990/11211    
		error(Eio); 
1990/03091    
	} 
	lock(&envalloc); 
	lock(e); 
1990/0802/sys/src/9/gnot/devenv.c:500,5061990/11211/sys/src/9/gnot/devenv.c:500,506
1990/03091    
	ev = e->val; 
	vn = ev? ev->len : 0; 
	if(c->offset > vn) 
		error(0, Egreg); /* perhaps should zero fill */ 
1990/11211    
		error(Egreg); /* perhaps should zero fill */ 
1990/03091    
	memcpy(ev->dat+c->offset, a, n); 
	e->val->len = c->offset+n; 
	poperror(); 
1990/0802/sys/src/9/gnot/devenv.c:543,5581990/11211/sys/src/9/gnot/devenv.c:543,545
1990/03091    
			i += ev->n*sizeof(Envval); 
	print(" %d free enval chars\n", i+((char *)envalloc.end-(char*)envalloc.vfree)); 
} 
                 
void 
envuserstr(Error *e, char *buf) 
{ 
	consuserstr(e, buf); 
} 
                 
void 
enverrstr(Error *e, char *buf) 
{ 
	rooterrstr(e, buf); 
} 
                 


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