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

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);