Subject: Re: FIONWRITE proposal
To: None <tech-kern@netbsd.org>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 10/14/2004 07:11:40
--IrhDeMKUP4DT/M7F
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Oct 14, 2004 at 07:38:34AM -0400, Allen Briggs wrote:
> On Wed, Oct 13, 2004 at 09:13:25PM -0700, cgd@broadcom.com wrote:
> > Given that the interface exists and has a particular meaning already,
> > I'd follow that.
>=20
> FWIW, I agree with this, although the manual should be explicit that
> it doesn't match what you might expect if you're familiar with the
> semantics of FIONREAD.  With no prior art, it would make the most
> sense to have:
>=20
> 	FIONREAD int
> 		Get the number of bytes that are immediately available
> 		for reading.
>=20
> 	FIONWRITE int
> 		Get the number of bytes that are immediately available
> 		for writing.
>=20
> i.e., for non-blocking applications, I think this is exactly what I'd
> want--how many bytes can I write in one shot without getting back either
> a short write or EAGAIN.

The problem is that this value is very difficult to promise, and in some=20
cases difficult to calculate.

For sockets, we may be out of network buffers. Or worse yet, we may run=20
out after the call returns. For files, there are all sort of questions.=20
Like are quotas limiting us, is the amount of free space in the fs=20
limiting us, will we be hit with metadata overhead if we write.

I started thinking about all of these things, and got myself quite dizzy.=
=20
The point is that the FIONWRITE above makes a promise that is very hard to=
=20
keep.

That dizzyness is a lot of why I like at call that just tells you how the=
=20
send queue is doing.

> Given the prior art, however, we should probably match the existing
> semantics.  Does anyone other than vxworks define it?

Not sure.

Take care,

Bill

--IrhDeMKUP4DT/M7F
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iD8DBQFBbokcWz+3JHUci9cRAggyAJwMCLSZ+k+c+eYk53Bvoa2pYNb1sQCfWxer
UZFlSI3EYgklrFZ9RRbEWUE=
=i9Hp
-----END PGP SIGNATURE-----

--IrhDeMKUP4DT/M7F--