Subject: CVS commit: src
To: None <>
From: Bill Studenmund <>
List: source-changes
Date: 11/06/2004 02:03:20
Module Name:	src
Committed By:	wrstuden
Date:		Sat Nov  6 02:03:20 UTC 2004

Modified Files:
	src/lib/libc/sys: ioctl.2
	src/sys/kern: sys_pipe.c sys_socket.c tty.c vfs_vnops.c
	src/sys/sys: filio.h

Log Message:
Add support for FIONWRITE and FIONSPACE ioctls. FIONWRITE reports
the number of bytes in the send queue, and FIONSPACE reports the
number of free bytes in the send queue. These ioctls permit applications
to monitor file descriptor transmission dynamics.

In examining prior art, FIONWRITE exists with the semantics given
here. FIONSPACE is provided so that programs may easily determine how
much space is left in the send queue; they do not need to know the
send queue size.

The fact that a write may block even if there is enough space in the
send queue for it is noted in the documentation.

FIONWRITE functionality may be used to implement TIOCOUTQ for Linux
emulation - Linux extended this ioctl to sockets, even though they are
not ttys.

To generate a diff of this commit:
cvs rdiff -r1.18 -r1.19 src/lib/libc/sys/ioctl.2
cvs rdiff -r1.58 -r1.59 src/sys/kern/sys_pipe.c
cvs rdiff -r1.40 -r1.41 src/sys/kern/sys_socket.c
cvs rdiff -r1.169 -r1.170 src/sys/kern/tty.c
cvs rdiff -r1.80 -r1.81 src/sys/kern/vfs_vnops.c
cvs rdiff -r1.8 -r1.9 src/sys/sys/filio.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.