MLOCKALL(3)                POSIX Programmer's Manual               MLOCKALL(3)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.


NNAAMMEE
       mlockall, munlockall -- lock/unlock the address space of a process
       (RREEAALLTTIIMMEE)

SSYYNNOOPPSSIISS
       #include <sys/mman.h>

       int mlockall(int _f_l_a_g_s);
       int munlockall(void);

DDEESSCCRRIIPPTTIIOONN
       The _m_l_o_c_k_a_l_l() function shall cause all of the pages mapped by the
       address space of a process to be memory-resident until unlocked or
       until the process exits or _e_x_e_cs another process image. The _f_l_a_g_s
       argument determines whether the pages to be locked are those currently
       mapped by the address space of the process, those that are mapped in
       the future, or both. The _f_l_a_g_s argument is constructed from the
       bitwise-inclusive OR of one or more of the following symbolic
       constants, defined in _<_s_y_s_/_m_m_a_n_._h_>:

       MCL_CURRENT Lock all of the pages currently mapped into the address
                   space of the process.

       MCL_FUTURE  Lock all of the pages that become mapped into the address
                   space of the process in the future, when those mappings are
                   established.

       If MCL_FUTURE is specified, and the automatic locking of future
       mappings eventually causes the amount of locked memory to exceed the
       amount of available physical memory or any other implementation-defined
       limit, the behavior is implementation-defined. The manner in which the
       implementation informs the application of these situations is also
       implementation-defined.

       The _m_u_n_l_o_c_k_a_l_l() function shall unlock all currently mapped pages of
       the address space of the process. Any pages that become mapped into the
       address space of the process after a call to _m_u_n_l_o_c_k_a_l_l() shall not be
       locked, unless there is an intervening call to _m_l_o_c_k_a_l_l() specifying
       MCL_FUTURE or a subsequent call to _m_l_o_c_k_a_l_l() specifying MCL_CURRENT.
       If pages mapped into the address space of the process are also mapped
       into the address spaces of other processes and are locked by those
       processes, the locks established by the other processes shall be
       unaffected by a call by this process to _m_u_n_l_o_c_k_a_l_l().

       Upon successful return from the _m_l_o_c_k_a_l_l() function that specifies
       MCL_CURRENT, all currently mapped pages of the address space of the
       process shall be memory-resident and locked.  Upon return from the
       _m_u_n_l_o_c_k_a_l_l() function, all currently mapped pages of the address space
       of the process shall be unlocked with respect to the address space of
       the process.  The memory residency of unlocked pages is unspecified.

       Appropriate privileges are required to lock process memory with
       _m_l_o_c_k_a_l_l().

RREETTUURRNN VVAALLUUEE
       Upon successful completion, the _m_l_o_c_k_a_l_l() function shall return a
       value of zero. Otherwise, no additional memory shall be locked, and the
       function shall return a value of -1 and set _e_r_r_n_o to indicate the
       error. The effect of failure of _m_l_o_c_k_a_l_l() on previously existing locks
       in the address space is unspecified.

       If it is supported by the implementation, the _m_u_n_l_o_c_k_a_l_l() function
       shall always return a value of zero. Otherwise, the function shall
       return a value of -1 and set _e_r_r_n_o to indicate the error.

EERRRROORRSS
       The _m_l_o_c_k_a_l_l() function shall fail if:

       EEAAGGAAIINN Some or all of the memory identified by the operation could not
              be locked when the call was made.

       EEIINNVVAALL The _f_l_a_g_s argument is zero, or includes unimplemented flags.

       The _m_l_o_c_k_a_l_l() function may fail if:

       EENNOOMMEEMM Locking all of the pages currently mapped into the address space
              of the process would exceed an implementation-defined limit on
              the amount of memory that the process may lock.

       EEPPEERRMM  The calling process does not have appropriate privileges to
              perform the requested operation.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

EEXXAAMMPPLLEESS
       None.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       None.

RRAATTIIOONNAALLEE
       None.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _e_x_e_c, _e_x_i_t(), _f_o_r_k(), _m_l_o_c_k(), _m_u_n_m_a_p()

       The Base Definitions volume of POSIX.1-2008, <<ssyyss__mmmmaann..hh>>

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
       -- Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, Copyright (C) 2013 by the Institute of
       Electrical and Electronics Engineers, Inc and The Open Group.  (This is
       POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) 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.unix.org/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 .



IEEE/The Open Group                  2013                          MLOCKALL(3)
