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.1 by pajs, Tue Feb 18 19:28:30 2003 UTC vs.
Revision 1.2 by pajs, Tue Feb 18 23:23:36 2003 UTC

# Line 24 | Line 24
24  
25   #include "statgrab.h"
26   #include <sys/utsname.h>
27 #include "ukcprog.h"
27   #include <stdio.h>
28   #ifdef SOLARIS
29   #include <kstat.h>
# Line 42 | Line 41 | general_stat_t *get_general_stats(){
41          kstat_named_t *kn;
42  
43          if((uname(&os)) < 0){
45                errf("Failed to get os stats (%m)");
44                  return NULL;
45          }
46          
# Line 54 | Line 52 | general_stat_t *get_general_stats(){
52  
53          /* get uptime */
54          if ((kc = kstat_open()) == NULL) {
57                errf("kstat_open failure (%m)");
55                  return NULL;
56          }
57          if((ksp=kstat_lookup(kc, "unix", -1, "system_misc"))==NULL){
61                errf("failed to find lookup information (%m)");
58                  return NULL;
59          }
60          if (kstat_read(kc, ksp, 0) == -1) {
65                errf("Failed to read kernel information (%m)");
61                  return NULL;
62          }
63          if((kn=kstat_data_lookup(ksp, "boot_time")) == NULL){
69                errf("Failed to get uptime (%m)");
64                  return NULL;
65          }
66          boottime=(kn->value.ui32);
67 <        if((kstat_close(kc)) != 0){
68 <                errf("Failed to close kstat control structure (%m)");
75 <                return NULL;
76 <        }
67 >
68 >        kstat_close(kc);
69  
70          time(&curtime);
71          general_stat.uptime = curtime - boottime;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines