sg_get_host_info3
Get general operating system statistics
Usage
FC#include <statgrab.h>F[0]
FCsg_host_info *sg_get_host_infoF[0] FC(size_t *entries);F[0]
FCsg_host_info *sg_get_host_info_rF[0] FC(size_t *entries);F[0]
FCsg_error sg_free_host_infoF[0] FC(sg_host_info *data);F[0]
Overview
These calls return details on the operating system and the machine it's running on.
API Shortcut
| function | returns | data owner |
| sg_get_host_info | FCsg_host_infoF[0] * | libstatgrab (thread local) |
| sg_get_host_info_r | FCsg_host_infoF[0] * | caller |
The FCsg_host_infoF[0] buffer received from FCsg_get_host_info_rF[0]() must be freed using FCsg_free_host_infoF[0]() when not needed any more. The caller is responsible for doing it.
Return values
The structure returned is of type FCsg_host_infoF[0].
FC
typedef enum {
sg_unknown_configuration = 0,
sg_physical_host,
sg_virtual_machine,
sg_paravirtual_machine,
sg_hardware_virtualized
} sg_host_state;
F[0]
FC
typedef struct{
char *os_name;
char *os_release;
char *os_version;
char *platform;
char *hostname;
unsigned bitwidth;
sg_host_state host_state;
unsigned ncpus;
unsigned maxcpus;
time_t uptime;
time_t systime;
}sg_host_info;
F[0]
FCos_nameF[0]
|
The operating system name. (eg. SunOS or Linux) |
|---|---|
FCos_releaseF[0]
|
The operating system release. (eg. 5.8 or 5.9 or Solaris) |
FCos_versionF[0]
|
The version level of the OS. |
FCplatformF[0]
|
The hardware platform (architecture) the OS runs on. |
FChostnameF[0]
|
The name of the machine. |
FCuptimeF[0]
|
The uptime of the machine in seconds. |
FCsystimeF[0]
|
The timestamp when the above stats where collected in seconds since epoch |
Website
⟨https://libstatgrab.org/⟩
Releases
11 releases since Debian 4.0 (Etch); the text changed 4 times.