version 1.114, 2019/02/03 14:41:22
|
version 1.120, 2020/01/10 11:15:49
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.31 |
RPL/2 (R) version 4.1.32 |
Copyright (C) 1989-2019 Dr. BERTRAND Joël |
Copyright (C) 1989-2020 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 1732 instruction_write(struct_processus *s_et
|
Line 1732 instruction_write(struct_processus *s_et
|
(*s_objet_argument_1).objet)).type, |
(*s_objet_argument_1).objet)).type, |
"SEQUENTIAL DATAGRAM") == 0)) |
"SEQUENTIAL DATAGRAM") == 0)) |
{ // Sockets connectées |
{ // Sockets connectées |
|
|
action.sa_handler = SIG_IGN; |
|
action.sa_flags = SA_ONSTACK; |
|
|
|
if (sigaction(SIGPIPE, &action, ®istre) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_signal; |
|
return; |
|
} |
|
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
# else |
# else |
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
# endif |
# endif |
{ |
{ |
if (sigaction(SIGPIPE, ®istre, NULL) != 0) |
(*s_etat_processus).erreur_systeme = d_es_processus; |
{ |
return; |
(*s_etat_processus).erreur_systeme = d_es_signal; |
} |
return; |
|
} |
|
|
|
|
if (pthread_mutex_lock(&mutex_sigaction) != 0) |
|
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
|
|
action.sa_handler = SIG_IGN; |
|
action.sa_flags = 0; |
|
|
|
if (sigaction(SIGPIPE, &action, ®istre) != 0) |
|
{ |
|
pthread_mutex_unlock(&mutex_sigaction); |
|
(*s_etat_processus).erreur_systeme = d_es_signal; |
|
return; |
|
} |
|
|
if (send((*((struct_socket *) (*s_objet_argument_1).objet)) |
if (send((*((struct_socket *) (*s_objet_argument_1).objet)) |
.socket, chaine, (size_t) longueur_effective, 0) < 0) |
.socket, chaine, (size_t) longueur_effective, 0) < 0) |
{ |
{ |
Line 1765 instruction_write(struct_processus *s_et
|
Line 1765 instruction_write(struct_processus *s_et
|
|
|
if (sigaction(SIGPIPE, ®istre, NULL) != 0) |
if (sigaction(SIGPIPE, ®istre, NULL) != 0) |
{ |
{ |
|
pthread_mutex_unlock(&mutex_sigaction); |
(*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; |
|
} |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
# else |
# else |
Line 1793 instruction_write(struct_processus *s_et
|
Line 1800 instruction_write(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
|
if (sigaction(SIGPIPE, ®istre, NULL) != 0) |
|
{ |
|
pthread_mutex_unlock(&mutex_sigaction); |
|
|
|
# ifndef SEMAPHORES_NOMMES |
|
while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) != 0) |
|
# endif |
|
{ |
|
if (errno != EINTR) |
|
{ |
|
if (sigaction(SIGPIPE, ®istre, NULL) != 0) |
|
{ |
|
pthread_mutex_unlock(&mutex_sigaction); |
|
(*s_etat_processus).erreur_systeme = d_es_signal; |
|
return; |
|
} |
|
|
|
pthread_mutex_unlock(&mutex_sigaction); |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
} |
|
|
|
(*s_etat_processus).erreur_systeme = d_es_signal; |
|
return; |
|
} |
|
|
|
if (pthread_mutex_unlock(&mutex_sigaction) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
# else |
# else |
Line 1811 instruction_write(struct_processus *s_et
|
Line 1853 instruction_write(struct_processus *s_et
|
return; |
return; |
} |
} |
} |
} |
|
|
if (sigaction(SIGPIPE, ®istre, NULL) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_signal; |
|
return; |
|
} |
|
} |
} |
else |
else |
{ // Sockets non connectées |
{ // Sockets non connectées |
Line 2292 instruction_wflock(struct_processus *s_e
|
Line 2328 instruction_wflock(struct_processus *s_e
|
return; |
return; |
} |
} |
|
|
# ifndef SEMAPHORES_NOMMES |
|
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
# endif |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
|
# ifndef SEMAPHORES_NOMMES |
|
while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) != 0) |
|
# endif |
|
{ |
|
if (errno != EINTR) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
} |
|
|
|
if (lock.l_type == F_UNLCK) |
if (lock.l_type == F_UNLCK) |
{ |
{ |
drapeau = d_vrai; |
drapeau = d_vrai; |
Line 2350 instruction_wflock(struct_processus *s_e
|
Line 2363 instruction_wflock(struct_processus *s_e
|
registre_instruction_valide; |
registre_instruction_valide; |
} |
} |
|
|
nanosleep(&attente, NULL); |
|
scrutation_injection(s_etat_processus); |
scrutation_injection(s_etat_processus); |
|
|
|
# ifndef SEMAPHORES_NOMMES |
|
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
# endif |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
|
nanosleep(&attente, NULL); |
|
|
INCR_GRANULARITE(attente.tv_nsec); |
INCR_GRANULARITE(attente.tv_nsec); |
|
|
|
# ifndef SEMAPHORES_NOMMES |
|
while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) != 0) |
|
# endif |
|
{ |
|
if (errno != EINTR) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
} |
} |
} |
} while((drapeau == d_faux) && ((*s_etat_processus) |
} while((drapeau == d_faux) && ((*s_etat_processus) |
.var_volatile_requete_arret != -1)); |
.var_volatile_requete_arret != -1)); |
Line 3892 instruction_wfswi(struct_processus *s_et
|
Line 3929 instruction_wfswi(struct_processus *s_et
|
} |
} |
else |
else |
{ |
{ |
|
# ifndef SEMAPHORES_NOMMES |
|
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
# endif |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
nanosleep(&attente, NULL); |
nanosleep(&attente, NULL); |
|
|
|
# ifndef SEMAPHORES_NOMMES |
|
while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) != 0) |
|
# endif |
|
{ |
|
if (errno != EINTR) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
} |
|
|
scrutation_injection(s_etat_processus); |
scrutation_injection(s_etat_processus); |
INCR_GRANULARITE(attente.tv_nsec); |
INCR_GRANULARITE(attente.tv_nsec); |
} |
} |