User Tools

Site Tools


solaris:dtrace_provider_modules.3dtrace

dtrace_provider_modules


NAME

dtrace_provider_modules - Retrieve the list of DTrace provider modules

SYNOPSIS

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

int dtrace_provider_modules(dtrace_hdl_t *dtp, const char **mods,

int nmods)

DESCRIPTION

The dtrace_provider_modules() function retrieves the list of kernel modules functioning as DTrace providers. The function writes at most nmods module names into the array, mods.

RETURN VALUES

On successful completion, the dtrace_provider_modules() function returns the number of DTrace provider modules. Otherwise the function returns -1, and sets an error number to indicate the error. The error number can be retrieved with the dtrace_errno(3DTRACE)) function.

ERRORS

The dtrace_provider_modules() function will fail if:

EINVAL

The dtp or the mods argument is NULL.

EXAMPLES

Example 1 Printing List of Loaded Kernel Modules

The following example shows how the dtrace_provider_modules() function prints the list of loaded kernel modules functioning as DTrace providers:

#include <dtrace.h>
#include <stdio.h>
#include <stdlib.h>

static dtrace_hdl_t *g_dtp;
static void
fatal(const char *fmt, …)
{
va_list ap;
va_start(ap, fmt);
(void) vfprintf(stderr, fmt, ap);
if (fmt[strlen(fmt) - 1] != ’\n’)
(void) fprintf(stderr, “: %s\n”,
dtrace_errmsg(g_dtp, dtrace_errno(g_dtp)));
exit(EXIT_FAILURE);
}
int
main(int argc, char **argv)
{
int err, i;
const char *mods[20];
int nmods;
if 1) == NULL)
fatal(“cannot open dtrace library: %s\n”,
dtrace_errmsg(NULL, err));
1)
g_dtp = dtrace_open(DTRACE_VERSION, 0, &err
solaris/dtrace_provider_modules.3dtrace.txt · Last modified: 2023/07/19 08:58 by A User Not Logged in