POSIX_MEM_OFFSET(3)        POSIX Programmer's Manual       POSIX_MEM_OFFSET(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_mem_offset -- find offset and length of a mapped typed memory
       block (AADDVVAANNCCEEDD RREEAALLTTIIMMEE)

SSYYNNOOPPSSIISS
       #include <sys/mman.h>

       int posix_mem_offset(const void *restrict _a_d_d_r, size_t _l_e_n,
           off_t *restrict _o_f_f, size_t *restrict _c_o_n_t_i_g___l_e_n,
           int *restrict _f_i_l_d_e_s);

DDEESSCCRRIIPPTTIIOONN
       The _p_o_s_i_x___m_e_m___o_f_f_s_e_t() function shall return in the variable pointed to
       by _o_f_f a value that identifies the offset (or location), within a
       memory object, of the memory block currently mapped at _a_d_d_r.  The
       function shall return in the variable pointed to by _f_i_l_d_e_s, the
       descriptor used (via _m_m_a_p()) to establish the mapping which contains
       _a_d_d_r.  If that descriptor was closed since the mapping was established,
       the returned value of _f_i_l_d_e_s shall be -1. The _l_e_n argument specifies
       the length of the block of the memory object the user wishes the offset
       for; upon return, the value pointed to by _c_o_n_t_i_g___l_e_n shall equal either
       _l_e_n, or the length of the largest contiguous block of the memory object
       that is currently mapped to the calling process starting at _a_d_d_r,
       whichever is smaller.

       If the memory object mapped at _a_d_d_r is a typed memory object, then if
       the _o_f_f and _c_o_n_t_i_g___l_e_n values obtained by calling _p_o_s_i_x___m_e_m___o_f_f_s_e_t()
       are used in a call to _m_m_a_p() with a file descriptor that refers to the
       same memory pool as _f_i_l_d_e_s (either through the same port or through a
       different port), and that was opened with neither the
       POSIX_TYPED_MEM_ALLOCATE nor the POSIX_TYPED_MEM_ALLOCATE_CONTIG flag,
       the typed memory area that is mapped shall be exactly the same area
       that was mapped at _a_d_d_r in the address space of the process that called
       _p_o_s_i_x___m_e_m___o_f_f_s_e_t().

       If the memory object specified by _f_i_l_d_e_s is not a typed memory object,
       then the behavior of this function is implementation-defined.

RREETTUURRNN VVAALLUUEE
       Upon successful completion, the _p_o_s_i_x___m_e_m___o_f_f_s_e_t() function shall
       return zero; otherwise, the corresponding error status value shall be
       returned.

EERRRROORRSS
       The _p_o_s_i_x___m_e_m___o_f_f_s_e_t() function shall fail if:

       EEAACCCCEESS The process has not mapped a memory object supported by this
              function at the given address _a_d_d_r.

       This function shall not return an error code of [[EEIINNTTRR]].

       _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
       _m_m_a_p(), _p_o_s_i_x___t_y_p_e_d___m_e_m___o_p_e_n()

       The Base Definitions volume of POSIX.1-2017, <<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_MEM_OFFSET(3)
