POSIX_TYPED_MEM_OPEN(3)    POSIX Programmer's Manual   POSIX_TYPED_MEM_OPEN(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
       posix_typed_mem_open -- open a typed memory object (AADDVVAANNCCEEDD RREEAALLTTIIMMEE)

SSYYNNOOPPSSIISS
       #include <sys/mman.h>

       int posix_typed_mem_open(const char *_n_a_m_e, int _o_f_l_a_g, int _t_f_l_a_g);

DDEESSCCRRIIPPTTIIOONN
       The _p_o_s_i_x___t_y_p_e_d___m_e_m___o_p_e_n() function shall establish a connection
       between the typed memory object specified by the string pointed to by
       _n_a_m_e and a file descriptor. It shall create an open file description
       that refers to the typed memory object and a file descriptor that
       refers to that open file description. The file descriptor shall be
       allocated as described in _S_e_c_t_i_o_n _2_._1_4, _F_i_l_e _D_e_s_c_r_i_p_t_o_r _A_l_l_o_c_a_t_i_o_n and
       can be used by other functions to refer to that typed memory object. It
       is unspecified whether the name appears in the file system and is
       visible to other functions that take pathnames as arguments. The _n_a_m_e
       argument conforms to the construction rules for a pathname, except that
       the interpretation of <slash> characters other than the leading <slash>
       character in _n_a_m_e is implementation-defined, and that the length limits
       for the _n_a_m_e argument are implementation-defined and need not be the
       same as the pathname limits {PATH_MAX} and {NAME_MAX}.  If _n_a_m_e begins
       with the <slash> character, then processes calling
       _p_o_s_i_x___t_y_p_e_d___m_e_m___o_p_e_n() with the same value of _n_a_m_e shall refer to the
       same typed memory object. If _n_a_m_e does not begin with the <slash>
       character, the effect is implementation-defined.

       Each typed memory object supported in a system shall be identified by a
       name which specifies not only its associated typed memory pool, but
       also the path or port by which it is accessed. That is, the same typed
       memory pool accessed via several different ports shall have several
       different corresponding names. The binding between names and typed
       memory objects is established in an implementation-defined manner.
       Unlike shared memory objects, there is no way within POSIX.1-2008 for a
       program to create a typed memory object.

       The value of _t_f_l_a_g shall determine how the typed memory object behaves
       when subsequently mapped by calls to _m_m_a_p().  At most, one of the
       following flags defined in _<_s_y_s_/_m_m_a_n_._h_> may be specified:

       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.

       If _t_f_l_a_g has the flag POSIX_TYPED_MEM_ALLOCATE specified, any
       subsequent call to _m_m_a_p() using the returned file descriptor shall
       result in allocation and mapping of typed memory from the specified
       typed memory pool. The allocated memory may be a contiguous previously
       unallocated area of the typed memory pool or several non-contiguous
       previously unallocated areas (mapped to a contiguous portion of the
       process address space). If _t_f_l_a_g has the flag
       POSIX_TYPED_MEM_ALLOCATE_CONTIG specified, any subsequent call to
       _m_m_a_p() using the returned file descriptor shall result in allocation
       and mapping of a single contiguous previously unallocated area of the
       typed memory pool (also mapped to a contiguous portion of the process
       address space). If _t_f_l_a_g has none of the flags POSIX_TYPED_MEM_ALLOCATE
       or POSIX_TYPED_MEM_ALLOCATE_CONTIG specified, any subsequent call to
       _m_m_a_p() using the returned file descriptor shall map an application-
       chosen area from the specified typed memory pool such that this mapped
       area becomes unavailable for allocation until unmapped by all
       processes. If _t_f_l_a_g has the flag POSIX_TYPED_MEM_MAP_ALLOCATABLE
       specified, any subsequent call to _m_m_a_p() using the returned file
       descriptor shall map an application-chosen area from the specified
       typed memory pool without an effect on the availability of that area
       for allocation; that is, mapping such an object leaves each byte of the
       mapped area unallocated if it was unallocated prior to the mapping or
       allocated if it was allocated prior to the mapping. Appropriate
       privileges to specify the POSIX_TYPED_MEM_MAP_ALLOCATABLE flag are
       implementation-defined.

       If successful, _p_o_s_i_x___t_y_p_e_d___m_e_m___o_p_e_n() shall return a file descriptor
       for the typed memory object.  The open file description is new, and
       therefore the file descriptor shall not share it with any other
       processes. It is unspecified whether the file offset is set. The
       FD_CLOEXEC file descriptor flag associated with the new file descriptor
       shall be cleared.

       The behavior of _m_s_y_n_c(), _f_t_r_u_n_c_a_t_e(), and all file operations other
       than _m_m_a_p(), _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(), _f_s_t_a_t(),
       _d_u_p(), _d_u_p_2(), and _c_l_o_s_e(), is unspecified when passed a file
       descriptor connected to a typed memory object by this function.

       The file status flags of the open file description shall be set
       according to the value of _o_f_l_a_g.  Applications shall specify exactly
       one of the three access mode values described below and defined in the
       _<_f_c_n_t_l_._h_> header, as the value of _o_f_l_a_g.

       O_RDONLY    Open for read access only.

       O_WRONLY    Open for write access only.

       O_RDWR      Open for read or write access.

RREETTUURRNN VVAALLUUEE
       Upon successful completion, the _p_o_s_i_x___t_y_p_e_d___m_e_m___o_p_e_n() function shall
       return a non-negative integer representing the file descriptor.
       Otherwise, it shall return -1 and set _e_r_r_n_o to indicate the error.

EERRRROORRSS
       The _p_o_s_i_x___t_y_p_e_d___m_e_m___o_p_e_n() function shall fail if:

       EEAACCCCEESS The typed memory object exists and the permissions specified by
              _o_f_l_a_g are denied.

       EEIINNTTRR  The _p_o_s_i_x___t_y_p_e_d___m_e_m___o_p_e_n() operation was interrupted by a
              signal.

       EEIINNVVAALL The flags specified in _t_f_l_a_g are invalid (more than one of
              POSIX_TYPED_MEM_ALLOCATE, POSIX_TYPED_MEM_ALLOCATE_CONTIG, or
              POSIX_TYPED_MEM_MAP_ALLOCATABLE is specified).

       EEMMFFIILLEE All file descriptors available to the process are currently
              open.

       EENNFFIILLEE Too many file descriptors are currently open in the system.

       EENNOOEENNTT The named typed memory object does not exist.

       EEPPEERRMM  The caller lacks appropriate privileges to specify the
              POSIX_TYPED_MEM_MAP_ALLOCATABLE flag in the _t_f_l_a_g argument.

       The _p_o_s_i_x___t_y_p_e_d___m_e_m___o_p_e_n() function may fail if:

       EENNAAMMEETTOOOOLLOONNGG
              The length of the _n_a_m_e argument exceeds {_POSIX_PATH_MAX} on
              systems that do not support the XSI option or exceeds
              {_XOPEN_PATH_MAX} on XSI systems, or has a pathname component
              that is longer than {_POSIX_NAME_MAX} on systems that do not
              support the XSI option or longer than {_XOPEN_NAME_MAX} on XSI
              systems.

       _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
       _S_e_c_t_i_o_n _2_._1_4, _F_i_l_e _D_e_s_c_r_i_p_t_o_r _A_l_l_o_c_a_t_i_o_n, _c_l_o_s_e(), _d_u_p(), _e_x_e_c,
       _f_c_n_t_l(), _f_s_t_a_t(), _f_t_r_u_n_c_a_t_e(), _m_m_a_p(), _m_s_y_n_c(), _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(), _u_m_a_s_k()

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

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              POSIX_TYPED_MEM_OPEN(3)
