version 1.74, 2017/08/03 17:17:48
|
version 1.80, 2019/02/11 09:45:51
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.28 |
RPL/2 (R) version 4.1.31 |
Copyright (C) 1989-2017 Dr. BERTRAND Joël |
Copyright (C) 1989-2019 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 750 instruction_poke(struct_processus *s_eta
|
Line 750 instruction_poke(struct_processus *s_eta
|
// figure ! |
// figure ! |
|
|
action.sa_handler = SIG_IGN; |
action.sa_handler = SIG_IGN; |
action.sa_flags = SA_ONSTACK; |
action.sa_flags = 0; |
|
|
|
if (pthread_mutex_lock(&mutex_sigaction) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
if (sigaction(SIGPIPE, &action, ®istre) != 0) |
if (sigaction(SIGPIPE, &action, ®istre) != 0) |
{ |
{ |
|
pthread_mutex_unlock(&mutex_sigaction); |
pthread_mutex_unlock(&((*s_etat_processus) |
pthread_mutex_unlock(&((*s_etat_processus) |
.mutex_pile_processus)); |
.mutex_pile_processus)); |
|
|
Line 785 instruction_poke(struct_processus *s_eta
|
Line 792 instruction_poke(struct_processus *s_eta
|
|
|
if ((*s_etat_processus).erreur_systeme != d_es) |
if ((*s_etat_processus).erreur_systeme != d_es) |
{ |
{ |
|
pthread_mutex_unlock(&mutex_sigaction); |
pthread_mutex_unlock(&((*s_etat_processus) |
pthread_mutex_unlock(&((*s_etat_processus) |
.mutex_pile_processus)); |
.mutex_pile_processus)); |
return; |
return; |
} |
} |
} |
} |
|
|
|
/* |
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) |
!= 0) |
!= 0) |
Line 798 instruction_poke(struct_processus *s_eta
|
Line 807 instruction_poke(struct_processus *s_eta
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
# endif |
# endif |
{ |
{ |
|
pthread_mutex_unlock(&mutex_sigaction); |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
*/ |
|
|
while((longueur_ecriture = write_atomic(s_etat_processus, |
while((longueur_ecriture = write_atomic(s_etat_processus, |
(*(*((struct_processus_fils *) |
(*(*((struct_processus_fils *) |
Line 808 instruction_poke(struct_processus *s_eta
|
Line 819 instruction_poke(struct_processus *s_eta
|
.pipe_nombre_injections[1], "-", |
.pipe_nombre_injections[1], "-", |
sizeof(unsigned char))) != sizeof(unsigned char)) |
sizeof(unsigned char))) != sizeof(unsigned char)) |
{ |
{ |
|
/* |
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
while(sem_wait( |
while(sem_wait( |
&((*s_etat_processus).semaphore_fork)) != 0) |
&((*s_etat_processus).semaphore_fork)) != 0) |
Line 823 instruction_poke(struct_processus *s_eta
|
Line 835 instruction_poke(struct_processus *s_eta
|
return; |
return; |
} |
} |
} |
} |
|
*/ |
|
|
if (longueur_ecriture == -1) |
if (longueur_ecriture == -1) |
{ |
{ |
|
pthread_mutex_unlock(&mutex_sigaction); |
pthread_mutex_unlock(&((*s_etat_processus) |
pthread_mutex_unlock(&((*s_etat_processus) |
.mutex_pile_processus)); |
.mutex_pile_processus)); |
|
|
Line 854 instruction_poke(struct_processus *s_eta
|
Line 868 instruction_poke(struct_processus *s_eta
|
|
|
if (sigaction(SIGPIPE, ®istre, NULL) != 0) |
if (sigaction(SIGPIPE, ®istre, NULL) != 0) |
{ |
{ |
|
pthread_mutex_unlock(&mutex_sigaction); |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_signal; |
d_es_signal; |
return; |
return; |
Line 862 instruction_poke(struct_processus *s_eta
|
Line 877 instruction_poke(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
|
/* |
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
if (sem_post( |
if (sem_post( |
&((*s_etat_processus).semaphore_fork)) != 0) |
&((*s_etat_processus).semaphore_fork)) != 0) |
Line 873 instruction_poke(struct_processus *s_eta
|
Line 889 instruction_poke(struct_processus *s_eta
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
*/ |
} |
} |
|
|
if (ecriture_pipe(s_etat_processus, |
if (ecriture_pipe(s_etat_processus, |
Line 889 instruction_poke(struct_processus *s_eta
|
Line 906 instruction_poke(struct_processus *s_eta
|
} |
} |
} |
} |
|
|
|
/* |
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) |
!= 0) |
!= 0) |
Line 902 instruction_poke(struct_processus *s_eta
|
Line 920 instruction_poke(struct_processus *s_eta
|
return; |
return; |
} |
} |
} |
} |
|
*/ |
|
|
if (registre_stop == 0) |
if (registre_stop == 0) |
{ |
{ |
Line 923 instruction_poke(struct_processus *s_eta
|
Line 942 instruction_poke(struct_processus *s_eta
|
|
|
if (sigaction(SIGPIPE, ®istre, NULL) != 0) |
if (sigaction(SIGPIPE, ®istre, NULL) != 0) |
{ |
{ |
|
pthread_mutex_unlock(&mutex_sigaction); |
pthread_mutex_unlock(&((*s_etat_processus) |
pthread_mutex_unlock(&((*s_etat_processus) |
.mutex_pile_processus)); |
.mutex_pile_processus)); |
|
|
Line 930 instruction_poke(struct_processus *s_eta
|
Line 950 instruction_poke(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
|
if (pthread_mutex_unlock(&mutex_sigaction) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
break; |
break; |
} |
} |
} |
} |
Line 956 instruction_poke(struct_processus *s_eta
|
Line 982 instruction_poke(struct_processus *s_eta
|
// de lecteur et on peut se prendre un SIGPIPE dans la |
// de lecteur et on peut se prendre un SIGPIPE dans la |
// figure ! |
// figure ! |
|
|
|
if (pthread_mutex_lock(&mutex_sigaction) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
action.sa_handler = SIG_IGN; |
action.sa_handler = SIG_IGN; |
action.sa_flags = SA_ONSTACK; |
action.sa_flags = 0; |
|
|
if (sigaction(SIGPIPE, &action, ®istre) != 0) |
if (sigaction(SIGPIPE, &action, ®istre) != 0) |
{ |
{ |
|
pthread_mutex_unlock(&mutex_sigaction); |
pthread_mutex_unlock(&((*s_etat_processus) |
pthread_mutex_unlock(&((*s_etat_processus) |
.mutex_pile_processus)); |
.mutex_pile_processus)); |
|
|
Line 976 instruction_poke(struct_processus *s_eta
|
Line 1009 instruction_poke(struct_processus *s_eta
|
(*(*l_element_courant).donnee).objet)).thread) |
(*(*l_element_courant).donnee).objet)).thread) |
.mutex)) != 0) |
.mutex)) != 0) |
{ |
{ |
|
pthread_mutex_unlock(&mutex_sigaction); |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
Line 984 instruction_poke(struct_processus *s_eta
|
Line 1018 instruction_poke(struct_processus *s_eta
|
(*(*l_element_courant).donnee).objet)).thread) |
(*(*l_element_courant).donnee).objet)).thread) |
.thread_actif == d_vrai) |
.thread_actif == d_vrai) |
{ |
{ |
if (envoi_signal_thread((*(*((struct_processus_fils *) |
if (envoi_signal_thread(s_etat_processus, |
|
(*(*((struct_processus_fils *) |
(*(*l_element_courant).donnee).objet)).thread) |
(*(*l_element_courant).donnee).objet)).thread) |
.tid, rpl_siginject) != 0) |
.tid, rpl_siginject) != 0) |
{ |
{ |
Line 995 instruction_poke(struct_processus *s_eta
|
Line 1030 instruction_poke(struct_processus *s_eta
|
(*(*l_element_courant).donnee).objet)) |
(*(*l_element_courant).donnee).objet)) |
.thread).mutex)) != 0) |
.thread).mutex)) != 0) |
{ |
{ |
|
pthread_mutex_unlock(&mutex_sigaction); |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_processus; |
d_es_processus; |
return; |
return; |
Line 1010 instruction_poke(struct_processus *s_eta
|
Line 1046 instruction_poke(struct_processus *s_eta
|
(*(*l_element_courant).donnee).objet)) |
(*(*l_element_courant).donnee).objet)) |
.thread).mutex)) != 0) |
.thread).mutex)) != 0) |
{ |
{ |
|
pthread_mutex_unlock(&mutex_sigaction); |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
Line 1021 instruction_poke(struct_processus *s_eta
|
Line 1058 instruction_poke(struct_processus *s_eta
|
(*(*l_element_courant).donnee).objet)).thread) |
(*(*l_element_courant).donnee).objet)).thread) |
.mutex)) != 0) |
.mutex)) != 0) |
{ |
{ |
|
pthread_mutex_unlock(&mutex_sigaction); |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
Line 1037 instruction_poke(struct_processus *s_eta
|
Line 1075 instruction_poke(struct_processus *s_eta
|
|
|
if ((*s_etat_processus).erreur_systeme != d_es) |
if ((*s_etat_processus).erreur_systeme != d_es) |
{ |
{ |
|
pthread_mutex_unlock(&mutex_sigaction); |
pthread_mutex_unlock(&((*s_etat_processus) |
pthread_mutex_unlock(&((*s_etat_processus) |
.mutex_pile_processus)); |
.mutex_pile_processus)); |
return; |
return; |
} |
} |
} |
} |
|
|
|
/* |
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
if (sem_post( |
if (sem_post( |
&((*s_etat_processus).semaphore_fork)) != 0) |
&((*s_etat_processus).semaphore_fork)) != 0) |
Line 1054 instruction_poke(struct_processus *s_eta
|
Line 1094 instruction_poke(struct_processus *s_eta
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
*/ |
|
|
while((longueur_ecriture = write_atomic(s_etat_processus, |
while((longueur_ecriture = write_atomic(s_etat_processus, |
(*(*((struct_processus_fils *) |
(*(*((struct_processus_fils *) |
Line 1061 instruction_poke(struct_processus *s_eta
|
Line 1102 instruction_poke(struct_processus *s_eta
|
.pipe_nombre_injections[1], "-", |
.pipe_nombre_injections[1], "-", |
sizeof(unsigned char))) != sizeof(unsigned char)) |
sizeof(unsigned char))) != sizeof(unsigned char)) |
{ |
{ |
|
/* |
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
while(sem_wait( |
while(sem_wait( |
&((*s_etat_processus).semaphore_fork)) != 0) |
&((*s_etat_processus).semaphore_fork)) != 0) |
Line 1076 instruction_poke(struct_processus *s_eta
|
Line 1118 instruction_poke(struct_processus *s_eta
|
return; |
return; |
} |
} |
} |
} |
|
*/ |
|
|
if (longueur_ecriture == -1) |
if (longueur_ecriture == -1) |
{ |
{ |
Line 1107 instruction_poke(struct_processus *s_eta
|
Line 1150 instruction_poke(struct_processus *s_eta
|
|
|
if (sigaction(SIGPIPE, ®istre, NULL) != 0) |
if (sigaction(SIGPIPE, ®istre, NULL) != 0) |
{ |
{ |
|
pthread_mutex_unlock(&mutex_sigaction); |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_signal; |
d_es_signal; |
return; |
return; |
} |
} |
|
|
|
pthread_mutex_unlock(&mutex_sigaction); |
return; |
return; |
} |
} |
|
|
|
/* |
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
if (sem_post( |
if (sem_post( |
&((*s_etat_processus).semaphore_fork)) != 0) |
&((*s_etat_processus).semaphore_fork)) != 0) |
Line 1126 instruction_poke(struct_processus *s_eta
|
Line 1172 instruction_poke(struct_processus *s_eta
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
*/ |
} |
} |
|
|
if (ecriture_pipe(s_etat_processus, |
if (ecriture_pipe(s_etat_processus, |
Line 1142 instruction_poke(struct_processus *s_eta
|
Line 1189 instruction_poke(struct_processus *s_eta
|
} |
} |
} |
} |
|
|
|
/* |
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
while(sem_wait( |
while(sem_wait( |
&((*s_etat_processus).semaphore_fork)) != 0) |
&((*s_etat_processus).semaphore_fork)) != 0) |
Line 1156 instruction_poke(struct_processus *s_eta
|
Line 1204 instruction_poke(struct_processus *s_eta
|
return; |
return; |
} |
} |
} |
} |
|
*/ |
|
|
if (registre_stop == 0) |
if (registre_stop == 0) |
{ |
{ |
Line 1177 instruction_poke(struct_processus *s_eta
|
Line 1226 instruction_poke(struct_processus *s_eta
|
|
|
if (sigaction(SIGPIPE, ®istre, NULL) != 0) |
if (sigaction(SIGPIPE, ®istre, NULL) != 0) |
{ |
{ |
|
pthread_mutex_unlock(&mutex_sigaction); |
pthread_mutex_unlock(&((*s_etat_processus) |
pthread_mutex_unlock(&((*s_etat_processus) |
.mutex_pile_processus)); |
.mutex_pile_processus)); |
|
|
Line 1184 instruction_poke(struct_processus *s_eta
|
Line 1234 instruction_poke(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
|
if (pthread_mutex_unlock(&mutex_sigaction) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
break; |
break; |
} |
} |
} |
} |