NAME
aaiioowwrriittee - asynchronous write to a file (REALTIME)
LLIIBBRRAARRYYStandard C Library (libc, -lc)
SYNOPSIS
##iinncclluuddee <
int aaiioowwrriittee(struct aiocb *aiocbp);> DESCRIPTION
The aaiioowwrriittee() system call allows the calling process to writeaiocbp->aionbytes from the buffer pointed to by aiocbp->aiobuf to the
descriptor aiocbp->aiofildes. The call returns immediately after the
write request has been enqueued to the descriptor; the write may or may not have completed at the time the call returns. If the request could not be enqueued, generally due to invalid arguments, the call returns without having enqueued the request.If OAPPEND is set for aiocbp->aiofildes, aaiioowwrriittee() operations append
to the file in the same order as the calls were made. If OAPPEND is notset for the file descriptor, the write operation will occur at the abso-
lute position from the beginning of the file plus aiocbp->aiooffset.
If POSIXPRIORITIZEDIO is defined, and the descriptor supports it, then the enqueued operation is submitted at a priority equal to that of thecalling process minus aiocbp->aioreqprio.
The aiocbp pointer may be subsequently used as an argument to aaiioorreettuurrnn() and aaiiooeerrrroorr() in order to determine return or error status for the enqueued operation while it is in progress.If the request is successfully enqueued, the value of aiocbp->aiooffset
can be modified during the request as context, so this value must not be referenced after the request is enqueued. RREESSTTRRIICCTTIIOONNSS The Asynchronous I/O Control Block structure pointed to by aiocbp and thebuffer that the aiocbp->aiobuf member of that structure references must
remain valid until the operation has completed. For this reason, use of auto (stack) variables for these objects is discouraged. The asynchronous I/O control buffer aiocbp should be zeroed before the aaiioowwrriittee() system call to avoid passing bogus context information to the kernel. Modifications of the Asynchronous I/O Control Block structure or the buffer contents after the request has been enqueued, but before the request has completed, are not allowed.If the file offset in aiocbp->aiooffset is past the offset maximum for
aiocbp->aiofildes, no I/O will occur.
RETURN VALUES
The aaiioowwrriittee() function returns the value 0 if successful; otherwise thevalue -1 is returned and the global variable errno is set to indicate the
error. EERRRROORRSS The aaiioowwrriittee() system call will fail if: [EAGAIN] Due to system resource limitations, the request was not queued. [ENOSYS] The aaiioowwrriittee() system call is not supported. The following conditions may be synchronously detected when theaaiioowwrriittee() system call is made, or asynchronously, at any time there-
after. If they are detected at call time, aaiioowwrriittee() returns -1 and
sets errno appropriately; otherwise the aaiioorreettuurrnn() system call must becalled, and will return -1, and aaiiooeerrrroorr() must be called to determine
the actual value that would have been returned in errno.[EBADF] The aiocbp->aiofildes argument is invalid, or is not
opened for writing.[EINVAL] The offset aiocbp->aiooffset is not valid, the prior-
ity specified by aiocbp->aioreqprio is not a valid
priority, or the number of bytes specified byaiocbp->aionbytes is not valid.
If the request is successfully enqueued, but subsequently canceled or an error occurs, the value returned by the aaiioorreettuurrnn() system call is perthe write(2) system call, and the value returned by the aaiiooeerrrroorr() sys-
tem call is either one of the error returns from the write(2) system call, or one of:[EBADF] The aiocbp->aiofildes argument is invalid for writ-
ing. [ECANCELED] The request was explicitly canceled via a call to aaiiooccaanncceell().[EINVAL] The offset aiocbp->aiooffset would be invalid.
SEE ALSO
aiocancel(2), aioerror(2), aioreturn(2), aiosuspend(2), aio(4) STANDARDS The aaiioowwrriittee() system call is expected to conform to the IEEE Std 1003.1 (``POSIX.1'') standard. HISTORY The aaiioowwrriittee() system call first appeared in FreeBSD 3.0. AUTHORS This manual page was written by Wes Peters. BUGS
Invalid information in aiocbp->aiocbprivate may confuse the kernel.
BSD June 2, 1999 BSD