Stop the process that's associated with the file descriptor.

#include <sys/procfs.h>

#define DCMD_PROC_STOP32  (__DIOF(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 5, procfs_status32))
#define DCMD_PROC_STOP64  (__DIOF(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 5, procfs_status64))
#define DCMD_PROC_STOP    (__DIOF(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 5, procfs_status))
Note: The generic command maps onto the 64-bit version, unless you're compiling for a 32-bit architecture and you define WANT_OLD_DEVCTLS before you include <sys/procfs.h>.

The arguments to devctl() are:

Argument Value
filedes A file descriptor for the process. You must have opened the file descriptor for writing.
dev_data_ptr A pointer to a procfs_status structure
n_bytes sizeof(procfs_status)
dev_info_ptr NULL

The argument to this command is the address of a procfs_status structure (see debug_thread_t in <sys/debug.h>). This structure is filled with status information on return. For example:

procfs_status my_status;

devctl( fd, DCMD_PROC_STOP, &my_status, sizeof(my_status), NULL);

For more information about the contents of this structure, see Thread information,” earlier in this chapter.

To resume the process, use DCMD_PROC_RUN.