Add kernel syscall support for explicit blocking and non-blocking I/O
authorMatthew Dillon <dillon@dragonflybsd.org>
Tue, 13 Jun 2006 08:12:04 +0000 (08:12 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Tue, 13 Jun 2006 08:12:04 +0000 (08:12 +0000)
commit9ba76b73b2c135df4edbbbf290df4e77e5f7ba1d
treeac1f9bbaf53ad2aa4197aed7518b41ced856af4c
parent15ef8e327bc5f3ef1719bacfb9d1e0df758541d0
Add kernel syscall support for explicit blocking and non-blocking I/O
regardless of the setting applied to the file pointer.

send/sendmsg/sendto/recv/recvmsg/recfrom: New MSG_ flags defined in
sys/socket.h may be passed to these functions to override the settings
applied to the file pointer on a per-I/O basis.

MSG_FBLOCKING - Force the operation to be blocking
MSG_FNONBLOCKING- Force the operation to be non-blocking

pread/preadv/pwrite/pwritev: These system calls have been renamed and
wrappers will be added to libc.  The new system calls are prefixed with
a double underscore (like getcwd vs __getcwd) and include an additional
flags argument.  The new flags are defined in sys/fcntl.h and may be
used to override settings applied to the file pointer on a per-I/O basis.

Additionally, the internal __ versions of these functions now accept an
offset of -1 to mean 'degenerate into a read/readv/write/writev' (i.e.
use the offset in the file pointer and update it on completion).

O_FBLOCKING - Force the operation to be blocking
O_FNONBLOCKING - Force the operation to be non-blocking
O_FAPPEND - Force the write operation to append (to a regular file)
O_FOFFSET - (implied of the offset != -1) - offset is valid
O_FSYNCWRITE - Force a synchronous write
O_FASYNCWRITE - Force an asynchronous write
O_FUNBUFFERED - Force an unbuffered operation (O_DIRECT)
O_FBUFFERED - Force a buffered operation (negate O_DIRECT)

If the flags do not specify an operation (e.g. neither FBLOCKING or
FNONBLOCKING are set), then the settings in the file pointer are used.

The original system calls will become wrappers in libc, without the flags
arguments.  The new system calls will be made available to libc_r to allow
it to perform non-blocking I/O without having to mess with a descriptor's
file flags.

NOTE: the new __pread and __pwrite system calls are backwards compatible
with the originals due to a pad byte that libc always set to 0.
The new __preadv and __pwritev system calls are NOT backwards compatible,
but since they were added to HEAD just two months ago I have decided
to not renumber them either.

NOTE: The subrev has been bumped to 1.5.4 and installworld will refuse to
install if you are not running at least a 1.5.4 kernel.
60 files changed:
sys/bus/usb/usb.c
sys/conf/subvers-DEVELOPMENT_1_5
sys/dev/drm/drm_drv.h
sys/dev/misc/snp/snp.c
sys/dev/sound/pcm/channel.c
sys/dev/sound/pcm/channel.h
sys/dev/sound/pcm/dsp.c
sys/dev/usbmisc/ugen/ugen.c
sys/dev/usbmisc/uhid/uhid.c
sys/emulation/linux/i386/linux_proto.h
sys/emulation/linux/i386/linux_syscall.h
sys/emulation/linux/i386/linux_sysent.c
sys/emulation/linux/i386/linux_union.h
sys/emulation/linux/linux_file.c
sys/i386/i386/mem.c
sys/kern/init_sysent.c
sys/kern/kern_descrip.c
sys/kern/kern_fp.c
sys/kern/kern_memio.c
sys/kern/subr_log.c
sys/kern/sys_generic.c
sys/kern/sys_pipe.c
sys/kern/sys_socket.c
sys/kern/syscalls.c
sys/kern/syscalls.master
sys/kern/tty.c
sys/kern/uipc_socket.c
sys/kern/uipc_syscalls.c
sys/kern/vfs_aio.c
sys/kern/vfs_vnops.c
sys/net/bpf.c
sys/net/i4b/driver/i4b_rbch.c
sys/net/netisr.h
sys/net/tap/if_tap.c
sys/net/tun/if_tun.c
sys/netgraph/ksocket/ng_ksocket.c
sys/netinet/sctp.h
sys/netinet/sctp_output.c
sys/netinet/sctp_pcb.c
sys/netinet/sctp_peeloff.c
sys/netproto/ncp/ncp_sock.c
sys/netproto/smb/smb_trantcp.c
sys/platform/pc32/i386/mem.c
sys/sys/fcntl.h
sys/sys/file.h
sys/sys/param.h
sys/sys/socket.h
sys/sys/socketvar.h
sys/sys/syscall-args
sys/sys/syscall-hide.h
sys/sys/syscall.h
sys/sys/syscall.mk
sys/sys/sysproto.h
sys/sys/sysunion.h
sys/vfs/fifofs/fifo_vnops.c
sys/vfs/nfs/bootp_subr.c
sys/vfs/nfs/krpc_subr.c
sys/vfs/nfs/nfs_socket.c
sys/vfs/nfs/nfs_vfsops.c
sys/vfs/portal/portal_vnops.c