--- rpl/src/interruptions.c 2010/08/18 12:56:55 1.32 +++ rpl/src/interruptions.c 2011/09/03 10:31:50 1.63 @@ -1,7 +1,7 @@ /* ================================================================================ - RPL/2 (R) version 4.0.18 - Copyright (C) 1989-2010 Dr. BERTRAND Joël + RPL/2 (R) version 4.1.3 + Copyright (C) 1989-2011 Dr. BERTRAND Joël This file is part of RPL/2. @@ -183,9 +183,9 @@ insertion_thread_surveillance(struct_pro } } - pthread_mutex_lock(&((*s_argument_thread).mutex)); + pthread_mutex_lock(&((*s_argument_thread).mutex_nombre_references)); (*s_argument_thread).nombre_references++; - pthread_mutex_unlock(&((*s_argument_thread).mutex)); + pthread_mutex_unlock(&((*s_argument_thread).mutex_nombre_references)); (*l_nouvel_objet).suivant = liste_threads_surveillance; (*l_nouvel_objet).donnee = (void *) s_argument_thread; @@ -378,7 +378,8 @@ retrait_thread_surveillance(struct_proce (*l_element_precedent).suivant = (*l_element_courant).suivant; } - if (pthread_mutex_lock(&((*s_argument_thread).mutex)) != 0) + if (pthread_mutex_lock(&((*s_argument_thread).mutex_nombre_references)) + != 0) { # ifndef SEMAPHORES_NOMMES sem_post(&semaphore_liste_threads); @@ -400,7 +401,8 @@ retrait_thread_surveillance(struct_proce if ((*s_argument_thread).nombre_references == 0) { - if (pthread_mutex_unlock(&((*s_argument_thread).mutex)) != 0) + if (pthread_mutex_unlock(&((*s_argument_thread) + .mutex_nombre_references)) != 0) { # ifndef SEMAPHORES_NOMMES sem_post(&semaphore_liste_threads); @@ -415,11 +417,13 @@ retrait_thread_surveillance(struct_proce } pthread_mutex_destroy(&((*s_argument_thread).mutex)); + pthread_mutex_destroy(&((*s_argument_thread).mutex_nombre_references)); free(s_argument_thread); } else { - if (pthread_mutex_unlock(&((*s_argument_thread).mutex)) != 0) + if (pthread_mutex_unlock(&((*s_argument_thread) + .mutex_nombre_references)) != 0) { # ifndef SEMAPHORES_NOMMES sem_post(&semaphore_liste_threads); @@ -676,7 +680,8 @@ liberation_threads(struct_processus *s_e s_argument_thread = (struct_descripteur_thread *) (*((struct_liste_chainee *) element_courant)).donnee; - if (pthread_mutex_lock(&((*s_argument_thread).mutex)) != 0) + if (pthread_mutex_lock(&((*s_argument_thread) + .mutex_nombre_references)) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; sem_post(&semaphore_liste_threads); @@ -700,8 +705,8 @@ liberation_threads(struct_processus *s_e close((*s_argument_thread) .pipe_nombre_interruptions_attente[0]); - if (pthread_mutex_unlock(&((*s_argument_thread).mutex)) - != 0) + if (pthread_mutex_unlock(&((*s_argument_thread) + .mutex_nombre_references)) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; sem_post(&semaphore_liste_threads); @@ -709,6 +714,8 @@ liberation_threads(struct_processus *s_e } pthread_mutex_destroy(&((*s_argument_thread).mutex)); + pthread_mutex_destroy(&((*s_argument_thread) + .mutex_nombre_references)); if ((*s_argument_thread).processus_detache == d_faux) { @@ -723,8 +730,8 @@ liberation_threads(struct_processus *s_e } else { - if (pthread_mutex_unlock(&((*s_argument_thread).mutex)) - != 0) + if (pthread_mutex_unlock(&((*s_argument_thread) + .mutex_nombre_references)) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; sem_post(&semaphore_liste_threads); @@ -796,25 +803,8 @@ liberation_threads(struct_processus *s_e } } - for(i = 0; i < (*s_etat_processus).nombre_variables; i++) - { - pthread_mutex_trylock(&((*(*s_etat_processus) - .s_liste_variables[i].objet).mutex)); - pthread_mutex_unlock(&((*(*s_etat_processus) - .s_liste_variables[i].objet).mutex)); - - // Les variables de niveau 0 sont des définitions qui - // ne sont pas copiées entre threads. - if ((*s_etat_processus).s_liste_variables[i].niveau > 0) - { - liberation(s_etat_processus, - (*s_etat_processus).s_liste_variables[i].objet); - } - - free((*s_etat_processus).s_liste_variables[i].nom); - } - - free((*s_etat_processus).s_liste_variables); + liberation_arbre_variables(s_etat_processus, + (*s_etat_processus).s_arbre_variables, d_faux); for(i = 0; i < (*s_etat_processus).nombre_variables_statiques; i++) { @@ -1328,6 +1318,7 @@ liberation_threads(struct_processus *s_e sem_destroy2((*s_etat_processus).semaphore_fork, sem_fork); # endif + liberation_contexte_cas(s_etat_processus); free(s_etat_processus); s_etat_processus = candidat; @@ -1350,7 +1341,8 @@ liberation_threads(struct_processus *s_e s_argument_thread = (struct_descripteur_thread *) (*l_element_courant).donnee; - if (pthread_mutex_lock(&((*s_argument_thread).mutex)) != 0) + if (pthread_mutex_lock(&((*s_argument_thread).mutex_nombre_references)) + != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; sem_post(&semaphore_liste_threads); @@ -1373,7 +1365,8 @@ liberation_threads(struct_processus *s_e close((*s_argument_thread).pipe_interruptions[0]); close((*s_argument_thread).pipe_nombre_interruptions_attente[0]); - if (pthread_mutex_unlock(&((*s_argument_thread).mutex)) != 0) + if (pthread_mutex_unlock(&((*s_argument_thread) + .mutex_nombre_references)) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; sem_post(&semaphore_liste_threads); @@ -1381,6 +1374,8 @@ liberation_threads(struct_processus *s_e } pthread_mutex_destroy(&((*s_argument_thread).mutex)); + pthread_mutex_destroy(&((*s_argument_thread) + .mutex_nombre_references)); if ((*s_argument_thread).processus_detache == d_faux) { @@ -1394,7 +1389,8 @@ liberation_threads(struct_processus *s_e } else { - if (pthread_mutex_unlock(&((*s_argument_thread).mutex)) != 0) + if (pthread_mutex_unlock(&((*s_argument_thread) + .mutex_nombre_references)) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; sem_post(&semaphore_liste_threads); @@ -1592,12 +1588,12 @@ verrouillage_gestionnaire_signaux() // ce que ce soit possible. # ifndef SEMAPHORES_NOMMES - while(sem_trywait(&semaphore_liste_threads) == -1) + while(sem_wait(&semaphore_liste_threads) == -1) # else - while(sem_trywait(semaphore_liste_threads) == -1) + while(sem_wait(semaphore_liste_threads) == -1) # endif { - if ((errno != EINTR) && (errno != EAGAIN)) + if (errno != EINTR) { pthread_sigmask(SIG_SETMASK, &oldset, NULL); @@ -1613,8 +1609,6 @@ verrouillage_gestionnaire_signaux() BUG(1, uprintf("Lock error !\n")); return; } - - sched_yield(); } } @@ -1724,434 +1718,6 @@ deverrouillage_gestionnaire_signaux() return; } -#ifdef _BROKEN_SIGINFO - -static int *fifos; -static int segment; -static int segment_mutexes; -static int longueur_queue; -static int nombre_queues; - -static pthread_mutex_t *mutexes; - -static unsigned char *chemin = NULL; - -unsigned char * -nom_segment(unsigned char *chemin, pid_t pid) -{ - unsigned char *fichier; - - if ((fichier = malloc((strlen(chemin) + 1 + 256 + 1) * - sizeof(unsigned char))) == NULL) - { - return(NULL); - } - - sprintf(fichier, "%s/RPL-SIGQUEUES-%d", chemin, (int) pid); - - return(fichier); -} - -unsigned char * -nom_segment_mutexes(unsigned char *chemin, pid_t pid) -{ - unsigned char *fichier; - - if ((fichier = malloc((strlen(chemin) + 1 + 256 + 1) * - sizeof(unsigned char))) == NULL) - { - return(NULL); - } - - sprintf(fichier, "%s/RPL-SIGMUTEXES-%d", chemin, (int) pid); - - return(fichier); -} - -int -queue_de_signal(int signal) -{ - switch(signal) - { - case SIGINT: - BUG(1, uprintf("SIGINT is not queued as it does not " - "come from program itself !\n")); - return(0); - case SIGTSTP: - return(1); - case SIGCONT: - return(2); - case SIGURG: - return(3); - case SIGPIPE: - return(4); - case SIGALRM: - return(5); - case SIGFSTOP: - return(6); - case SIGSTART: - return(7); - case SIGINJECT: - return(8); - case SIGABORT: - return(9); - case SIGFABORT: - return(10); - } - - return(-1); -} - -void -creation_fifos_signaux(struct_processus *s_etat_processus) -{ - file *desc; - - int i; - - key_t clef; - - pthread_mutexattr_t attributs_mutex; - - unsigned char *nom; - - /* - * Signaux utilisés - * SIGINT, SIGTSTP, SIGCONT, SIGURG, SIGPIPE, SIGALRM, SIGFSTOP, - * SIGSTART, SIGINJECT, SIGABORT, SIGFABORT - */ - - // Création d'un segment de données associé au PID du processus courant - - chemin = (*s_etat_processus).chemin_fichiers_temporaires; - - if ((nom = nom_segment((*s_etat_processus).chemin_fichiers_temporaires, - getpid())) == NULL) - { - (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; - return; - } - - /* - * Structure d'une queue - * 0 : pointeur en lecture sur le premier emplacement libre (int) - * 1 : pointeur en écriture sur le premier emplacement à lire (int) - * 2 : longueur de la queue (int) - * 3 : éléments restants (int) - * 4 à 4 + (2) : queue (int) - * 5 : mutex - */ - - nombre_queues = 11; - longueur_queue = 256; - - if ((desc = fopen(nom, "w")) == NULL) - { - (*s_etat_processus).erreur_systeme = d_es_erreur_fichier; - return; - } - - fclose(desc); - - if ((clef = ftok(nom, 1)) == -1) - { - (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; - return; - } - - free(nom); - - if ((segment = shmget(clef, - nombre_queues * (longueur_queue + 4) * sizeof(int), - IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR)) == -1) - { - (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; - return; - } - - fifos = shmat(segment, NULL, 0); - - if (((void *) fifos) == ((void *) -1)) - { - (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; - return; - } - - for(i = 0; i < nombre_queues; i++) - { - fifos[(i * (longueur_queue + 4))] = 0; - fifos[(i * (longueur_queue + 4)) + 1] = 0; - fifos[(i * (longueur_queue + 4)) + 2] = longueur_queue; - fifos[(i * (longueur_queue + 4)) + 3] = longueur_queue; - } - - if ((nom = nom_segment_mutexes((*s_etat_processus) - .chemin_fichiers_temporaires, getpid())) == NULL) - { - (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; - return; - } - - if ((desc = fopen(nom, "w")) == NULL) - { - (*s_etat_processus).erreur_systeme = d_es_erreur_fichier; - return; - } - - fclose(desc); - - if ((clef = ftok(nom, 1)) == -1) - { - (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; - return; - } - - free(nom); - - if ((segment_mutexes = shmget(clef, - nombre_queues * sizeof(pthread_mutex_t), - IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR)) == -1) - { - (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; - return; - } - - mutexes = shmat(segment_mutexes, NULL, 0); - - if (((void *) mutexes) == ((void *) -1)) - { - (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; - return; - } - - /* - * Création et initialisation d'un mutex par queue. Ce mutex n'est pas - * dans le premier segment parce qu'il peut y avoir des problèmes - * d'alignements sur certaines architectures. - */ - - pthread_mutexattr_init(&attributs_mutex); - pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_RECURSIVE); - - for(i = 0; i < nombre_queues; i++) - { - pthread_mutex_init(&(mutexes[i]), &attributs_mutex); - } - - pthread_mutexattr_destroy(&attributs_mutex); - return; -} - -void -liberation_fifos_signaux(struct_processus *s_etat_processus) -{ - if (shmdt(fifos) == -1) - { - (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; - return; - } - - if (shmdt(mutexes) == -1) - { - (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; - return; - } - - return; -} - -void -destruction_fifos_signaux(struct_processus *s_etat_processus) -{ - int i; - - unsigned char *nom; - - if (shmdt(fifos) == -1) - { - (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; - return; - } - - if (shmctl(segment, IPC_RMID, 0) == -1) - { - (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; - return; - } - - for(i = 0; i < nombre_queues; i++) - { - pthread_mutex_destroy(&(mutexes[i])); - } - - if (shmdt(mutexes) == -1) - { - (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; - return; - } - - if (shmctl(segment_mutexes, IPC_RMID, 0) == -1) - { - (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; - return; - } - - if ((nom = nom_segment_mutexes((*s_etat_processus) - .chemin_fichiers_temporaires, getpid())) == NULL) - { - (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; - return; - } - - unlink(nom); - free(nom); - - if ((nom = nom_segment((*s_etat_processus).chemin_fichiers_temporaires, - getpid())) == NULL) - { - (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; - return; - } - - unlink(nom); - free(nom); - - return; -} - -int -queue_in(pid_t pid, int signal) -{ - int *base; - int *buffer; - int *projection_fifos; - int queue; - int identifiant; - - key_t clef; - - pthread_mutex_t *projection_mutexes; - - unsigned char *nom; - - queue = queue_de_signal(signal); - - // Ouverture des projections - - if ((nom = nom_segment(chemin, pid)) == NULL) - { - return(-1); - } - - if ((clef = ftok(nom, 1)) == -1) - { - free(nom); - return(-1); - } - - free(nom); - - while((identifiant = shmget(clef, - nombre_queues * (longueur_queue + 4) * sizeof(int), - S_IRUSR | S_IWUSR)) == -1); - - projection_fifos = shmat(identifiant, NULL, 0); - - if ((nom = nom_segment_mutexes(chemin, pid)) == NULL) - { - return(-1); - } - - if ((clef = ftok(nom, 1)) == -1) - { - free(nom); - return(-1); - } - - free(nom); - - while((identifiant = shmget(clef, - nombre_queues * sizeof(pthread_mutex_t), - S_IRUSR | S_IWUSR)) == -1); - - projection_mutexes = shmat(identifiant, NULL, 0); - - if (pthread_mutex_lock(&(projection_mutexes[queue])) != 0) - { - return(-1); - } - - base = &(projection_fifos[(longueur_queue + 4) * queue]); - buffer = &(base[4]); - - // base[1] contient le prochain élément à écrire - buffer[base[1]++] = (int) pid; - base[1] %= base[2]; - - // base[3] contient le nombre d'éléments non lus - if (base[3] <= 0) - { - pthread_mutex_unlock(&(projection_mutexes[queue])); - shmdt(projection_mutexes); - shmdt(projection_fifos); - return(-1); - } - - base[3]--; - - if (pthread_mutex_unlock(&(projection_mutexes[queue])) != 0) - { - shmdt(projection_mutexes); - shmdt(projection_fifos); - return(-1); - } - - // Fermeture des projections - shmdt(projection_mutexes); - shmdt(projection_fifos); - return(0); -} - -pid_t -origine_signal(int signal) -{ - int *base; - int *buffer; - int pid; - int queue; - - queue = queue_de_signal(signal); - - BUG(queue == -1, uprintf("[%d] Unknown signal %d in this context\n", - (int) getpid(), signal)); - - if (pthread_mutex_lock(&(mutexes[queue])) != 0) - { - return(-1); - } - - base = &(fifos[(longueur_queue + 4) * queue]); - buffer = &(base[4]); - pid = buffer[base[0]++]; - base[0] %= base[2]; - base[3]++; - - if (base[3] > base[2]) - { - pthread_mutex_unlock(&(mutexes[queue])); - return(-1); - } - if (pthread_mutex_unlock(&(mutexes[queue])) != 0) - { - perror("unlock"); - return(-1); - } - - return((pid_t) pid); -} - -#endif - void interruption1(SIGHANDLER_ARGS) { @@ -2166,7 +1732,7 @@ interruption1(SIGHANDLER_ARGS) verrouillage_gestionnaire_signaux(); # ifdef _BROKEN_SIGINFO - if (signal == SIGINT) + if ((signal == SIGINT) || (signal == SIGTERM)) { // Si l'interruption provient du clavier, il n'y a pas eu d'appel // à queue_in(). @@ -2178,7 +1744,14 @@ interruption1(SIGHANDLER_ARGS) pid = origine_signal(signal); } # else - pid = (*siginfo).si_pid; + if (siginfo != NULL) + { + pid = (*siginfo).si_pid; + } + else + { + pid = getpid(); + } # endif switch(signal) @@ -2223,6 +1796,7 @@ interruption1(SIGHANDLER_ARGS) } case SIGINT : + case SIGTERM : { /* * Une vieille spécification POSIX permet au pointeur siginfo @@ -2248,8 +1822,17 @@ interruption1(SIGHANDLER_ARGS) if (((*s_etat_processus).type_debug & d_debug_signaux) != 0) { - printf("[%d] SIGINT (thread %llu)\n", (int) getpid(), - (unsigned long long) pthread_self()); + if (signal == SIGINT) + { + printf("[%d] SIGINT (thread %llu)\n", (int) getpid(), + (unsigned long long) pthread_self()); + } + else + { + printf("[%d] SIGTERM (thread %llu)\n", (int) getpid(), + (unsigned long long) pthread_self()); + } + fflush(stdout); } @@ -2271,16 +1854,19 @@ interruption1(SIGHANDLER_ARGS) return; } - if (strncmp(getenv("LANG"), "fr", 2) == 0) + if (signal == SIGINT) { - printf("+++Interruption\n"); - } - else - { - printf("+++Interrupt\n"); - } + if (strncmp(getenv("LANG"), "fr", 2) == 0) + { + printf("+++Interruption\n"); + } + else + { + printf("+++Interrupt\n"); + } - fflush(stdout); + fflush(stdout); + } (*s_etat_processus).var_volatile_requete_arret = -1; (*s_etat_processus).var_volatile_alarme = -1; @@ -2325,7 +1911,14 @@ interruption2(SIGHANDLER_ARGS) # ifdef _BROKEN_SIGINFO pid = origine_signal(signal); # else - pid = (*siginfo).si_pid; + if (siginfo != NULL) + { + pid = (*siginfo).si_pid; + } + else + { + pid = getpid(); + } # endif # ifndef _BROKEN_SIGINFO @@ -2398,20 +1991,12 @@ interruption2(SIGHANDLER_ARGS) void interruption3(SIGHANDLER_ARGS) { - pid_t pid; + pthread_t thread; struct_processus *s_etat_processus; - static int compteur = 0; - verrouillage_gestionnaire_signaux(); -# ifdef _BROKEN_SIGINFO - pid = origine_signal(signal); -# else - pid = (*siginfo).si_pid; -# endif - if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) { deverrouillage_gestionnaire_signaux(); @@ -2436,24 +2021,76 @@ interruption3(SIGHANDLER_ARGS) // Segfault dans une routine interne if (strncmp(getenv("LANG"), "fr", 2) == 0) { - printf("+++Système : Violation d'accès (dépassement de pile)\n"); + printf("+++Système : Violation d'accès\n"); } else { - printf("+++System : Access violation (stack overflow)\n"); + printf("+++System : Access violation\n"); } fflush(stdout); - compteur++; + (*s_etat_processus).compteur_violation_d_acces++; - if (compteur > 1) + if ((*s_etat_processus).compteur_violation_d_acces > 1) { + // On vient de récupérer plus d'une erreur de segmentation + // dans le même processus ou le même thread. L'erreur n'est pas + // récupérable et on sort autoritairement du programme. Il peut + // rester des processus orphelins en attente ! + + if (strncmp(getenv("LANG"), "fr", 2) == 0) + { + printf("+++Système : Violation d'accès\n"); + } + else + { + printf("+++System : Access violation\n"); + } + + fflush(stdout); + deverrouillage_gestionnaire_signaux(); exit(EXIT_FAILURE); } else { + // Première erreur de segmentation. On essaie de terminer + // proprement le thread ou le processus. Le signal ne peut être + // envoyé que depuis le même processus. + + if (recherche_thread_principal(getpid(), &thread) == d_vrai) + { + if (pthread_equal(thread, pthread_self()) != 0) + { + deverrouillage_gestionnaire_signaux(); + + if ((*s_etat_processus).pid_processus_pere != getpid()) + { + // On est dans le thread principal d'un processus. + + longjmp(contexte_processus, -1); + } + else + { + // On est dans le thread principal du processus + // père. + + longjmp(contexte_initial, -1); + } + } + else + { + // On est dans un thread fils d'un thread principal. + + deverrouillage_gestionnaire_signaux(); + longjmp(contexte_thread, -1); + } + } + + // Là, on ramasse les miettes puisque le thread n'existe plus + // dans la base (corruption de la mémoire). + deverrouillage_gestionnaire_signaux(); longjmp(contexte_initial, -1); } @@ -2466,18 +2103,10 @@ interruption3(SIGHANDLER_ARGS) void interruption4(SIGHANDLER_ARGS) { - pid_t pid; - struct_processus *s_etat_processus; verrouillage_gestionnaire_signaux(); -# ifdef _BROKEN_SIGINFO - pid = origine_signal(signal); -# else - pid = (*siginfo).si_pid; -# endif - if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) { deverrouillage_gestionnaire_signaux(); @@ -2574,18 +2203,10 @@ interruption5(SIGHANDLER_ARGS) void interruption6(SIGHANDLER_ARGS) { - pid_t pid; - struct_processus *s_etat_processus; verrouillage_gestionnaire_signaux(); -# ifdef _BROKEN_SIGINFO - pid = origine_signal(signal); -# else - pid = (*siginfo).si_pid; -# endif - if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) { deverrouillage_gestionnaire_signaux(); @@ -2606,18 +2227,10 @@ interruption6(SIGHANDLER_ARGS) void interruption7(SIGHANDLER_ARGS) { - pid_t pid; - struct_processus *s_etat_processus; verrouillage_gestionnaire_signaux(); -# ifdef _BROKEN_SIGINFO - pid = origine_signal(signal); -# else - pid = (*siginfo).si_pid; -# endif - if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) { deverrouillage_gestionnaire_signaux(); @@ -2693,18 +2306,10 @@ interruption8(SIGHANDLER_ARGS) void interruption9(SIGHANDLER_ARGS) { - pid_t pid; - struct_processus *s_etat_processus; verrouillage_gestionnaire_signaux(); -# ifdef _BROKEN_SIGINFO - pid = origine_signal(signal); -# else - pid = (*siginfo).si_pid; -# endif - if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) { deverrouillage_gestionnaire_signaux(); @@ -2738,20 +2343,12 @@ interruption10(SIGHANDLER_ARGS) { file *fichier; - pid_t pid; - struct_processus *s_etat_processus; unsigned char nom[8 + 64 + 1]; verrouillage_gestionnaire_signaux(); -# ifdef _BROKEN_SIGINFO - pid = origine_signal(signal); -# else - pid = (*siginfo).si_pid; -# endif - if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) { deverrouillage_gestionnaire_signaux(); @@ -2877,45 +2474,4 @@ traitement_exceptions_gsl(const char *re return; } -#ifdef _BROKEN_SIGINFO - -#undef kill -#undef pthread_kill - -int -rpl_kill(pid_t pid, int signal) -{ - /* - * Lorsqu'on veut interrompre le processus pid, on ouvre le segment - * correspondant au processus en question et ou ajoute le pid dans la - * queue. - */ - - if ((signal != 0) && (signal != SIGINT)) - { - if (queue_in(pid, signal) != 0) - { - return(-1); - } - } - - return(kill(pid, signal)); -} - -int -rpl_pthread_kill(pthread_t tid, int signal) -{ - if ((signal != 0) && (signal != SIGINT)) - { - if (queue_in(getpid(), signal) != 0) - { - return(-1); - } - } - - return(pthread_kill(tid, signal)); -} - -#endif - // vim: ts=4