The following information is readily available about the process via the DCMD_PROC_INFO devctl() command:
typedef struct _debug_process_info {
pid_t pid;
pid_t parent;
uint32_t flags;
uint32_t umask;
pid_t child;
pid_t sibling;
pid_t pgrp;
pid_t sid;
uint64_t base_address;
uint64_t initial_stack;
uid_t uid;
gid_t gid;
uid_t euid;
gid_t egid;
uid_t suid;
gid_t sgid;
sigset_t sig_ignore;
sigset_t sig_queue;
sigset_t sig_pending;
uint32_t num_chancons;
uint32_t num_fdcons;
uint32_t num_threads;
uint32_t num_timers;
uint64_t start_time; /* Start time in nsec */
uint64_t utime; /* User running time in nsec */
uint64_t stime; /* System running time in nsec */
uint64_t cutime; /* terminated children user time in nsec */
uint64_t cstime; /* terminated children user time in nsec */
uint8_t priority; /* process base priority */
uint8_t reserved2[7];
uint8_t extsched[8];
uint64_t pls; /* Address of process local storage */
uint64_t sigstub; /* Address of process signal trampoline */
uint64_t canstub; /* Address of process thread cancellation trampoline */
uint64_t private_mem; /* Amount of MAP_PRIVATE memory */
uint32_t appid; /* Application id */
uint32_t reserved3[1];
uint64_t reserved[8];
} debug_process_t;
This information is filled into the debug_process_t structure by issuing the DCMD_PROC_INFO devctl(). For details, see its description in the QNX Neutrino Programmer's Guide. Note that the debug_process_t is the same type as procfs_info (via a typedef in <sys/procfs.h>). To get this structure:
void
dump_procfs_info (int fd, int pid)
{
procfs_info info;
int sts;
sts = devctl (fd, DCMD_PROC_INFO, &info, sizeof (info), NULL);
if (sts != EOK) {
fprintf(stderr, "%s: DCMD_PROC_INFO pid %d error %d (%s)\n",
progname, pid, sts, strerror (sts));
exit (EXIT_FAILURE);
}
// structure is now full, and can be printed, analyzed, etc.
...
}
As an example, we'll stick with the pipe process. Here are the contents of the procfs_info structure for the pipe process:
PROCESS ID 4105 Info from DCMD_PROC_INFO pid 4105 parent 2 flags 0x00000210 umask 0x00000000 child 0 sibling 8 pgrp 4105 sid 1 base_address 0x0000000008048000 initial_stack 0x0000000008047F18 uid 0 gid 0 euid 0 egid 0 suid 0 sgid 0 sig_ignore 0x06800000-00000000 sig_queue 0x00000000-FF000000 sig_pending 0x00000000-00000000 num_chancons 4 num_fdcons 3 num_threads 4 num_timers 0 start_time 0x0EB99001F9CD1EF7 utime 0x0000000016D3DA23 stime 0x000000000CDF64E8 cutime 0x0000000000000000 cstime 0x0000000000000000 priority 10
Let's look at the various fields that are present here.