Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/sys/aio_mlock.2
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | |||||
.Pp | .Pp | ||||
If the request could not be enqueued (generally due to | If the request could not be enqueued (generally due to | ||||
.Xr aio 4 | .Xr aio 4 | ||||
limits), | limits), | ||||
then the call returns without having enqueued the request. | then the call returns without having enqueued the request. | ||||
.Pp | .Pp | ||||
The | The | ||||
.Fa iocb->aio_sigevent | .Fa iocb->aio_sigevent | ||||
structure can be used to request notification of the request's | structure can be used to request notification of the operation's | ||||
completion as described in | completion as described in | ||||
.Xr aio 4 . | .Xr aio 4 . | ||||
.Sh RESTRICTIONS | .Sh RESTRICTIONS | ||||
The Asynchronous I/O Control Block structure pointed to by | The Asynchronous I/O Control Block structure pointed to by | ||||
.Fa iocb | .Fa iocb | ||||
and the buffer that the | and the buffer that the | ||||
.Fa iocb->aio_buf | .Fa iocb->aio_buf | ||||
member of that structure references must remain valid until the | member of that structure references must remain valid until the | ||||
operation has completed. | operation has completed. | ||||
For this reason, use of auto (stack) variables | |||||
for these objects is discouraged. | |||||
.Pp | .Pp | ||||
The asynchronous I/O control buffer | The asynchronous I/O control buffer | ||||
.Fa iocb | .Fa iocb | ||||
should be zeroed before the | should be zeroed before the | ||||
.Fn aio_mlock | .Fn aio_mlock | ||||
call to avoid passing bogus context information to the kernel. | call to avoid passing bogus context information to the kernel. | ||||
.Pp | .Pp | ||||
Modifications of the Asynchronous I/O Control Block structure or the | Modifications of the Asynchronous I/O Control Block structure or the | ||||
buffer contents after the request has been enqueued, but before the | memory mapping described by the virtual address range are not allowed | ||||
request has completed, are not allowed. | while the request is queued. | ||||
jhb: In this case, I didn't want to keep the prohibition on modifying the buffer (i.e. the memory… | |||||
Not Done Inline ActionsWe should prohibit changes to mappings, since mappings are parsed at the moment the mlock() is performed. Or rather, the aio request would mlock whatever is mapped at the time of processing, rather at the time of issuing the request. BTW, there is a difference between modifying buffers or mappings, and modifying the control block itself. The laguage above only talks about control block. kib: We should prohibit changes to mappings, since mappings are parsed at the moment the mlock() is… | |||||
.Sh RETURN VALUES | .Sh RETURN VALUES | ||||
.Rv -std aio_mlock | .Rv -std aio_mlock | ||||
.Sh ERRORS | .Sh ERRORS | ||||
The | The | ||||
.Fn aio_mlock | .Fn aio_mlock | ||||
system call will fail if: | system call will fail if: | ||||
.Bl -tag -width Er | .Bl -tag -width Er | ||||
.It Bq Er EAGAIN | .It Bq Er EAGAIN | ||||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |
In this case, I didn't want to keep the prohibition on modifying the buffer (i.e. the memory mapped by the region being mlock'd) as modifying the data in the pages won't result in indeterminate behavior wrt mlock(). However, it's not clear if we should prohibit changes to the mapping (e.g. munmap(), mprotect(), etc.) while the request is pending?