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

Comparing projects/libstatgrab/src/libstatgrab/load_stats.c (file contents):
Revision 1.17 by ats, Sun Nov 7 12:29:20 2004 UTC vs.
Revision 1.19 by tdb, Mon Oct 9 14:09:38 2006 UTC

# Line 42 | Line 42
42  
43   sg_load_stats *sg_get_load_stats(){
44  
45 + #if !defined(CYGWIN) && !defined(WIN32)
46          static sg_load_stats load_stat;
47  
48   #ifdef HPUX
# Line 49 | Line 50 | sg_load_stats *sg_get_load_stats(){
50   #else
51          double loadav[3];
52   #endif
53 + #endif /* not CYGWIN or WIN32 */
54  
55   #ifdef CYGWIN
56          sg_set_error(SG_ERROR_UNSUPPORTED, "Cygwin");
57          return NULL;
58 + #elif defined(WIN32)
59 +        sg_set_error(SG_ERROR_UNSUPPORTED, "Win32");
60 +        return NULL;
61   #else
62  
63   #if defined(SOLARIS) && !defined(HAVE_SYS_LOADAVG_H)
# Line 68 | Line 73 | sg_load_stats *sg_get_load_stats(){
73  
74          if((ksp=kstat_lookup(kc, "unix", 0, "system_misc")) == NULL){
75                  sg_set_error(SG_ERROR_KSTAT_LOOKUP, "unix,0,system_misc");
76 +                kstat_close(kc);
77                  return NULL;
78          }
79  
80          if (kstat_read(kc, ksp, 0) == -1) {
81                  sg_set_error(SG_ERROR_KSTAT_READ, NULL);
82 +                kstat_close(kc);
83                  return NULL;
84          }
85 +
86 +        kstat_close(kc);
87  
88          if((kn=kstat_data_lookup(ksp, "avenrun_1min")) == NULL){
89                  sg_set_error(SG_ERROR_KSTAT_DATA_LOOKUP, "avenrun_1min");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines