Set specific debug flags with the values provided for the process associated with the file descriptor.
#include <sys/procfs.h> #define DCMD_PROC_SET_FLAG __DIOT(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 18, uint32_t)
The arguments to devctl() are:
| Argument | Value | 
|---|---|
| filedes | A file descriptor for the process. | 
| dcmd | DCMD_PROC_SET_FLAG | 
| dev_data_ptr | A pointer to a uint32_t | 
| n_bytes | sizeof(uint32_t) | 
| dev_info_ptr | NULL | 
The flags that can be set are described in <sys/debug.h>. The argument is a pointer to an unsigned integer that specifies the debug flags to set. For example:
int flags; flags = _DEBUG_FLAG_KLC; /* Kill-on-Last-Close flag */ devctl( fd, DCMD_PROC_SET_FLAG, &flags, sizeof(flags), NULL);
To clear the debug flags, use DCMD_PROC_CLEAR_FLAG.