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

1990/11161/port/devpipe.c (diff list | history)

1990/1115/sys/src/9/port/devpipe.c:179,1841990/11161/sys/src/9/port/devpipe.c:179,191 (short | long | prev | next)
1990/1009    
		 */ 
		if(streamenter(local)<0) 
			panic("pipeattach"); 
1990/11161    
	} else { 
		/* 
		 *  increment the inuse count of the other 
		 *  stream 
		 */ 
		if(streamenter(local->devq->ptr)<0) 
			panic("pipeattach2"); 
1990/1009    
	} 
	unlock(p); 
	poperror(); 
1990/1115/sys/src/9/port/devpipe.c:208,2261990/11161/sys/src/9/port/devpipe.c:215,220
1990/0227    
} 
 
void 
1990/1115    
pipeexit(Pipe *p) 
{ 
	if(decref(p) < 0) 
		panic("pipeexit"); 
	if(p->ref == 0){ 
		lock(&pipealloc); 
		p->next = pipealloc.free; 
		pipealloc.free = p; 
		unlock(&pipealloc); 
	} 
} 
                 
void 
1990/0227    
pipeclose(Chan *c) 
{ 
1990/1009    
	Stream *remote; 
1990/1115/sys/src/9/port/devpipe.c:228,2381990/11161/sys/src/9/port/devpipe.c:222,227
1990/1009    
	Pipe *p; 
1990/0629    
 
1990/1009    
	p = &pipealloc.pipe[STREAMID(c->qid)/2]; 
1990/1115    
	lock(p); 
	if(waserror()){ 
		unlock(p); 
		nexterror(); 
	} 
1990/0629    
 
1990/1009    
	/* 
1990/1011    
	 *  take care of associated streams 
1990/1115/sys/src/9/port/devpipe.c:242,2501990/11161/sys/src/9/port/devpipe.c:231,248
1990/1009    
		streamclose(c);		/* close this stream */ 
		streamexit(remote, 0);	/* release stream for other half of pipe */ 
1990/0629    
	} 
1990/1104    
	unlock(p); 
1990/1115    
	poperror(); 
	pipeexit(p); 
1990/11161    
 
	/* 
	 *  free the structure 
	 */ 
	if(decref(p) == 0){ 
		lock(&pipealloc); 
		p->next = pipealloc.free; 
		pipealloc.free = p; 
		unlock(&pipealloc); 
	} 
	if(p->ref < 0) 
		panic("pipeexit"); 
1990/0227    
} 
 
long 


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