--- rpl/src/rpl.c 2013/05/28 22:09:56 1.145 +++ 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,8 @@ 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); @@ -271,6 +276,12 @@ 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_signaux), + &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_allocation), &attributs_mutex); pthread_mutexattr_destroy(&attributs_mutex); @@ -291,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') { @@ -339,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 @@ -363,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"); @@ -415,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 @@ -437,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) @@ -485,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 @@ -532,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 @@ -573,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 @@ -622,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 @@ -660,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 @@ -709,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 @@ -747,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 @@ -796,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 @@ -837,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 @@ -884,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 @@ -925,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 @@ -974,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 @@ -1015,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 @@ -1064,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 @@ -1170,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 @@ -1214,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 @@ -1265,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 @@ -1328,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 @@ -1381,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 @@ -1424,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 @@ -1469,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 @@ -1514,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 @@ -1558,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 @@ -1603,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 @@ -1640,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 @@ -1677,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 @@ -1723,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 @@ -1777,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 @@ -1822,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 @@ -1859,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 @@ -1904,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 @@ -1949,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 @@ -1994,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 @@ -2031,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 @@ -2083,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 @@ -2144,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 @@ -2194,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 @@ -2234,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 @@ -2281,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 @@ -2333,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 @@ -2394,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 @@ -2443,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 @@ -2518,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 @@ -2565,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 @@ -2609,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 @@ -2738,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 @@ -2781,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 @@ -2830,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 @@ -2874,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 @@ -2930,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 @@ -2984,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 @@ -3055,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 @@ -3099,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 @@ -3142,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 @@ -3186,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 @@ -3229,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 @@ -3294,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 @@ -3354,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 @@ -3621,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 @@ -3664,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 @@ -3721,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 @@ -3811,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 @@ -3863,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 @@ -3943,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 @@ -3999,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 @@ -4096,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 @@ -4155,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 @@ -4242,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 @@ -4290,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 @@ -4339,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 @@ -4387,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 @@ -4440,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 @@ -4513,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 @@ -4583,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 @@ -4634,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 @@ -4686,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 @@ -4750,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 @@ -4798,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 @@ -4842,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 @@ -4891,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 @@ -4943,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 @@ -4997,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 @@ -5046,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 @@ -5100,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 @@ -5378,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; @@ -5596,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 @@ -5614,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); } @@ -5659,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 @@ -5677,8 +5688,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); } } @@ -5696,14 +5707,16 @@ rplinit(int argc, char *argv[], char *en pthread_mutex_unlock(&((*s_etat_processus) .mutex_interruptions)); - - pthread_mutex_unlock(&((*s_etat_processus).mutex)); + 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); @@ -6216,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); @@ -6247,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; } @@ -6395,4 +6413,6 @@ date_compilation() return(date); } +#pragma GCC diagnostic pop + // vim: ts=4