--- rpl/src/rpl.c 2013/04/18 15:32:38 1.142 +++ rpl/src/rpl.c 2014/05/17 15:35:51 1.157 @@ -1,7 +1,7 @@ /* ================================================================================ - RPL/2 (R) version 4.1.14 - Copyright (C) 1989-2013 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" + /* ================================================================================ @@ -260,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); @@ -285,16 +302,11 @@ rplinit(int argc, char *argv[], char *en 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') { @@ -333,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 @@ -357,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"); @@ -409,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 @@ -431,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 à 2012, 2013 BERTRAND Joël\n"); - } - else - { - printf("+++Copyright (C) 1989 to 2012, 2013 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) @@ -479,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 @@ -526,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 @@ -567,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 @@ -616,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 @@ -654,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 @@ -703,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 @@ -741,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 @@ -790,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 @@ -831,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 @@ -878,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 @@ -919,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 @@ -968,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 @@ -1009,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 @@ -1058,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 @@ -1164,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 @@ -1208,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 @@ -1259,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 @@ -1322,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 @@ -1375,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 @@ -1418,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 @@ -1463,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 @@ -1508,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 @@ -1552,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 @@ -1597,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 @@ -1634,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 @@ -1671,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 @@ -1717,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 @@ -1771,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 @@ -1816,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 @@ -1853,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 @@ -1898,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 @@ -1943,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 @@ -1988,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 @@ -2025,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 @@ -2077,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 @@ -2138,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 @@ -2188,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 @@ -2228,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 @@ -2275,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 @@ -2327,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 @@ -2388,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 @@ -2437,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 @@ -2512,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 @@ -2559,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 @@ -2603,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 @@ -2732,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 @@ -2775,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 @@ -2824,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 @@ -2868,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 @@ -2924,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 @@ -2978,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 @@ -3049,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 @@ -3093,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 @@ -3136,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 @@ -3180,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 @@ -3223,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 @@ -3288,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 @@ -3348,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 @@ -3404,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; @@ -3614,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 @@ -3657,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 @@ -3714,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 @@ -3804,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 @@ -3856,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 @@ -3936,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 @@ -3992,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 @@ -4089,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 @@ -4148,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 @@ -4235,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 @@ -4283,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 @@ -4332,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 @@ -4380,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 @@ -4433,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 @@ -4506,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 @@ -4576,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 @@ -4627,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 @@ -4679,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 @@ -4743,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 @@ -4791,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 @@ -4835,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 @@ -4884,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 @@ -4936,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 @@ -4990,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 @@ -5039,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 @@ -5093,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 @@ -5371,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; @@ -5589,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 @@ -5607,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); } @@ -5652,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 @@ -5670,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) @@ -5686,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); @@ -6204,8 +6229,10 @@ rplinit(int argc, char *argv[], char *en 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); @@ -6235,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; } @@ -6383,4 +6413,6 @@ date_compilation() return(date); } +#pragma GCC diagnostic pop + // vim: ts=4