AIO_ERROR(3POSIX)

πŸ’– AIO_ERROR(3POSIX) πŸ’–

okay so bestie, welcome to the POSIX Programmer's Manual πŸ’… this one's aio_error from section 3POSIX, and it's genuinely one of the cutest little calls in the async I/O family. let's get into it πŸ¦‹


🌸 PROLOG 🌸

so like, real talk first: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ (so if you're on Linux, pls go consult the corresponding Linux manual page for the deets on Linux behavior), or honestly the interface may not even be implemented on Linux at all. no cap. 😭


✨ NAME ✨

aio_error β€” retrieve errors status for an asynchronous I/O operation


πŸŽ€ SYNOPSIS πŸŽ€

#include <aio.h>

int aio_error(const struct aiocb *aiocbp);

πŸ’« DESCRIPTION πŸ’«

so here's the vibe: the aio_error() function shall return the error status associated with the aiocb structure referenced by the aiocbp argument. 🫢

and what even is the error status for an async I/O operation, you ask? it's the errno value that would be set by the corresponding read(), write(), fdatasync(), or fsync() operation. like, it's literally the same energy, just delivered async. if the operation has not yet completed, then the error status shall be equal to [EINPROGRESS]. ⏳

⚠️ okay and this part is important: if the aiocb structure pointed to by aiocbp is not associated with an operation that has been scheduled, the results are undefined. undefined behavior is not a slay, it's a πŸ’€. don't do it.

πŸ”₯ RETURN VALUE πŸ”₯

  • if the asynchronous I/O operation has completed successfully β†’ 0 shall be returned. we love a clean zero. ✨
  • if the asynchronous operation has completed unsuccessfully β†’ the error status shall be returned, as described for read(), write(), fdatasync(), and fsync(). 😭
  • if the asynchronous I/O operation has not yet completed β†’ [EINPROGRESS] shall be returned. she's still cooking πŸ“

and if the aio_error() function itself fails, it shall return -1 and set errno to indicate the error. classic.


🌈 ERRORS 🌈

the aio_error() function may fail if:

  • EINVAL β€” the aiocbp argument does not refer to an asynchronous operation whose return status has not yet been retrieved.

and that's it, that's the whole list, she's a short queen πŸ‘‘

the following sections are informative. (iykyk, informative means it's not the normative rules, it's the ✨ lore ✨)

🧚 EXAMPLES 🧚

None.

like literally none. iconic minimalism. πŸ’…


🌸 APPLICATION USAGE 🌸

None.


πŸ’œ RATIONALE πŸ’œ

None.


πŸ¦‹ FUTURE DIRECTIONS πŸ¦‹

None.


⭐ SEE ALSO ⭐

aio_cancel(), aio_fsync(), aio_read(), aio_return(), aio_write(), close(), exec, exit(), fork(), lio_listio(), lseek(), read()

and the Base Definitions volume of POSIX.1‐2017, <aio.h> πŸ“š


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 came to you courtesy of IEEE/The Open Group, dated 2017, and it lives in the 3POSIX manual. go forth and check your async errors, main character πŸ’–βœ¨