Manipulating a process or thread

Once you have a file descriptor to a particular process's /proc/pid/ctl file, you can get information about and control that process and its associated threads.

All of these functions are performed using the devctl() call as described in the sections that follow. To be able to use these devctl() calls, you'll need at least the following:

#include <devctl.h>
#include <sys/procfs.h>
Note: There are 32- and 64-bit versions of some of the DCMD_PROC_* commands. For example:
#define DCMD_PROC_STATUS32  (__DIOF(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 7, procfs_status32))
#define DCMD_PROC_STATUS64  (__DIOF(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 7, procfs_status64))
#define DCMD_PROC_STATUS    (__DIOF(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 7, procfs_status))

The first two forms are for specific sizes; the generic form (DCMD_PROC_STATUS) maps onto the 64-bit version, whether you compile for a 32- or 64-bit architecture. If you're compiling for a 32-bit architecture, and you want the generic version to map onto the 32-bit command, define WANT_OLD_DEVCTLS before you include <sys/procfs.h>. If you're compiling for a 64-bit architecture, the generic version always maps onto the 64-bit version of the command.

You can use the devctl() commands (described in the sections that follow) to do the following: