--- projects/libstatgrab/src/libstatgrab/os_info.c 2003/03/07 13:20:46 1.4 +++ projects/libstatgrab/src/libstatgrab/os_info.c 2003/04/03 20:14:40 1.5 @@ -31,6 +31,12 @@ #ifdef LINUX #include #endif +#ifdef FREEBSD +#include +#include +#include +#include +#endif general_stat_t *get_general_stats(){ @@ -46,6 +52,11 @@ general_stat_t *get_general_stats(){ #ifdef LINUX FILE *f; #endif +#ifdef FREEBSD + struct timeval boottime; + time_t curtime; + size_t size; +#endif if((uname(&os)) < 0){ return NULL; @@ -86,6 +97,16 @@ general_stat_t *get_general_stats(){ return NULL; } fclose(f); +#endif +#ifdef FREEBSD + if (sysctlbyname("kern.boottime", NULL, &size, NULL, NULL) < 0){ + return NULL; + } + if (sysctlbyname("kern.boottime", &boottime, &size, NULL, NULL) < 0){ + return NULL; + } + time(&curtime); + general_stat.uptime=curtime-boottime.tv_sec; #endif return &general_stat;