Asynchronous I/O control block
#include <aio.h>
struct aiocb {
int aio_fildes;
int aio_reqprio;
#if __OFF_BITS__ == 64
off_t aio_offset;
#elif __OFF_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 __OFF_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];
/* used by the library, application shouldn't touch them */
struct aiocb *_aio_next;
unsigned _aio_flag;
unsigned _aio_iotype;
unsigned _aio_result;
unsigned _aio_error;
void *_aio_suspend;
void *_aio_plist;
int _aio_policy;
struct __sched_param _aio_param;
};
#ifdef __EXT_LF64SRC
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];
/* used by the library, application shouldn't touch them */
struct aiocb *_aio_next;
unsigned _aio_flag;
unsigned _aio_iotype;
unsigned _aio_result;
unsigned _aio_error;
void *_aio_suspend;
void *_aio_plist;
unsigned _aio_policy;
struct __sched_param _aio_param;
};
#endif
The aiocb and aiocb64 structures define the control block for asynchronous I/O operations.
These structures include at least the following:
aiocb is POSIX 1003.1; aiocb64 is Large-file support
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.