1sg_get_host_info(3)                                        sg_get_host_info(3)
2
3
4

NAME

6       sg_get_host_info,  sg_get_host_info_r,  sg_free_host_info - get general
7       operating system statistics
8

SYNOPSIS

10       #include <statgrab.h>
11
12
13       sg_host_info *sg_get_host_info (size_t *entries);
14
15       sg_host_info *sg_get_host_info_r (size_t *entries);
16
17       sg_error sg_free_host_info (sg_host_info *data);
18

DESCRIPTION

20       These calls return details on the operating system and the machine it's
21       running on.
22
23       API Shortcut
24
25       ┌───────────────────┬────────────────┬─────────────────────┐
26       │function           │ returns        │ data owner          │
27       ├───────────────────┼────────────────┼─────────────────────┤
28       │sg_get_host_info   │ sg_host_info * │ libstatgrab (thread │
29       │                   │                │ local)              │
30       ├───────────────────┼────────────────┼─────────────────────┤
31       │sg_get_host_info_r │ sg_host_info * │ caller              │
32       └───────────────────┴────────────────┴─────────────────────┘
33       The sg_host_info buffer  received  from  sg_get_host_info_r()  must  be
34       freed using sg_free_host_info() when not needed any more. The caller is
35       responsible for doing it.
36

RETURN VALUES

38       The structure returned is of type sg_host_info.
39
40       typedef enum {
41               sg_unknown_configuration = 0,
42               sg_physical_host,
43               sg_virtual_machine,
44               sg_paravirtual_machine,
45               sg_hardware_virtualized
46       } sg_host_state;
47
48
49       typedef struct{
50               char *os_name;
51               char *os_release;
52               char *os_version;
53               char *platform;
54               char *hostname;
55               unsigned bitwidth;
56               sg_host_state host_state;
57               unsigned ncpus;
58               unsigned maxcpus;
59               time_t uptime;
60               time_t systime;
61       }sg_host_info;
62
63
64       os_name
65              The operating system name.  (eg. SunOS or Linux)
66
67       os_release
68              The operating system release.  (eg. 5.8 or 5.9 or Solaris)
69
70       os_version
71              The version level of the OS.
72
73       platform
74              The hardware platform (architecture) the OS runs on.
75
76       hostname
77              The name of the machine.
78
79       uptime The uptime of the machine in seconds.
80
81       systime
82              The timestamp when the above stats where  collected  in  seconds
83              since epoch
84

SEE ALSO

86       statgrab(3)
87

WEBSITE

89https://libstatgrab.org/
90
91
92
93libstatgrab                       2019-03-08               sg_get_host_info(3)
Impressum