--- rpl/src/rpl.c 2012/10/19 19:05:52 1.124 +++ rpl/src/rpl.c 2014/04/25 08:18:59 1.155 @@ -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. @@ -51,6 +51,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 +82,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 +108,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 +220,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 +242,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 +260,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 +287,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 +323,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 +341,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 +365,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 +417,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 +439,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 +491,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 +538,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 +579,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 +606,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 +628,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 +666,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 +693,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 +715,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 +753,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 +780,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 +802,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 +843,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 +868,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 +890,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 +931,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 +958,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 +980,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 +1021,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 +1048,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 +1070,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 +1176,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 +1220,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 +1271,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 +1334,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 +1387,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 +1430,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 +1475,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 +1520,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 +1564,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 +1609,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 +1646,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 +1683,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 +1729,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 +1783,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 +1828,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 +1865,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 +1910,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 +1955,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 +2000,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 +2037,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 +2089,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 +2150,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 +2200,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 +2240,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 +2266,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 +2287,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 +2339,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 +2400,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 +2449,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 +2524,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 +2571,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 +2615,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 +2744,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 +2787,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 +2813,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 +2836,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 +2880,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 +2913,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 +2936,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 +2990,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 +3061,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 +3105,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 +3148,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 +3192,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 +3235,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 +3300,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 +3360,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 +3416,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 +3450,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 +3627,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 +3670,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 +3727,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 +3817,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 +3869,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 +3949,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 +4005,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 +4102,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 +4161,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 +4248,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 +4296,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 +4345,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 +4393,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 +4446,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 +4496,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 +4519,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 +4589,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 +4640,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 +4692,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 +4756,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 +4804,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 +4848,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 +4897,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 +4918,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 +4949,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 +5003,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 +5052,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 +5106,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 +5154,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 +5255,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 +5384,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 +5557,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 +5603,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 +5621,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 +5666,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 +5684,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 +5701,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 +5862,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 +5879,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 +5904,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 +6222,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));