ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/os_info.c
(Generate patch)

Comparing projects/libstatgrab/src/libstatgrab/os_info.c (file contents):
Revision 1.4 by pajs, Fri Mar 7 13:20:46 2003 UTC vs.
Revision 1.5 by pajs, Thu Apr 3 20:14:40 2003 UTC

# Line 31 | Line 31
31   #ifdef LINUX
32   #include <stdio.h>
33   #endif
34 + #ifdef FREEBSD
35 + #include <sys/types.h>
36 + #include <sys/sysctl.h>
37 + #include <time.h>
38 + #include <sys/time.h>
39 + #endif
40  
41   general_stat_t *get_general_stats(){
42  
# Line 46 | Line 52 | general_stat_t *get_general_stats(){
52   #ifdef LINUX
53          FILE *f;
54   #endif
55 + #ifdef FREEBSD
56 +        struct timeval boottime;
57 +        time_t curtime;
58 +        size_t size;
59 + #endif
60  
61          if((uname(&os)) < 0){
62                  return NULL;
# Line 86 | Line 97 | general_stat_t *get_general_stats(){
97                  return NULL;
98          }
99          fclose(f);
100 + #endif
101 + #ifdef FREEBSD
102 +        if (sysctlbyname("kern.boottime", NULL, &size, NULL, NULL) < 0){
103 +                return NULL;
104 +        }
105 +        if (sysctlbyname("kern.boottime", &boottime, &size, NULL, NULL) < 0){
106 +                return NULL;
107 +        }
108 +        time(&curtime);
109 +        general_stat.uptime=curtime-boottime.tv_sec;
110   #endif
111  
112          return &general_stat;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines