sg_get_host_info(3)
β¨ sg_get_host_info(3) β like, the whole manual page, bestie β¨
Okay so this is the sg_get_host_info(3) page from libstatgrab and it's literally about getting the tea on your operating system and the machine it's living on. Pull up a chair π
πΈ NAME πΈ
sg_get_host_info, sg_get_host_info_r, sg_free_host_info β get general operating system statistics. That's the whole vibe: OS stats, general ones, no cap.
π¦ SYNOPSIS π¦
#include <statgrab.h>
sg_host_info *sg_get_host_info (size_t *entries);
sg_host_info *sg_get_host_info_r (size_t *entries);
sg_error sg_free_host_info (sg_host_info *data);
Three little functions, three little signatures, all copied exactly because I would never mess with your headers π
π DESCRIPTION π
These calls return details on the operating system and the machine it's running on. Like a vibe check for your whole computer β¨
π§ API Shortcut
So the original had a whole cute table and I'm gonna give it to you as a list because we're in a terminal and tables are giving "spreadsheet from 2004" lowkey:
sg_get_host_infoβ returnssg_host_info *β data owner is libstatgrab (thread local). It handles its own business, you don't gotta do a thing π«Άsg_get_host_info_rβ returnssg_host_info *β data owner is the caller. That's you. You own it. Main character responsibility π
Thesg_host_infobuffer received fromsg_get_host_info_r()must be freed usingsg_free_host_info()when not needed any more. The caller is responsible for doing it. Fr fr, don't forget or that's a leak bestie π
π RETURN VALUES π
The structure returned is of type sg_host_info. Here's the enum and the struct, verbatim, no edits, slay:
typedef enum {
sg_unknown_configuration = 0,
sg_physical_host,
sg_virtual_machine,
sg_paravirtual_machine,
sg_hardware_virtualized
} sg_host_state;
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;
And now the field-by-field breakdown, because every single one matters π
os_nameβ the operating system name. (eg.SunOSorLinux)os_releaseβ the operating system release. (eg.5.8or5.9orSolaris)os_versionβ the version level of the OS.platformβ the hardware platform (architecture) the OS runs on.hostnameβ the name of the machine.uptimeβ the uptime of the machine in seconds.systimeβ the timestamp when the above stats where collected in seconds since epoch. (Yes, "where" β that's how the original spells it and I'm not gonna gaslight you by fixing it π)
Not me just noticingbitwidth,host_state,ncpusandmaxcpusare literally in the struct but the original page doesn't give them their own little description paragraphs. They're there, they're in the struct, that's the facts β I'm not gonna make up behaviour for them π
π₯ SEE ALSO π₯
statgrab(3)β go read that one next, iykyk
π WEBSITE π
The official site, as listed: https://libstatgrab.org/ π
And that's the whole page, bestie β no details left behind, every flag and field accounted for β¨ This was libstatgrab, dated 2019-03-08, and it's the sg_get_host_info(3) manual page signing off. Periodt π
π
π¦ where this page comes from
- alpine 3.24: libstatgrab-doc 0.92.1-r1 Β· LGPL-2.0-or-later
- arch rolling: libstatgrab 0.92.1-2 Β· LGPL AND GPL
- fedora 43: libstatgrab-devel 1:0.92.1-14.fc43 Β· LGPL-2.1-or-later
- fedora 43: libstatgrab-devel 1:0.92.1-14.fc43 Β· LGPL-2.1-or-later
- fedora 44: libstatgrab-devel 1:0.92.1-15.fc44 Β· LGPL-2.1-or-later
- fedora 44: libstatgrab-devel 1:0.92.1-15.fc44 Β· LGPL-2.1-or-later
- nixos 26.05: libstatgrab 0.92.1
- nixpkgs unstable: libstatgrab 0.92.1
- opensuse-leap 16.0: libstatgrab-devel 0.92.1-bp160.1.14 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libstatgrab-devel 0.92.1-bp160.1.14 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libstatgrab-devel 0.92.1-bp160.1.14 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libstatgrab-devel 0.92.1-bp160.1.14 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms