Read from or write to a file.
- macOS 10.6+
UIO_READ for a read, UIO_WRITE for a write.
The vnode on which to perform I/O.
Start of buffer into which to read or from which to write data.
Length of buffer.
Offset within the file at which to start I/O.
What kind of address "base" is. See uio_seg definition in sys/uio.h. UIO_SYSSPACE for kernelspace, UIO_USERSPACE for userspace. UIO_USERSPACE32 and UIO_USERSPACE64 are in general preferred, but vn_rdwr will make sure that has the correct address sizes.
Defined in vnode.h, e.g. IO_NOAUTH, IO_NOCACHE.
Credential to pass down to filesystem for authentication.
Destination for amount of requested I/O which was not completed, as with uio_resid().
Process requesting I/O.
0 for success; errors from filesystem, and EIO if did not perform all requested I/O and the "aresid" parameter is NULL.
vn_rdwr() abstracts the details of constructing a uio and picking a vnode operation to allow simple in-kernel file I/O.