introspection_get_virtual_regions()

Get all virtual memory regions within a virtual address range

Synopsis:

#include <sys/introspection.h>

int introspection_get_virtual_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_virtual_regions() function gets all virtual memory regions from within a virtual address range and stores an array of region information in the provided buffer.

Virtual 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.
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 virtual memory regions, 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: