9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: presotto@plan9.att.com presotto@plan9.att.com
Subject: dirfstat on tcp/udp/il connections is always 0
Date: Sat, 16 Sep 1995 10:53:02 -0400	[thread overview]
Message-ID: <19950916145302.A5vfq-FRGH-Jav75KJwTHQfMPN-76lCnx57tPYlrVbA@z> (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*);







             reply	other threads:[~1995-09-16 14:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-09-16 14:53 presotto [this message]
1995-09-16 15:31 Steve

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19950916145302.A5vfq-FRGH-Jav75KJwTHQfMPN-76lCnx57tPYlrVbA@z \
    --to=presotto@plan9.att.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).