1sg_init(3) sg_init(3)
2
3
4
6 sg_init, sg_snapshot, sg_shutdown, sg_drop_privileges - initialise lib‐
7 statgrab
8
10 #include <statgrab.h>
11
12
13 sg_error sg_init (int ignore_init_errors);
14
15 sg_error sg_snapshot (void);
16
17 sg_error sg_shutdown (void);
18
19 sg_error sg_drop_privileges (void);
20
22 sg_init() either initialises the statgrab library and sets the initial‐
23 isation counter to 1, if not already done, or increases the initialisa‐
24 tion counter. If called for the first time (in fact: if called when
25 the initialisation counter is 0), the constructor (initialisation rou‐
26 tine) of each registered component is invoked, some global variables
27 are initialised, requested mutual exclusion semaphores are initialised
28 and so on. sg_init() is protected by the mutex named "statgrab".
29
30 sg_snapshot() is Win32 only and will probably disappear.
31
32 sg_shutdown() decrements the initialisation counter. If the counter
33 reaches zero, components' destructors are called, mutual exclusion sem‐
34 aphores (exept "statgrab") are destroyed etc. sg_shutdown() is pro‐
35 tected by the mutex named "statgrab".
36
37 sg_drop_privileges() drops elevated privileges.
38
40 All functions return a statgrab error code. Either SG_ERROR_NONE when
41 everything was ok or the appropriate error code from an constructor/de‐
42 structor.
43
45 statgrab(3)
46
48 ⟨http://www.i-scream.org/libstatgrab/⟩
49
50
51
52i-scream 2013-06-07 sg_init(3)