version 1.29, 2010/08/13 21:00:37
|
version 1.38, 2010/08/31 09:57:43
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.18 |
RPL/2 (R) version 4.0.19 |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
Line 1597 verrouillage_gestionnaire_signaux()
|
Line 1597 verrouillage_gestionnaire_signaux()
|
while(sem_trywait(semaphore_liste_threads) == -1) |
while(sem_trywait(semaphore_liste_threads) == -1) |
# endif |
# endif |
{ |
{ |
|
perror("sem_trywait"); |
if ((errno != EINTR) && (errno != EAGAIN)) |
if ((errno != EINTR) && (errno != EAGAIN)) |
{ |
{ |
pthread_sigmask(SIG_SETMASK, &oldset, NULL); |
pthread_sigmask(SIG_SETMASK, &oldset, NULL); |
Line 1725 deverrouillage_gestionnaire_signaux()
|
Line 1726 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; |
|
|
volatile sig_atomic_t exclusion = 0; |
volatile sig_atomic_t exclusion = 0; |
|
|
|
verrouillage_gestionnaire_signaux(); |
|
|
# ifdef _BROKEN_SIGINFO |
# ifdef _BROKEN_SIGINFO |
(*siginfo).si_pid=getpid(); |
if (signal == SIGINT) |
# endif |
{ |
|
// Si l'interruption provient du clavier, il n'y a pas eu d'appel |
|
// à queue_in(). |
|
|
verrouillage_gestionnaire_signaux(); |
pid = getpid(); |
|
} |
|
else |
|
{ |
|
pid = origine_signal(signal); |
|
} |
|
# else |
|
pid = (*siginfo).si_pid; |
|
# 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 1788 interruption1(int signal, siginfo_t *sig
|
Line 1803 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 1867 interruption1(int signal, siginfo_t *sig
|
Line 1885 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(); |
|
|
# ifdef _BROKEN_SIGINFO |
# ifdef _BROKEN_SIGINFO |
(*siginfo).si_pid=getpid(); |
pid = origine_signal(signal); |
|
# else |
|
pid = (*siginfo).si_pid; |
# endif |
# endif |
|
|
verrouillage_gestionnaire_signaux(); |
# ifndef _BROKEN_SIGINFO |
|
|
if (siginfo == NULL) |
if (siginfo == NULL) |
{ |
{ |
/* |
/* |
Line 1895 interruption2(int signal, siginfo_t *sig
|
Line 1919 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 1943 interruption2(int signal, siginfo_t *sig
|
Line 1969 interruption2(int signal, siginfo_t *sig
|
} |
} |
|
|
void |
void |
interruption3(int signal, siginfo_t *siginfo, void *context) |
interruption3(SIGHANDLER_ARGS) |
{ |
{ |
|
pid_t pid; |
|
|
struct_processus *s_etat_processus; |
struct_processus *s_etat_processus; |
|
|
static int compteur = 0; |
static int compteur = 0; |
|
|
|
verrouillage_gestionnaire_signaux(); |
|
|
# ifdef _BROKEN_SIGINFO |
# ifdef _BROKEN_SIGINFO |
(*siginfo).si_pid=getpid(); |
pid = origine_signal(signal); |
|
# else |
|
pid = (*siginfo).si_pid; |
# endif |
# endif |
|
|
verrouillage_gestionnaire_signaux(); |
|
|
|
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) |
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) |
{ |
{ |
deverrouillage_gestionnaire_signaux(); |
deverrouillage_gestionnaire_signaux(); |
Line 2007 interruption3(int signal, siginfo_t *sig
|
Line 2037 interruption3(int signal, siginfo_t *sig
|
} |
} |
|
|
void |
void |
interruption4(int signal, siginfo_t *siginfo, void *context) |
interruption4(SIGHANDLER_ARGS) |
{ |
{ |
|
pid_t pid; |
|
|
struct_processus *s_etat_processus; |
struct_processus *s_etat_processus; |
|
|
|
verrouillage_gestionnaire_signaux(); |
|
|
# ifdef _BROKEN_SIGINFO |
# ifdef _BROKEN_SIGINFO |
(*siginfo).si_pid=getpid(); |
pid = origine_signal(signal); |
|
# else |
|
pid = (*siginfo).si_pid; |
# endif |
# endif |
|
|
verrouillage_gestionnaire_signaux(); |
|
|
|
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) |
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) |
{ |
{ |
deverrouillage_gestionnaire_signaux(); |
deverrouillage_gestionnaire_signaux(); |
Line 2039 interruption4(int signal, siginfo_t *sig
|
Line 2073 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(); |
|
|
# ifdef _BROKEN_SIGINFO |
# ifdef _BROKEN_SIGINFO |
(*siginfo).si_pid=getpid(); |
pid = origine_signal(signal); |
|
# else |
|
pid = (*siginfo).si_pid; |
# endif |
# endif |
|
|
verrouillage_gestionnaire_signaux(); |
if (pid == getpid()) |
|
|
if ((*siginfo).si_pid == getpid()) |
|
{ |
{ |
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) |
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) |
== NULL) |
== NULL) |
Line 2106 interruption5(int signal, siginfo_t *sig
|
Line 2145 interruption5(int signal, siginfo_t *sig
|
} |
} |
|
|
void |
void |
interruption6(int signal, siginfo_t *siginfo, void *context) |
interruption6(SIGHANDLER_ARGS) |
{ |
{ |
|
pid_t pid; |
|
|
struct_processus *s_etat_processus; |
struct_processus *s_etat_processus; |
|
|
|
verrouillage_gestionnaire_signaux(); |
|
|
# ifdef _BROKEN_SIGINFO |
# ifdef _BROKEN_SIGINFO |
(*siginfo).si_pid=getpid(); |
pid = origine_signal(signal); |
|
# else |
|
pid = (*siginfo).si_pid; |
# endif |
# endif |
|
|
verrouillage_gestionnaire_signaux(); |
|
|
|
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) |
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) |
{ |
{ |
deverrouillage_gestionnaire_signaux(); |
deverrouillage_gestionnaire_signaux(); |
Line 2134 interruption6(int signal, siginfo_t *sig
|
Line 2177 interruption6(int signal, siginfo_t *sig
|
} |
} |
|
|
void |
void |
interruption7(int signal, siginfo_t *siginfo, void *context) |
interruption7(SIGHANDLER_ARGS) |
{ |
{ |
|
pid_t pid; |
|
|
struct_processus *s_etat_processus; |
struct_processus *s_etat_processus; |
|
|
|
verrouillage_gestionnaire_signaux(); |
|
|
# ifdef _BROKEN_SIGINFO |
# ifdef _BROKEN_SIGINFO |
(*siginfo).si_pid=getpid(); |
pid = origine_signal(signal); |
|
# else |
|
pid = (*siginfo).si_pid; |
# endif |
# endif |
|
|
verrouillage_gestionnaire_signaux(); |
|
|
|
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) |
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) |
{ |
{ |
deverrouillage_gestionnaire_signaux(); |
deverrouillage_gestionnaire_signaux(); |
Line 2165 interruption7(int signal, siginfo_t *sig
|
Line 2212 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(); |
|
|
# ifdef _BROKEN_SIGINFO |
# ifdef _BROKEN_SIGINFO |
(*siginfo).si_pid=getpid(); |
pid = origine_signal(signal); |
|
# else |
|
pid = (*siginfo).si_pid; |
# endif |
# endif |
|
|
verrouillage_gestionnaire_signaux(); |
if (pid == getpid()) |
|
|
if ((*siginfo).si_pid == getpid()) |
|
{ |
{ |
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) |
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) |
== NULL) |
== NULL) |
Line 2212 interruption8(int signal, siginfo_t *sig
|
Line 2264 interruption8(int signal, siginfo_t *sig
|
} |
} |
|
|
void |
void |
interruption9(int signal, siginfo_t *siginfo, void *context) |
interruption9(SIGHANDLER_ARGS) |
{ |
{ |
|
pid_t pid; |
|
|
struct_processus *s_etat_processus; |
struct_processus *s_etat_processus; |
|
|
|
verrouillage_gestionnaire_signaux(); |
|
|
# ifdef _BROKEN_SIGINFO |
# ifdef _BROKEN_SIGINFO |
(*siginfo).si_pid=getpid(); |
pid = origine_signal(signal); |
|
# else |
|
pid = (*siginfo).si_pid; |
# endif |
# endif |
|
|
verrouillage_gestionnaire_signaux(); |
|
|
|
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) |
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) |
{ |
{ |
deverrouillage_gestionnaire_signaux(); |
deverrouillage_gestionnaire_signaux(); |
Line 2235 interruption9(int signal, siginfo_t *sig
|
Line 2291 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; |
|
|
|
pid_t pid; |
|
|
struct_processus *s_etat_processus; |
struct_processus *s_etat_processus; |
|
|
unsigned char nom[8 + 64 + 1]; |
unsigned char nom[8 + 64 + 1]; |
|
|
|
verrouillage_gestionnaire_signaux(); |
|
|
# ifdef _BROKEN_SIGINFO |
# ifdef _BROKEN_SIGINFO |
(*siginfo).si_pid=getpid(); |
pid = origine_signal(signal); |
|
# else |
|
pid = (*siginfo).si_pid; |
# endif |
# endif |
|
|
verrouillage_gestionnaire_signaux(); |
|
|
|
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) |
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) == NULL) |
{ |
{ |
deverrouillage_gestionnaire_signaux(); |
deverrouillage_gestionnaire_signaux(); |
Line 2286 interruption10(int signal, siginfo_t *si
|
Line 2356 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(); |
|
|
# ifdef _BROKEN_SIGINFO |
# ifdef _BROKEN_SIGINFO |
(*siginfo).si_pid=getpid(); |
pid = origine_signal(signal); |
|
# else |
|
pid = (*siginfo).si_pid; |
# endif |
# endif |
|
|
verrouillage_gestionnaire_signaux(); |
if (pid == getpid()) |
|
|
if ((*siginfo).si_pid == getpid()) |
|
{ |
{ |
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) |
if ((s_etat_processus = recherche_thread(getpid(), pthread_self())) |
== NULL) |
== NULL) |