--- rpl/src/rpl.c 2012/10/05 13:12:39 1.120 +++ rpl/src/rpl.c 2012/12/19 09:58:28 1.131 @@ -1,6 +1,6 @@ /* ================================================================================ - RPL/2 (R) version 4.1.11 + RPL/2 (R) version 4.1.12 Copyright (C) 1989-2012 Dr. BERTRAND Joël This file is part of RPL/2. @@ -80,7 +80,14 @@ rplinit(int argc, char *argv[], char *en struct_processus *s_etat_processus; - struct_table_variables_partagees s_variables_partagees; + 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_arbre_variables_partagees *s_arbre_variables_partagees; + struct_liste_variables_partagees *l_liste_variables_partagees; struct sigaction action; struct sigaction registre; @@ -151,6 +158,14 @@ rplinit(int argc, char *argv[], char *en if ((s_etat_processus = malloc(sizeof(struct_processus))) == NULL) { +# 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 + erreur = d_es_allocation_memoire; if ((langue = getenv("LANG")) != NULL) @@ -184,16 +199,17 @@ rplinit(int argc, char *argv[], char *en if (getcwd(repertoire_initial, RPL_PATH_MAX) == NULL) { - if ((langue = getenv("LANG")) != NULL) +# 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 + + if ((*s_etat_processus).langue == 'F') { - if (strncmp(langue, "fr", 2) == 0) - { - uprintf("+++Système : Mémoire insuffisante\n"); - } - else - { - uprintf("+++System : Not enough memory\n"); - } + uprintf("+++Système : Mémoire insuffisante\n"); } else { @@ -205,16 +221,17 @@ rplinit(int argc, char *argv[], char *en if ((arg_exec = malloc((argc + 1) * sizeof(char *))) == NULL) { - if ((langue = getenv("LANG")) != NULL) +# 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 + + if ((*s_etat_processus).langue == 'F') { - if (strncmp(langue, "fr", 2) == 0) - { - uprintf("+++Système : Mémoire insuffisante\n"); - } - else - { - uprintf("+++System : Not enough memory\n"); - } + uprintf("+++Système : Mémoire insuffisante\n"); } else { @@ -256,12 +273,28 @@ 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 + + liberation(contexte_cas(s_etat_processus); + if ((*s_etat_processus).langue == 'F') { uprintf("+++Système : Mémoire insuffisante\n"); @@ -281,31 +314,67 @@ 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); insertion_thread(s_etat_processus, d_vrai); creation_queue_signaux(s_etat_processus); -# ifndef OS2 - localisation_courante(s_etat_processus); -# else if ((*s_etat_processus).erreur_systeme != d_es) { - 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).semphore_fork, getpid(), + pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + + if ((*s_etat_processus).langue == 'F') + { + uprintf("+++Système : Mémoire insuffisante\n"); + } + else + { + uprintf("+++System : Not enough memory\n"); + } + + return(EXIT_FAILURE); + } + + if (d_forced_locale == 0) + { + localisation_courante(s_etat_processus); + } + 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) { if ((*s_etat_processus).langue == 'F') { @@ -321,7 +390,6 @@ rplinit(int argc, char *argv[], char *en strcpy((*s_etat_processus).localisation, d_locale); } -# endif (*s_etat_processus).erreur_systeme = d_es; @@ -330,6 +398,23 @@ rplinit(int argc, char *argv[], char *en 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).semphore_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"); @@ -350,11 +435,11 @@ rplinit(int argc, char *argv[], char *en if ((*s_etat_processus).langue == 'F') { - printf("+++Copyright (C) 1989 à 2011, 2012 BERTRAND Joël\n"); + printf("+++Copyright (C) 1989 à 2012, 2013 BERTRAND Joël\n"); } else { - printf("+++Copyright (C) 1989 to 2011, 2012 BERTRAND Joel\n"); + printf("+++Copyright (C) 1989 to 2012, 2013 BERTRAND Joel\n"); } if (getenv("HOME") != NULL) @@ -383,6 +468,23 @@ rplinit(int argc, char *argv[], char *en if (stackoverflow_install_handler(interruption_depassement_pile, pile_signaux, sizeof(pile_signaux)) != 0) { +# 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); + erreur = d_es_signal; if ((*s_etat_processus).langue == 'F') @@ -411,11 +513,70 @@ rplinit(int argc, char *argv[], char *en } # endif + if (lancement_thread_signaux(s_etat_processus) != d_absence_erreur) + { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + + erreur = d_es_signal; + + if ((*s_etat_processus).langue == 'F') + { + printf("+++Système : Initialisation des signaux POSIX " + "impossible\n"); + } + else + { + printf("+++System : Initialization of POSIX signals failed\n"); + } + + return(EXIT_FAILURE); + } + action.sa_handler = interruption1; action.sa_flags = 0; if (sigaction(SIGINT, &action, NULL) != 0) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + erreur = d_es_signal; if ((*s_etat_processus).langue == 'F') @@ -444,6 +605,27 @@ rplinit(int argc, char *argv[], char *en if (signal_test != SIGINT) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + erreur = d_es_signal; if ((*s_etat_processus).langue == 'F') @@ -461,6 +643,27 @@ rplinit(int argc, char *argv[], char *en if (sigaction(SIGTERM, &action, NULL) != 0) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + erreur = d_es_signal; if ((*s_etat_processus).langue == 'F') @@ -489,6 +692,27 @@ rplinit(int argc, char *argv[], char *en if (signal_test != SIGTERM) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + erreur = d_es_signal; if ((*s_etat_processus).langue == 'F') @@ -506,6 +730,27 @@ rplinit(int argc, char *argv[], char *en if (sigaction(SIGALRM, &action, NULL) != 0) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + erreur = d_es_signal; if ((*s_etat_processus).langue == 'F') @@ -534,6 +779,27 @@ rplinit(int argc, char *argv[], char *en if (signal_test != SIGALRM) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + erreur = d_es_signal; if ((*s_etat_processus).langue == 'F') @@ -554,6 +820,27 @@ rplinit(int argc, char *argv[], char *en if (sigaction(SIGTSTP, &action, NULL) != 0) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Système : Initialisation des signaux POSIX " @@ -580,6 +867,27 @@ rplinit(int argc, char *argv[], char *en if (signal_test != SIGTSTP) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + erreur = d_es_signal; if ((*s_etat_processus).langue == 'F') @@ -600,6 +908,27 @@ rplinit(int argc, char *argv[], char *en if (sigaction(SIGPIPE, &action, NULL) != 0) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + erreur = d_es_signal; if ((*s_etat_processus).langue == 'F') @@ -628,6 +957,27 @@ rplinit(int argc, char *argv[], char *en if (signal_test != SIGPIPE) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + erreur = d_es_signal; if ((*s_etat_processus).langue == 'F') @@ -648,6 +998,27 @@ rplinit(int argc, char *argv[], char *en if (sigaction(SIGUSR1, &action, NULL) != 0) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + erreur = d_es_signal; if ((*s_etat_processus).langue == 'F') @@ -676,6 +1047,27 @@ rplinit(int argc, char *argv[], char *en if (signal_test != SIGUSR1) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + erreur = d_es_signal; if ((*s_etat_processus).langue == 'F') @@ -760,6 +1152,28 @@ rplinit(int argc, char *argv[], char *en { if (option_a == d_vrai) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : option -a présente " @@ -782,6 +1196,28 @@ rplinit(int argc, char *argv[], char *en { if (option_A == d_vrai) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : option -A présente " @@ -806,6 +1242,33 @@ rplinit(int argc, char *argv[], char *en if ((arguments = malloc((strlen(argv[0]) + 7) * 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) + .semphore_fork, getpid(), + pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Système : Mémoire " @@ -842,6 +1305,33 @@ rplinit(int argc, char *argv[], char *en if ((arguments = malloc((strlen(argv[0]) + 7) * 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) + .semphore_fork, getpid(), + pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Système : Mémoire " @@ -873,6 +1363,28 @@ 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : Aucune donnée " @@ -894,6 +1406,28 @@ rplinit(int argc, char *argv[], char *en { if (option_c == d_vrai) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : option -c présente " @@ -917,6 +1451,28 @@ rplinit(int argc, char *argv[], char *en { if (option_d == d_vrai) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : option -d présente " @@ -940,6 +1496,28 @@ rplinit(int argc, char *argv[], char *en { if (option_D == d_vrai) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : option -D présente " @@ -962,6 +1540,28 @@ rplinit(int argc, char *argv[], char *en { if (option_h == d_vrai) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : option -h présente " @@ -985,6 +1585,28 @@ rplinit(int argc, char *argv[], char *en { if (option_i == d_vrai) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : option -i présente " @@ -1000,6 +1622,28 @@ rplinit(int argc, char *argv[], char *en } else if (option_S == d_vrai) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : options -i et -S " @@ -1015,6 +1659,28 @@ rplinit(int argc, char *argv[], char *en } else if (option_p == d_vrai) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : options -i et -p " @@ -1039,6 +1705,28 @@ rplinit(int argc, char *argv[], char *en { if (option_l == d_vrai) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : option -l présente " @@ -1071,6 +1759,28 @@ rplinit(int argc, char *argv[], char *en { if (option_n == d_vrai) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : option -n présente " @@ -1094,6 +1804,28 @@ rplinit(int argc, char *argv[], char *en { if (option_p == d_vrai) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : option -p présente " @@ -1109,6 +1841,28 @@ rplinit(int argc, char *argv[], char *en } else if (option_i == d_vrai) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : options -i et -p " @@ -1132,6 +1886,28 @@ rplinit(int argc, char *argv[], char *en { if (option_P > 2) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : option -P présente " @@ -1155,6 +1931,28 @@ rplinit(int argc, char *argv[], char *en { if (option_s == d_vrai) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : option -s présente " @@ -1178,6 +1976,28 @@ rplinit(int argc, char *argv[], char *en { if (option_S == d_vrai) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : option -S présente " @@ -1193,6 +2013,28 @@ rplinit(int argc, char *argv[], char *en } else if (option_i == d_vrai) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : options -i et -S " @@ -1218,6 +2060,33 @@ rplinit(int argc, char *argv[], char *en malloc((strlen(argv[0]) + 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) + .semphore_fork, getpid(), + pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Système : Mémoire " @@ -1252,6 +2121,33 @@ rplinit(int argc, char *argv[], char *en malloc((strlen(argv[0]) + 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) + .semphore_fork, getpid(), + pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Système : Mémoire " @@ -1280,6 +2176,28 @@ 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : Aucun script " @@ -1298,6 +2216,28 @@ rplinit(int argc, char *argv[], char *en compactage((*s_etat_processus) .definitions_chainees)) == 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).semphore_fork, + getpid(), pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Système : Mémoire " @@ -1323,6 +2263,28 @@ rplinit(int argc, char *argv[], char *en { if (option_t == d_vrai) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : option -t présente " @@ -1348,6 +2310,33 @@ rplinit(int argc, char *argv[], char *en if ((type_debug = malloc((strlen(argv[0]) + 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) + .semphore_fork, getpid(), + pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Système : Mémoire " @@ -1382,6 +2371,33 @@ rplinit(int argc, char *argv[], char *en malloc((strlen(argv[0]) + 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) + .semphore_fork, getpid(), + pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Système : Mémoire " @@ -1409,6 +2425,28 @@ 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : Aucun niveau " @@ -1452,6 +2490,40 @@ rplinit(int argc, char *argv[], char *en default: { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : Niveau " @@ -1475,6 +2547,28 @@ rplinit(int argc, char *argv[], char *en if (sscanf(type_debug, "%llX", &((*s_etat_processus).type_debug)) != 1) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : Niveau " @@ -1497,6 +2591,28 @@ rplinit(int argc, char *argv[], char *en { if (option_v == d_vrai) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : option -v présente " @@ -1601,10 +2717,31 @@ rplinit(int argc, char *argv[], char *en if (debug == d_faux) { - # ifdef HAVE_SIGSEGV_RECOVERY if (sigsegv_install_handler(interruption_violation_access) != 0) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + erreur = d_es_signal; if ((*s_etat_processus).langue == 'F') @@ -1626,6 +2763,28 @@ rplinit(int argc, char *argv[], char *en if (sigaction(SIGSEGV, &action, NULL) != 0) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Système : Initialisation des signaux POSIX " @@ -1653,6 +2812,28 @@ rplinit(int argc, char *argv[], char *en if (signal_test != SIGSEGV) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + erreur = d_es_signal; if ((*s_etat_processus).langue == 'F') @@ -1675,6 +2856,35 @@ rplinit(int argc, char *argv[], char *en if (sigaction(SIGBUS, &action, NULL) != 0) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Système : Initialisation des signaux POSIX " @@ -1702,6 +2912,35 @@ rplinit(int argc, char *argv[], char *en if (signal_test != SIGBUS) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + erreur = d_es_signal; if ((*s_etat_processus).langue == 'F') @@ -1727,6 +2966,35 @@ rplinit(int argc, char *argv[], char *en if (sigaction(SIGHUP, &action, NULL) != 0) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Système : Initialisation des signaux POSIX " @@ -1769,6 +3037,35 @@ rplinit(int argc, char *argv[], char *en creation_nom_fichier(s_etat_processus, (*s_etat_processus) .chemin_fichiers_temporaires)) == 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).semphore_fork, + getpid(), pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Système : Fichier indisponible\n"); @@ -1784,6 +3081,35 @@ rplinit(int argc, char *argv[], char *en if ((f_source = fopen(nom_fichier_temporaire, "w")) == 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).semphore_fork, + getpid(), pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Système : Fichier introuvable\n"); @@ -1798,6 +3124,35 @@ rplinit(int argc, char *argv[], char *en if (fprintf(f_source, "MODE_INTERACTIF\n") < 0) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Système : Erreur d'écriture dans un fichier\n"); @@ -1813,6 +3168,35 @@ rplinit(int argc, char *argv[], char *en if (fprintf(f_source, "<< DO HALT UNTIL FALSE END >>\n") < 0) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Système : Erreur d'écriture dans un fichier\n"); @@ -1827,6 +3211,35 @@ rplinit(int argc, char *argv[], char *en if (fclose(f_source) != 0) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Système : Fichier indisponible\n"); @@ -1864,6 +3277,34 @@ rplinit(int argc, char *argv[], char *en if (((existence == d_faux) || (erreur_fichier != d_absence_erreur)) && (option_S == d_faux)) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + if (presence_definition == 'O') { if ((*s_etat_processus).langue == 'F') @@ -1896,6 +3337,34 @@ rplinit(int argc, char *argv[], char *en if ((*s_etat_processus).chemin_fichiers_temporaires == 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).semphore_fork, + getpid(), pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Système : Chemin des fichiers temporaires nul\n"); @@ -1967,10 +3436,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; @@ -2127,6 +3603,34 @@ rplinit(int argc, char *argv[], char *en if ((*s_etat_processus).erreur_systeme != d_es) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Système : Mémoire insuffisante\n"); @@ -2142,6 +3646,34 @@ rplinit(int argc, char *argv[], char *en if (((*s_etat_processus).instruction_derniere_erreur = malloc(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).semphore_fork, + getpid(), pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + erreur = d_es_allocation_memoire; if ((*s_etat_processus).langue == 'F') @@ -2171,6 +3703,34 @@ rplinit(int argc, char *argv[], char *en if (((*s_etat_processus).instruction_courante = (unsigned char *) malloc(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).semphore_fork, + getpid(), pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + erreur = d_es_allocation_memoire; if ((*s_etat_processus).langue == 'F') @@ -2233,6 +3793,34 @@ rplinit(int argc, char *argv[], char *en ((*((*s_etat_processus). parametres_courbes_de_niveau)).objet == 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).semphore_fork, + getpid(), pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + erreur = d_es_allocation_memoire; if ((*s_etat_processus).langue == 'F') @@ -2257,6 +3845,34 @@ rplinit(int argc, char *argv[], char *en (*((*s_etat_processus).depend)).objet)).nom == 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).semphore_fork, + getpid(), pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + erreur = d_es_allocation_memoire; if ((*s_etat_processus).langue == 'F') @@ -2309,6 +3925,34 @@ rplinit(int argc, char *argv[], char *en .parametres_courbes_de_niveau)).objet)).donnee == 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).semphore_fork, + getpid(), pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + erreur = d_es_allocation_memoire; if ((*s_etat_processus).langue == 'F') @@ -2337,6 +3981,34 @@ rplinit(int argc, char *argv[], char *en .objet = malloc(10 * 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).semphore_fork, + getpid(), pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + erreur = d_es_allocation_memoire; if ((*s_etat_processus).langue == 'F') @@ -2397,20 +4069,6 @@ rplinit(int argc, char *argv[], char *en (*s_etat_processus).my2_lines = d_faux; (*s_etat_processus).mz2_lines = d_faux; - if ((*s_etat_processus).erreur_systeme != d_es) - { - if ((*s_etat_processus).langue == 'F') - { - printf("+++Système : Mémoire insuffisante\n"); - } - else - { - printf("+++System : Not enough memory\n"); - } - - return(EXIT_FAILURE); - } - (*s_etat_processus).mode_evaluation_expression = 'N'; (*s_etat_processus).mode_execution_programme = 'Y'; @@ -2419,6 +4077,35 @@ rplinit(int argc, char *argv[], char *en if ((erreur = chainage(s_etat_processus)) != d_absence_erreur) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Fatal :" @@ -2450,6 +4137,34 @@ rplinit(int argc, char *argv[], char *en if ((erreur = compilation(s_etat_processus)) != d_absence_erreur) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + if (traitement_fichier_temporaire == 'Y') { if (destruction_fichier(nom_fichier_temporaire) @@ -2509,6 +4224,34 @@ rplinit(int argc, char *argv[], char *en if ((*s_etat_processus).s_arbre_variables == 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).semphore_fork, + getpid(), pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Fatal : Aucun point d'entrée\n"); @@ -2529,6 +4272,34 @@ rplinit(int argc, char *argv[], char *en if (recherche_instruction_suivante(s_etat_processus) == d_erreur) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Fatal : Aucun point d'entrée\n"); @@ -2550,6 +4321,34 @@ rplinit(int argc, char *argv[], char *en (*s_etat_processus) .instruction_courante) == d_faux) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Fatal : Aucun point d'entrée\n"); @@ -2570,6 +4369,34 @@ rplinit(int argc, char *argv[], char *en if ((*(*s_etat_processus).pointeur_variable_courante) .niveau != 0) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Fatal : Aucun point d'entrée\n"); @@ -2595,6 +4422,34 @@ rplinit(int argc, char *argv[], char *en strlen(ds_fichier_historique) + 2) * 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).semphore_fork, + getpid(), pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + erreur = d_es_allocation_memoire; if ((*s_etat_processus).langue == 'F') @@ -2634,6 +4489,40 @@ rplinit(int argc, char *argv[], char *en if ((message = messages(s_etat_processus)) == 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) + .semphore_fork, + getpid(), pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + erreur = d_es_allocation_memoire; if ((*s_etat_processus).langue == 'F') @@ -2670,6 +4559,40 @@ rplinit(int argc, char *argv[], char *en { if ((*s_etat_processus).erreur_systeme != d_es) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + erreur = d_es_allocation_memoire; if ((*s_etat_processus).langue == 'F') @@ -2687,6 +4610,40 @@ 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + if ((*s_etat_processus).langue == 'F') { printf("+++Erreur : Erreur de " @@ -2710,6 +4667,35 @@ rplinit(int argc, char *argv[], char *en if ((*s_etat_processus).erreur_systeme != d_es) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + if ((message = messages(s_etat_processus)) == NULL) { @@ -2740,6 +4726,40 @@ rplinit(int argc, char *argv[], char *en if ((message = messages(s_etat_processus)) == 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) + .semphore_fork, + getpid(), pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + erreur = d_es_allocation_memoire; if ((*s_etat_processus).langue == 'F') @@ -2759,6 +4779,35 @@ rplinit(int argc, char *argv[], char *en printf("%s [%d]\n", message, (int) getpid()); free(message); +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + return(EXIT_FAILURE); } @@ -2769,6 +4818,41 @@ rplinit(int argc, char *argv[], char *en if ((message = messages(s_etat_processus)) == 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) + .semphore_fork, + getpid(), pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + + erreur = d_es_allocation_memoire; erreur = d_es_allocation_memoire; if ((*s_etat_processus).langue == 'F') @@ -2788,6 +4872,35 @@ rplinit(int argc, char *argv[], char *en printf("%s [%d]\n", message, (int) getpid()); free(message); +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + return(EXIT_FAILURE); } @@ -2799,6 +4912,45 @@ rplinit(int argc, char *argv[], char *en if ((message = messages(s_etat_processus)) == 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) + .semphore_fork, getpid(), + pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + erreur = d_es_allocation_memoire; if ((*s_etat_processus).langue == 'F') @@ -2819,6 +4971,41 @@ rplinit(int argc, char *argv[], char *en (int) getpid()); free(message); +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + + erreur = d_es_allocation_memoire; return(EXIT_FAILURE); } @@ -2828,6 +5015,45 @@ rplinit(int argc, char *argv[], char *en if ((message = messages(s_etat_processus)) == 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) + .semphore_fork, getpid(), + pthread_self(), SEM_FORK); +# endif + + liberation_contexte_cas(s_etat_processus); + liberation_queue_signaux(s_etat_processus); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + erreur = d_es_allocation_memoire; if ((*s_etat_processus).langue == 'F') @@ -2848,6 +5074,40 @@ rplinit(int argc, char *argv[], char *en (int) getpid()); free(message); +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + return(EXIT_FAILURE); } } @@ -3146,6 +5406,45 @@ rplinit(int argc, char *argv[], char *en if (sigaction(SIGPIPE, &action, ®istre) != 0) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + pthread_mutex_unlock( &((*s_etat_processus).mutex)); return(EXIT_FAILURE); @@ -3170,6 +5469,45 @@ rplinit(int argc, char *argv[], char *en if (sigaction(SIGPIPE, ®istre, NULL) != 0) { +# 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); + +# ifdef HAVE_STACK_OVERFLOW_RECOVERY + stackoverflow_deinstall_handler(); +# endif + +# ifdef HAVE_SIGSEGV_RECOVERY + if (debug == d_faux) + { + sigsegv_deinstall_handler(); + } +# endif + pthread_mutex_unlock( &((*s_etat_processus).mutex)); return(EXIT_FAILURE); @@ -3341,23 +5679,33 @@ 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); - 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_statique_courant = (*s_etat_processus) + .l_liste_variables_statiques; + + while(l_element_statique_courant != NULL) + { + l_element_statique_suivant = + (*l_element_statique_courant).suivant; + free(l_element_statique_courant); + l_element_statique_courant = l_element_statique_suivant; } - free((struct_variable_partagee *) - (*((*s_etat_processus).s_liste_variables_partagees)) - .table); + l_element_partage_courant = (*(*s_etat_processus) + .l_liste_variables_partagees); + + 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é @@ -3676,11 +6024,7 @@ rplinit(int argc, char *argv[], char *en if (traitement_fichier_temporaire == 'Y') { - if (destruction_fichier(nom_fichier_temporaire) == d_erreur) - { - return(EXIT_FAILURE); - } - + destruction_fichier(nom_fichier_temporaire); free(nom_fichier_temporaire); } @@ -3694,14 +6038,13 @@ 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_allocation)); pthread_mutex_destroy(&mutex_sections_critiques); + pthread_mutex_destroy(&mutex_liste_variables_partagees); # ifndef SEMAPHORES_NOMMES sem_post(&((*s_etat_processus).semaphore_fork)); @@ -3735,6 +6078,7 @@ rplinit(int argc, char *argv[], char *en } free(arg_exec); + arret_thread_signaux(s_etat_processus); free(s_etat_processus); # ifdef DEBUG_MEMOIRE @@ -3775,7 +6119,7 @@ informations(struct_processus *s_etat_pr printf(" -l : licence d'utilisation\n"); printf(" -n : ignorance du signal HUP\n"); printf(" -p : précompilation du script avant exécution\n"); - printf(" -P : profilage\n"); + printf(" -P : profilage (-P ou -PP)\n"); printf(" -s : empêchement de l'ouverture de l'écran initial\n"); printf(" -S : exécution du script passé en ligne de commande\n"); printf(" -t : trace\n"); @@ -3796,7 +6140,7 @@ informations(struct_processus *s_etat_pr printf(" -l : prints the user licence of the software\n"); printf(" -n : ignores HUP signal\n"); printf(" -p : precompiles script\n"); - printf(" -P : computes profile data\n"); + printf(" -P : computes profile data (-P or -PP)\n"); printf(" -s : disables splash screen\n"); printf(" -S : executes script written in command line\n"); printf(" -t : enables tracing mode\n");