~kris/9p

9hist

7c75f6ff19f71e1bee32b55b6ca1416f2c3059af — David du Colombier 23 years ago bba78df
Plan 9 from Bell Labs 2002-11-13
2 files changed, 0 insertions(+), 40 deletions(-)

M port/portfns.h
M port/qio.c
M port/portfns.h => port/portfns.h +0 -1
@@ 240,7 240,6 @@ void		putswap(Page*);
ulong		pwait(Waitmsg*);
void		qaddlist(Queue*, Block*);
Block*		qbread(Queue*, int);
long		qblen(Queue*);
long		qbwrite(Queue*, Block*);
int		qcanread(Queue*);
void		qclose(Queue*);

M port/qio.c => port/qio.c +0 -39
@@ 485,45 485,6 @@ qdiscard(Queue *q, int len)
}

/*
 *  Return length that next qconsume will return
 */
long
qblen(Queue *q)
{
	Block *b;
	int n;
	Block *tofree = nil;

	ilock(q);

	for(;;) {
		b = q->bfirst;
		if(b == 0){
			q->state |= Qstarve;
			iunlock(q);
			return -1;
		}
		QDEBUG checkb(b, "qblen 1");

		n = BLEN(b);
		if(n > 0)
			break;
		q->bfirst = b->next;
		q->len -= BALLOC(b);

		/* remember to free this */
		b->next = tofree;
		tofree = b;
	};
	iunlock(q);

	if(tofree != nil)
		freeblist(tofree);

	return n;
}

/*
 *  Interrupt level copy out of a queue, return # bytes copied.
 */
int