LIO_LISTIO(2)
π LIO_LISTIO(2) π
okay bestie, welcome to lio_listio(2) β it's a system call, it lives in the System Calls Manual, and it is literally the group-chat of I/O: you hand it a whole list of requests and it sends them all at once. no cap. π«Ά
β¨ NAME β¨
lio_listio β list directed I/O (REALTIME)
π LIBRARY π
Standard C Library (libc, -lc)
πΈ SYNOPSIS πΈ
#include <aio.h>
int
lio_listio(int mode, struct aiocb * const list[], int nent,
struct sigevent *sig);
π¦ DESCRIPTION π¦
So the way that lio_listio() works is it kicks off a whole list of I/O requests in one single function call. iconic behavior honestly. the list argument is an array of pointers to aiocb structures, and each one describes one operation you want done β and there are nent elements in that array. elements that are NULL? ignored, they're not even invited to the party. π
The aio_lio_opcode field of each aiocb is what tells you which operation is happening. the supported ops are:
LIO_READβ read data as if by a call toaio_read(2). πLIO_NOPβ no operation. (the "seen at 3am, no reply" of opcodes.)LIO_WRITEβ write data as if by a call toaio_write(2). β¨
Now, the mode argument changes the whole vibe:
- if
modeisLIO_WAIT,lio_listio()does not return until every single requested operation is done. it's giving "I'll wait, but not happily." - if
modeisLIO_NOWAIT, thensigcan be used to ask for asynchronous notification once all the operations have completed. and ifsigisNULL, no notification gets sent at all. ghosted, basically. π
π for SIGEV_KEVENT notifications π
the posted kevent is gonna contain:
identβlistfilterβEVFILT_LIOudataβ the value stored insig->sigev_value
π for SIGEV_SIGNO and SIGEV_THREAD_ID notifications π
the info for the queued signal is gonna include SI_ASYNCIO in the si_code field, plus the value stored in sig->sigev_value sitting in the si_value field. periodt.
π for SIGEV_THREAD notifications π
the value stored in sig->sigev_value gets passed to the sig->sigev_notify_function, exactly as described in sigevent(3).
π¨ okay this part matters: the order in which the requests are carried out is not specified. in particular, there is no guarantee that they'll be executed in the order0,1, ...,nent-1. so don't you dare assume they run in order, bestie, that's not the vibe at all.
π₯ RETURN VALUES π₯
- if
modeisLIO_WAIT,lio_listio()returns0if the operations completed successfully β otherwise-1. - if
modeisLIO_NOWAIT,lio_listio()returns0if the operations were successfully queued β otherwise-1.
π ERRORS π
lio_listio() will fail if:
[EAGAIN]β there are not enough resources to enqueue the requests. π[EAGAIN]β the request would cause the system-wide limit{AIO_MAX}to be exceeded.[EINVAL]β themodeargument is neitherLIO_WAITnorLIO_NOWAIT, ornentis greater than{AIO_LISTIO_MAX}.[EINVAL]β the asynchronous notification method insig->sigev_notifyis invalid or not supported.[EINTR]β a signal interrupted the system call before it could be completed. rude.[EIO]β one or more requests failed.
And on top of all that, lio_listio() may fail for any of the reasons listed for aio_read(2) and aio_write(2). so check those pages too, bestie, iykyk.
β οΈ big one: iflio_listio()succeeds, or fails with an error code ofEAGAIN,EINTR, orEIO, some of the requests may have already been initiated. so the caller should check the error status of eachaiocbstructure individually by callingaio_error(2). don't skip this, fr fr. π
π SEE ALSO π
aio_error(2), aio_read(2), aio_write(2), read(2), write(2), sigevent(3), siginfo(3), aio(4)
β STANDARDS β
The lio_listio() function is expected to conform to IEEE Std 1003.1-2001 (βPOSIX.1β). slay.
π§ HISTORY π§
The lio_listio() system call first appeared in FreeBSD 3.0. a true elder icon. π
and that's the whole page, bestie!! this one's from Debian, dated Dec 7, 2019, and it's the LIO_LISTIO(2) page β go forth and queue your I/O lists responsibly. mwah. π
β¨π
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2003 Tim J. Robbins
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms