aiocb, aiocb64

Asynchronous I/O control block

Synopsis:

#include <aio.h>

struct aiocb {
        int                                     aio_filedes;
        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;

        /* used by the library, applications shouldn't touch them */
        void                            *_aio_lio_state;
        int                                     _aio_pad[3];
        struct aiocb        *_aio_next;
        unsigned            _aio_flag;
        unsigned            _aio_iotype;
        ssize_t             _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_filedes;
        int                                     aio_reqprio;
        off64_t                         aio_offset;
        __volatile void*        aio_buf;
        size_t                          aio_nbytes;
        struct sigevent         aio_sigevent;
        int                                     aio_lio_opcode;
        
        /* used by the library, applications shouldn't touch them */
        void                            *_aio_lio_state;
        int                                     _aio_pad[3];
        struct aiocb        *_aio_next;
        unsigned            _aio_flag;
        unsigned            _aio_iotype;
        ssize_t             _aio_result;
        unsigned            _aio_error;
        void                *_aio_suspend;
        void                *_aio_plist;
        unsigned            _aio_policy;
        struct __sched_param  _aio_param;
};
#endif

Description:

The aiocb and aiocb64 structures define the control block for asynchronous I/O operations.

Note: In QNX Neutrino 6.6 or later, the large-file support functions and data types appear in the name space only if you define _LARGEFILE64_SOURCE when you compile your code. For more information, see Classification in What's in a Function Description?

These structures include at least the following:

aio_filedes
The file descriptor to use in an asynchronous I/O operation.
Note: The aio_* functions work with Transparent Distributed Processing; the file descriptor can be one that you've opened across Qnet.
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.

The other members are used by the library. Applications shouldn't touch them.

Classification:

aiocb is POSIX 1003.1; 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.