Go to main content

man pages section 3: Extended Library Functions, Volume 2

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

dtrace_getopt (3DTRACE)

Name

dtrace_setopt, dtrace_getopt - Process DTrace options

Synopsis

     cc [ flag... ] file... -ldtrace [ library... ]
     #include <dtrace.h>

     int dtrace_getopt(dtrace_hdl_t *dtp, const char *opt,
	 dtrace_optval_t *val)

     int dtrace_setopt(dtrace_hdl_t *dtp, const char *opt,
	 const char *val)

Description

The dtrace_getopt() function gets the current value of the specified option, opt, and returns that value in the third argument, val.

The dtrace_setopt() function sets the specified option, opt, to the specified value, val, for the DTrace handle, dtp. The value is specified as a string.


Note -  See the Options and Tunables chapter of the Solaris Dynamic Tracing Guide for the full list of options specified by the opt argument. If you collect regular data using functions such as trace(), tracemem(), and printf(), then you must set the bufsize option to allocate principal buffers. If you use aggregations, you must set the aggsize option to allocate aggregation buffers.

Return Values

On successful completion, the dtrace_setopt() function returns 0. Otherwise the function returns -1 and sets the DTrace error number to indicate the reason for the failure. See the dtrace_errno(3DTRACE) man page for more information.

On successful completion, the dtrace_getopt() function returns 0 and places the value of the specified option in the val argument. Otherwise the function returns -1 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_getopt() and dtrace_setopt() functions will fail if:

EINVAL

Either the dtp or the opt argument is NULL.

EDT_BADOPTNAME

The opt argument contains an invalid DTrace option name.

The dtrace_setopt() function will fail if:

EDT_BADOPTVAL

The val argument is an inappropriate value for the specified option. See the Solaris Dynamic Tracing Guide for the appropriate values.

EDT_NOMEM

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

EDT_VERSINVAL

When setting the version option, this error indicates that the specified version is invalid.

EDT_VERSUNDEF

When setting the version option, this error indicates that the requested API version is undefined.

EOVERFLOW

When setting the strsize option, the specified value exceeds UINT_MAX.

Examples

See libdtrace(3LIB) for an example of using the dtrace_setopt() 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)