--- rpl/src/interruptions.c 2010/06/17 11:00:23 1.22 +++ rpl/src/interruptions.c 2010/08/25 16:40:57 1.36 @@ -1,6 +1,6 @@ /* ================================================================================ - RPL/2 (R) version 4.0.16 + RPL/2 (R) version 4.0.18 Copyright (C) 1989-2010 Dr. BERTRAND Joël This file is part of RPL/2. @@ -20,7 +20,7 @@ */ -#include "rpl.conv.h" +#include "rpl-conv.h" /* @@ -1725,8 +1725,10 @@ deverrouillage_gestionnaire_signaux() } void -interruption1(int signal, siginfo_t *siginfo, void *context) +interruption1(SIGHANDLER_ARGS) { + pid_t pid; + pthread_t thread; struct_processus *s_etat_processus; @@ -1735,17 +1737,33 @@ interruption1(int signal, siginfo_t *sig verrouillage_gestionnaire_signaux(); +# ifdef _BROKEN_SIGINFO + if (signal == SIGINT) + { + // Si l'interruption provient du clavier, il n'y a pas eu d'appel + // à queue_in(). + + pid = getpid(); + } + else + { + pid = origine_signal(signal); + } +# else + pid = (*siginfo).si_pid; +# endif + switch(signal) { case SIGALRM : { - if ((*siginfo).si_pid == getpid()) + if (pid == getpid()) { if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) { deverrouillage_gestionnaire_signaux(); - return; + return; } if (((*s_etat_processus).type_debug & d_debug_signaux) != 0) @@ -1784,11 +1802,14 @@ interruption1(int signal, siginfo_t *sig * Solaris suit en particulier cette spécification. */ +# ifndef _BROKEN_SIGINFO if (siginfo == NULL) { kill(getpid(), signal); } - else if ((*siginfo).si_pid == getpid()) + else +# endif + if (pid == getpid()) { if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) @@ -1863,13 +1884,23 @@ interruption1(int signal, siginfo_t *sig } void -interruption2(int signal, siginfo_t *siginfo, void *context) +interruption2(SIGHANDLER_ARGS) { + pid_t pid; + pthread_t thread; + struct_processus *s_etat_processus; verrouillage_gestionnaire_signaux(); +# ifdef _BROKEN_SIGINFO + pid = origine_signal(signal); +# else + pid = (*siginfo).si_pid; +# endif + +# ifndef _BROKEN_SIGINFO if (siginfo == NULL) { /* @@ -1887,7 +1918,9 @@ interruption2(int signal, siginfo_t *sig return; } } - else if ((*siginfo).si_pid == getpid()) + else +# endif + if (pid == getpid()) { if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) @@ -1935,14 +1968,22 @@ interruption2(int signal, siginfo_t *sig } void -interruption3(int signal, siginfo_t *siginfo, void *context) +interruption3(SIGHANDLER_ARGS) { + pid_t pid; + struct_processus *s_etat_processus; static int compteur = 0; verrouillage_gestionnaire_signaux(); +# ifdef _BROKEN_SIGINFO + pid = origine_signal(signal); +# else + pid = (*siginfo).si_pid; +# endif + if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) { deverrouillage_gestionnaire_signaux(); @@ -1995,12 +2036,20 @@ interruption3(int signal, siginfo_t *sig } void -interruption4(int signal, siginfo_t *siginfo, void *context) +interruption4(SIGHANDLER_ARGS) { + pid_t pid; + struct_processus *s_etat_processus; verrouillage_gestionnaire_signaux(); +# ifdef _BROKEN_SIGINFO + pid = origine_signal(signal); +# else + pid = (*siginfo).si_pid; +# endif + if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) { deverrouillage_gestionnaire_signaux(); @@ -2023,14 +2072,23 @@ interruption4(int signal, siginfo_t *sig } void -interruption5(int signal, siginfo_t *siginfo, void *context) +interruption5(SIGHANDLER_ARGS) { + pid_t pid; + pthread_t thread; + struct_processus *s_etat_processus; verrouillage_gestionnaire_signaux(); - if ((*siginfo).si_pid == getpid()) +# ifdef _BROKEN_SIGINFO + pid = origine_signal(signal); +# else + pid = (*siginfo).si_pid; +# endif + + if (pid == getpid()) { if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) @@ -2086,12 +2144,20 @@ interruption5(int signal, siginfo_t *sig } void -interruption6(int signal, siginfo_t *siginfo, void *context) +interruption6(SIGHANDLER_ARGS) { + pid_t pid; + struct_processus *s_etat_processus; verrouillage_gestionnaire_signaux(); +# ifdef _BROKEN_SIGINFO + pid = origine_signal(signal); +# else + pid = (*siginfo).si_pid; +# endif + if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) { deverrouillage_gestionnaire_signaux(); @@ -2110,12 +2176,20 @@ interruption6(int signal, siginfo_t *sig } void -interruption7(int signal, siginfo_t *siginfo, void *context) +interruption7(SIGHANDLER_ARGS) { + pid_t pid; + struct_processus *s_etat_processus; verrouillage_gestionnaire_signaux(); +# ifdef _BROKEN_SIGINFO + pid = origine_signal(signal); +# else + pid = (*siginfo).si_pid; +# endif + if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) { deverrouillage_gestionnaire_signaux(); @@ -2137,14 +2211,23 @@ interruption7(int signal, siginfo_t *sig } void -interruption8(int signal, siginfo_t *siginfo, void *context) +interruption8(SIGHANDLER_ARGS) { + pid_t pid; + pthread_t thread; + struct_processus *s_etat_processus; verrouillage_gestionnaire_signaux(); - if ((*siginfo).si_pid == getpid()) +# ifdef _BROKEN_SIGINFO + pid = origine_signal(signal); +# else + pid = (*siginfo).si_pid; +# endif + + if (pid == getpid()) { if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) @@ -2180,12 +2263,20 @@ interruption8(int signal, siginfo_t *sig } void -interruption9(int signal, siginfo_t *siginfo, void *context) +interruption9(SIGHANDLER_ARGS) { + pid_t pid; + struct_processus *s_etat_processus; verrouillage_gestionnaire_signaux(); +# ifdef _BROKEN_SIGINFO + pid = origine_signal(signal); +# else + pid = (*siginfo).si_pid; +# endif + if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) { deverrouillage_gestionnaire_signaux(); @@ -2199,22 +2290,40 @@ interruption9(int signal, siginfo_t *sig fflush(stdout); } +# ifdef _BROKEN_SIGINFO + if (queue_in(getpid(), signal) != 0) + { + return; + } + + deverrouillage_gestionnaire_signaux(); + interruption11(signal); +# else deverrouillage_gestionnaire_signaux(); interruption11(signal, siginfo, context); +# endif return; } void -interruption10(int signal, siginfo_t *siginfo, void *context) +interruption10(SIGHANDLER_ARGS) { file *fichier; + pid_t pid; + struct_processus *s_etat_processus; unsigned char nom[8 + 64 + 1]; verrouillage_gestionnaire_signaux(); +# ifdef _BROKEN_SIGINFO + pid = origine_signal(signal); +# else + pid = (*siginfo).si_pid; +# endif + if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) { deverrouillage_gestionnaire_signaux(); @@ -2246,14 +2355,23 @@ interruption10(int signal, siginfo_t *si } void -interruption11(int signal, siginfo_t *siginfo, void *context) +interruption11(SIGHANDLER_ARGS) { + pid_t pid; + pthread_t thread; + struct_processus *s_etat_processus; verrouillage_gestionnaire_signaux(); - if ((*siginfo).si_pid == getpid()) +# ifdef _BROKEN_SIGINFO + pid = origine_signal(signal); +# else + pid = (*siginfo).si_pid; +# endif + + if (pid == getpid()) { if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL)