dtrace_work - DTrace work interface
cc [ flag... ] file... -ldtrace [ library... ] #include <dtrace.h> dtrace_workstatus_t dtrace_work(dtrace_hdl_t *dtp, FILE *fp, dtrace_consume_probe_f *pfunc, dtrace_consume_rec_f *rfunc, void *arg)
The dtrace_work() function consumes traced data and snapshots aggregation data. The dtp argument is the DTrace handle as returned by the dtrace_open(3DTRACE) function. The fp argument is the file pointer for any output. The pfunc argument is a function to be called to process data from this enabled probe. The rfunc argument is a function to be called to process data from individual data records. arg is a user-defined argument to be passed to these two callback functions. See the dtrace_consume(3DTRACE) man page for a description of these callback functions.
Upon successful completion, the dtrace_work() function returns the value, DTRACE_WORKSTATUS_OKAY or DTRACE_WORKSTATUS_DONE. On failure, the function returns the value DTRACE_WORKSTATUS_ERROR and sets the DTrace error number to indicate the reason for the failure. See the dtrace_errno(3DTRACE) man page for more information.
The dtrace_work() function will fail if:
The dtp argument is NULL.
The system encountered an error when copying out the status for this DTrace handle.
The DTrace handle is not active because the dtrace_go(3DTRACE) function has not been called yet.
DTrace has self-terminated for some reason.
The D program is aborting due to dropped data. Data is dropped either because an installed a drop handler has explicitly returned the value, DTRACE_HANDLE_ABORT, or there is no drop handler.
The system was unable to allocate memory while processing this function.
See the libdtrace(3LIB) man page for an example of using the dtrace_work() function.
See attributes(7) for descriptions of the following attributes: