posix_mem_offset(), posix_mem_offset64()
QNX SDP8.0C Library ReferenceAPIDeveloper
Get the physical address and length of a mapped memory block
Note:
The QNX OS implementation doesn't follow the expected POSIX behavior,
because this function does not return an offset within the object, but instead returns a direct
physical address.
Synopsis:
#include <sys/mman.h>
int posix_mem_offset( const void *addr,
size_t len,
off_t *off,
size_t *contig_len,
int *filedes );
int posix_mem_offset64( const void *addr,
size_t len,
off64_t *off,
size_t *contig_len,
int *filedes );
Arguments:
- addr
- The virtual address of the memory block whose physical address you want to get. This address doesn't have to be page-aligned (i.e., a multiple of PAGESIZE) because the function reports the physical address that backs the virtual address.
- len
- The length of the memory block that you want the location of.
- off
- NULL, or a pointer to a location for storing the physical address that the virtual address (addr) maps to.
- contig_len
- NULL, or a pointer to a location for storing either the value of len or the length of the physically contiguous block of memory that starts at addr, whichever is smaller.
- filedes
- A pointer to a location for storing the file descriptor used to establish the mapping that contains addr.
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() and posix_mem_offset64() functions set the variable pointed to by off to the physical address of the memory block currently mapped at addr. The length of the physically contiguous block of memory at addr is written into the variable pointed to by contig_len if this argument is not NULL.
Note:
The posix_mem_offset64() function is a large-file support version of
posix_mem_offset().
If you're using large-file support functions and data types, you should define
_LARGEFILE64_SOURCE with a value of 1 to ensure they appear in the name space.
For more information, see
Classificationin
What's in a Function Description?.
These functions support typed memory, shared memory, and memory-mapped files, but not anonymous memory.
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 Large-file support
Safety: | |
---|---|
Cancellation point | No |
Signal handler | Yes |
Thread | Yes |
Page updated: