--- rpl/src/rpl.c 2012/10/17 14:27:06 1.123 +++ rpl/src/rpl.c 2012/10/19 19:05:52 1.124 @@ -154,6 +154,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) @@ -187,16 +195,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 { @@ -208,16 +217,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 { @@ -265,6 +275,17 @@ 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 + + liberation(contexte_cas(s_etat_processus); + if ((*s_etat_processus).langue == 'F') { uprintf("+++Système : Mémoire insuffisante\n"); @@ -302,31 +323,75 @@ rplinit(int argc, char *argv[], char *en insertion_thread(s_etat_processus, d_vrai); creation_queue_signaux(s_etat_processus); + 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); + + 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 { - 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); + + if (((*s_etat_processus).localisation = malloc((strlen(d_locale) + + 1) * sizeof(unsigned char))) == NULL) { - if (((*s_etat_processus).localisation = malloc((strlen(d_locale) - + 1) * sizeof(unsigned char))) == NULL) + if ((*s_etat_processus).langue == 'F') { - if ((*s_etat_processus).langue == 'F') - { - uprintf("+++Système : Mémoire insuffisante\n"); - } - else - { - uprintf("+++System : Not enough memory\n"); - } - - return(EXIT_FAILURE); + uprintf("+++Système : Mémoire insuffisante\n"); + } + else + { + uprintf("+++System : Not enough memory\n"); } - strcpy((*s_etat_processus).localisation, d_locale); + return(EXIT_FAILURE); } + + strcpy((*s_etat_processus).localisation, d_locale); } (*s_etat_processus).erreur_systeme = d_es; @@ -336,6 +401,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"); @@ -389,6 +471,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') @@ -419,6 +518,27 @@ rplinit(int argc, char *argv[], char *en 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') @@ -439,6 +559,27 @@ rplinit(int argc, char *argv[], char *en 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') @@ -467,6 +608,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') @@ -484,6 +646,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') @@ -512,6 +695,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') @@ -529,6 +733,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') @@ -557,6 +782,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') @@ -577,6 +823,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 " @@ -603,6 +870,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') @@ -623,6 +911,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') @@ -651,6 +960,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') @@ -671,6 +1001,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') @@ -699,6 +1050,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') @@ -783,6 +1155,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 " @@ -805,6 +1199,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 " @@ -829,6 +1245,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 " @@ -865,6 +1308,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 " @@ -896,6 +1366,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 " @@ -917,6 +1409,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 " @@ -940,6 +1454,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 " @@ -963,6 +1499,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 " @@ -985,6 +1543,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 " @@ -1008,6 +1588,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 " @@ -1023,6 +1625,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 " @@ -1038,6 +1662,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 " @@ -1062,6 +1708,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 " @@ -1094,6 +1762,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 " @@ -1117,6 +1807,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 " @@ -1132,6 +1844,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 " @@ -1155,6 +1889,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 " @@ -1178,6 +1934,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 " @@ -1201,6 +1979,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 " @@ -1216,6 +2016,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 " @@ -1241,6 +2063,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 " @@ -1275,6 +2124,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 " @@ -1303,6 +2179,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 " @@ -1321,6 +2219,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 " @@ -1346,6 +2266,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 " @@ -1371,6 +2313,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 " @@ -1405,6 +2374,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 " @@ -1432,6 +2428,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 " @@ -1475,6 +2493,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 " @@ -1498,6 +2550,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 " @@ -1520,6 +2594,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 " @@ -1624,10 +2720,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') @@ -1649,6 +2766,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 " @@ -1676,6 +2815,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') @@ -1698,6 +2859,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 " @@ -1725,6 +2915,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') @@ -1750,6 +2969,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 " @@ -1792,6 +3040,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"); @@ -1807,6 +3084,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"); @@ -1821,6 +3127,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"); @@ -1836,6 +3171,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"); @@ -1850,6 +3214,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"); @@ -1887,6 +3280,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') @@ -1919,6 +3340,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"); @@ -2150,6 +3599,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"); @@ -2165,6 +3642,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') @@ -2194,6 +3699,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') @@ -2256,6 +3789,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') @@ -2280,6 +3841,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') @@ -2332,6 +3921,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') @@ -2360,6 +3977,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') @@ -2420,20 +4065,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'; @@ -2442,6 +4073,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 :" @@ -2473,6 +4133,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) @@ -2532,6 +4220,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"); @@ -2552,6 +4268,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"); @@ -2573,6 +4317,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"); @@ -2593,6 +4365,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"); @@ -2618,6 +4418,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') @@ -2657,6 +4485,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') @@ -2693,6 +4555,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') @@ -2710,6 +4606,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 " @@ -2733,6 +4663,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) { @@ -2763,6 +4722,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') @@ -2782,6 +4775,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); } @@ -2792,6 +4814,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') @@ -2811,6 +4868,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); } @@ -2822,6 +4908,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') @@ -2842,6 +4967,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); } @@ -2851,6 +5011,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') @@ -2871,6 +5070,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); } } @@ -3169,6 +5402,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); @@ -3193,6 +5465,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); @@ -3710,11 +6021,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); } @@ -3810,7 +6117,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"); @@ -3831,7 +6138,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");