dtrace_faultstr, dtrace_subrstr - Map DTrace fault and subroutine constants to strings
cc [ flag... ] file... -ldtrace [ library... ] #include <dtrace.h> const char *dtrace_faultstr(dtrace_hdl_t *dtp, int fault) const char *dtrace_subrstr(dtrace_hdl_t *dtp, int subr)
The dtrace_faultstr() function returns a string associated with a particular DTrace fault number corresponding to the fault argument. If the value passed does not match a known fault, the string, unknown fault is returned.
The dtrace_subrstr() function returns the string corresponding to the subr argument. The string is the name of a DTrace subroutine given the constant associated with that subroutine. If the value passed does not match a known subroutine, the string, unknown is returned.
The dtrace_faultstr() function returns the string corresponding to the fault argument. If the value passed does not match a known fault, the string "unknown fault" is returned.
The dtrace_subrstr() function returns the string corresponding to the subr argument. If the value passed does not match a known subroutine, the string "unknown" is returned.
None
The dtrace_faultstr() function might be used in an error handler as in the following example:
static int errhandler(const dtrace_errdata_t *data, void *arg) { fprintf(stderr, "Error on enabled probe %d (probe %s:%s:%s:%s): %s\n", data->dteda_edesc->dtepd_epid, data->dteda_pdesc->dtpd_provider, data->dteda_pdesc->dtpd_mod, data->dteda_pdesc->dtpd_func, data->dteda_pdesc->dtpd_name, dtrace_faultstr(g_dtp, data->dteda_fault)); return (DTRACE_HANDLE_OK); } int main() { [ ... ] if (dtrace_handle_err(dtp, errhandler, NULL) == -1) fprintf(stderr, "failed to install error handler: %s\n", dtrace_errmsg(dtp, dtrace_errno(dtp))); [ ... ] }
See attributes(7) for descriptions of the following attributes:
|
libdtrace(3LIB), dtrace_errno(3DTRACE), dtrace_handle_err(3DTRACE)