Standard C Library Functions rctlwalk(3C)
NAME
rctlwalk - visit registered rctls on current system
SYNOPSIS
#include
int rctlwalk(int (*callback)(const char *rctlname, void *walkdata),
void *initdata);
DESCRIPTION
The rctlwalk() function provides a mechanism for the appli-
cation author to examine all active resource controls
(rctls) on the current system. The callback function pro-
vided by the application is given the name of an rctl at
each invocation and can use the walkdata to record its own
state. The callback function should return non-zero if it
encounters an error condition or attempts to terminate the
walk prematurely; otherwise the callback function should
return 0.
RETURN VALUES
Upon successful completion, rctlwalk() returns 0. It
returns -1 if the callback function returned a non-zero
value or if the walk encountered an error, in which case
errno is set to indicate the error.
ERORS
The rctlwalk() function will fail if:
ENOMEM There is insufficient memory available to set up
the initial data for the walk.
Other returned error values are presumably caused by the
callback function.
EXAMPLES
Example 1 Count the number of rctls available on the system.
The following example counts the number of resource controls
on the system.
#include
#include
#include
typedef struct wdata {
uintt count;
SunOS 5.11 Last change: 2001 1
Standard C Library Functions rctlwalk(3C)
} wdatat;
wdatat totalcount;
int
simplecallback(const char *name, void *pvt)
{
wdatat *w = (wdatat *)pvt;
w->count];
return (0);
}
...
totalcount.count = 0;
errno = 0;
if (rctlwalk(simplecallback, &totalcount)) == 0)
(void) printf("count = %u\n", totalcount.count);
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Evolving
MT-Level MT-Safe
SEE ALSO
setrctl(2), attributes(5)
SunOS 5.11 Last change: 2001 2
|