Subject: Re: FIONWRITE proposal
To: Pavel Cahyna <pavel.cahyna@st.cuni.cz>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 10/18/2004 12:29:07
--OXfL5xGRrasGEqWY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Oct 17, 2004 at 06:51:47PM +0200, Pavel Cahyna wrote:
> On Thu, 14 Oct 2004 14:11:40 +0000, Bill Studenmund wrote:
>=20
> > The problem is that this value is very difficult to promise, and in som=
e=20
> > cases difficult to calculate.
>=20
> I hope such questions are not too stupid:
>=20
> would such FIONWRITE/FIONSPACE be equivalent to the functionality
> already provided by kqueue/kevent with the EVFILT_WRITE filter? From
> the manual page:
>=20
>      EVFILT_WRITE   Takes a descriptor as the identifier, and returns
> 		    whenever it is possible to write to the
> 		    descriptor.  For sockets, pipes, fifos, and ttys,
> 		    data will contain the amount of space remaining in
> 		    the write buffer.  The filter will set EV_EOF when
> 		    the reader disconnects, and for the fifo case,
> 		    this may be cleared by use of EV_CLEAR.  Note that
> 		    this filter is not supported for vnodes.
>=20
> If it would, then: 1) is duplication of this functionality needed? =20
> 2) why not do the same thing with respect to network buffer exhaustion et=
c.
> problems as this kfilter does (whatever it does - I haven't looked)?

The functionality (well FIONSPACE) would be the same. I believe this=20
duplication is needed as it is not exact duplication. kevent is, as its=20
name implies, an event framework. If your application is set up so that=20
being able to write works as an event, then this filter is perfect. If,=20
however, the app isn't set up for being able to write =3D=3D an event, then=
=20
this filter doesn't help.

As for your second point, "why not do what this filter does for buffer=20
exhaustion," well, the filter does nothing. It really is just reporting=20
how much space is open in the buffer; the text you quote is ignoring all=20
the issues I've raised. :-)

Take care,

Bill

--OXfL5xGRrasGEqWY
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iD8DBQFBdBmDWz+3JHUci9cRAqy0AJwIMDeQmSu6cxssniF8vENhlIcjtgCfZbj9
etTxz2L7q7drizMKIP9Veok=
=odLW
-----END PGP SIGNATURE-----

--OXfL5xGRrasGEqWY--