UName
Get information on hardware platform and operating system agent is running on.
Strings that are returned by uname functions are statically allocated in
libhostinfo, no need to dispose them
These functions are optional, and may return generic data is they are not
implemented on target platform
Linux
Linux shares implementation with POSIX, but provides domain name from uname()
output.
hi_get_os_name()
is redefined because uname()
provides only a Linux Kernel name.
It collects information from following sources:
-
/etc/oracle-release
for Oracle Enterprise Linux -
/etc/redhat-release
for RHEL other derivatives -
/etc/SuSE-release
for SuSE derivatives -
lsb_release
output for any other Linux
It also cuts out irrelevant words i.e. CentOS release 6.3 (Final)
-> CentOS 6.3
hi_get_sys_name()
provides information from /sys/class/dmi/id/
for x86 platforms
for non-x86 platforms, it'll probably return "Unknown system" string
POSIX
These functions are simple wrappers around uname()
system call.
Getting hardware platform name and DNS domain name is not supported
Solaris
On Solaris hi_get_os_name()
/ hi_get_os_release()
are based on /etc/release
First line of release file looks like:
<lot of spaces> <name of Solaris> <Version fields> <KernelID> [SPARC|X86] <misc. info>
Uses SPARC|X86 as an anchor to provide Kernel ID as OS release and rest of /etc/release's
first line as osname. Misc info is ignored
hi_get_sys_name()
is implemented only for x86 using libsmbios
Windows
Uses GetVersionEx() and GetSystemInfo() pair of calls to get all system information
GetComputerName*() functions provide host name and domain
NOTE: Operating system name is deduced from dwMajorVersion
/ dwMinorVersion
so for newer Windows versions it may return "Unknown ..."
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724429%28v=vs.85%29.aspx
Functions
hi_get_os_release, hi_get_os_name
publicplat
Returns operating system name and version
LIBEXPORT PLATAPI const char* hi_get_os_name() LIBEXPORT PLATAPI const char* hi_get_os_release()
hi_get_nodename, hi_get_domainname
publicplat
Returns nodename and domain name of current host
LIBEXPORT PLATAPI const char* hi_get_nodename() LIBEXPORT PLATAPI const char* hi_get_domainname()
hi_get_mach
publicplat
Returns machine architecture
LIBEXPORT PLATAPI const char* hi_get_mach()
hi_get_sys_name
publicplat
Returns system model and vendor
LIBEXPORT PLATAPI const char* hi_get_sys_name()