_POSIX_ASYNCHRONOUS_IO

Impl
Cov

Asynchronous I/O is backed by the OS-managed request pool (CONFIG_SYS_AIO): submitted operations are performed by a dedicated kernel service queue that waits for descriptor readiness where the descriptor has a waitable readiness condition (e.g. sockets and eventfds) and performs the operation directly otherwise (e.g. regular files). Completion is observed with aio_error(), aio_suspend(), and aio_return(), or announced by the control block’s aio_sigevent (SIGEV_SIGNAL deliveries carry an SI_ASYNCIO code; SIGEV_THREAD functions run in a fresh detached thread). lio_listio() with LIO_NOWAIT supports a list-completion sigevent that fires once, when the last operation of the list completes.

Notes on implementation-defined behaviour:

  • The buffer named by a control block must remain valid until the operation is retrieved with aio_return(); closing a descriptor with operations in flight completes them with EBADF, so cancel before closing.

  • aio_fsync() synchronizes data and metadata together: O_DSYNC and O_SYNC are equivalent.

  • AIO_PRIO_DELTA_MAX is 0, so aio_reqprio must be 0.

  • AIO_MAX and AIO_LISTIO_MAX derive from the request pool bounds (CONFIG_POSIX_AIO_MAX and CONFIG_POSIX_AIO_LISTIO_MAX).

Enable this option with CONFIG_POSIX_ASYNCHRONOUS_IO.

_POSIX_ASYNCHRONOUS_IO

API

Supported

aio_cancel()

yes

aio_error()

yes

aio_fsync()

yes

aio_read()

yes

aio_return()

yes

aio_suspend()

yes

aio_write()

yes

lio_listio()

yes