version 1.54, 2013/04/01 15:29:37
|
version 1.80, 2019/02/11 09:45:51
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.14 |
RPL/2 (R) version 4.1.31 |
Copyright (C) 1989-2013 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 718 instruction_poke(struct_processus *s_eta
|
Line 718 instruction_poke(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
if (pthread_mutex_lock(&((*s_etat_processus).mutex)) != 0) |
if (pthread_mutex_lock(&((*s_etat_processus).mutex_pile_processus)) |
|
!= 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
Line 749 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(&((*s_etat_processus).mutex)); |
pthread_mutex_unlock(&mutex_sigaction); |
|
pthread_mutex_unlock(&((*s_etat_processus) |
|
.mutex_pile_processus)); |
|
|
(*s_etat_processus).erreur_systeme = d_es_signal; |
(*s_etat_processus).erreur_systeme = d_es_signal; |
return; |
return; |
Line 765 instruction_poke(struct_processus *s_eta
|
Line 774 instruction_poke(struct_processus *s_eta
|
|
|
if (envoi_signal_processus((*(*((struct_processus_fils *) |
if (envoi_signal_processus((*(*((struct_processus_fils *) |
(*(*l_element_courant).donnee).objet)) |
(*(*l_element_courant).donnee).objet)) |
.thread).pid, rpl_siginject) != 0) |
.thread).pid, rpl_siginject, d_faux) != 0) |
{ |
{ |
// Le processus fils peut s'être terminé. |
// Le processus fils peut s'être terminé. |
break; |
break; |
Line 783 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(&((*s_etat_processus).mutex)); |
pthread_mutex_unlock(&mutex_sigaction); |
|
pthread_mutex_unlock(&((*s_etat_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 795 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 805 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 820 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(&((*s_etat_processus).mutex)); |
pthread_mutex_unlock(&mutex_sigaction); |
|
pthread_mutex_unlock(&((*s_etat_processus) |
|
.mutex_pile_processus)); |
|
|
liberation(s_etat_processus, s_objet_argument_1); |
liberation(s_etat_processus, s_objet_argument_1); |
liberation(s_etat_processus, s_objet_argument_2); |
liberation(s_etat_processus, s_objet_argument_2); |
Line 850 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 858 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 869 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 885 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 898 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 919 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(&((*s_etat_processus).mutex)); |
pthread_mutex_unlock(&mutex_sigaction); |
|
pthread_mutex_unlock(&((*s_etat_processus) |
|
.mutex_pile_processus)); |
|
|
(*s_etat_processus).erreur_systeme = d_es_signal; |
(*s_etat_processus).erreur_systeme = d_es_signal; |
return; |
return; |
} |
} |
|
|
|
if (pthread_mutex_unlock(&mutex_sigaction) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
break; |
break; |
} |
} |
} |
} |
Line 951 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(&((*s_etat_processus).mutex)); |
pthread_mutex_unlock(&mutex_sigaction); |
|
pthread_mutex_unlock(&((*s_etat_processus) |
|
.mutex_pile_processus)); |
|
|
(*s_etat_processus).erreur_systeme = d_es_signal; |
(*s_etat_processus).erreur_systeme = d_es_signal; |
return; |
return; |
Line 970 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 978 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 989 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 1004 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 1015 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 1031 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(&((*s_etat_processus).mutex)); |
pthread_mutex_unlock(&mutex_sigaction); |
|
pthread_mutex_unlock(&((*s_etat_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 1047 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 1054 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 1069 instruction_poke(struct_processus *s_eta
|
Line 1118 instruction_poke(struct_processus *s_eta
|
return; |
return; |
} |
} |
} |
} |
|
*/ |
|
|
if (longueur_ecriture == -1) |
if (longueur_ecriture == -1) |
{ |
{ |
pthread_mutex_unlock(&((*s_etat_processus).mutex)); |
pthread_mutex_unlock(&((*s_etat_processus) |
|
.mutex_pile_processus)); |
|
|
liberation(s_etat_processus, s_objet_argument_1); |
liberation(s_etat_processus, s_objet_argument_1); |
liberation(s_etat_processus, s_objet_argument_2); |
liberation(s_etat_processus, s_objet_argument_2); |
Line 1099 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 1118 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 1134 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 1148 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 1169 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(&((*s_etat_processus).mutex)); |
pthread_mutex_unlock(&mutex_sigaction); |
|
pthread_mutex_unlock(&((*s_etat_processus) |
|
.mutex_pile_processus)); |
|
|
(*s_etat_processus).erreur_systeme = d_es_signal; |
(*s_etat_processus).erreur_systeme = d_es_signal; |
return; |
return; |
} |
} |
|
|
|
if (pthread_mutex_unlock(&mutex_sigaction) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
break; |
break; |
} |
} |
} |
} |
Line 1182 instruction_poke(struct_processus *s_eta
|
Line 1247 instruction_poke(struct_processus *s_eta
|
l_element_courant = (*l_element_courant).suivant; |
l_element_courant = (*l_element_courant).suivant; |
} |
} |
|
|
if (pthread_mutex_unlock(&((*s_etat_processus).mutex)) != 0) |
if (pthread_mutex_unlock(&((*s_etat_processus).mutex_pile_processus)) |
|
!= 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |