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.77 by ats, Sat Nov 6 15:10:07 2004 UTC vs.
Revision 1.78 by ats, Sat Nov 6 15:31:26 2004 UTC

# Line 685 | Line 685 | sg_process_stats *sg_get_process_stats(int *entries){
685                  return NULL;
686          }
687  
688 <        do {
688 >        while (1) {
689                  num = pstat_getproc(pstat_procinfo, sizeof pstat_procinfo[0],
690                                      PROCESS_BATCH, procidx);
691 +                if (num == -1) {
692 +                        sg_set_error_with_errno(SG_ERROR_PSTAT,
693 +                                                "pstat_getproc");
694 +                        return NULL;
695 +                } else if (num == 0) {
696 +                        break;
697 +                }
698  
699                  for (i = 0; i < num; i++) {
700                          struct pst_status *pi = &pstat_procinfo[i];
# Line 740 | Line 747 | sg_process_stats *sg_get_process_stats(int *entries){
747          
748                          proc_state_size++;
749                  }
750 <                procidx = pstat_procinfo[n - 1].pst_idx + 1;
751 <        } while (num > 0);
750 >                procidx = pstat_procinfo[num - 1].pst_idx + 1;
751 >        }
752   #endif
753  
754   #ifdef CYGWIN

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines