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.73 by tdb, Mon Jun 21 14:48:48 2004 UTC vs.
Revision 1.74 by ats, Sun Jul 18 21:30:11 2004 UTC

# Line 131 | Line 131 | sg_process_stats *sg_get_process_stats(int *entries){
131  
132   #ifdef LINUX
133          if ((f=fopen("/proc/uptime", "r")) == NULL) {
134 <                sg_set_error(SG_ERROR_OPEN, "/proc/uptime");
134 >                sg_set_error_with_errno(SG_ERROR_OPEN, "/proc/uptime");
135                  return NULL;
136          }
137          if((fscanf(f,"%lu %*d",&uptime)) != 1){
# Line 142 | Line 142 | sg_process_stats *sg_get_process_stats(int *entries){
142   #endif
143  
144          if((proc_dir=opendir(PROC_LOCATION))==NULL){
145 <                sg_set_error(SG_ERROR_OPENDIR, PROC_LOCATION);
145 >                sg_set_error_with_errno(SG_ERROR_OPENDIR, PROC_LOCATION);
146                  return NULL;
147          }
148  
# Line 307 | Line 307 | sg_process_stats *sg_get_process_stats(int *entries){
307          mib[2] = KERN_PROC_ALL;
308  
309          if(sysctl(mib, 3, NULL, &size, NULL, 0) < 0) {
310 <                sg_set_error(SG_ERROR_SYSCTL, "CTL_KERN.KERN_PROC.KERN_PROC_ALL");
310 >                sg_set_error_with_errno(SG_ERROR_SYSCTL,
311 >                                        "CTL_KERN.KERN_PROC.KERN_PROC_ALL");
312                  return NULL;
313          }
314  
# Line 320 | Line 321 | sg_process_stats *sg_get_process_stats(int *entries){
321          memset(kp_stats, 0, size);
322  
323          if(sysctl(mib, 3, kp_stats, &size, NULL, 0) < 0) {
324 <                sg_set_error(SG_ERROR_SYSCTL, "CTL_KERN.KERN_PROC.KERN_PROC_ALL");
324 >                sg_set_error_with_errno(SG_ERROR_SYSCTL,
325 >                                        "CTL_KERN.KERN_PROC.KERN_PROC_ALL");
326                  free(kp_stats);
327                  return NULL;
328          }
# Line 546 | Line 548 | sg_process_stats *sg_get_process_stats(int *entries){
548                          mib[4] = 0;
549  
550                          if(sysctl(mib, 5, NULL, &size, NULL, 0) < 0) {
551 <                                sg_set_error(SG_ERROR_SYSCTL, "CTL_KERN.KERN_LWP.pid.structsize.0");
551 >                                sg_set_error_with_errno(SG_ERROR_SYSCTL, "CTL_KERN.KERN_LWP.pid.structsize.0");
552                                  return NULL;
553                          }
554  
# Line 559 | Line 561 | sg_process_stats *sg_get_process_stats(int *entries){
561                          }
562  
563                          if(sysctl(mib, 5, kl_stats, &size, NULL, 0) < 0) {
564 <                                sg_set_error(SG_ERROR_SYSCTL, "CTL_KERN.KERN_LWP.pid.structsize.buffersize");
564 >                                sg_set_error_with_errno(SG_ERROR_SYSCTL, "CTL_KERN.KERN_LWP.pid.structsize.buffersize");
565                                  return NULL;
566                          }
567                  }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines