| 26 |
|
<funcsynopsisinfo>#include <statgrab.h></funcsynopsisinfo> |
| 27 |
|
|
| 28 |
|
<funcprototype> |
| 29 |
+ |
<funcdef>int <function>statgrab_init</function></funcdef> |
| 30 |
+ |
<void/> |
| 31 |
+ |
</funcprototype> |
| 32 |
+ |
<funcprototype> |
| 33 |
+ |
<funcdef>int <function>statgrab_drop_privileges</function></funcdef> |
| 34 |
+ |
<void/> |
| 35 |
+ |
</funcprototype> |
| 36 |
+ |
|
| 37 |
+ |
<funcprototype> |
| 38 |
|
<funcdef>cpu_percent_t *<function>cpu_percent_usage</function></funcdef> |
| 39 |
|
<void/> |
| 40 |
|
</funcprototype> |
| 113 |
|
system statistics. Each of the function calls returns a structure |
| 114 |
|
containing statistics. See the manual page for each individual |
| 115 |
|
function for more details on usage. |
| 116 |
+ |
</para> |
| 117 |
+ |
<para> |
| 118 |
+ |
<function>statgrab_init(void)</function> should be the first |
| 119 |
+ |
function you call before you start to use libstatgrab. This |
| 120 |
+ |
function on *bsd systems opens up the kernel structures and |
| 121 |
+ |
leaves them open for future use. Because of this, any special |
| 122 |
+ |
privileges the program has (e.g. setgid kmem) can be dropped |
| 123 |
+ |
after this call, and all the libstatgrab calls should continue to |
| 124 |
+ |
work. It is therefore a good idea to call |
| 125 |
+ |
<function>statgrab_drop_privileges</function>, which discards |
| 126 |
+ |
setuid and setgid privileges, immediately after you call |
| 127 |
+ |
<function>statgrab_init</function>, unless your application has |
| 128 |
+ |
another reason for needing setuid or setgid privileges. |
| 129 |
+ |
</para> |
| 130 |
+ |
<para> |
| 131 |
+ |
<function>statgrab_init</function> and |
| 132 |
+ |
<function>statgrab_drop_privileges</function> return 0 on success, and |
| 133 |
+ |
non-zero on failure. |
| 134 |
|
</para> |
| 135 |
|
<para> |
| 136 |
|
The library was originally written to support the i-scream central |