aio.h(7POSIX)

๐ŸŒธ aio.h โ€” asynchronous input and output ๐Ÿ’…

okay bestie, sit DOWN, because we're talking about aio.h from the POSIX Programmer's Manual (that's the 7POSIX situation, iykyk). It's the header that gives you async I/O, and it's lowkey iconic.

๐Ÿซถ heads up fr fr: this page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (so go check the corresponding Linux manual page for the actual Linux behavior), or the interface might not even be implemented on Linux at all. no cap.

โœจ SYNOPSIS โœจ

#include <aio.h>

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

So the <aio.h> header shall define the aiocb structure, and it's gotta include at least these members, okay? Not one less:

int             aio_fildes     File descriptor.
off_t           aio_offset     File offset.
volatile void  *aio_buf        Location of buffer.
size_t          aio_nbytes     Length of transfer.
int             aio_reqprio    Request priority offset.
struct sigevent aio_sigevent   Signal number and value.
int             aio_lio_opcode Operation to be performed.

Periodt. ๐Ÿ’–

The <aio.h> header shall also define the off_t, pthread_attr_t, size_t, and ssize_t types, exactly as described in <sys/types.h>.

It shall define the struct timespec structure as described in <time.h>. ๐ŸŒˆ

And it shall define the sigevent structure and the sigval union as described in <signal.h>. โœจ


๐ŸŽ€ the symbolic constants (the vibe check) ๐ŸŽ€

The <aio.h> header shall define the following symbolic constants:

  • AIO_ALLDONE โ€” a return value that means none of the requested operations could be canceled, because they're already complete. like, they're done, bestie, nothing to cancel ๐Ÿ’€
  • AIO_CANCELED โ€” a return value meaning all the requested operations have been canceled. slay.
  • AIO_NOTCANCELED โ€” a return value meaning some of the requested operations could not be canceled, since they're in progress. half ate, honestly.
  • LIO_NOP โ€” a lio_listio() element operation option indicating no transfer is requested. literally nothing happening.
  • LIO_NOWAIT โ€” a lio_listio() synchronization operation indicating the calling thread is to keep on executing while the lio_listio() operation is being performed, and no notification is given when the operation is complete. main character energy: you do you, we're not telling you when it's done ๐Ÿ™ˆ
  • LIO_READ โ€” a lio_listio() element operation option requesting a read. ๐Ÿ“–
  • LIO_WAIT โ€” a lio_listio() synchronization operation indicating the calling thread is to suspend until the lio_listio() operation is complete. hold please ๐Ÿงš
  • LIO_WRITE โ€” a lio_listio() element operation option requesting a write. โœ๏ธ

๐Ÿ’œ the functions ๐Ÿ’œ

The following shall be declared as functions, and they may also be defined as macros. Function prototypes shall be provided. (yes, shall, we're being official about it)

int      aio_cancel(int, struct aiocb *);
int      aio_error(const struct aiocb *);
int      aio_fsync(int, struct aiocb *);
int      aio_read(struct aiocb *);
ssize_t  aio_return(struct aiocb *);
int      aio_suspend(const struct aiocb *const [], int,
             const struct timespec *);
int      aio_write(struct aiocb *);
int      lio_listio(int, struct aiocb *restrict const [restrict], int,
             struct sigevent *restrict);

also: including the <aio.h> header may make visible symbols that are defined in the headers <fcntl.h>, <signal.h>, and <time.h>. so like, watch out, surprise symbols ๐Ÿซฃ

๐Ÿ“Œ The following sections are informative. (translation: the tea is optional, the facts above were the real ones)

๐Ÿ’… APPLICATION USAGE

None.

like. none. nothing. empty. the void. ๐Ÿ’€


๐Ÿง  RATIONALE

None.

also none bestie, we're keeping it mysterious โœจ


๐Ÿ”ฎ FUTURE DIRECTIONS

None.

no plans, no drama, no notes. ๐Ÿ’–


๐Ÿ‘‘ SEE ALSO

  • <fcntl.h>
  • <signal.h>
  • <sys_types.h>
  • <time.h>

And the System Interfaces volume of POSIX.1โ€2017: aio_cancel(), aio_error(), aio_fsync(), aio_read(), aio_return(), aio_suspend(), aio_write(), fsync(), lio_listio(), lseek(), read(), write() โ€” the whole friend group, go say hi ๐ŸŒธ


Okay so legally I have to tell you this and I'm doing it with love:

Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group.

And if there's ever any discrepancy between this version and the original IEEE and The Open Group Standard โ€” the original IEEE and The Open Group Standard is the referee document. it's the final boss, it wins, no arguing ๐Ÿซถ

The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


๐ŸŒŸ okay that's the whole page, you ate that. it's giving informed.

IEEE/The Open Group โ€” 2017 โ€” aio.h(7POSIX) ๐ŸŽ€ bye bestie, go read something async ๐Ÿ’–

๐Ÿ“ฆ where this page comes from