DCMD_PROC_PAGEDATA

Obtain page data about mapped memory segments in the process associated with the file descriptor. This call matches the corresponding mmap() calls.

#include <sys/procfs.h>

#define DCMD_PROC_PAGEDATA   __DIOF(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 20, procfs_mapinfo)

The arguments to devctl() are:

Argument Value
filedes A file descriptor for the process.
dcmd DCMD_PROC_PAGEDATA
dev_data_ptr NULL, or an array of procfs_mapinfo structures
n_bytes 0, or the size of the array
dev_info_ptr A pointer to an integer where the number of map entries can be stored
Note: If you need the segment-specific attributes, use DCMD_PROC_MAPINFO instead.

Call this the first time with an argument of NULL to get the number of map entries:

devctl(fd, DCMD_PROC_PAGEDATA, NULL, 0, &n);

Next, allocate a buffer that's large enough to hold a procfs_mapinfo structure for each map entry, and pass it to another devctl() call:

my_buffer = (procfs_mapinfo *)
                malloc( sizeof(procfs_mapinfo) * n );
if ( my_buffer == NULL ) {
  /* Not enough memory. */
}

devctl( fd, DCMD_PROC_PAGEDATA, my_buffer,
        sizeof(procfs_mapinfo) * n, &dummy);

For more information, see the section on DCMD_PROC_MAPINFO and DCMD_PROC_PAGEDATA in the appendix about the /procfs filesystem in The QNX Neutrino Cookbook.