--- rpl/src/rpl.c 2011/08/30 14:19:28 1.78 +++ rpl/src/rpl.c 2011/09/10 20:45:06 1.82 @@ -105,6 +105,7 @@ rplinit(int argc, char *argv[], unsigned volatile unsigned char traitement_fichier_temporaire; errno = 0; + pid_processus_pere = getpid(); # ifdef DEBUG_MEMOIRE debug_memoire_initialisation(); @@ -187,6 +188,7 @@ rplinit(int argc, char *argv[], unsigned (*s_etat_processus).exception = d_ep; (*s_etat_processus).erreur_systeme = d_es; (*s_etat_processus).erreur_execution = d_ex; + (*s_etat_processus).compteur_violation_d_acces = 0; (*s_etat_processus).rpl_home = rpl_home; @@ -439,6 +441,26 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } + signal_test = SIGTEST; + kill(getpid(), SIGINT); + + if (signal_test != SIGINT) + { + erreur = d_es_signal; + + if ((*s_etat_processus).langue == 'F') + { + printf("+++Système : Initialisation des signaux POSIX " + "impossible\n"); + } + else + { + printf("+++System : Initialization of POSIX signals failed\n"); + } + + return(EXIT_FAILURE); + } + if (sigaction(SIGTERM, &action, NULL) != 0) { erreur = d_es_signal; @@ -456,6 +478,26 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } + signal_test = SIGTEST; + kill(getpid(), SIGTERM); + + if (signal_test != SIGTERM) + { + erreur = d_es_signal; + + if ((*s_etat_processus).langue == 'F') + { + printf("+++Système : Initialisation des signaux POSIX " + "impossible\n"); + } + else + { + printf("+++System : Initialization of POSIX signals failed\n"); + } + + return(EXIT_FAILURE); + } + # ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption2; # else @@ -478,6 +520,26 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } + signal_test = SIGTEST; + kill(getpid(), SIGTSTP); + + if (signal_test != SIGTSTP) + { + erreur = d_es_signal; + + if ((*s_etat_processus).langue == 'F') + { + printf("+++Système : Initialisation des signaux POSIX " + "impossible\n"); + } + else + { + printf("+++System : Initialization of POSIX signals failed\n"); + } + + return(EXIT_FAILURE); + } + # ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption4; # else @@ -501,6 +563,26 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } + signal_test = SIGTEST; + kill(getpid(), SIGSTART); + + if (signal_test != SIGSTART) + { + erreur = d_es_signal; + + if ((*s_etat_processus).langue == 'F') + { + printf("+++Système : Initialisation des signaux POSIX " + "impossible\n"); + } + else + { + printf("+++System : Initialization of POSIX signals failed\n"); + } + + return(EXIT_FAILURE); + } + if (sigaction(SIGCONT, &action, NULL) != 0) { if ((*s_etat_processus).langue == 'F') @@ -516,6 +598,26 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } + signal_test = SIGTEST; + kill(getpid(), SIGCONT); + + if (signal_test != SIGCONT) + { + erreur = d_es_signal; + + if ((*s_etat_processus).langue == 'F') + { + printf("+++Système : Initialisation des signaux POSIX " + "impossible\n"); + } + else + { + printf("+++System : Initialization of POSIX signals failed\n"); + } + + return(EXIT_FAILURE); + } + # ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption5; # else @@ -540,6 +642,26 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } + signal_test = SIGTEST; + kill(getpid(), SIGFSTOP); + + if (signal_test != SIGFSTOP) + { + erreur = d_es_signal; + + if ((*s_etat_processus).langue == 'F') + { + printf("+++Système : Initialisation des signaux POSIX " + "impossible\n"); + } + else + { + printf("+++System : Initialization of POSIX signals failed\n"); + } + + return(EXIT_FAILURE); + } + # ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption11; # else @@ -564,6 +686,26 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } + signal_test = SIGTEST; + kill(getpid(), SIGFABORT); + + if (signal_test != SIGFABORT) + { + erreur = d_es_signal; + + if ((*s_etat_processus).langue == 'F') + { + printf("+++Système : Initialisation des signaux POSIX " + "impossible\n"); + } + else + { + printf("+++System : Initialization of POSIX signals failed\n"); + } + + return(EXIT_FAILURE); + } + # ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption8; # else @@ -588,6 +730,26 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } + signal_test = SIGTEST; + kill(getpid(), SIGURG); + + if (signal_test != SIGURG) + { + erreur = d_es_signal; + + if ((*s_etat_processus).langue == 'F') + { + printf("+++Système : Initialisation des signaux POSIX " + "impossible\n"); + } + else + { + printf("+++System : Initialization of POSIX signals failed\n"); + } + + return(EXIT_FAILURE); + } + # ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption7; # else @@ -612,6 +774,26 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } + signal_test = SIGTEST; + kill(getpid(), SIGPIPE); + + if (signal_test != SIGPIPE) + { + erreur = d_es_signal; + + if ((*s_etat_processus).langue == 'F') + { + printf("+++Système : Initialisation des signaux POSIX " + "impossible\n"); + } + else + { + printf("+++System : Initialization of POSIX signals failed\n"); + } + + return(EXIT_FAILURE); + } + # ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption6; # else @@ -636,6 +818,26 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } + signal_test = SIGTEST; + kill(getpid(), SIGINJECT); + + if (signal_test != SIGINJECT) + { + erreur = d_es_signal; + + if ((*s_etat_processus).langue == 'F') + { + printf("+++Système : Initialisation des signaux POSIX " + "impossible\n"); + } + else + { + printf("+++System : Initialization of POSIX signals failed\n"); + } + + return(EXIT_FAILURE); + } + # ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption9; # else @@ -660,6 +862,26 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } + signal_test = SIGTEST; + kill(getpid(), SIGABORT); + + if (signal_test != SIGABORT) + { + erreur = d_es_signal; + + if ((*s_etat_processus).langue == 'F') + { + printf("+++Système : Initialisation des signaux POSIX " + "impossible\n"); + } + else + { + printf("+++System : Initialization of POSIX signals failed\n"); + } + + return(EXIT_FAILURE); + } + # ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption1; # else @@ -684,12 +906,27 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } -# ifndef _BROKEN_SIGINFO - action.sa_sigaction = interruption3; -# else - action.sa_handler = interruption3; -# endif - action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO; + signal_test = SIGTEST; + kill(getpid(), SIGALRM); + + if (signal_test != SIGALRM) + { + erreur = d_es_signal; + + if ((*s_etat_processus).langue == 'F') + { + printf("+++Système : Initialisation des signaux POSIX " + "impossible\n"); + } + else + { + printf("+++System : Initialization of POSIX signals failed\n"); + } + + return(EXIT_FAILURE); + } + + signal_test = SIGTEST + 1; erreur = d_absence_erreur; core = d_faux; @@ -1578,6 +1815,13 @@ rplinit(int argc, char *argv[], unsigned if (debug == d_faux) { +# ifndef _BROKEN_SIGINFO + action.sa_sigaction = interruption3; +# else + action.sa_handler = interruption3; +# endif + action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO; + if (sigaction(SIGSEGV, &action, NULL) != 0) { if ((*s_etat_processus).langue == 'F') @@ -1858,7 +2102,6 @@ rplinit(int argc, char *argv[], unsigned (*s_etat_processus).l_base_pile = NULL; (*s_etat_processus).l_base_pile_last = NULL; - (*s_etat_processus).l_base_pile_undo = NULL; (*s_etat_processus).s_arbre_variables = NULL; (*s_etat_processus).l_liste_variables_par_niveau = NULL; @@ -2013,6 +2256,7 @@ rplinit(int argc, char *argv[], unsigned (*s_etat_processus).var_volatile_recursivite = 0; (*s_etat_processus).var_volatile_exception_gsl = 0; (*s_etat_processus).arret_depuis_abort = 0; + (*s_etat_processus).signal_a_traiter = d_faux; initialisation_allocateur(s_etat_processus); initialisation_drapeaux(s_etat_processus); @@ -2766,6 +3010,20 @@ rplinit(int argc, char *argv[], unsigned if (setjmp(contexte_initial) == 0) { erreur = sequenceur(s_etat_processus); + + if (erreur == d_absence_erreur) + { + if (((*s_etat_processus).var_volatile_alarme + == 0) && ((*s_etat_processus) + .arret_depuis_abort == 0) && + ((*s_etat_processus).at_exit + != NULL)) + { + erreur = evaluation(s_etat_processus, + (*s_etat_processus).at_exit, + 'E'); + } + } } } else @@ -2773,18 +3031,20 @@ rplinit(int argc, char *argv[], unsigned if (setjmp(contexte_initial) == 0) { erreur = sequenceur_optimise(s_etat_processus); - } - } - if (erreur == d_absence_erreur) - { - if (((*s_etat_processus).var_volatile_alarme == 0) - && ((*s_etat_processus).arret_depuis_abort - == 0) && ((*s_etat_processus).at_exit - != NULL)) - { - erreur = evaluation(s_etat_processus, - (*s_etat_processus).at_exit, 'E'); + if (erreur == d_absence_erreur) + { + if (((*s_etat_processus).var_volatile_alarme + == 0) && ((*s_etat_processus) + .arret_depuis_abort == 0) && + ((*s_etat_processus).at_exit + != NULL)) + { + erreur = evaluation(s_etat_processus, + (*s_etat_processus).at_exit, + 'E'); + } + } } } } @@ -3385,21 +3645,6 @@ rplinit(int argc, char *argv[], unsigned while(l_element_courant != NULL) { l_element_suivant = (*((struct_liste_chainee *) - l_element_courant)).suivant; - - liberation(s_etat_processus, - (*((struct_liste_chainee *) - l_element_courant)).donnee); - free((struct_liste_chainee *) l_element_courant); - - l_element_courant = l_element_suivant; - } - - l_element_courant = (void *) (*s_etat_processus) - .l_base_pile_undo; - while(l_element_courant != NULL) - { - l_element_suivant = (*((struct_liste_chainee *) l_element_courant)).suivant; liberation(s_etat_processus,