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

1990/0331/port/stream.c (diff list | history)

1990/03292/sys/src/9/port/stream.c:62,671990/0331/sys/src/9/port/stream.c:62,89 (short | long | prev | next)
1990/0227    
}; 
 
/* 
1990/0331    
 *  Dump all block information of how many blocks are in which queues 
 */ 
void 
dumpqueues(void) 
{ 
	Queue *q; 
	int count; 
	Block *bp; 
 
	for(q = qlist; q < qlist + conf.nqueue; q++, q++){ 
		if(!(q->flag & QINUSE)) 
			continue; 
		for(count = 0, bp = q->first; bp; bp = bp->next) 
			count++; 
		print("%s %ux  RD count %d len %d", q->info->name, q, count, q->len); 
		for(count = 0, bp = WR(q)->first; bp; bp = bp->next) 
			count++; 
		print("  WR count %d len %d\n", count, WR(q)->len); 
	} 
} 
 
/* 
1990/0227    
 *  Allocate streams, queues, and blocks.  Allocate n block classes with 
 *	1/2(m+1) to class m < n-1 
 *	1/2(n-1) to class n-1 
1990/03292/sys/src/9/port/stream.c:123,1301990/0331/sys/src/9/port/stream.c:145,155
1990/0227    
	lock(bcp); 
	while(bcp->first == 0){ 
		unlock(bcp); 
1990/0322    
		if(loop++ > 10) 
1990/0331    
		if(loop++ > 10){ 
			dumpqueues(); 
			dumpstack(); 
1990/03292    
			panic("waiting for blocks\n"); 
1990/0331    
		} 
1990/03292    
		qlock(bcp); 
1990/0322    
		tsleep(&bcp->r, isblock, (void *)bcp, 250); 
1990/03292    
		qunlock(bcp); 
1990/03292/sys/src/9/port/stream.c:614,6191990/0331/sys/src/9/port/stream.c:639,645
1990/0227    
 	 *  hang a device and process q off the stream 
	 */ 
	s->inuse = 1; 
1990/0331    
	s->hread = 0; 
1990/0227    
	s->tag[0] = 0; 
	q = allocq(&procinfo); 
	s->procq = WR(q); 
1990/03292/sys/src/9/port/stream.c:825,8321990/0331/sys/src/9/port/stream.c:851,862
1990/0227    
	while(left){ 
		bp = getq(q); 
		if(bp == 0){ 
			if(q->flag & QHUNGUP) 
				break; 
1990/0331    
			if(q->flag & QHUNGUP){ 
				if(s->hread++ < 3) 
					break; 
				else 
					error(0, Ehungup); 
			} 
1990/0227    
			sleep(&q->r, &isinput, (void *)q); 
			continue; 
		} 


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