Define an event to be delivered when the process associated with the file descriptor reaches a point of interest.
#include <sys/procfs.h> #define DCMD_PROC_EVENT32 (__DIOT(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 17, struct __sigevent32)) #define DCMD_PROC_EVENT64 (__DIOT(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 17, struct __sigevent64)) #define DCMD_PROC_EVENT (__DIOT(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 17, struct sigevent))
The arguments to devctl() are:
Argument | Value |
---|---|
filedes | A file descriptor for the process. |
dcmd | DCMD_PROC_EVENT |
dev_data_ptr | A pointer to a struct sigevent |
n_bytes | sizeof(struct sigevent) |
dev_info_ptr | NULL |
Use the DCMD_PROC_RUN command to set up the point of interest.
Unlike DCMD_PROC_WAITSTOP, the DCMD_PROC_EVENT command doesn't block the calling process.
The argument is a pointer to the sigevent that you want to be delivered at the appropriate time. For example:
struct sigevent event; // Define a sigevent for process stopped notification. event.sigev_notify = SIGEV_SIGNAL_THREAD; event.sigev_signo = SIGUSR2; event.sigev_code = 0; event.sigev_value.sival_ptr = prp; event.sigev_priority = -1; devctl( fd, DCMD_PROC_EVENT, &event, sizeof(event), NULL);