9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* dirfstat on tcp/udp/il connections is always 0
@ 1995-09-16 15:31 Steve
  0 siblings, 0 replies; 2+ messages in thread
From: Steve @ 1995-09-16 15:31 UTC (permalink / raw)


Your change is almost line for line what I did!  We must think alike.






^ permalink raw reply	[flat|nested] 2+ messages in thread

* dirfstat on tcp/udp/il connections is always 0
@ 1995-09-16 14:53 presotto
  0 siblings, 0 replies; 2+ messages in thread
From: presotto @ 1995-09-16 14:53 UTC (permalink / raw)


Since dirfstat returns the size of the next message queued
for reading for pipes, it would be nice if the same happened
for IP protocols.  The following changes make it work.
Note that dirstat will still return 0 (the stream gets bound
to the fd on open...).

--------------------------------------------
In port/stream.c, replace streamstat() with:
--------------------------------------------

ulong
streamlen(Chan *c)
{
	Stream *s;
	Queue *q;
	Block *bp;
	ulong n;

	s = c->stream;
	n = 0;
	if(s) {
		q = RD(s->procq);
		if(q->flag & QHUNGUP)
			error(Ehungup);
		lock(q);
		for(bp=q->first; bp; bp = bp->next){
			n += BLEN(bp);
			if(bp->flags&S_DELIM)
				break;
		}
		unlock(q);
	}
	return n;
}
void
streamstat(Chan *c, char *db, char *name, long perm)
{
	Dir dir;

	devdir(c, c->qid, name, streamlen(c), eve, perm, &dir);
	convD2M(&dir, db);
}

--------------------------------------------
In port/net.c
--------------------------------------------

% diff net.c $old/net.c
93c93
< 		devdir(c, q, "data", streamlen(c), o, perm, dp);
---
> 		devdir(c, q, "data", 0, o, perm, dp);

--------------------------------------------
In port/portfns.h
--------------------------------------------

% diff portfns.h $old/portfns.h
267d266
< ulong		streamlen(Chan*);







^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1995-09-16 15:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-09-16 15:31 dirfstat on tcp/udp/il connections is always 0 Steve
  -- strict thread matches above, loose matches on Subject: below --
1995-09-16 14:53 presotto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).