introspection_get_physical_regions()

Get mapped memory ranges within a virtual address range

Synopsis:

#include <sys/introspection.h>

int introspection_get_physical_regions( pid64_t pid64,
                                        uintptr_t startaddr,
                                        uintptr_t endaddr,
                                        struct _procfs_map_info *mapinfo,
                                        size_t bsize );

Arguments:

pid64
The PID (pid_t) or unique PID (pid64_t) of the target process.
startaddr
The beginning of the address range.
endaddr
The end of the address range.
mapinfo
The buffer to store the data.
bsize
The size of the buffer.

Library:

libintrospection

Use the -l introspection option to qcc to link against this library.

Description:

The introspection_get_physical_regions() function gets all physical memory regions from within a virtual address range and stores an array of region information in the provided buffer.

This function differs from introspection_get_virtual_regions() in that it provides information on how a virtual memory region is mapped to physical memory regions. Virtual memory regions aren't necessarily made up of a single physical memory region. They don't need to be backed by physical memory at all or can be made up of two or more physical regions. These physical regions aren't contiguous in the physical address space or differ in their protection bits or other attributes. For example, introspection_get_virtual_regions() may report a single virtual region for a given address range,but introspection_get_physical_regions() may report two or more physical regions for the same range.

Physical region information includes:
  • virtual start address
  • size
  • attributes of the region (stack, ELF text segment, RAM, shared, or private)
  • protection bits (read, write, exec)
  • other attributes (e.g., cacheability)
  • device and inode of the object backing of that region, if applicable. A backing object can include a file, shared memory, or typed memory.
  • physical start address
If there is no region at startaddr, the function returns information about regions with a higher address, as long as they start within the given address range.
Note:
Your process must have the PROCMGR_AID_XPROCESS_QUERY ability enabled to request information about another process.

Returns:

The required size in bytes to store the mapped memory ranges, on success. If an error occurs, the function returns the negative of a value from the Errors section.

Errors:

EFAULT
Error accessing the output buffer.
EPERM
The calling process doesn't have the required ability.
ESRCH
The PID is invalid.

Classification:

QNX OS

Safety:
Cancellation point Yes
Signal handler Yes
Thread Yes
Page updated: