DCMD_PROC_INFO

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;
        _Uint32t   flags;
        _Uint32t   umask;
        pid_t      child;
        pid_t      sibling;
        pid_t      pgrp;
        pid_t      sid;
        _Uint64t   base_address;
        _Uint64t   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;
        _Uint32t   num_chancons;
        _Uint32t   num_fdcons;
        _Uint32t   num_threads;
        _Uint32t   num_timers;
        _Uint64t   start_time;     /* Start time in nsec */
        _Uint64t   utime;          /* User running time in nsec */
        _Uint64t   stime;          /* System running time in nsec */
        _Uint64t   cutime;         /* terminated children user time in nsec */
        _Uint64t   cstime;         /* terminated children user time in nsec */
        _Uint8t    priority;       /* process base priority */
        _Uint8t    reserved2[7];
        _Uint8t    extsched[8];
        _Uint64t   pls;            /* Address of process local storage */
        _Uint64t   sigstub;        /* Address of process signal trampoline */
        _Uint64t   canstub;        /* Address of process thread cancellation trampoline */
        _Uint64t   private_mem;    /* Amount of MAP_PRIVATE memory */
        _Uint32t   appid;          /* Application id */
        _Uint32t   reserved3[1];
        _Uint64t   reserved[8];
} debug_process_t;

This information is filled into the debug_process_t structure by issuing the DCMD_PROC_INFO devctl(). 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 errno %d (%s)\n",
            progname, pid, errno, strerror (errno));
    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.