comparison src/readpst.c @ 259:78e95fab9a8b

add some debug checking for process exit status
author Carl Byington <carl@five-ten-sg.com>
date Sat, 16 Apr 2011 10:31:32 -0700
parents 8ad8fd1c5451
children 41862bddcf63
comparison
equal deleted inserted replaced
258:8ad8fd1c5451 259:78e95fab9a8b
159 int status; 159 int status;
160 pid_t child = child_processes[i]; 160 pid_t child = child_processes[i];
161 pid_t ch = waitpid(child, &status, ((waitall) ? 0 : WNOHANG)); 161 pid_t ch = waitpid(child, &status, ((waitall) ? 0 : WNOHANG));
162 if (ch == child) { 162 if (ch == child) {
163 // check termination status 163 // check termination status
164 //if (WIFEXITED(status)) {
165 // int ext = WEXITSTATUS(status);
166 // printf("Process %d exited with status %d\n", child, ext);
167 // fflush(stdout);
168 //}
164 if (WIFSIGNALED(status)) { 169 if (WIFSIGNALED(status)) {
165 int sig = WTERMSIG(status); 170 int sig = WTERMSIG(status);
166 DEBUG_INFO(("Process %d terminated with signal %d\n", child, sig)); 171 DEBUG_INFO(("Process %d terminated with signal %d\n", child, sig));
172 //printf("Process %d terminated with signal %d\n", child, sig);
173 //fflush(stdout);
167 } 174 }
168 // this has terminated, remove it from the list 175 // this has terminated, remove it from the list
169 for (j=i; j<active_children-1; j++) { 176 for (j=i; j<active_children-1; j++) {
170 child_processes[j] = child_processes[j+1]; 177 child_processes[j] = child_processes[j+1];
171 } 178 }