# posix_mem_offset

## PROLOG



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


## NAME



           posix_mem_offset — find offset and length of a mapped typed memory
           block (**ADVANCED REALTIME**)
    


## SYNOPSIS



           #include <sys/mman.h>
    
           int posix_mem_offset(const void *restrict _addr_ , size_t _len_ ,
               off_t *restrict _off_ , size_t *restrict _contig_len_ ,
               int *restrict _fildes_);
    


## DESCRIPTION



           The _posix_mem_offset_() function shall return in the variable
           pointed to by _off_ a value that identifies the offset (or
           location), within a memory object, of the memory block currently
           mapped at _addr_.  The function shall return in the variable pointed
           to by _fildes_ , the descriptor used (via _mmap_()) to establish the
           mapping which contains _addr_.  If that descriptor was closed since
           the mapping was established, the returned value of _fildes_ shall be
           -1. The _len_ argument specifies the length of the block of the
           memory object the user wishes the offset for; upon return, the
           value pointed to by _contig_len_ shall equal either _len_ , or the
           length of the largest contiguous block of the memory object that
           is currently mapped to the calling process starting at _addr_ ,
           whichever is smaller.
    
           If the memory object mapped at _addr_ is a typed memory object, then
           if the _off_ and _contig_len_ values obtained by calling
           _posix_mem_offset_() are used in a call to _mmap_() with a file
           descriptor that refers to the same memory pool as _fildes_ (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 _addr_
           in the address space of the process that called
           _posix_mem_offset_().
    
           If the memory object specified by _fildes_ is not a typed memory
           object, then the behavior of this function is implementation-
           defined.
    


## RETURN VALUE



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


## ERRORS



           The _posix_mem_offset_() function shall fail if:
    
           **EACCES** The process has not mapped a memory object supported by
                  this function at the given address _addr_.
    
           This function shall not return an error code of **[EINTR]**.
    
           _The following sections are informative._
    


## EXAMPLES



           None.
    


## APPLICATION USAGE



           None.
    


## RATIONALE



           None.
    


## FUTURE DIRECTIONS



           None.
    


* * *