sys_mman.h(3)              POSIX Programmer's Manual             sys_mman.h(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
       sys/mman.h -- memory management declarations

SSYYNNOOPPSSIISS
       #include <sys/mman.h>

DDEESSCCRRIIPPTTIIOONN
       The _<_s_y_s_/_m_m_a_n_._h_> header shall define the following symbolic constants
       for use as protection options:

       PROT_EXEC     Page can be executed.

       PROT_NONE     Page cannot be accessed.

       PROT_READ     Page can be read.

       PROT_WRITE    Page can be written.

       The _<_s_y_s_/_m_m_a_n_._h_> header shall define the following symbolic constants
       for use as flag options:

       MAP_FIXED     Interpret _a_d_d_r exactly.

       MAP_PRIVATE   Changes are private.

       MAP_SHARED    Share changes.

       The _<_s_y_s_/_m_m_a_n_._h_> header shall define the following symbolic constants
       for the _m_s_y_n_c() function:

       MS_ASYNC      Perform asynchronous writes.

       MS_INVALIDATE Invalidate mappings.

       MS_SYNC       Perform synchronous writes.

       The _<_s_y_s_/_m_m_a_n_._h_> header shall define the following symbolic constants
       for the _m_l_o_c_k_a_l_l() function:

       MCL_CURRENT   Lock currently mapped pages.

       MCL_FUTURE    Lock pages that become mapped.

       The _<_s_y_s_/_m_m_a_n_._h_> header shall define the symbolic constant MAP_FAILED
       which shall have type vvooiidd ** and shall be used to indicate a failure
       from the _m_m_a_p() function .

       If the Advisory Information option is supported, the _<_s_y_s_/_m_m_a_n_._h_>
       header shall define symbolic constants for the _a_d_v_i_c_e argument to the
       _p_o_s_i_x___m_a_d_v_i_s_e() function as follows:

       POSIX_MADV_DONTNEED
             The application expects that it will not access the specified
             range in the near future.

       POSIX_MADV_NORMAL
             The application has no advice to give on its behavior with
             respect to the specified range. It is the default characteristic
             if no advice is given for a range of memory.

       POSIX_MADV_RANDOM
             The application expects to access the specified range in a random
             order.

       POSIX_MADV_SEQUENTIAL
             The application expects to access the specified range
             sequentially from lower addresses to higher addresses.

       POSIX_MADV_WILLNEED
             The application expects to access the specified range in the near
             future.

       The _<_s_y_s_/_m_m_a_n_._h_> header shall define the following symbolic constants
       for use as flags for the _p_o_s_i_x___t_y_p_e_d___m_e_m___o_p_e_n() function:

       POSIX_TYPED_MEM_ALLOCATE
             Allocate on _m_m_a_p().

       POSIX_TYPED_MEM_ALLOCATE_CONTIG
             Allocate contiguously on _m_m_a_p().

       POSIX_TYPED_MEM_MAP_ALLOCATABLE
             Map on _m_m_a_p(), without affecting allocatability.

       The _<_s_y_s_/_m_m_a_n_._h_> header shall define the mmooddee__tt, ooffff__tt, and ssiizzee__tt
       types as described in <<ssyyss__ttyyppeess..hh>>.

       The _<_s_y_s_/_m_m_a_n_._h_> header shall define the ppoossiixx__ttyyppeedd__mmeemm__iinnffoo
       structure, which shall include at least the following member:


           size_t  posix_tmi_length  Maximum length which may be allocated
                                     from a typed memory object.

       The following shall be declared as functions and may also be defined as
       macros. Function prototypes shall be provided.


           int    mlock(const void *, size_t);
           int    mlockall(int);
           void  *mmap(void *, size_t, int, int, int, off_t);
           int    mprotect(void *, size_t, int);
           int    msync(void *, size_t, int);
           int    munlock(const void *, size_t);
           int    munlockall(void);
           int    munmap(void *, size_t);
           int    posix_madvise(void *, size_t, int);
           int    posix_mem_offset(const void *restrict, size_t, off_t *restrict,
                      size_t *restrict, int *restrict);
           int    posix_typed_mem_get_info(int, struct posix_typed_mem_info *);
           int    posix_typed_mem_open(const char *, int, int);
           int    shm_open(const char *, int, mode_t);
           int    shm_unlink(const char *);

       _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_.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       None.

RRAATTIIOONNAALLEE
       None.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       <<ssyyss__ttyyppeess..hh>>

       The System Interfaces volume of POSIX.1-2017, _m_l_o_c_k(), _m_l_o_c_k_a_l_l(),
       _m_m_a_p(), _m_p_r_o_t_e_c_t(), _m_s_y_n_c(), _m_u_n_m_a_p(), _p_o_s_i_x___m_a_d_v_i_s_e(),
       _p_o_s_i_x___m_e_m___o_f_f_s_e_t(), _p_o_s_i_x___t_y_p_e_d___m_e_m___g_e_t___i_n_f_o(), _p_o_s_i_x___t_y_p_e_d___m_e_m___o_p_e_n(),
       _s_h_m___o_p_e_n(), _s_h_m___u_n_l_i_n_k()

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the
       Institute of Electrical and Electronics Engineers, Inc and The Open
       Group.  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.opengroup.org/unix/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                  2017                        sys_mman.h(3)
