LIO_LISTIO(3P)
β¨ LIO_LISTIO(3P) β¨ β list directed I/O, bestie edition π
okay so this is a page from the POSIX Programmer's Manual (yes, the LIO_LISTIO(3P) one, the 3P girlies know π
). Heads up though: the Linux implementation of this interface may differ from what's written here β so go check the corresponding Linux manual page for the actual Linux behavior β or honestly the interface might not even be implemented on Linux at all. π
πΈ PROLOG πΈ
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.
no cap, that's literally the first thing it says. read it twice. π
π NAME π
lio_listio β list directed I/O
π¦ SYNOPSIS π¦
#include <aio.h>
int lio_listio(int mode, struct aiocb *restrict const list[restrict],
int nent, struct sigevent *restrict sig);
β¨ DESCRIPTION β¨
So the lio_listio() function shall initiate a whole list of I/O requests with a single function call. one call. many I/O. iconic behavior honestly. π
The mode argument takes one of the values LIO_WAIT or LIO_NOWAIT, declared in <aio.h>, and it decides whether the function returns when the I/O operations have been completed, or as soon as the operations have been queued. If mode is LIO_WAIT, the function shall wait until all I/O is complete, and the sig argument shall be ignored. (ignored. not even looked at. it's giving ghosted π)
If mode is LIO_NOWAIT, the function shall return immediately, and asynchronous notification shall occur, according to the sig argument, when all the I/O operations complete. If sig is NULL, then no asynchronous notification shall occur. If sig is not NULL, asynchronous notification occurs as specified in Section 2.4.1, Signal Generation and Delivery, when all the requests in list have completed.
The I/O requests enumerated by list are submitted in an unspecified order. (so don't come for me about ordering, it's not my call π«Ά)
The list argument is an array of pointers to aiocb structures. The array contains nent elements. The array may contain NULL elements, which shall be ignored.
π¨ UNDEFINED BEHAVIOR ALERT π¨ if the buffer pointed to bylist, or theaiocbstructures pointed to by the elements of the arraylist, become illegal addresses before all asynchronous I/O completed and (if necessary) the notification is sent β the behavior is undefined. Same deal: if the buffers pointed to by theaio_bufmember of theaiocbstructure pointed to by the elements of the arraylistbecome illegal addresses prior to the asynchronous I/O associated with thataiocbstructure being completed, the behavior is undefined. do not do this. it's not a vibe. π
The aio_lio_opcode field of each aiocb structure specifies the operation to be performed. The supported operations are LIO_READ, LIO_WRITE, and LIO_NOP; these symbols are defined in <aio.h>. The LIO_NOP operation causes the list entry to be ignored. If the aio_lio_opcode element is equal to LIO_READ, then an I/O operation is submitted as if by a call to aio_read() with the aiocbp equal to the address of the aiocb structure. If the aio_lio_opcode element is equal to LIO_WRITE, then an I/O operation is submitted as if by a call to aio_write() with the aiocbp equal to the address of the aiocb structure.
- The
aio_fildesmember specifies the file descriptor on which the operation is to be performed. - The
aio_bufmember specifies the address of the buffer to or from which the data is transferred. - The
aio_nbytesmember specifies the number of bytes of data to be transferred.
The members of the aiocb structure further describe the I/O operation to be performed, in a manner identical to that of the corresponding aiocb structure when used by the aio_read() and aio_write() functions. β¨
The nent argument specifies how many elements are members of the list; that is, the length of the array. (it's just... how long the array is. that's it. that's the tweet. π¦)
The behavior of this function is altered according to the definitions of synchronized I/O data integrity completion and synchronized I/O file integrity completion if synchronized I/O is enabled on the file associated with aio_fildes.
For regular files, no data transfer shall occur past the offset maximum established in the open file description associated with aiocbp->aio_fildes.
π¨ one more undefined-behavior situation, bestie π¨ ifsig->sigev_notifyisSIGEV_THREADandsig->sigev_notify_attributesis a non-null pointer, and the block pointed to by this pointer becomes an illegal address prior to all asynchronous I/O being completed, then the behavior is undefined.
π RETURN VALUE π
If mode has the value LIO_NOWAIT, the lio_listio() function shall return the value zero if the I/O operations are successfully queued; otherwise, the function shall return the value -1 and set errno to indicate the error.
If mode has the value LIO_WAIT, the lio_listio() function shall return the value zero when all the indicated I/O has completed successfully. Otherwise, lio_listio() shall return a value of -1 and set errno to indicate the error.
In either case, the return value only indicates the success or failure of the lio_listio() call itself β not the status of the individual I/O requests. π³ In some cases one or more of the I/O requests contained in the list may fail. Failure of an individual request does not prevent completion of any other individual request. To determine the outcome of each I/O request, the application shall examine the error status associated with each aiocb control block. The error statuses so returned are identical to those returned as the result of an aio_read() or aio_write() function.
so like... zero doesn't mean everything worked. it means the call worked. check your aiocbs, queen. π
π ERRORS π
The lio_listio() function shall fail if:
EAGAINβ The resources necessary to queue all the I/O requests were not available. The application may check the error status for eachaiocbto determine the individual request(s) that failed.EAGAINβ The number of entries indicated bynentwould cause the system-wide limit{AIO_MAX}to be exceeded.EINVALβ Themodeargument is not a proper value, or the value ofnentwas greater than{AIO_LISTIO_MAX}.EINTRβ A signal was delivered while waiting for all I/O requests to complete during anLIO_WAIToperation. Note that, since each I/O operation invoked bylio_listio()may possibly provoke a signal when it completes, this error return may be caused by the completion of one (or more) of the very I/O operations being awaited. Outstanding I/O requests are not canceled, and the application shall examine each list element to determine whether the request was initiated, canceled, or completed.EIOβ One or more of the individual I/O operations failed. The application may check the error status for eachaiocbstructure to determine the individual request(s) that failed.
In addition to the errors returned by the lio_listio() function, if the lio_listio() function succeeds or fails with errors of [EAGAIN], [EINTR], or [EIO], then some of the I/O specified by the list may have been initiated. π« If the lio_listio() function fails with an error code other than [EAGAIN], [EINTR], or [EIO], no operations from the list shall have been initiated.
The I/O operation indicated by each list element can encounter errors specific to the individual read or write function being performed. In this event, the error status for each aiocb control block contains the associated error code. The error codes that can be set are the same as would be set by a read() or write() function, with the following additional error codes possible:
EAGAINβ The requested I/O operation was not queued due to resource limitations.ECANCELEDβ The requested I/O was canceled before the I/O completed due to an explicitaio_cancel()request.EFBIGβ Theaiocbp->aio_lio_opcodeisLIO_WRITE, the file is a regular file,aiocbp->aio_nbytesis greater than0, and theaiocbp->aio_offsetis greater than or equal to the offset maximum in the open file description associated withaiocbp->aio_fildes.EINPROGRESSβ The requested I/O is in progress.EOVERFLOWβ Theaiocbp->aio_lio_opcodeisLIO_READ, the file is a regular file,aiocbp->aio_nbytesis greater than0, and theaiocbp->aio_offsetis before the end-of-file and is greater than or equal to the offset maximum in the open file description associated withaiocbp->aio_fildes.
The following sections are informative.
π EXAMPLES π
None.
π APPLICATION USAGE π
None.
π§ RATIONALE π§
Okay so like, it might look like there are inconsistencies in the specified circumstances for error codes, but here's the tea: the [EIO] error condition applies when any circumstance relating to an individual operation makes that operation fail. This might be due to a badly formulated request (for example, the aio_lio_opcode field is invalid, and aio_error() returns [EINVAL]) or might arise from application behavior (for example, the file descriptor is closed before the operation is initiated, and aio_error() returns [EBADF]).
The limitation on the set of error codes returned when operations from the list shall have been initiated enables applications to know when operations have been started and whether aio_error() is valid for a specific operation. π«Ά
β FUTURE DIRECTIONS β
None.
π SEE ALSO π
aio_read(), aio_write(), aio_error(), aio_return(), aio_cancel(), close(), exec, exit(), fork(), lseek(), read()
The Base Definitions volume of POSIX.1β2017, <aio.h>
π COPYRIGHT π
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.
okay that's the whole page bestie, you ate that π
β¨ this one's from IEEE/The Open Group, dated 2017, and it's the LIO_LISTIO(3P) page β go forth and queue your I/O lists responsibly, mwah ππ¦πΈ
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms