sg_init(3)

NAME
sg_init, sg_snapshot, sg_shutdown, sg_drop_privileges - initialise libstatgrab

SYNOPSIS
\FC#include <statgrab.h>\F[]

\FCsg_error sg_init\F[]
\FC(int ignore_init_errors);\F[]

\FCsg_error sg_snapshot\F[]
\FC(void);\F[]

\FCsg_error sg_shutdown\F[]
\FC(void);\F[]

\FCsg_error sg_drop_privileges\F[]
\FC(void);\F[]

DESCRIPTION
\FCsg_init\F[]() either initialises the statgrab library and sets the initialisation counter to 1, if not already done, or increases the initialisation counter. If called for the first time (in fact: if called when the initialisation counter is 0), the constructor (initialisation routine) of each registered component is invoked, some global variables are initialised, requested mutual exclusion semaphores are initialised and so on. \FCsg_init\F[]() is protected by the mutex named "statgrab".

\FCsg_snapshot\F[]() is Win32 only and will probably disappear.

\FCsg_shutdown\F[]() decrements the initialisation counter. If the counter reaches zero, components' destructors are called, mutual exclusion semaphores (exept "statgrab") are destroyed etc. \FCsg_shutdown\F[]() is protected by the mutex named "statgrab".

\FCsg_drop_privileges\F[]() drops elevated privileges.

RETURN VALUES
All functions return a statgrab error code. Either SG_ERROR_NONE when everything was ok or the appropriate error code from an constructor/destructor.

SEE ALSO
statgrab(3)

WEBSITE
⟨http://www.i-scream.org/libstatgrab/⟩