aiocb, aiocb64
Asynchronous I/O control block
Synopsis:
#include <aio.h>
struct aiocb {
int aio_fildes;
int aio_reqprio;
#if _FILE_OFFSET_BITS - 0 == 64
off_t aio_offset;
#elif !defined(_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS == 32
#if defined(__LITTLEENDIAN__)
off_t aio_offset;
off_t aio_offset_hi;
#elif defined(__BIGENDIAN__)
off_t aio_offset_hi;
off_t aio_offset;
#else
#error endian not configured for system
#endif
#else
#error _FILE_OFFSET_BITS value is unsupported
#endif
__volatile void* aio_buf;
size_t aio_nbytes;
struct sigevent aio_sigevent;
int aio_lio_opcode;
ssize_t _aio_reserved;
int _aio_pad[3];
...
};
#if _LARGEFILE64_SOURCE - 0 > 0
struct aiocb64 {
int aio_fildes;
int aio_reqprio;
off64_t aio_offset;
__volatile void* aio_buf;
size_t aio_nbytes;
struct sigevent aio_sigevent;
int aio_lio_opcode;
ssize_t _aio_reserved;
int _aio_pad[3];
...
};
#endif /* _LARGEFILE64_SOURCE */
Description:
The aiocb and aiocb64 structures define the control block for asynchronous I/O operations. They include at least the following:
- aio_fildes
- The file descriptor to use in an asynchronous I/O operation.
- aio_reqprio
- The request priority offset.
- aio_offset
- The file offset.
- aio_offset_hi
- (aiocb only) The high-order bits of the file offset.
- aio_buf
- A pointer to a buffer.
- aio_nbytes
- The length of a transfer.
- aio_sigevent
- A pointer to a sigevent structure that specifies the signal number and value.
- aio_lio_opcode
- The operation to be performed; one of the following:
- LIO_NOP — a lio_listio() element operation option indicating that no transfer is requested.
- LIO_NOWAIT — a lio_listio() synchronization operation indicating that the calling thread is to continue execution while the lio_listio() operation is being performed, and no notification is given when the operation is complete.
- LIO_READ — a lio_listio() element operation option requesting a read.
- LIO_WAIT — a lio_listio() synchronization operation indicating that the calling thread is to suspend until the lio_listio() operation is complete.
- LIO_WRITE — a lio_listio() element operation option requesting a write.
Classification:
aiocb is POSIX 1003.1 AIO; aiocb64 is Large-file support
Caveats:
The first time you call an aio_* function, a thread pool is created, making your process multithreaded if it isn't already. The thread pool isn't destroyed until your process ends.