--- rpl/src/rpl.c 2012/10/19 19:05:52 1.124 +++ rpl/src/rpl.c 2014/05/17 15:35:51 1.157 @@ -1,7 +1,7 @@ /* ================================================================================ - RPL/2 (R) version 4.1.11 - Copyright (C) 1989-2012 Dr. BERTRAND Joël + RPL/2 (R) version 4.1.18 + Copyright (C) 1989-2014 Dr. BERTRAND Joël This file is part of RPL/2. @@ -23,6 +23,10 @@ #define MAIN_RPL #include "rpl-conv.h" +// Bug de gcc à partir de gcc 4.6 (bug 48544) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wclobbered" + /* ================================================================================ @@ -51,6 +55,8 @@ rplinit(int argc, char *argv[], char *en int erreur_historique; int option_P; + integer8 i; + logical1 core; logical1 debug; logical1 erreur_fichier; @@ -80,10 +86,14 @@ rplinit(int argc, char *argv[], char *en struct_processus *s_etat_processus; + struct_liste_variables_partagees *l_element_partage_courant; + struct_liste_variables_partagees *l_element_partage_suivant; + struct_liste_variables_statiques *l_element_statique_courant; struct_liste_variables_statiques *l_element_statique_suivant; - struct_table_variables_partagees s_variables_partagees; + struct_arbre_variables_partagees *s_arbre_variables_partagees; + struct_liste_variables_partagees *l_liste_variables_partagees; struct sigaction action; struct sigaction registre; @@ -102,7 +112,6 @@ rplinit(int argc, char *argv[], char *en unsigned char *ptr; unsigned char *tampon; - unsigned long i; unsigned long unite_fichier; void *l_element_courant; @@ -215,7 +224,7 @@ rplinit(int argc, char *argv[], char *en return(EXIT_FAILURE); } - if ((arg_exec = malloc((argc + 1) * sizeof(char *))) == NULL) + if ((arg_exec = malloc((((size_t) argc) + 1) * sizeof(char *))) == NULL) { # ifndef SEMAPHORES_NOMMES sem_post(&semaphore_gestionnaires_signaux); @@ -237,7 +246,7 @@ rplinit(int argc, char *argv[], char *en return(EXIT_FAILURE); } - for(i = 0; i < (unsigned long) argc; i++) + for(i = 0; i < argc; i++) { arg_exec[i] = argv[i]; } @@ -255,7 +264,20 @@ rplinit(int argc, char *argv[], char *en pthread_mutexattr_init(&attributs_mutex); pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL); - pthread_mutex_init(&((*s_etat_processus).mutex), &attributs_mutex); + pthread_mutex_init(&((*s_etat_processus).mutex_pile_processus), + &attributs_mutex); + pthread_mutexattr_destroy(&attributs_mutex); + + pthread_mutexattr_init(&attributs_mutex); + pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL); + pthread_mutex_init(&((*s_etat_processus).mutex_interruptions), + &attributs_mutex); + pthread_mutexattr_destroy(&attributs_mutex); + + pthread_mutexattr_init(&attributs_mutex); + pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL); + pthread_mutex_init(&((*s_etat_processus).mutex_signaux), + &attributs_mutex); pthread_mutexattr_destroy(&attributs_mutex); pthread_mutexattr_init(&attributs_mutex); @@ -269,22 +291,22 @@ rplinit(int argc, char *argv[], char *en pthread_mutex_init(&mutex_sections_critiques, &attributs_mutex); pthread_mutexattr_destroy(&attributs_mutex); + pthread_mutexattr_init(&attributs_mutex); + pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&mutex_liste_variables_partagees, &attributs_mutex); + pthread_mutexattr_destroy(&attributs_mutex); + # ifndef SEMAPHORES_NOMMES sem_init(&((*s_etat_processus).semaphore_fork), 0, 0); # else if (((*s_etat_processus).semaphore_fork = sem_init3(0, getpid(), pthread_self(), SEM_FORK)) == SEM_FAILED) { -# ifndef SEMAPHORES_NOMMES - sem_post(&semaphore_gestionnaires_signaux); - sem_destroy(&semaphore_gestionnaires_signaux); -# else - sem_post(semaphore_gestionnaires_signaux); - sem_destroy2(semaphore_gestionnaires_signaux, getpid(), - SEM_SIGNAUX); -# endif + sem_post(semaphore_gestionnaires_signaux); + sem_destroy2(semaphore_gestionnaires_signaux, getpid(), + SEM_SIGNAUX); - liberation(contexte_cas(s_etat_processus); + liberation_contexte_cas(s_etat_processus); if ((*s_etat_processus).langue == 'F') { @@ -305,18 +327,6 @@ rplinit(int argc, char *argv[], char *en &attributs_mutex); pthread_mutexattr_destroy(&attributs_mutex); - (*s_etat_processus).s_liste_variables_partagees = &s_variables_partagees; - - s_variables_partagees.nombre_variables = 0; - s_variables_partagees.nombre_variables_allouees = 0; - s_variables_partagees.table = NULL; - - pthread_mutexattr_init(&attributs_mutex); - pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL); - pthread_mutex_init(&((*((*s_etat_processus).s_liste_variables_partagees)) - .mutex), &attributs_mutex); - pthread_mutexattr_destroy(&attributs_mutex); - (*s_etat_processus).chemin_fichiers_temporaires = recherche_chemin_fichiers_temporaires(s_etat_processus); @@ -335,7 +345,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, getpid(), + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -359,26 +369,26 @@ rplinit(int argc, char *argv[], char *en } else { -# ifndef SEMAPHORES_NOMMES - sem_post(&((*s_etat_processus).semaphore_fork)); - sem_post(&semaphore_gestionnaires_signaux); - sem_destroy(&semaphore_gestionnaires_signaux); - sem_destroy(&((*s_etat_processus).semaphore_fork)); -# else - sem_post((*s_etat_processus).semaphore_fork); - sem_post(semaphore_gestionnaires_signaux); - sem_destroy2(semaphore_gestionnaires_signaux, getpid(), - SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, getpid(), - pthread_self(), SEM_FORK); -# endif - - liberation_contexte_cas(s_etat_processus); - liberation_queue_signaux(s_etat_processus); - if (((*s_etat_processus).localisation = malloc((strlen(d_locale) + 1) * sizeof(unsigned char))) == NULL) { +# ifndef SEMAPHORES_NOMMES + sem_post(&((*s_etat_processus).semaphore_fork)); + sem_post(&semaphore_gestionnaires_signaux); + sem_destroy(&semaphore_gestionnaires_signaux); + sem_destroy(&((*s_etat_processus).semaphore_fork)); +# else + sem_post((*s_etat_processus).semaphore_fork); + sem_post(semaphore_gestionnaires_signaux); + sem_destroy2(semaphore_gestionnaires_signaux, getpid(), + SEM_SIGNAUX); + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), + pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + if ((*s_etat_processus).langue == 'F') { uprintf("+++Système : Mémoire insuffisante\n"); @@ -411,7 +421,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, getpid(), + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -433,16 +443,20 @@ rplinit(int argc, char *argv[], char *en strcpy((*s_etat_processus).localisation, d_locale); } - printf("+++RPL/2 (R) version %s (%s)\n", d_version_rpl, - ((*s_etat_processus).langue == 'F') ? d_date_rpl : d_date_en_rpl); - - if ((*s_etat_processus).langue == 'F') + if (resultats == NULL) // Appel direct { - printf("+++Copyright (C) 1989 à 2011, 2012 BERTRAND Joël\n"); - } - else - { - printf("+++Copyright (C) 1989 to 2011, 2012 BERTRAND Joel\n"); + printf("+++RPL/2 (R) version %s (%s)\n", d_version_rpl, + ((*s_etat_processus).langue == 'F') + ? d_date_rpl : d_date_en_rpl); + + if ((*s_etat_processus).langue == 'F') + { + printf("+++Copyright (C) 1989 à 2013, 2014 BERTRAND Joël\n"); + } + else + { + printf("+++Copyright (C) 1989 to 2013, 2014 BERTRAND Joel\n"); + } } if (getenv("HOME") != NULL) @@ -481,7 +495,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, getpid(), + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -528,7 +542,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, getpid(), + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -569,7 +583,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, getpid(), + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -596,7 +610,7 @@ rplinit(int argc, char *argv[], char *en } signal_test = SIGTEST; - kill(getpid(), SIGINT); + raise(SIGINT); attente.tv_sec = 0; attente.tv_nsec = 1000000; @@ -618,7 +632,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, getpid(), + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -656,7 +670,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, getpid(), + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -683,7 +697,7 @@ rplinit(int argc, char *argv[], char *en } signal_test = SIGTEST; - kill(getpid(), SIGTERM); + raise(SIGTERM); attente.tv_sec = 0; attente.tv_nsec = 1000000; @@ -705,7 +719,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, getpid(), + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -743,7 +757,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, getpid(), + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -770,7 +784,7 @@ rplinit(int argc, char *argv[], char *en } signal_test = SIGTEST; - kill(getpid(), SIGALRM); + raise(SIGALRM); attente.tv_sec = 0; attente.tv_nsec = 1000000; @@ -792,7 +806,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, getpid(), + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -833,7 +847,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, getpid(), + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -858,7 +872,7 @@ rplinit(int argc, char *argv[], char *en } signal_test = SIGTEST; - kill(getpid(), SIGTSTP); + raise(SIGTSTP); attente.tv_sec = 0; attente.tv_nsec = 1000000; @@ -880,7 +894,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, getpid(), + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -921,7 +935,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, getpid(), + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -948,7 +962,7 @@ rplinit(int argc, char *argv[], char *en } signal_test = SIGTEST; - kill(getpid(), SIGPIPE); + raise(SIGPIPE); attente.tv_sec = 0; attente.tv_nsec = 1000000; @@ -970,7 +984,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, getpid(), + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1011,7 +1025,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, getpid(), + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1038,7 +1052,7 @@ rplinit(int argc, char *argv[], char *en } signal_test = SIGTEST; - kill(getpid(), SIGUSR1); + raise(SIGUSR1); attente.tv_sec = 0; attente.tv_nsec = 1000000; @@ -1060,7 +1074,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, getpid(), + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1166,7 +1180,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1210,7 +1224,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1261,7 +1275,7 @@ rplinit(int argc, char *argv[], char *en semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); sem_destroy3((*s_etat_processus) - .semphore_fork, getpid(), + .semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1324,7 +1338,7 @@ rplinit(int argc, char *argv[], char *en semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); sem_destroy3((*s_etat_processus) - .semphore_fork, getpid(), + .semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1377,7 +1391,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1420,7 +1434,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1465,7 +1479,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1510,7 +1524,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1554,7 +1568,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1599,7 +1613,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1636,7 +1650,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1673,7 +1687,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1719,7 +1733,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1773,7 +1787,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1818,7 +1832,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1855,7 +1869,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1900,7 +1914,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1945,7 +1959,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -1990,7 +2004,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -2027,7 +2041,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -2079,7 +2093,7 @@ rplinit(int argc, char *argv[], char *en semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); sem_destroy3((*s_etat_processus) - .semphore_fork, getpid(), + .semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -2140,7 +2154,7 @@ rplinit(int argc, char *argv[], char *en semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); sem_destroy3((*s_etat_processus) - .semphore_fork, getpid(), + .semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -2190,7 +2204,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -2230,7 +2244,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -2256,7 +2270,7 @@ rplinit(int argc, char *argv[], char *en } (*s_etat_processus).longueur_definitions_chainees = - strlen((*s_etat_processus) + (integer8) strlen((*s_etat_processus) .definitions_chainees); break; @@ -2277,7 +2291,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -2329,7 +2343,7 @@ rplinit(int argc, char *argv[], char *en semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); sem_destroy3((*s_etat_processus) - .semphore_fork, getpid(), + .semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -2390,7 +2404,7 @@ rplinit(int argc, char *argv[], char *en semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); sem_destroy3((*s_etat_processus) - .semphore_fork, getpid(), + .semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -2439,7 +2453,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -2514,7 +2528,7 @@ rplinit(int argc, char *argv[], char *en semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); sem_destroy3((*s_etat_processus) - .semphore_fork, getpid(), + .semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -2561,7 +2575,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -2605,7 +2619,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -2734,7 +2748,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -2777,7 +2791,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -2803,7 +2817,7 @@ rplinit(int argc, char *argv[], char *en } signal_test = SIGTEST; - kill(getpid(), SIGSEGV); + raise(SIGSEGV); attente.tv_sec = 0; attente.tv_nsec = 1000000; @@ -2826,7 +2840,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -2870,7 +2884,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -2903,7 +2917,7 @@ rplinit(int argc, char *argv[], char *en } signal_test = SIGTEST; - kill(getpid(), SIGBUS); + raise(SIGBUS); attente.tv_sec = 0; attente.tv_nsec = 1000000; @@ -2926,7 +2940,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -2980,7 +2994,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -3051,7 +3065,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -3095,7 +3109,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -3138,7 +3152,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -3182,7 +3196,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -3225,7 +3239,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -3290,7 +3304,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -3350,7 +3364,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -3406,6 +3420,7 @@ rplinit(int argc, char *argv[], char *en (*s_etat_processus).liste_mutexes = NULL; (*s_etat_processus).sections_critiques = 0; + (*s_etat_processus).initialisation_scheduler = d_faux; (*s_etat_processus).test_instruction = 'N'; (*s_etat_processus).nombre_arguments = 0; @@ -3439,10 +3454,17 @@ rplinit(int argc, char *argv[], char *en (*s_etat_processus).s_arbre_variables = NULL; (*s_etat_processus).l_liste_variables_par_niveau = NULL; + (*s_etat_processus).l_liste_variables_statiques = NULL; (*s_etat_processus).gel_liste_variables = d_faux; + s_arbre_variables_partagees = NULL; + l_liste_variables_partagees = NULL; + (*s_etat_processus).s_arbre_variables_partagees = + &s_arbre_variables_partagees; + (*s_etat_processus).l_liste_variables_partagees = + &l_liste_variables_partagees; (*s_etat_processus).pointeur_variable_courante = NULL; (*s_etat_processus).pointeur_variable_statique_courante = NULL; - (*s_etat_processus).l_liste_variables_statiques = NULL; + (*s_etat_processus).pointeur_variable_partagee_courante = NULL; (*s_etat_processus).niveau_courant = 0; (*s_etat_processus).niveau_initial = 0; (*s_etat_processus).creation_variables_statiques = d_faux; @@ -3609,7 +3631,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -3652,7 +3674,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -3709,7 +3731,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -3799,7 +3821,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -3851,7 +3873,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -3931,7 +3953,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -3987,7 +4009,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -4084,7 +4106,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -4143,7 +4165,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -4230,7 +4252,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -4278,7 +4300,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -4327,7 +4349,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -4375,7 +4397,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -4428,7 +4450,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -4478,7 +4500,7 @@ rplinit(int argc, char *argv[], char *en { (*s_etat_processus).erreur_systeme = d_es; encart(s_etat_processus, - (unsigned long) (5 * 1000000)); + (integer8) (5 * 1000000)); if ((*s_etat_processus).erreur_systeme != d_es) { @@ -4501,7 +4523,7 @@ rplinit(int argc, char *argv[], char *en semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); sem_destroy3((*s_etat_processus) - .semphore_fork, + .semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -4571,7 +4593,7 @@ rplinit(int argc, char *argv[], char *en semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); sem_destroy3((*s_etat_processus) - .semphore_fork, + .semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -4622,7 +4644,7 @@ rplinit(int argc, char *argv[], char *en semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); sem_destroy3((*s_etat_processus) - .semphore_fork, + .semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -4674,7 +4696,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -4738,7 +4760,7 @@ rplinit(int argc, char *argv[], char *en semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); sem_destroy3((*s_etat_processus) - .semphore_fork, + .semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -4786,7 +4808,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -4830,7 +4852,7 @@ rplinit(int argc, char *argv[], char *en semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); sem_destroy3((*s_etat_processus) - .semphore_fork, + .semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -4879,7 +4901,7 @@ rplinit(int argc, char *argv[], char *en sem_post(semaphore_gestionnaires_signaux); sem_destroy2(semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); - sem_destroy3((*s_etat_processus).semphore_fork, + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -4900,6 +4922,8 @@ rplinit(int argc, char *argv[], char *en return(EXIT_FAILURE); } + empilement_pile_systeme(s_etat_processus); + if (evaluation(s_etat_processus, s_objet, 'E') == d_erreur) { @@ -4929,7 +4953,7 @@ rplinit(int argc, char *argv[], char *en semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); sem_destroy3((*s_etat_processus) - .semphore_fork, getpid(), + .semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -4983,7 +5007,7 @@ rplinit(int argc, char *argv[], char *en semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); sem_destroy3((*s_etat_processus) - .semphore_fork, + .semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -5032,7 +5056,7 @@ rplinit(int argc, char *argv[], char *en semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); sem_destroy3((*s_etat_processus) - .semphore_fork, getpid(), + .semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -5086,7 +5110,7 @@ rplinit(int argc, char *argv[], char *en semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); sem_destroy3((*s_etat_processus) - .semphore_fork, + .semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -5134,15 +5158,95 @@ rplinit(int argc, char *argv[], char *en if (erreur == d_absence_erreur) { - if (((*s_etat_processus).var_volatile_alarme - == 0) && ((*s_etat_processus) + if (((*s_etat_processus) .arret_depuis_abort == 0) && ((*s_etat_processus).at_exit != NULL)) { + // Permet de traiter ATEXIT + // même après réception d'un SIGINT. + (*s_etat_processus) + .var_volatile_alarme = 0; + (*s_etat_processus) + .var_volatile_requete_arret = 0; + + if ((*s_etat_processus).profilage == + d_vrai) + { + profilage(s_etat_processus, + "ATEXIT"); + } + erreur = evaluation(s_etat_processus, (*s_etat_processus).at_exit, 'E'); + + if ((*s_etat_processus).profilage == + d_vrai) + { + profilage(s_etat_processus, NULL); + } + + if (((*s_etat_processus) + .erreur_execution != d_ex) || + ((*s_etat_processus).exception + != d_ep) || ((*s_etat_processus) + .erreur_systeme != d_es)) + { + printf("%s [%d]\n", message = + messages(s_etat_processus), + (int) getpid()); + free(message); + + if (test_cfsf(s_etat_processus, 51) + == d_faux) + { + printf("%s", ds_beep); + } + + if ((*s_etat_processus).core == + d_vrai) + { + printf("\n"); + + if ((*s_etat_processus).langue + == 'F') + { + printf("+++Information : Gé" + "nération du fichie" + "r rpl-core " + "[%d]\n", (int) + getpid()); + } + else + { + printf("+++Information : Wr" + "iting rpl-core fil" + "e [%d]\n", + (int) getpid()); + } + + rplcore(s_etat_processus); + + if ((*s_etat_processus).langue + == 'F') + { + printf("+++Information : Pr" + "ocessus tracé [%d]" + "\n", + (int) getpid()); + } + else + { + printf("+++Information : Do" + "ne [%d]\n", (int) + getpid()); + } + + printf("\n"); + fflush(stdout); + } + } } } } @@ -5155,15 +5259,95 @@ rplinit(int argc, char *argv[], char *en if (erreur == d_absence_erreur) { - if (((*s_etat_processus).var_volatile_alarme - == 0) && ((*s_etat_processus) + if (((*s_etat_processus) .arret_depuis_abort == 0) && ((*s_etat_processus).at_exit != NULL)) { + // Permet de traiter ATEXIT + // même après réception d'un SIGINT. + (*s_etat_processus) + .var_volatile_alarme = 0; + (*s_etat_processus) + .var_volatile_requete_arret = 0; + + if ((*s_etat_processus).profilage == + d_vrai) + { + profilage(s_etat_processus, + "ATEXIT"); + } + erreur = evaluation(s_etat_processus, (*s_etat_processus).at_exit, 'E'); + + if ((*s_etat_processus).profilage == + d_vrai) + { + profilage(s_etat_processus, NULL); + } + + if (((*s_etat_processus) + .erreur_execution != d_ex) || + ((*s_etat_processus).exception + != d_ep) || ((*s_etat_processus) + .erreur_systeme != d_es)) + { + printf("%s [%d]\n", message = + messages(s_etat_processus), + (int) getpid()); + free(message); + + if (test_cfsf(s_etat_processus, 51) + == d_faux) + { + printf("%s", ds_beep); + } + + if ((*s_etat_processus).core == + d_vrai) + { + printf("\n"); + + if ((*s_etat_processus).langue + == 'F') + { + printf("+++Information : Gé" + "nération du fichie" + "r rpl-core " + "[%d]\n", (int) + getpid()); + } + else + { + printf("+++Information : Wr" + "iting rpl-core fil" + "e [%d]\n", + (int) getpid()); + } + + rplcore(s_etat_processus); + + if ((*s_etat_processus).langue + == 'F') + { + printf("+++Information : Pr" + "ocessus tracé [%d]" + "\n", + (int) getpid()); + } + else + { + printf("+++Information : Do" + "ne [%d]\n", (int) + getpid()); + } + + printf("\n"); + fflush(stdout); + } + } } } } @@ -5204,7 +5388,8 @@ rplinit(int argc, char *argv[], char *en pthread_cancel((*s_etat_processus).thread_fusible); } - pthread_mutex_lock(&((*s_etat_processus).mutex)); + pthread_mutex_lock(&((*s_etat_processus) + .mutex_pile_processus)); l_element_courant = (void *) (*s_etat_processus) .l_base_pile_processus; @@ -5376,8 +5561,7 @@ rplinit(int argc, char *argv[], char *en l_element_courant = (void *) (*s_etat_processus).l_base_pile_processus; - for(i = 0; i < (unsigned long) - (*(*((struct_processus_fils *) + for(i = 0; i < (*(*((struct_processus_fils *) (*(*((struct_liste_chainee *) l_element_courant)).donnee).objet)).thread) .nombre_objets_dans_pipe; i++) @@ -5423,7 +5607,7 @@ rplinit(int argc, char *argv[], char *en semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); sem_destroy3((*s_etat_processus) - .semphore_fork, getpid(), + .semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -5441,8 +5625,8 @@ rplinit(int argc, char *argv[], char *en } # endif - pthread_mutex_unlock( - &((*s_etat_processus).mutex)); + pthread_mutex_unlock(&((*s_etat_processus) + .mutex_pile_processus)); return(EXIT_FAILURE); } @@ -5486,7 +5670,7 @@ rplinit(int argc, char *argv[], char *en semaphore_gestionnaires_signaux, getpid(), SEM_SIGNAUX); sem_destroy3((*s_etat_processus) - .semphore_fork, getpid(), + .semaphore_fork, getpid(), pthread_self(), SEM_FORK); # endif @@ -5504,14 +5688,15 @@ rplinit(int argc, char *argv[], char *en } # endif - pthread_mutex_unlock( - &((*s_etat_processus).mutex)); + pthread_mutex_unlock(&((*s_etat_processus) + .mutex_pile_processus)); return(EXIT_FAILURE); } } } - pthread_mutex_unlock(&((*s_etat_processus).mutex)); + pthread_mutex_lock(&((*s_etat_processus) + .mutex_interruptions)); if ((*s_etat_processus) .nombre_interruptions_non_affectees != 0) @@ -5520,12 +5705,18 @@ rplinit(int argc, char *argv[], char *en s_etat_processus); } + pthread_mutex_unlock(&((*s_etat_processus) + .mutex_interruptions)); + pthread_mutex_unlock(&((*s_etat_processus) + .mutex_pile_processus)); nanosleep(&attente, NULL); scrutation_interruptions(s_etat_processus); - pthread_mutex_lock(&((*s_etat_processus).mutex)); + pthread_mutex_lock(&((*s_etat_processus) + .mutex_pile_processus)); } - pthread_mutex_unlock(&((*s_etat_processus).mutex)); + pthread_mutex_unlock(&((*s_etat_processus) + .mutex_pile_processus)); erreur_historique = write_history( (*s_etat_processus).nom_fichier_historique); @@ -5675,6 +5866,8 @@ rplinit(int argc, char *argv[], char *en * le libérer... */ + liberation_arbre_variables_partagees(s_etat_processus, + (*(*s_etat_processus).s_arbre_variables_partagees)); liberation_arbre_variables(s_etat_processus, (*s_etat_processus).s_arbre_variables, d_vrai); free((*s_etat_processus).pointeurs_caracteres_variables); @@ -5690,19 +5883,16 @@ rplinit(int argc, char *argv[], char *en l_element_statique_courant = l_element_statique_suivant; } - for(i = 0; i < (*((*s_etat_processus) - .s_liste_variables_partagees)).nombre_variables; - i++) - { - liberation(s_etat_processus, (*((*s_etat_processus) - .s_liste_variables_partagees)).table[i].objet); - free((*((*s_etat_processus) - .s_liste_variables_partagees)).table[i].nom); - } + l_element_partage_courant = (*(*s_etat_processus) + .l_liste_variables_partagees); - free((struct_variable_partagee *) - (*((*s_etat_processus).s_liste_variables_partagees)) - .table); + while(l_element_partage_courant != NULL) + { + l_element_partage_suivant = + (*l_element_partage_courant).suivant; + free(l_element_partage_courant); + l_element_partage_courant = l_element_partage_suivant; + } /* * Si resultats est non nul, rplinit a été appelé @@ -5718,8 +5908,9 @@ rplinit(int argc, char *argv[], char *en { free((*resultats)); - if (((*resultats) = malloc(((*s_etat_processus) - .hauteur_pile_operationnelle + 1) + if (((*resultats) = malloc(((size_t) + ((*s_etat_processus) + .hauteur_pile_operationnelle + 1)) * sizeof(unsigned char **))) != NULL) { (*resultats)[(*s_etat_processus) @@ -6035,14 +6226,15 @@ rplinit(int argc, char *argv[], char *en closelog(); pthread_mutex_destroy(&((*s_etat_processus).protection_liste_mutexes)); - pthread_mutex_destroy(&((*((*s_etat_processus).s_liste_variables_partagees)) - .mutex)); retrait_thread(s_etat_processus); - pthread_mutex_destroy(&((*s_etat_processus).mutex)); + pthread_mutex_destroy(&((*s_etat_processus).mutex_pile_processus)); pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation)); + pthread_mutex_destroy(&((*s_etat_processus).mutex_interruptions)); + pthread_mutex_destroy(&((*s_etat_processus).mutex_signaux)); pthread_mutex_destroy(&mutex_sections_critiques); + pthread_mutex_destroy(&mutex_liste_variables_partagees); # ifndef SEMAPHORES_NOMMES sem_post(&((*s_etat_processus).semaphore_fork)); @@ -6070,8 +6262,11 @@ rplinit(int argc, char *argv[], char *en if ((*s_etat_processus).requete_redemarrage == d_vrai) { - chdir(repertoire_initial); - execvp(arg_exec[0], &(arg_exec[0])); + if (chdir(repertoire_initial) == 0) + { + execvp(arg_exec[0], &(arg_exec[0])); + } + erreur = d_erreur; } @@ -6218,4 +6413,6 @@ date_compilation() return(date); } +#pragma GCC diagnostic pop + // vim: ts=4