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

Comparing projects/libstatgrab/src/libstatgrab/process_stats.c (file contents):
Revision 1.64 by pajs, Wed Apr 7 15:46:34 2004 UTC vs.
Revision 1.65 by tdb, Wed Apr 7 21:08:40 2004 UTC

# Line 130 | Line 130 | sg_process_stats *sg_get_process_stats(int *entries){
130  
131   #ifdef LINUX
132          if ((f=fopen("/proc/uptime", "r")) == NULL) {
133 +                sg_set_error(SG_ERROR_OPEN, "/proc/uptime");
134                  return NULL;
135          }
136          if((fscanf(f,"%lu %*d",&uptime)) != 1){
137 +                sg_set_error(SG_ERROR_PARSE, NULL);
138                  return NULL;
139          }
140          fclose(f);
141   #endif
142  
143          if((proc_dir=opendir(PROC_LOCATION))==NULL){
144 +                sg_set_error(SG_ERROR_OPENDIR, PROC_LOCATION);
145                  return NULL;
146          }
147  
# Line 303 | Line 306 | sg_process_stats *sg_get_process_stats(int *entries){
306          mib[2] = KERN_PROC_ALL;
307  
308          if(sysctl(mib, 3, NULL, &size, NULL, 0) < 0) {
309 +                sg_set_error(SG_ERROR_SYSCTL, "CTL_KERN.KERN_PROC.KERN_PROC_ALL");
310                  return NULL;
311          }
312  
# Line 315 | Line 319 | sg_process_stats *sg_get_process_stats(int *entries){
319          memset(kp_stats, 0, size);
320  
321          if(sysctl(mib, 3, kp_stats, &size, NULL, 0) < 0) {
322 +                sg_set_error(SG_ERROR_SYSCTL, "CTL_KERN.KERN_PROC.KERN_PROC_ALL");
323                  free(kp_stats);
324                  return NULL;
325          }
# Line 360 | Line 365 | sg_process_stats *sg_get_process_stats(int *entries){
365  
366   #ifdef FREEBSD5
367                  if(sysctlbyname("kern.ps_arg_cache_limit", &buflen, &size, NULL, 0) < 0) {
368 +                        sg_set_error(SG_ERROR_SYSCTLBYNAME, "kern.ps_arg_cache_limit");
369                          return NULL;
370                  }
371   #else
# Line 369 | Line 375 | sg_process_stats *sg_get_process_stats(int *entries){
375                  mib[1] = KERN_ARGMAX;
376  
377                  if(sysctl(mib, 2, &buflen, &size, NULL, 0) < 0) {
378 +                        sg_set_error(SG_ERROR_SYSCTL, "CTL_KERN.KERN_ARGMAX");
379                          return NULL;
380                  }
381   #endif
# Line 520 | Line 527 | sg_process_stats *sg_get_process_stats(int *entries){
527                          mib[4] = 0;
528  
529                          if(sysctl(mib, 5, NULL, &size, NULL, 0) < 0) {
530 +                                sg_set_error(SG_ERROR_SYSCTL, "CTL_KERN.KERN_LWP.pid.structsize.0");
531                                  return NULL;
532                          }
533  
# Line 532 | Line 540 | sg_process_stats *sg_get_process_stats(int *entries){
540                          }
541  
542                          if(sysctl(mib, 5, kl_stats, &size, NULL, 0) < 0) {
543 +                                sg_set_error(SG_ERROR_SYSCTL, "CTL_KERN.KERN_LWP.pid.structsize.buffersize");
544                                  return NULL;
545                          }
546                  }
# Line 616 | Line 625 | sg_process_stats *sg_get_process_stats(int *entries){
625   #endif
626  
627   #ifdef CYGWIN
628 +        sg_set_error(SG_ERROR_UNSUPPORTED, "Cygwin");
629          return NULL;
630   #endif
631  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines