Handler APIs
-
int dtrace_handle_err(dtrace_hdl_t *dtp, dtrace_handle_err_f *hdlr, void *arg)
-
Registers an error handler for a DTrace consumer. The error handler is called when an error occurs in a running D program such as accessing an invalid address or dividing by zero. Information about the error is stored in the
dtrace_errdata_t
argument. The error handler can return aDTRACE_HANDLE_OK
value to continue processing orDTRACE_HANDLE_ABORT
to abort. An error handler has the following signature:int dtrace_handle_err_f(const dtrace_errdata_t *, void *);
-
int dtrace_handle_drop(dtrace_hdl_t *dtp, dtrace_handle_drop_f *hdlr, void *arg)
-
Registers a drop handler for a DTrace consumer. The drop handler is called when the data is dropped by the running D program. Information about the drop (including the drop type) is stored in the
dtrace_dropdata_t
argument. The drop handler can return a value to continue processingDTRACE_HANDLE_OK
orDTRACE_HANDLE_ABORT
to abort. A drop handler has the following signature:int dtrace_handle_drop_f(const dtrace_dropdata_t *, void *);
-
int dtrace_handle_proc(dtrace_hdl_t *dtp, dtrace_handle_proc_f *hdlr, void *arg)
-
Registers a process handler for a DTrace consumer. The process handler is called when certain events occur for a process under DTrace control, such as dynamic linker activity or the process exiting. The process handler is called whenever certain events occur for a process under DTrace control, such as dynamic linker activity or the process exiting. A
libproc
handle to the process is passed as the first argument, and a predefined message is passed as the second argument. A proc handler has the following signature:void dtrace_handle_proc_f(struct ps_prochandle *, const char *, void *);
-
int dtrace_handle_buffered(dtrace_hdl_t *dtp, dtrace_handle_buffered_f *hdlr, void *arg)
-
Registers a buffered I/O handler for a DTrace consumer. A buffered I/O handler allows the consumer to perform its own buffered I/O. If a NULL pointer is passed to
dtrace_work
(),dtrace_consume
(), ordtrace_aggregate_print
(),libdtrace
() will make use of the buffered I/O handler. Output goes into thedtbda_buffered
member of thedtrace_bufdata_t
data structure. A simple buffered I/O handler can just print that output. Information about the probe and the record or aggregation data being processed is also included. The buffered I/O handler can return aDTRACE_HANDLE_OK
value to continue processing orDTRACE_HANDLE_ABORT
to abort. Seedtrace_handle_buffered
(3DTRACE). -
int dtrace_handle_setopt(dtrace_hdl_t *dtp, dtrace_handle_setopt_f *hdlr, void *arg)
-
Registers a
setopt
handler for a DTrace consumer. Thesetopt
handler is called when a DTrace option is set from within a D program by using thesetopt
() action. Information about the option being set and the old and new values of the option are passed in thedtrace_setoptdata_t
argument. Thesetopt
handler can return aDTRACE_HANDLE_OK
value to continue processing orDTRACE_HANDLE_ABORT
to abort. Seedtrace_handle_setopt
(3DTRACE).