Go to main content

man pages section 3: Extended Library Functions, Volume 2

Exit Print View

Updated: Thursday, June 13, 2019
 
 

dtrace_work (3DTRACE)

Name

dtrace_work - DTrace work interface

Synopsis

     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)

Description

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.

Return Values

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.

Errors

The dtrace_work() function will fail if:

EINVAL

The dtp argument is NULL.

EFAULT

The system encountered an error when copying out the status for this DTrace handle.

EDT_NOTACTIVE

The DTrace handle is not active because the dtrace_go(3DTRACE) function has not been called yet.

EDT_BRICKED

DTrace has self-terminated for some reason.

EDT_DROPABORT

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.

EDT_NOMEM

The system was unable to allocate memory while processing this function.

Examples

See the libdtrace(3LIB) man page for an example of using the dtrace_work() function.

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Architecture
All
Availability
system/dtrace
Interface Stability
Committed
MT-Level
Safe

See Also

libdtrace(3LIB), dtrace_errno(3DTRACE)