1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
void sig_chld(int signo)
{
int status, child_val;
switch(signo) {
case SIGCHLD :
if (waitpid(-1, &status, WNOHANG | WUNTRACED)<0)
{
printf("Erreur dans l'appel du wait : %s\n", strerror(errno));
return;
}
if (WIFEXITED(status)) /* did child exit normally? */
{
child_val = WEXITSTATUS(status); /* get child's exit status */
printf("child's exited normally with status %d\n", child_val);
}
break;
case SIGINT :
printf("\nSIGINT reçu\n");
break;
case SIGTSTP :
printf("\nSIGSTOP reçu\n");
break;
}
} |
Partager