AIO_MLOCK(2)
π aio_mlock(2) π
okay so this cutie comes straight from the System Calls Manual, and we're about to make aio_mlock(2) make sense, bestie. β¨
πΈ NAME πΈ
aio_mlock β asynchronous mlock(2) operation π
π§Έ LIBRARY π§Έ
Standard C Library (libc, -lc) π«Ά
π SYNOPSIS π
#include <aio.h>
int
aio_mlock(struct aiocb *iocb);
π DESCRIPTION π
okay so the aio_mlock() system call lets the calling process lock into memory the physical pages associated with the virtual address range starting at iocb->aio_buf for iocb->aio_nbytes bytes. π
The call returns immediately after the locking request has been enqueued β like, it does not wait around. the operation may or may not have completed at the time the call returns. π
The iocb pointer may be subsequently used as an argument to aio_return() and aio_error() in order to determine return or error status for the enqueued operation while it is in progress. π
If the request could not be enqueued (generally due to aio(4) limits), then the call returns without having enqueued the request. π
The iocb->aio_sigevent structure can be used to request notification of the operation's completion as described in aio(4). π
π§ RESTRICTIONS π§
read this part, bestie β it's giving important: π«Ά
- The Asynchronous I/O Control Block structure pointed to by
iocband the buffer that theiocb->aio_bufmember of that structure references must remain valid until the operation has completed. β³ - The asynchronous I/O control buffer
iocbshould be zeroed before theaio_mlock()call to avoid passing bogus context information to the kernel. π§Ό - Modifications of the Asynchronous I/O Control Block structure or the memory mapping described by the virtual address range are not allowed while the request is queued. π«
no cap, those restrictions are not optional. the kernel is literally not trying to hear it. π
π RETURN VALUES π
The aio_mlock() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. π
π ERRORS π
The aio_mlock() system call will fail if:
[EAGAIN]β The request was not queued because of system resource limitations. π[EINVAL]β The asynchronous notification method iniocb->aio_sigevent.sigev_notifyis invalid or not supported. π
If the request is successfully enqueued, but subsequently cancelled or an error occurs, the value returned by the aio_return() system call is per the mlock(2) system call, and the value returned by the aio_error() system call is one of the error returns from the mlock(2) system call, or ECANCELED if the request was explicitly cancelled via a call to aio_cancel(). π
π SEE ALSO π
π PORTABILITY π
The aio_mlock() system call is a FreeBSD extension, and should not be used in portable code. π§
π HISTORY π
The aio_mlock() system call first appeared in FreeBSD 10.0. β
π AUTHORS π
The system call was introduced by Gleb Smirnoff <glebius@FreeBSD.org>. π«Ά
mwah π β the footer on this page says Debian, August 19, 2016, and AIO_MLOCK(2). xoxo, go lock some pages responsibly πβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2013 Gleb Smirnoff <glebius@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms