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

Comparing projects/libstatgrab/src/libstatgrab/swap_stats.c (file contents):
Revision 1.19 by tdb, Tue Apr 6 14:52:58 2004 UTC vs.
Revision 1.20 by tdb, Wed Apr 7 21:08:40 2004 UTC

# Line 84 | Line 84 | sg_swap_stats *sg_get_swap_stats(){
84  
85   #ifdef SOLARIS
86          if((pagesize=sysconf(_SC_PAGESIZE)) == -1){
87 +                sg_set_error(SG_ERROR_SYSCONF, "_SC_PAGESIZE");
88                  return NULL;
89          }
90          if (swapctl(SC_AINFO, &ai) == -1) {
91 +                sg_set_error(SG_ERROR_SWAPCTL, NULL);
92                  return NULL;
93          }
94          swap_stat.total = (long long)ai.ani_max * (long long)pagesize;
# Line 95 | Line 97 | sg_swap_stats *sg_get_swap_stats(){
97   #endif
98   #if defined(LINUX) || defined(CYGWIN)
99          if ((f = fopen("/proc/meminfo", "r")) == NULL) {
100 +                sg_set_error(SG_ERROR_OPEN, "/proc/meminfo");
101                  return NULL;
102          }
103  
# Line 123 | Line 126 | sg_swap_stats *sg_get_swap_stats(){
126  
127          mibsize = sizeof mib / sizeof mib[0];
128          if (sysctlnametomib("vm.swap_info", mib, &mibsize) < 0) {
129 +                sg_set_error(SG_ERROR_SYSCTLNAMETOMIB, "vm.swap_info");
130                  return NULL;
131          }
132          for (n = 0; ; ++n) {
# Line 132 | Line 136 | sg_swap_stats *sg_get_swap_stats(){
136                          break;
137                  }
138                  if (xsw.xsw_version != XSWDEV_VERSION) {
139 +                        sg_set_error(SG_ERROR_XSW_VER_MISMATCH, NULL);
140                          return NULL;
141                  }
142                  swap_stat.total += (long long) xsw.xsw_nblks;
143                  swap_stat.used += (long long) xsw.xsw_used;
144          }
145          if (errno != ENOENT) {
146 +                sg_set_error(SG_ERROR_ENOENT, NULL);
147                  return NULL;
148          }
149   #else
# Line 145 | Line 151 | sg_swap_stats *sg_get_swap_stats(){
151                  return NULL;
152          }
153          if ((kvm_getswapinfo(kvmd, &swapinfo, 1,0)) == -1){
154 +                sg_set_error(SG_ERROR_KVM_GETSWAPINFO, NULL);
155                  return NULL;
156          }
157  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines