Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Oct 2002 10:45:12 -0800 (PST)
From:      Kelly Yancey <kbyanc@posi.net>
To:        Julian Elischer <julian@elischer.org>
Cc:        Kelly Yancey <kelly@nttmcl.com>, <freebsd-arch@FreeBSD.ORG>
Subject:   Re: RFC: Exporting number of bytes of protocol data to userland
Message-ID:  <20021029101832.X35506-100000@gateway.posi.net>
In-Reply-To: <Pine.BSF.4.21.0210282340400.27722-100000@InterJet.elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 28 Oct 2002, Julian Elischer wrote:

> It seems reasonable to me, but have you run a lot of apps?
> Also I'd like to know what the standards say about these interfaces.
>
> On Mon, 28 Oct 2002, Kelly Yancey wrote:
>
> >
> >   The attached patch is rather short so the impatient can probably skip
> > right to the source.
> >
> >   The background is that there are at least 3 interfaces which report the
> > "number of bytes in the socket buffer" to userland:
> > 	ioctl(s, FIONREAD, &len)
> > 	stat(2) via the st_size member of struct stat
> > 	kqueue(2) via data member of struct kevents returned for
> > 		EVFILT_READ filters.
> >
> [...]
>

  Thanks for the feedback,

  I've had the kqueue portion of the patch running on my workstation for a
couple of weeks now.  Needless to say, not a lot of applications use kqueue
yet so that doesn't really say much. :|  However my UDP applicates which
use kqueue are rather happy with the change. :)  In any event, kqueue isn't
covered by any standards so it is the safest to modify.
  The stat change I've been running for a few days with no ill effects so far
which I more or less expected: I seriously doubt too many applications rely on
fstat's behavior on sockets.  Heck, according to the fstat(2) man page[*],
practically the entire struct sb (including st_size) should be 0 which,
despite not being the case on either -stable or -current, if anything relied
on the old st_size value being anything other than 0 then they already knew
they were dancing with the devil.
  All this is moot anyway because the change is a no-op for sockets without
non-protocol data in the socket buffer (i.e. TCP) and for sockets that do put
non-protocol data in the socket buffer the old value was practically useless
anyway.

  Thanks again,

  Kelly

  [*] The fstat(2) man page's BUGS section is horribly out-of-touch with
reality with regards to sockets.

--
Kelly Yancey -- kbyanc@{posi.net,FreeBSD.org}
FreeBSD, The Power To Serve: http://www.freebsd.org/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021029101832.X35506-100000>