diff --git a/src/sigar.c b/src/sigar.c index 5ecd503b..fd1bf291 100644 --- a/src/sigar.c +++ b/src/sigar.c @@ -244,7 +244,39 @@ SIGAR_DECLARE(char *) sigar_format_size(sigar_uint64_t size, char *buf) } while (1); } +SIGAR_DECLARE(int) sigar_sys_info_get(sigar_t *sigar, + sigar_sys_info_t *sysinfo) +{ + SIGAR_ZERO(sysinfo); + #ifndef WIN32 + sigar_sys_info_get_uname(sysinfo); +#endif + + sigar_os_sys_info_get(sigar, sysinfo); + + return SIGAR_OK; +} + +#ifndef WIN32 + +#include + +int sigar_sys_info_get_uname(sigar_sys_info_t *sysinfo) +{ + struct utsname name; + + uname(&name); + + SIGAR_SSTRCPY(sysinfo->version, name.release); + SIGAR_SSTRCPY(sysinfo->vendor_name, name.sysname); + SIGAR_SSTRCPY(sysinfo->name, name.sysname); + SIGAR_SSTRCPY(sysinfo->arch, name.machine); + SIGAR_SSTRCPY(sysinfo->patch_level, "unknown"); + + return SIGAR_OK; +} + #include #include @@ -1211,40 +1243,6 @@ int sigar_net_info_get(sigar_t *sigar, return SIGAR_OK; } -#ifndef WIN32 - -#include - -int sigar_sys_info_get_uname(sigar_sys_info_t *sysinfo) -{ - struct utsname name; - - uname(&name); - - SIGAR_SSTRCPY(sysinfo->version, name.release); - SIGAR_SSTRCPY(sysinfo->vendor_name, name.sysname); - SIGAR_SSTRCPY(sysinfo->name, name.sysname); - SIGAR_SSTRCPY(sysinfo->arch, name.machine); - SIGAR_SSTRCPY(sysinfo->patch_level, "unknown"); - - return SIGAR_OK; -} -#endif - -SIGAR_DECLARE(int) sigar_sys_info_get(sigar_t *sigar, - sigar_sys_info_t *sysinfo) -{ - SIGAR_ZERO(sysinfo); - -#ifndef WIN32 - sigar_sys_info_get_uname(sysinfo); -#endif - - sigar_os_sys_info_get(sigar, sysinfo); - - return SIGAR_OK; -} - #include #define OffsetOf(structure, field) \