rctl_walk man page on SmartOS

Man page or keyword search:  
man Server   16655 pages
apropos Keyword Search (all sections)
Output format
SmartOS logo
[printable version]

RCTL_WALK(3C)							 RCTL_WALK(3C)

NAME
       rctl_walk - visit registered rctls on current system

SYNOPSIS
       #include <rctl.h>

       int rctl_walk(int (*callback)(const char *rctlname, void *walk_data),
	    void *init_data);

DESCRIPTION
       The  rctl_walk()	 function  provides  a	mechanism  for the application
       author to examine all active resource controls (rctls) on  the  current
       system.	The callback function provided by the application is given the
       name of an rctl at each invocation and can use the walk_data to	record
       its  own	 state.	 The  callback	function  should return non-zero if it
       encounters an error condition or attempts to terminate the walk	prema‐
       turely; otherwise the callback function should return 0.

RETURN VALUES
       Upon successful completion, rctl_walk() 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.

ERRORS
       The rctl_walk() 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 func‐
       tion.

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 <sys/types.h>
	 #include <rctl.h>
	 #include <stdio.h>

	 typedef struct wdata {
	      uint_t count;
	 } wdata_t;

	 wdata_t total_count;

	 int
	 simple_callback(const char *name, void *pvt)
	 {
	      wdata_t *w = (wdata_t *)pvt;
	      w->count++;
	      return (0);
	 }

	 ...

	 total_count.count = 0;
	 errno = 0;
	 if (rctl_walk(simple_callback, &total_count)) == 0)
	      (void) printf("count = %u\n", total_count.count);

ATTRIBUTES
       See attributes(5) for descriptions of the following attributes:

       ┌────────────────────┬─────────────────┐
       │  ATTRIBUTE TYPE    │ ATTRIBUTE VALUE │
       ├────────────────────┼─────────────────┤
       │Interface Stability │ Evolving	      │
       ├────────────────────┼─────────────────┤
       │MT-Level	    │ MT-Safe	      │
       └────────────────────┴─────────────────┘

SEE ALSO
       setrctl(2), attributes(5)

				  Jan 1, 2001			 RCTL_WALK(3C)
[top]

List of man pages available for SmartOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net