hi -- just have to handle SIGCHLD
Code:
sig_atomic_t chid_exit_status;
void clean_up_child (int sig_num) {
int status;
wait(&status);
child_exit_status = status; // in case we need this later
}
int main() {
struct sigaction sigchld_action;
memset (&sigchld_action,0,sizeof(sigchld_action));
sigchld_action.sa_handler = &clean_up_child;
sigaction (SIGCHLD, &sigchld_action, NULL);
// fork off some children
return 0;
}