| 35 |  | </funcprototype> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 36 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 37 |  | <funcprototype> | 
 
 
 
 
 
 
 
 | 38 | + | <funcdef>sg_error <function>sg_get_error</function></funcdef> | 
 
 
 
 
 
 
 
 | 39 | + | <void/> | 
 
 
 
 
 
 
 
 | 40 | + | </funcprototype> | 
 
 
 
 
 
 
 
 | 41 | + | <funcprototype> | 
 
 
 
 
 
 
 
 | 42 | + | <funcdef>const char *<function>sg_get_error_arg</function></funcdef> | 
 
 
 
 
 
 
 
 | 43 | + | <void/> | 
 
 
 
 
 
 
 
 | 44 | + | </funcprototype> | 
 
 
 
 
 
 
 
 | 45 | + | <funcprototype> | 
 
 
 
 
 
 
 
 | 46 | + | <funcdef>const char *<function>sg_str_error</function></funcdef> | 
 
 
 
 
 
 
 
 | 47 | + | <paramdef>sg_error <parameter>code</parameter></paramdef> | 
 
 
 
 
 
 
 
 | 48 | + | </funcprototype> | 
 
 
 
 
 
 
 
 | 49 | + |  | 
 
 
 
 
 
 
 
 | 50 | + | <funcprototype> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 51 |  | <funcdef>sg_cpu_stats *<function>sg_get_cpu_stats</function></funcdef> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 52 |  | <void/> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 53 |  | </funcprototype> | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 150 |  | <function>sg_init</function> and | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 151 |  | <function>sg_drop_privileges</function> return 0 on success, and | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 152 |  | non-zero on failure. | 
 
 
 
 
 
 
 
 | 153 | + | </para> | 
 
 
 
 
 
 
 
 | 154 | + | <para> | 
 
 
 
 
 
 
 
 | 155 | + | There are three functions relating to error reporting in libstatgrab. | 
 
 
 
 
 
 
 
 | 156 | + | The first, <function>sg_get_error</function> returns an sg_error code | 
 
 
 
 
 
 
 
 | 157 | + | which relates to the last error generated by libstatgrab. This can be | 
 
 
 
 
 
 
 
 | 158 | + | converted to a string by calling <function>sg_str_error</function> | 
 
 
 
 
 
 
 
 | 159 | + | giving the sg_error code as an argument. Finally, an optional | 
 
 
 
 
 
 
 
 | 160 | + | argument may be set when the error was generated. This can be | 
 
 
 
 
 
 
 
 | 161 | + | accessed by calling <function>sg_get_error_arg</function>. | 
 
 
 
 
 
 
 
 | 162 | + | </para> | 
 
 
 
 
 
 
 
 | 163 | + | <para> | 
 
 
 
 
 
 
 
 | 164 | + | It is the intended practice that whenever a libstatgrab function is | 
 
 
 
 
 
 
 
 | 165 | + | called and subsequently fails that an appropriate error will be set. | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 166 |  | </para> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 167 |  | <para> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 168 |  | The library was originally written to support the i-scream |