Finding out information about the process

Once we've identified which process we're interested in, one of the first things we need to do is find information about the process. (We'll look at how to get information about the threads in a process shortly.)

There are six devctl() commands that deal with processes:

DCMD_PROC_MAPDEBUG_BASE
Returns the name of the process (we've used this one above, in iterate_process()). See also its description in the QNX Neutrino Programmer's Guide.
DCMD_PROC_INFO
Returns basic information about the process (process IDs, signals, virtual addresses, CPU usage).
DCMD_PROC_MAPINFO and DCMD_PROC_PAGEDATA
Returns information about various chunks (“segments,” but not to be confused with x86 segments) of memory.
DCMD_PROC_TIMERS
Returns information about the timers owned by the process.
DCMD_PROC_IRQS
Returns information about the interrupt handlers owned by the process.

Other devctl() commands deal with processes as well, but they're used for control operations rather than fetching information.

To use these commands, we need to open the process's ctl file; we don't need to access the process's address space in order to issue devctl() commands. We do have to have the appropriate permissions, as described in Controlling processes via the /proc filesystem in the Processes chapter of the QNX Neutrino Programmer's Guide.