DCMD_PROC_EVENT

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))
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.
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.

Note: The DCMD_PROC_EVENT command won't work unless you've set _DEBUG_RUN_ARM in the flags field of the procfs_run structure for the DCMD_PROC_RUN command.

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);