1*8269e767SBrooks Davis.\" Copyright (c) 2013 Gleb Smirnoff <glebius@FreeBSD.org> 2*8269e767SBrooks Davis.\" All rights reserved. 3*8269e767SBrooks Davis.\" 4*8269e767SBrooks Davis.\" Redistribution and use in source and binary forms, with or without 5*8269e767SBrooks Davis.\" modification, are permitted provided that the following conditions 6*8269e767SBrooks Davis.\" are met: 7*8269e767SBrooks Davis.\" 1. Redistributions of source code must retain the above copyright 8*8269e767SBrooks Davis.\" notice, this list of conditions and the following disclaimer. 9*8269e767SBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright 10*8269e767SBrooks Davis.\" notice, this list of conditions and the following disclaimer in the 11*8269e767SBrooks Davis.\" documentation and/or other materials provided with the distribution. 12*8269e767SBrooks Davis.\" 13*8269e767SBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14*8269e767SBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15*8269e767SBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16*8269e767SBrooks Davis.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17*8269e767SBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18*8269e767SBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19*8269e767SBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20*8269e767SBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21*8269e767SBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22*8269e767SBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23*8269e767SBrooks Davis.\" SUCH DAMAGE. 24*8269e767SBrooks Davis.\" 25*8269e767SBrooks Davis.Dd August 19, 2016 26*8269e767SBrooks Davis.Dt AIO_MLOCK 2 27*8269e767SBrooks Davis.Os 28*8269e767SBrooks Davis.Sh NAME 29*8269e767SBrooks Davis.Nm aio_mlock 30*8269e767SBrooks Davis.Nd asynchronous 31*8269e767SBrooks Davis.Xr mlock 2 32*8269e767SBrooks Davisoperation 33*8269e767SBrooks Davis.Sh LIBRARY 34*8269e767SBrooks Davis.Lb libc 35*8269e767SBrooks Davis.Sh SYNOPSIS 36*8269e767SBrooks Davis.In aio.h 37*8269e767SBrooks Davis.Ft int 38*8269e767SBrooks Davis.Fn aio_mlock "struct aiocb *iocb" 39*8269e767SBrooks Davis.Sh DESCRIPTION 40*8269e767SBrooks DavisThe 41*8269e767SBrooks Davis.Fn aio_mlock 42*8269e767SBrooks Davissystem call allows the calling process to lock into memory the 43*8269e767SBrooks Davisphysical pages associated with the virtual address range starting at 44*8269e767SBrooks Davis.Fa iocb->aio_buf 45*8269e767SBrooks Davisfor 46*8269e767SBrooks Davis.Fa iocb->aio_nbytes 47*8269e767SBrooks Davisbytes. 48*8269e767SBrooks DavisThe call returns immediately after the locking request has 49*8269e767SBrooks Davisbeen enqueued; the operation may or may not have completed at the time 50*8269e767SBrooks Davisthe call returns. 51*8269e767SBrooks Davis.Pp 52*8269e767SBrooks DavisThe 53*8269e767SBrooks Davis.Fa iocb 54*8269e767SBrooks Davispointer may be subsequently used as an argument to 55*8269e767SBrooks Davis.Fn aio_return 56*8269e767SBrooks Davisand 57*8269e767SBrooks Davis.Fn aio_error 58*8269e767SBrooks Davisin order to determine return or error status for the enqueued operation 59*8269e767SBrooks Daviswhile it is in progress. 60*8269e767SBrooks Davis.Pp 61*8269e767SBrooks DavisIf the request could not be enqueued (generally due to 62*8269e767SBrooks Davis.Xr aio 4 63*8269e767SBrooks Davislimits), 64*8269e767SBrooks Davisthen the call returns without having enqueued the request. 65*8269e767SBrooks Davis.Pp 66*8269e767SBrooks DavisThe 67*8269e767SBrooks Davis.Fa iocb->aio_sigevent 68*8269e767SBrooks Davisstructure can be used to request notification of the operation's 69*8269e767SBrooks Daviscompletion as described in 70*8269e767SBrooks Davis.Xr aio 4 . 71*8269e767SBrooks Davis.Sh RESTRICTIONS 72*8269e767SBrooks DavisThe Asynchronous I/O Control Block structure pointed to by 73*8269e767SBrooks Davis.Fa iocb 74*8269e767SBrooks Davisand the buffer that the 75*8269e767SBrooks Davis.Fa iocb->aio_buf 76*8269e767SBrooks Davismember of that structure references must remain valid until the 77*8269e767SBrooks Davisoperation has completed. 78*8269e767SBrooks Davis.Pp 79*8269e767SBrooks DavisThe asynchronous I/O control buffer 80*8269e767SBrooks Davis.Fa iocb 81*8269e767SBrooks Davisshould be zeroed before the 82*8269e767SBrooks Davis.Fn aio_mlock 83*8269e767SBrooks Daviscall to avoid passing bogus context information to the kernel. 84*8269e767SBrooks Davis.Pp 85*8269e767SBrooks DavisModifications of the Asynchronous I/O Control Block structure or the 86*8269e767SBrooks Davismemory mapping described by the virtual address range are not allowed 87*8269e767SBrooks Daviswhile the request is queued. 88*8269e767SBrooks Davis.Sh RETURN VALUES 89*8269e767SBrooks Davis.Rv -std aio_mlock 90*8269e767SBrooks Davis.Sh ERRORS 91*8269e767SBrooks DavisThe 92*8269e767SBrooks Davis.Fn aio_mlock 93*8269e767SBrooks Davissystem call will fail if: 94*8269e767SBrooks Davis.Bl -tag -width Er 95*8269e767SBrooks Davis.It Bq Er EAGAIN 96*8269e767SBrooks DavisThe request was not queued because of system resource limitations. 97*8269e767SBrooks Davis.It Bq Er EINVAL 98*8269e767SBrooks DavisThe asynchronous notification method in 99*8269e767SBrooks Davis.Fa iocb->aio_sigevent.sigev_notify 100*8269e767SBrooks Davisis invalid or not supported. 101*8269e767SBrooks Davis.El 102*8269e767SBrooks Davis.Pp 103*8269e767SBrooks DavisIf the request is successfully enqueued, but subsequently cancelled 104*8269e767SBrooks Davisor an error occurs, the value returned by the 105*8269e767SBrooks Davis.Fn aio_return 106*8269e767SBrooks Davissystem call is per the 107*8269e767SBrooks Davis.Xr mlock 2 108*8269e767SBrooks Davissystem call, and the value returned by the 109*8269e767SBrooks Davis.Fn aio_error 110*8269e767SBrooks Davissystem call is one of the error returns from the 111*8269e767SBrooks Davis.Xr mlock 2 112*8269e767SBrooks Davissystem call, or 113*8269e767SBrooks Davis.Er ECANCELED 114*8269e767SBrooks Davisif the request was explicitly cancelled via a call to 115*8269e767SBrooks Davis.Fn aio_cancel . 116*8269e767SBrooks Davis.Sh SEE ALSO 117*8269e767SBrooks Davis.Xr aio_cancel 2 , 118*8269e767SBrooks Davis.Xr aio_error 2 , 119*8269e767SBrooks Davis.Xr aio_return 2 , 120*8269e767SBrooks Davis.Xr mlock 2 , 121*8269e767SBrooks Davis.Xr sigevent 3 , 122*8269e767SBrooks Davis.Xr aio 4 123*8269e767SBrooks Davis.Sh PORTABILITY 124*8269e767SBrooks DavisThe 125*8269e767SBrooks Davis.Fn aio_mlock 126*8269e767SBrooks Davissystem call is a 127*8269e767SBrooks Davis.Fx 128*8269e767SBrooks Davisextension, and should not be used in portable code. 129*8269e767SBrooks Davis.Sh HISTORY 130*8269e767SBrooks DavisThe 131*8269e767SBrooks Davis.Fn aio_mlock 132*8269e767SBrooks Davissystem call first appeared in 133*8269e767SBrooks Davis.Fx 10.0 . 134*8269e767SBrooks Davis.Sh AUTHORS 135*8269e767SBrooks DavisThe system call was introduced by 136*8269e767SBrooks Davis.An Gleb Smirnoff Aq Mt glebius@FreeBSD.org . 137