Subject: Re: FIONWRITE proposal
To: Bill Studenmund <wrstuden@netbsd.org>
From: Daniel Carosone <dan@geek.com.au>
List: tech-kern
Date: 10/14/2004 19:03:59
--cz6wLo+OExbGG7q/
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Wed, Oct 13, 2004 at 04:11:12PM -0700, Bill Studenmund wrote:
> I'd like to propose a new ioctl, to be called FIONWRITE.

[..]


> +		if (com == FIONWRITE) {
> +			/*
> +			 * Files don't have the semantic of unsent bytes,
> +			 * so say all written bytes are "sent".
> +			 */
> +			*(int *)data = 0;
> +			return (0);
> +		}


I have no idea if it would be hard to get the information, but one
reasonable and probably quite useful result to return would be the
amount of data still sitting in file cache, dirty and uncomitted to
disk.

Essentially, "if I call fsync now, how much disk traffic will I
cause?".

Of course, if it is too hard to find the right answer, one could
always havge the ioctl implicitly call fsync first, so the 0 is not
any kind of lie. :)

--
Dan.


--cz6wLo+OExbGG7q/
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iD8DBQFBbkD+EAVxvV4N66cRAql1AJwMdIJlue/61QopBxF5qUiTWPxPtACePoYz
shG/6UxTYHwW6wHXVZ+tP2A=
=hK2n
-----END PGP SIGNATURE-----

--cz6wLo+OExbGG7q/--