version 1.20, 2010/06/04 07:48:20
|
version 1.64, 2011/09/04 07:46:08
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.16 |
RPL/2 (R) version 4.1.3 |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
Copyright (C) 1989-2011 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 20
|
Line 20
|
*/ |
*/ |
|
|
|
|
#include "rpl.conv.h" |
#include "rpl-conv.h" |
|
|
|
|
/* |
/* |
Line 125 insertion_thread(struct_processus *s_eta
|
Line 125 insertion_thread(struct_processus *s_eta
|
} |
} |
|
|
(*l_nouvel_objet).suivant = liste_threads; |
(*l_nouvel_objet).suivant = liste_threads; |
|
|
liste_threads = l_nouvel_objet; |
liste_threads = l_nouvel_objet; |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
Line 184 insertion_thread_surveillance(struct_pro
|
Line 183 insertion_thread_surveillance(struct_pro
|
} |
} |
} |
} |
|
|
printf("<1> +1 %d\n", (*s_argument_thread).nombre_references); |
pthread_mutex_lock(&((*s_argument_thread).mutex_nombre_references)); |
|
(*s_argument_thread).nombre_references++; |
|
pthread_mutex_unlock(&((*s_argument_thread).mutex_nombre_references)); |
|
|
(*l_nouvel_objet).suivant = liste_threads_surveillance; |
(*l_nouvel_objet).suivant = liste_threads_surveillance; |
(*l_nouvel_objet).donnee = (void *) s_argument_thread; |
(*l_nouvel_objet).donnee = (void *) s_argument_thread; |
|
|
Line 376 retrait_thread_surveillance(struct_proce
|
Line 378 retrait_thread_surveillance(struct_proce
|
(*l_element_precedent).suivant = (*l_element_courant).suivant; |
(*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 |
# ifndef SEMAPHORES_NOMMES |
sem_post(&semaphore_liste_threads); |
sem_post(&semaphore_liste_threads); |
Line 391 retrait_thread_surveillance(struct_proce
|
Line 394 retrait_thread_surveillance(struct_proce
|
} |
} |
|
|
(*s_argument_thread).nombre_references--; |
(*s_argument_thread).nombre_references--; |
printf("<3> -1 %d %p\n", (*s_argument_thread).nombre_references, s_argument_thread); |
|
|
|
BUG((*s_argument_thread).nombre_references < 0, |
BUG((*s_argument_thread).nombre_references < 0, |
printf("(*s_argument_thread).nombre_references = %d\n", |
printf("(*s_argument_thread).nombre_references = %d\n", |
(int) (*s_argument_thread).nombre_references)); |
(int) (*s_argument_thread).nombre_references)); |
|
|
printf("retrait_thread_surveillance : %d\n", (*s_argument_thread).nombre_references); |
|
if ((*s_argument_thread).nombre_references == 0) |
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 |
# ifndef SEMAPHORES_NOMMES |
sem_post(&semaphore_liste_threads); |
sem_post(&semaphore_liste_threads); |
Line 415 printf("retrait_thread_surveillance : %d
|
Line 417 printf("retrait_thread_surveillance : %d
|
} |
} |
|
|
pthread_mutex_destroy(&((*s_argument_thread).mutex)); |
pthread_mutex_destroy(&((*s_argument_thread).mutex)); |
|
pthread_mutex_destroy(&((*s_argument_thread).mutex_nombre_references)); |
free(s_argument_thread); |
free(s_argument_thread); |
} |
} |
else |
else |
{ |
{ |
if (pthread_mutex_unlock(&((*s_argument_thread).mutex)) != 0) |
if (pthread_mutex_unlock(&((*s_argument_thread) |
|
.mutex_nombre_references)) != 0) |
{ |
{ |
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
sem_post(&semaphore_liste_threads); |
sem_post(&semaphore_liste_threads); |
Line 676 liberation_threads(struct_processus *s_e
|
Line 680 liberation_threads(struct_processus *s_e
|
s_argument_thread = (struct_descripteur_thread *) |
s_argument_thread = (struct_descripteur_thread *) |
(*((struct_liste_chainee *) element_courant)).donnee; |
(*((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; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
sem_post(&semaphore_liste_threads); |
sem_post(&semaphore_liste_threads); |
Line 684 liberation_threads(struct_processus *s_e
|
Line 689 liberation_threads(struct_processus *s_e
|
} |
} |
|
|
(*s_argument_thread).nombre_references--; |
(*s_argument_thread).nombre_references--; |
printf("<1> -1 %d %p\n", (*s_argument_thread).nombre_references, s_argument_thread); |
|
|
|
BUG((*s_argument_thread).nombre_references < 0, |
BUG((*s_argument_thread).nombre_references < 0, |
printf("(*s_argument_thread).nombre_references = %d\n", |
printf("(*s_argument_thread).nombre_references = %d\n", |
Line 701 printf("<1> -1 %d %p\n", (*s_argument_th
|
Line 705 printf("<1> -1 %d %p\n", (*s_argument_th
|
close((*s_argument_thread) |
close((*s_argument_thread) |
.pipe_nombre_interruptions_attente[0]); |
.pipe_nombre_interruptions_attente[0]); |
|
|
if (pthread_mutex_unlock(&((*s_argument_thread).mutex)) |
if (pthread_mutex_unlock(&((*s_argument_thread) |
!= 0) |
.mutex_nombre_references)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
sem_post(&semaphore_liste_threads); |
sem_post(&semaphore_liste_threads); |
Line 710 printf("<1> -1 %d %p\n", (*s_argument_th
|
Line 714 printf("<1> -1 %d %p\n", (*s_argument_th
|
} |
} |
|
|
pthread_mutex_destroy(&((*s_argument_thread).mutex)); |
pthread_mutex_destroy(&((*s_argument_thread).mutex)); |
|
pthread_mutex_destroy(&((*s_argument_thread) |
|
.mutex_nombre_references)); |
|
|
if ((*s_argument_thread).processus_detache == d_faux) |
if ((*s_argument_thread).processus_detache == d_faux) |
{ |
{ |
Line 724 printf("<1> -1 %d %p\n", (*s_argument_th
|
Line 730 printf("<1> -1 %d %p\n", (*s_argument_th
|
} |
} |
else |
else |
{ |
{ |
if (pthread_mutex_unlock(&((*s_argument_thread).mutex)) |
if (pthread_mutex_unlock(&((*s_argument_thread) |
!= 0) |
.mutex_nombre_references)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
sem_post(&semaphore_liste_threads); |
sem_post(&semaphore_liste_threads); |
Line 797 printf("<1> -1 %d %p\n", (*s_argument_th
|
Line 803 printf("<1> -1 %d %p\n", (*s_argument_th
|
} |
} |
} |
} |
|
|
for(i = 0; i < (*s_etat_processus).nombre_variables; i++) |
liberation_arbre_variables(s_etat_processus, |
{ |
(*s_etat_processus).s_arbre_variables, d_faux); |
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); |
|
|
|
for(i = 0; i < (*s_etat_processus).nombre_variables_statiques; i++) |
for(i = 0; i < (*s_etat_processus).nombre_variables_statiques; i++) |
{ |
{ |
Line 1329 printf("<1> -1 %d %p\n", (*s_argument_th
|
Line 1318 printf("<1> -1 %d %p\n", (*s_argument_th
|
sem_destroy2((*s_etat_processus).semaphore_fork, sem_fork); |
sem_destroy2((*s_etat_processus).semaphore_fork, sem_fork); |
# endif |
# endif |
|
|
|
liberation_contexte_cas(s_etat_processus); |
free(s_etat_processus); |
free(s_etat_processus); |
|
|
s_etat_processus = candidat; |
s_etat_processus = candidat; |
Line 1351 printf("<1> -1 %d %p\n", (*s_argument_th
|
Line 1341 printf("<1> -1 %d %p\n", (*s_argument_th
|
s_argument_thread = (struct_descripteur_thread *) |
s_argument_thread = (struct_descripteur_thread *) |
(*l_element_courant).donnee; |
(*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; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
sem_post(&semaphore_liste_threads); |
sem_post(&semaphore_liste_threads); |
Line 1359 printf("<1> -1 %d %p\n", (*s_argument_th
|
Line 1350 printf("<1> -1 %d %p\n", (*s_argument_th
|
} |
} |
|
|
(*s_argument_thread).nombre_references--; |
(*s_argument_thread).nombre_references--; |
printf("<2> -1 %d %p\n", (*s_argument_thread).nombre_references, s_argument_thread); |
|
|
|
BUG((*s_argument_thread).nombre_references < 0, |
BUG((*s_argument_thread).nombre_references < 0, |
printf("(*s_argument_thread).nombre_references = %d\n", |
printf("(*s_argument_thread).nombre_references = %d\n", |
Line 1375 printf("<2> -1 %d %p\n", (*s_argument_th
|
Line 1365 printf("<2> -1 %d %p\n", (*s_argument_th
|
close((*s_argument_thread).pipe_interruptions[0]); |
close((*s_argument_thread).pipe_interruptions[0]); |
close((*s_argument_thread).pipe_nombre_interruptions_attente[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; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
sem_post(&semaphore_liste_threads); |
sem_post(&semaphore_liste_threads); |
Line 1383 printf("<2> -1 %d %p\n", (*s_argument_th
|
Line 1374 printf("<2> -1 %d %p\n", (*s_argument_th
|
} |
} |
|
|
pthread_mutex_destroy(&((*s_argument_thread).mutex)); |
pthread_mutex_destroy(&((*s_argument_thread).mutex)); |
|
pthread_mutex_destroy(&((*s_argument_thread) |
|
.mutex_nombre_references)); |
|
|
if ((*s_argument_thread).processus_detache == d_faux) |
if ((*s_argument_thread).processus_detache == d_faux) |
{ |
{ |
Line 1396 printf("<2> -1 %d %p\n", (*s_argument_th
|
Line 1389 printf("<2> -1 %d %p\n", (*s_argument_th
|
} |
} |
else |
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; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
sem_post(&semaphore_liste_threads); |
sem_post(&semaphore_liste_threads); |
Line 1594 verrouillage_gestionnaire_signaux()
|
Line 1588 verrouillage_gestionnaire_signaux()
|
// ce que ce soit possible. |
// ce que ce soit possible. |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
while(sem_trywait(&semaphore_liste_threads) == -1) |
while(sem_wait(&semaphore_liste_threads) == -1) |
# else |
# else |
while(sem_trywait(semaphore_liste_threads) == -1) |
while(sem_wait(semaphore_liste_threads) == -1) |
# endif |
# endif |
{ |
{ |
if ((errno != EINTR) && (errno != EAGAIN)) |
if (errno != EINTR) |
{ |
{ |
pthread_sigmask(SIG_SETMASK, &oldset, NULL); |
pthread_sigmask(SIG_SETMASK, &oldset, NULL); |
|
|
Line 1615 verrouillage_gestionnaire_signaux()
|
Line 1609 verrouillage_gestionnaire_signaux()
|
BUG(1, uprintf("Lock error !\n")); |
BUG(1, uprintf("Lock error !\n")); |
return; |
return; |
} |
} |
|
|
sched_yield(); |
|
} |
} |
} |
} |
|
|
Line 1727 deverrouillage_gestionnaire_signaux()
|
Line 1719 deverrouillage_gestionnaire_signaux()
|
} |
} |
|
|
void |
void |
interruption1(int signal, siginfo_t *siginfo, void *context) |
interruption1(SIGHANDLER_ARGS) |
{ |
{ |
|
pid_t pid; |
|
|
pthread_t thread; |
pthread_t thread; |
|
|
struct_processus *s_etat_processus; |
struct_processus *s_etat_processus; |
Line 1737 interruption1(int signal, siginfo_t *sig
|
Line 1731 interruption1(int signal, siginfo_t *sig
|
|
|
verrouillage_gestionnaire_signaux(); |
verrouillage_gestionnaire_signaux(); |
|
|
|
# ifdef _BROKEN_SIGINFO |
|
if ((signal == SIGINT) || (signal == SIGTERM)) |
|
{ |
|
// Si l'interruption provient du clavier, il n'y a pas eu d'appel |
|
// à queue_in(). |
|
|
|
pid = getpid(); |
|
} |
|
else |
|
{ |
|
pid = origine_signal(signal); |
|
} |
|
# else |
|
if (siginfo != NULL) |
|
{ |
|
pid = (*siginfo).si_pid; |
|
} |
|
else |
|
{ |
|
pid = getpid(); |
|
} |
|
# endif |
|
|
switch(signal) |
switch(signal) |
{ |
{ |
case SIGALRM : |
case SIGALRM : |
{ |
{ |
if ((*siginfo).si_pid == getpid()) |
if (pid == getpid()) |
{ |
{ |
if ((s_etat_processus = recherche_thread(getpid(), |
if ((s_etat_processus = recherche_thread(getpid(), |
pthread_self())) == NULL) |
pthread_self())) == NULL) |
{ |
{ |
deverrouillage_gestionnaire_signaux(); |
deverrouillage_gestionnaire_signaux(); |
return; |
return; |
} |
} |
|
|
if (((*s_etat_processus).type_debug & d_debug_signaux) != 0) |
if (((*s_etat_processus).type_debug & d_debug_signaux) != 0) |
Line 1779 interruption1(int signal, siginfo_t *sig
|
Line 1796 interruption1(int signal, siginfo_t *sig
|
} |
} |
|
|
case SIGINT : |
case SIGINT : |
|
case SIGTERM : |
{ |
{ |
/* |
/* |
* Une vieille spécification POSIX permet au pointeur siginfo |
* Une vieille spécification POSIX permet au pointeur siginfo |
Line 1786 interruption1(int signal, siginfo_t *sig
|
Line 1804 interruption1(int signal, siginfo_t *sig
|
* Solaris suit en particulier cette spécification. |
* Solaris suit en particulier cette spécification. |
*/ |
*/ |
|
|
|
# ifndef _BROKEN_SIGINFO |
if (siginfo == NULL) |
if (siginfo == NULL) |
{ |
{ |
kill(getpid(), signal); |
kill(getpid(), signal); |
} |
} |
else if ((*siginfo).si_pid == getpid()) |
else |
|
# endif |
|
if (pid == getpid()) |
{ |
{ |
if ((s_etat_processus = recherche_thread(getpid(), |
if ((s_etat_processus = recherche_thread(getpid(), |
pthread_self())) == NULL) |
pthread_self())) == NULL) |
Line 1801 interruption1(int signal, siginfo_t *sig
|
Line 1822 interruption1(int signal, siginfo_t *sig
|
|
|
if (((*s_etat_processus).type_debug & d_debug_signaux) != 0) |
if (((*s_etat_processus).type_debug & d_debug_signaux) != 0) |
{ |
{ |
printf("[%d] SIGINT (thread %llu)\n", (int) getpid(), |
if (signal == SIGINT) |
(unsigned long long) pthread_self()); |
{ |
|
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); |
fflush(stdout); |
} |
} |
|
|
Line 1824 interruption1(int signal, siginfo_t *sig
|
Line 1854 interruption1(int signal, siginfo_t *sig
|
return; |
return; |
} |
} |
|
|
if (strncmp(getenv("LANG"), "fr", 2) == 0) |
if (signal == SIGINT) |
{ |
{ |
printf("+++Interruption\n"); |
if (strncmp(getenv("LANG"), "fr", 2) == 0) |
} |
{ |
else |
printf("+++Interruption\n"); |
{ |
} |
printf("+++Interrupt\n"); |
else |
} |
{ |
|
printf("+++Interrupt\n"); |
|
} |
|
|
fflush(stdout); |
fflush(stdout); |
|
} |
|
|
(*s_etat_processus).var_volatile_requete_arret = -1; |
(*s_etat_processus).var_volatile_requete_arret = -1; |
(*s_etat_processus).var_volatile_alarme = -1; |
(*s_etat_processus).var_volatile_alarme = -1; |
Line 1865 interruption1(int signal, siginfo_t *sig
|
Line 1898 interruption1(int signal, siginfo_t *sig
|
} |
} |
|
|
void |
void |
interruption2(int signal, siginfo_t *siginfo, void *context) |
interruption2(SIGHANDLER_ARGS) |
{ |
{ |
|
pid_t pid; |
|
|
pthread_t thread; |
pthread_t thread; |
|
|
struct_processus *s_etat_processus; |
struct_processus *s_etat_processus; |
|
|
verrouillage_gestionnaire_signaux(); |
verrouillage_gestionnaire_signaux(); |
|
|
|
# ifdef _BROKEN_SIGINFO |
|
pid = origine_signal(signal); |
|
# else |
|
if (siginfo != NULL) |
|
{ |
|
pid = (*siginfo).si_pid; |
|
} |
|
else |
|
{ |
|
pid = getpid(); |
|
} |
|
# endif |
|
|
|
# ifndef _BROKEN_SIGINFO |
if (siginfo == NULL) |
if (siginfo == NULL) |
{ |
{ |
/* |
/* |
Line 1889 interruption2(int signal, siginfo_t *sig
|
Line 1939 interruption2(int signal, siginfo_t *sig
|
return; |
return; |
} |
} |
} |
} |
else if ((*siginfo).si_pid == getpid()) |
else |
|
# endif |
|
if (pid == getpid()) |
{ |
{ |
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) |
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) |
== NULL) |
== NULL) |
Line 1937 interruption2(int signal, siginfo_t *sig
|
Line 1989 interruption2(int signal, siginfo_t *sig
|
} |
} |
|
|
void |
void |
interruption3(int signal, siginfo_t *siginfo, void *context) |
interruption3(SIGHANDLER_ARGS) |
{ |
{ |
struct_processus *s_etat_processus; |
pthread_t thread; |
|
|
static int compteur = 0; |
struct_processus *s_etat_processus; |
|
|
verrouillage_gestionnaire_signaux(); |
verrouillage_gestionnaire_signaux(); |
|
|
Line 1969 interruption3(int signal, siginfo_t *sig
|
Line 2021 interruption3(int signal, siginfo_t *sig
|
// Segfault dans une routine interne |
// Segfault dans une routine interne |
if (strncmp(getenv("LANG"), "fr", 2) == 0) |
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 |
else |
{ |
{ |
printf("+++System : Access violation (stack overflow)\n"); |
printf("+++System : Access violation\n"); |
} |
} |
|
|
fflush(stdout); |
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, tentative de " |
|
"terminaison de la tâche\n"); |
|
printf(" (defauts multiples)\n"); |
|
} |
|
else |
|
{ |
|
printf("+++System : Access violation, trying to kill task " |
|
"(multiple defaults)\n"); |
|
} |
|
|
|
fflush(stdout); |
|
|
deverrouillage_gestionnaire_signaux(); |
deverrouillage_gestionnaire_signaux(); |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
} |
} |
else |
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(); |
deverrouillage_gestionnaire_signaux(); |
longjmp(contexte_initial, -1); |
longjmp(contexte_initial, -1); |
} |
} |
Line 1997 interruption3(int signal, siginfo_t *sig
|
Line 2104 interruption3(int signal, siginfo_t *sig
|
} |
} |
|
|
void |
void |
interruption4(int signal, siginfo_t *siginfo, void *context) |
interruption4(SIGHANDLER_ARGS) |
{ |
{ |
struct_processus *s_etat_processus; |
struct_processus *s_etat_processus; |
|
|
Line 2025 interruption4(int signal, siginfo_t *sig
|
Line 2132 interruption4(int signal, siginfo_t *sig
|
} |
} |
|
|
void |
void |
interruption5(int signal, siginfo_t *siginfo, void *context) |
interruption5(SIGHANDLER_ARGS) |
{ |
{ |
|
pid_t pid; |
|
|
pthread_t thread; |
pthread_t thread; |
|
|
struct_processus *s_etat_processus; |
struct_processus *s_etat_processus; |
|
|
verrouillage_gestionnaire_signaux(); |
verrouillage_gestionnaire_signaux(); |
|
|
if ((*siginfo).si_pid == getpid()) |
# ifdef _BROKEN_SIGINFO |
|
pid = origine_signal(signal); |
|
# else |
|
pid = (*siginfo).si_pid; |
|
# endif |
|
|
|
if (pid == getpid()) |
{ |
{ |
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) |
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) |
== NULL) |
== NULL) |
Line 2088 interruption5(int signal, siginfo_t *sig
|
Line 2204 interruption5(int signal, siginfo_t *sig
|
} |
} |
|
|
void |
void |
interruption6(int signal, siginfo_t *siginfo, void *context) |
interruption6(SIGHANDLER_ARGS) |
{ |
{ |
struct_processus *s_etat_processus; |
struct_processus *s_etat_processus; |
|
|
Line 2112 interruption6(int signal, siginfo_t *sig
|
Line 2228 interruption6(int signal, siginfo_t *sig
|
} |
} |
|
|
void |
void |
interruption7(int signal, siginfo_t *siginfo, void *context) |
interruption7(SIGHANDLER_ARGS) |
{ |
{ |
struct_processus *s_etat_processus; |
struct_processus *s_etat_processus; |
|
|
Line 2139 interruption7(int signal, siginfo_t *sig
|
Line 2255 interruption7(int signal, siginfo_t *sig
|
} |
} |
|
|
void |
void |
interruption8(int signal, siginfo_t *siginfo, void *context) |
interruption8(SIGHANDLER_ARGS) |
{ |
{ |
|
pid_t pid; |
|
|
pthread_t thread; |
pthread_t thread; |
|
|
struct_processus *s_etat_processus; |
struct_processus *s_etat_processus; |
|
|
verrouillage_gestionnaire_signaux(); |
verrouillage_gestionnaire_signaux(); |
|
|
if ((*siginfo).si_pid == getpid()) |
# ifdef _BROKEN_SIGINFO |
|
pid = origine_signal(signal); |
|
# else |
|
pid = (*siginfo).si_pid; |
|
# endif |
|
|
|
if (pid == getpid()) |
{ |
{ |
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) |
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) |
== NULL) |
== NULL) |
Line 2182 interruption8(int signal, siginfo_t *sig
|
Line 2307 interruption8(int signal, siginfo_t *sig
|
} |
} |
|
|
void |
void |
interruption9(int signal, siginfo_t *siginfo, void *context) |
interruption9(SIGHANDLER_ARGS) |
{ |
{ |
struct_processus *s_etat_processus; |
struct_processus *s_etat_processus; |
|
|
Line 2201 interruption9(int signal, siginfo_t *sig
|
Line 2326 interruption9(int signal, siginfo_t *sig
|
fflush(stdout); |
fflush(stdout); |
} |
} |
|
|
|
# ifdef _BROKEN_SIGINFO |
|
if (queue_in(getpid(), signal) != 0) |
|
{ |
|
return; |
|
} |
|
|
|
deverrouillage_gestionnaire_signaux(); |
|
interruption11(signal); |
|
# else |
deverrouillage_gestionnaire_signaux(); |
deverrouillage_gestionnaire_signaux(); |
interruption11(signal, siginfo, context); |
interruption11(signal, siginfo, context); |
|
# endif |
return; |
return; |
} |
} |
|
|
void |
void |
interruption10(int signal, siginfo_t *siginfo, void *context) |
interruption10(SIGHANDLER_ARGS) |
{ |
{ |
file *fichier; |
file *fichier; |
|
|
Line 2248 interruption10(int signal, siginfo_t *si
|
Line 2383 interruption10(int signal, siginfo_t *si
|
} |
} |
|
|
void |
void |
interruption11(int signal, siginfo_t *siginfo, void *context) |
interruption11(SIGHANDLER_ARGS) |
{ |
{ |
|
pid_t pid; |
|
|
pthread_t thread; |
pthread_t thread; |
|
|
struct_processus *s_etat_processus; |
struct_processus *s_etat_processus; |
|
|
verrouillage_gestionnaire_signaux(); |
verrouillage_gestionnaire_signaux(); |
|
|
if ((*siginfo).si_pid == getpid()) |
# ifdef _BROKEN_SIGINFO |
|
pid = origine_signal(signal); |
|
# else |
|
pid = (*siginfo).si_pid; |
|
# endif |
|
|
|
if (pid == getpid()) |
{ |
{ |
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) |
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) |
== NULL) |
== NULL) |