Set specific debug flags with the values provided for the process associated with the file descriptor. 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 .