~kris/9p

9hist

07acb90dd6daeac1ca3224fd550601de47b1635b — David du Colombier 33 years ago 47a4ce5
Plan 9 from Bell Labs 1993-05-15
3 files changed, 32 insertions(+), 23 deletions(-)

M port/alloc.c
M port/portfns.h
M port/stream.c
M port/alloc.c => port/alloc.c +2 -4
@@ 95,8 95,7 @@ xinit(void)
	if(np1 > conf.npage1)
		np1 = conf.npage1;

	palloc.p1 = conf.base1;
	conf.base1 += np1*BY2PG;
	palloc.p1 = conf.base1 + (conf.npage1 - np1)*BY2PG;
	conf.npage1 -= np1;
	xhole(conf.base1, conf.npage1*BY2PG);
	conf.npage1 = conf.base1+(conf.npage1*BY2PG);


@@ 106,8 105,7 @@ xinit(void)
	if(np0 > conf.npage0)
		np0 = conf.npage0;

	palloc.p0 = conf.base0;
	conf.base0 += np0*BY2PG;
	palloc.p0 = conf.base0 + (conf.npage0 - np0)*BY2PG;
	conf.npage0 -= np0;
	xhole(conf.base0, conf.npage0*BY2PG);
	conf.npage0 = conf.base0+(conf.npage0*BY2PG);

M port/portfns.h => port/portfns.h +11 -6
@@ 1,6 1,11 @@
void		alarmkproc(void*);
int		anyready(void);
Image*		attachimage(int, Chan*, ulong, ulong);
long		authread(Chan*, char*, int);
long		authwrite(Chan*, char*, int);
long		authcheck(Chan*, char*, int);
ulong		authrequest(Session*, Fcall*);
void		authreply(Session*, ulong, Fcall*);
void		bitdebug(void);
void		bitdepth(void);
void		bitreverse(uchar*, int);


@@ 71,6 76,7 @@ int		freebroken(void);
void		freechan(Chan*);
void		freepte(Segment*, Pte*);
void		freesegs(int);
void		freesession(Session*);
int		getc(IOQ*);
void		getcolor(ulong, ulong*, ulong*, ulong*);
int		getfields(char*, char**, int, char);


@@ 172,8 178,13 @@ void		putstr(char*);
void		putstrn(char*, long);
void		putswap(Page*);
ulong		pwait(Waitmsg*);
int		qconsume(Queue*, uchar*, int, int);
void		qlock(QLock*);
Queue*		qopen(int);
int		qproduce(Queue*, uchar*, int, int);
long		qread(Queue*, char*, int, int);
void		qunlock(QLock*);
long		qwrite(Queue*, char*, int);
int		readnum(ulong, char*, ulong, ulong, int);
int		readstr(ulong, char*, ulong, char*);
void		ready(Proc*);


@@ 265,9 276,3 @@ long		keywrite(char*, int);
long		userwrite(char*, int);
long		hostownerwrite(char*, int);
long		hostdomainwrite(char*, int);
long		authread(Chan*, char*, int);
long		authwrite(Chan*, char*, int);
long		authcheck(Chan*, char*, int);
ulong		authrequest(Session*, Fcall*);
void		authreply(Session*, ulong, Fcall*);
void		freesession(Session*);

M port/stream.c => port/stream.c +19 -13
@@ 218,7 218,7 @@ consume(Queue *q, uchar *p, int len, int drop)
}

int
produce(Queue *q, uchar *p, int len)
produce(Queue *q, uchar *p, int len, int append)
{
	Block *b;



@@ 240,18 240,24 @@ produce(Queue *q, uchar *p, int len)
	/* no waiting receivers, buffer */
	if(q->len >= q->limit)
		return -1;
	b = ialloc(sizeof(Block)+len);
	if(b == 0)
		return -1;
	b->base = (uchar*)(b+1);
	b->rp = b->base;
	b->wp = b->lim = b->base + len;
	memmove(b->rp, p, len);
	if(q->bfirst)
		q->blast->next = b;
	else
		q->bfirst = b;
	q->last = b;
	b = q->first;
	if(append && b && b->lim-b->wp <= len){
		memmove(b->wp, p, len);
		b->wp += len;
	} else {
		b = ialloc(sizeof(Block)+len);
		if(b == 0)
			return -1;
		b->base = (uchar*)(b+1);
		b->rp = b->base;
		b->wp = b->lim = b->base + len;
		memmove(b->rp, p, len);
		if(q->bfirst)
			q->blast->next = b;
		else
			q->bfirst = b;
		q->last = b;
	}
	q->len += len;
	unlock(q);
	return len;