Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/posix_mem_offset.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/posix_mem_offset.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/posix_mem_offset.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/posix_mem_offset.html on line 8

posix_mem_offset(), posix_mem_offset64()

Get the offset and length of a mapped typed memory block

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);
             
int posix_mem_offset64(const void *restrict addr,
                     size_t len,
                     off64_t *restrict off,
                     size_t *restrict contig_len,
                     int *restrict fildes);

Arguments:

addr
The address that the memory block is currently mapped at.
len
The length of the block of memory object that you want the offset of.
off
A pointer to a location where the function can store the offset (or location) within the memory block
contig_len
A pointer to a location where the function can store either the value of len or the length of the largest contiguous block of typed memory that's currently mapped to the calling process starting at addr, whichever is smaller.
fildes
A pointer to a location where the function can store the file descriptor for the typed memory object.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The posix_mem_offset() function sets the variable pointed to by off to the offset (or location), within a typed memory object, of the memory block currently mapped at addr.

The posix_mem_offset() function uses a variable to return the descriptor that establishes the mapping containing addr. This variable is pointed to by fildes; its value is -1 when the descriptor closes after the mapping is established.

The len argument specifies the length of the block of memory you want the offset for. On return, the value pointed to by contig_len is either len, or the length of the largest contiguous block of typed memory that's currently mapped to the calling process starting at addr, whichever is smaller.

If the off and contig_len values obtained from 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), the typed memory area that is mapped is exactly the same area that was mapped at addr of the process that called posix_mem_offset(). Note that neither of the two flags (such as the POSIX_TYPED_MEMORY_ALLOCATE or the POSIX_TYPED_MEM_ALLOCATE_CONTIG) did open the file descriptor.

Returns:

0
Success.
EACCES
The process hasn't mapped a memory object at the given address addr.

Classification:

posix_mem_offset() is POSIX 1003.1 TYM; posix_mem_offset64() is for large-file support

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

posix_typed_mem_get_info(), posix_typed_mem_open()


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/posix_mem_offset.html on line 190

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/posix_mem_offset.html on line 190