aio.h(0P)

🌸 aio.h β€” the POSIX Programmer's Manual tea, bestie edition πŸ’…

okay so first things first, hi, welcome, you're reading aio.h(0P) from the POSIX Programmer's Manual and honestly? iconic header, no notes. πŸ’–

🫧 PROLOG

so like, real talk before we get into it: this manual 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 deets on Linux behavior, fr fr), or the interface might not even be implemented on Linux at all. 😭 just a heads up, don't come for me.


✨ NAME ✨

aio.h β€” asynchronous input and output. that's it. that's the whole vibe. asynchronous I/O, but make it a header file. πŸ¦‹


🌈 SYNOPSIS

#include <aio.h>

literally one line. we love a low-maintenance queen. πŸ‘‘


πŸ’– DESCRIPTION πŸ’–

okay so here's where it gets juicy. The <aio.h> header shall define the aiocb structure, and that structure shall include at least these members (yes, at least, so there could be more, don't @ me):

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.

look at her. every single field accounted for. πŸŽ€

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>. borrowing from the neighbors, we love to see it.

The <aio.h> header shall define the struct timespec structure as described in <time.h>.

The <aio.h> header shall define the sigevent structure and the sigval union as described in <signal.h>.

🧚 the symbolic constants (a whole squad)

The <aio.h> header shall define the following symbolic constants, and bestie, there are eight of them, so buckle up:

  • AIO_ALLDONE β€” a return value meaning none of the requested operations could be canceled because they're already complete. too late, they ate. πŸ’€
  • AIO_CANCELED β€” a return value meaning all the requested operations have been canceled. slay, mission accomplished. ✨
  • AIO_NOTCANCELED β€” a return value meaning some of the requested operations could not be canceled because they are in progress. partial slay. mid. πŸ™ˆ
  • LIO_NOP β€” a lio_listio() element operation option indicating that no transfer is requested. she's just standing there. standing there MENACINGLY.
  • 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. ghosting, but legally.
  • 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. she waits. patiently. πŸ’…
  • LIO_WRITE β€” a lio_listio() element operation option requesting a write.

πŸ‘‘ the functions

The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided. (so don't be shocked if your fave is secretly a macro, iykyk.)

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);

copy that exactly, character for character, bestie. the restrict keywords are not decorative, they're the moment. πŸ”₯

also lowkey important: inclusion of the <aio.h> header may make visible symbols defined in the headers <fcntl.h>, <signal.h>, and <time.h>. surprise guests at the function. πŸŽ‰

The following sections are informative. (translation: not normative, just chatting.)


🌸 APPLICATION USAGE

None.

she said nothing. silence. a mood. 🀐


πŸ¦‹ RATIONALE

None.

also nothing! two for two! the restraint is honestly impressive. 😌


⭐ FUTURE DIRECTIONS

None.

no future plans. living in the present. main character energy. 🌈


πŸ”₯ SEE ALSO

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

and from 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()

go read those too, they're all connected, it's a whole cinematic universe. 🎬


okay this part is the serious part so let me be real with you:

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. In the event of 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. 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 .


and that's the whole page bestie!! πŸ’– this one was brought to you by IEEE/The Open Group, 2017 β€” aka the aio.h(0P) footer girlies β€” mwah, take care of her, she's asynchronous and she's thriving ✨🫢

πŸ“¦ where this page comes from