version 1.87, 2013/09/06 10:30:55
|
version 1.117, 2019/02/12 14:38:43
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.16 |
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 410 instruction_write(struct_processus *s_et
|
Line 410 instruction_write(struct_processus *s_et
|
integer8 recursivite; |
integer8 recursivite; |
|
|
logical1 format_degenere; |
logical1 format_degenere; |
|
logical1 format_oriente_ligne; |
logical1 mise_a_jour; |
logical1 mise_a_jour; |
|
|
|
|
sqlite3_stmt *ppStmt; |
sqlite3_stmt *ppStmt; |
|
|
ssize_t ios; |
ssize_t ios; |
Line 712 instruction_write(struct_processus *s_et
|
Line 712 instruction_write(struct_processus *s_et
|
|
|
free(chaine); |
free(chaine); |
|
|
if (alsprintf(&commande, "insert or replace into data " |
if (alsprintf(s_etat_processus, &commande, |
|
"insert or replace into data " |
"(id, data) values (%lld, '%s')", (*((integer8 *) |
"(id, data) values (%lld, '%s')", (*((integer8 *) |
(*s_objet_argument_2).objet)), chaine_utf8) < 0) |
(*s_objet_argument_2).objet)), chaine_utf8) < 0) |
{ |
{ |
Line 762 instruction_write(struct_processus *s_et
|
Line 763 instruction_write(struct_processus *s_et
|
|
|
// Récupération de la position de la clef |
// Récupération de la position de la clef |
|
|
if (alsprintf(&commande, "select key from control " |
if (alsprintf(s_etat_processus, &commande, |
"where id = 1") < 0) |
"select key from control where id = 1") < 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_allocation_memoire; |
d_es_allocation_memoire; |
Line 939 instruction_write(struct_processus *s_et
|
Line 940 instruction_write(struct_processus *s_et
|
|
|
// Récupération de l'identifiant de la clef |
// Récupération de l'identifiant de la clef |
|
|
if (alsprintf(&commande, "select id from key where key = " |
if (alsprintf(s_etat_processus, &commande, |
"'%s'", clef_utf8) < 0) |
"select id from key where key = '%s'", clef_utf8) < 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_allocation_memoire; |
d_es_allocation_memoire; |
Line 985 instruction_write(struct_processus *s_et
|
Line 986 instruction_write(struct_processus *s_et
|
|
|
free(commande); |
free(commande); |
|
|
if (alsprintf(&commande, "insert into key " |
if (alsprintf(s_etat_processus, &commande, |
"(key) values ('%s')", clef_utf8) < 0) |
"insert into key (key) values ('%s')", |
|
clef_utf8) < 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_allocation_memoire; |
d_es_allocation_memoire; |
Line 1019 instruction_write(struct_processus *s_et
|
Line 1021 instruction_write(struct_processus *s_et
|
|
|
free(commande); |
free(commande); |
|
|
if (alsprintf(&commande, "select id from key " |
if (alsprintf(s_etat_processus, &commande, |
"where key = '%s'", clef_utf8) < 0) |
"select id from key where key = '%s'", |
|
clef_utf8) < 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_allocation_memoire; |
d_es_allocation_memoire; |
Line 1083 instruction_write(struct_processus *s_et
|
Line 1086 instruction_write(struct_processus *s_et
|
|
|
if (mise_a_jour == d_vrai) |
if (mise_a_jour == d_vrai) |
{ |
{ |
if (alsprintf(&commande, "update key set key = '%s' where " |
if (alsprintf(s_etat_processus, &commande, |
"id = %lld", clef_utf8, id) < 0) |
"update key set key = '%s' where id = %lld", |
|
clef_utf8, id) < 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_allocation_memoire; |
d_es_allocation_memoire; |
Line 1119 instruction_write(struct_processus *s_et
|
Line 1123 instruction_write(struct_processus *s_et
|
|
|
// Effacement de l'enregistrement existant |
// Effacement de l'enregistrement existant |
|
|
if (alsprintf(&commande, "delete from data where " |
if (alsprintf(s_etat_processus, &commande, |
"key_id = %lld", id) < 0) |
"delete from data where key_id = %lld", id) < 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_allocation_memoire; |
d_es_allocation_memoire; |
Line 1254 instruction_write(struct_processus *s_et
|
Line 1258 instruction_write(struct_processus *s_et
|
|
|
free(chaine); |
free(chaine); |
|
|
if (alsprintf(&commande, "insert into data " |
if (alsprintf(s_etat_processus, &commande, |
"(data, key_id, sequence) values " |
"insert into data (data, key_id, sequence) values " |
"('%s', %lld, %lld)", chaine_utf8, id, ordre) < 0) |
"('%s', %lld, %lld)", chaine_utf8, id, ordre) < 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
Line 1494 instruction_write(struct_processus *s_et
|
Line 1498 instruction_write(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
if ((format_chaine = conversion_majuscule((unsigned char *) |
if ((format_chaine = conversion_majuscule(s_etat_processus, |
(*(*l_element_courant_format).donnee).objet)) |
(unsigned char *) (*(*l_element_courant_format) |
== NULL) |
.donnee).objet)) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_allocation_memoire; |
d_es_allocation_memoire; |
return; |
return; |
} |
} |
|
|
if (strncmp("LENGTH*(", format_chaine, 8) != 0) |
if (strcmp("LINE*(*)", format_chaine) == 0) |
{ |
{ |
free(format_chaine); |
format_oriente_ligne = d_vrai; |
|
format_degenere = d_vrai; |
liberation(s_etat_processus, s_objet_argument_2); |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_format_fichier; |
|
return; |
|
} |
} |
|
else |
longueur = (integer8) strlen(format_chaine); |
|
|
|
if (format_chaine[longueur - 1] != ')') |
|
{ |
{ |
free(format_chaine); |
format_oriente_ligne = d_faux; |
|
|
liberation(s_etat_processus, s_objet_argument_2); |
if (strncmp("LENGTH*(", format_chaine, 8) != 0) |
liberation(s_etat_processus, s_objet_argument_1); |
{ |
|
free(format_chaine); |
|
|
(*s_etat_processus).erreur_execution = |
liberation(s_etat_processus, s_objet_argument_2); |
d_ex_erreur_format_fichier; |
liberation(s_etat_processus, s_objet_argument_1); |
return; |
|
} |
|
|
|
format_chaine[longueur] = d_code_fin_chaine; |
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_format_fichier; |
|
return; |
|
} |
|
|
if (format_chaine[8] == '*') |
longueur = (integer8) strlen(format_chaine); |
{ |
|
format_degenere = d_vrai; |
|
} |
|
else |
|
{ |
|
// Détermination de la longueur |
|
format_degenere = d_faux; |
|
|
|
if (sscanf(&(format_chaine[8]), "%lld", &longueur) != 1) |
if (format_chaine[longueur - 1] != ')') |
{ |
{ |
free(format_chaine); |
free(format_chaine); |
|
|
Line 1551 instruction_write(struct_processus *s_et
|
Line 1541 instruction_write(struct_processus *s_et
|
d_ex_erreur_format_fichier; |
d_ex_erreur_format_fichier; |
return; |
return; |
} |
} |
|
|
|
format_chaine[longueur] = d_code_fin_chaine; |
|
|
|
if (format_chaine[8] == '*') |
|
{ |
|
format_degenere = d_vrai; |
|
} |
|
else |
|
{ |
|
// Détermination de la longueur |
|
format_degenere = d_faux; |
|
|
|
if (sscanf(&(format_chaine[8]), "%lld", &longueur) |
|
!= 1) |
|
{ |
|
free(format_chaine); |
|
|
|
liberation(s_etat_processus, |
|
s_objet_argument_2); |
|
liberation(s_etat_processus, |
|
s_objet_argument_1); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_format_fichier; |
|
return; |
|
} |
|
} |
} |
} |
|
|
free(format_chaine); |
free(format_chaine); |
Line 1592 instruction_write(struct_processus *s_et
|
Line 1609 instruction_write(struct_processus *s_et
|
|
|
free(chaine); |
free(chaine); |
|
|
|
if (format_oriente_ligne == d_vrai) |
|
{ |
|
if (fwrite("\n", 1, 1, (*descripteur).descripteur_c) |
|
!= 1) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_erreur_fichier; |
|
return; |
|
} |
|
} |
|
|
l_element_courant = (*l_element_courant).suivant; |
l_element_courant = (*l_element_courant).suivant; |
l_element_courant_format = (*l_element_courant_format) |
l_element_courant_format = (*l_element_courant_format) |
.suivant; |
.suivant; |
Line 1704 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 1737 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 1765 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 1783 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 2211 instruction_wflock(struct_processus *s_e
|
Line 2275 instruction_wflock(struct_processus *s_e
|
|
|
do |
do |
{ |
{ |
if ((chaine = conversion_majuscule((unsigned char *) |
if ((chaine = conversion_majuscule(s_etat_processus, |
(*s_objet_argument_1).objet)) == NULL) |
(unsigned char *) (*s_objet_argument_1).objet)) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 2518 instruction_wfproc(struct_processus *s_e
|
Line 2582 instruction_wfproc(struct_processus *s_e
|
{ |
{ |
if (envoi_signal_processus((*(*((struct_processus_fils *) |
if (envoi_signal_processus((*(*((struct_processus_fils *) |
(*(*l_element_courant).donnee).objet)).thread).pid, |
(*(*l_element_courant).donnee).objet)).thread).pid, |
rpl_signull) != 0) |
rpl_signull, d_faux) != 0) |
{ |
{ |
drapeau_fin = d_vrai; |
drapeau_fin = d_vrai; |
} |
} |
Line 3037 instruction_wfdata(struct_processus *s_e
|
Line 3101 instruction_wfdata(struct_processus *s_e
|
================================================================================ |
================================================================================ |
*/ |
*/ |
|
|
|
static inline logical1 |
|
options_sockets(struct_processus *s_etat_processus, struct_socket *s_socket) |
|
{ |
|
int drapeau; |
|
|
|
if (((*s_socket).options & (1 << d_BROADCAST)) != 0) |
|
{ |
|
if (setsockopt((*s_socket).socket, SOL_SOCKET, SO_BROADCAST, &drapeau, |
|
sizeof(drapeau)) != 0) |
|
{ |
|
return(d_erreur); |
|
} |
|
} |
|
|
|
if (((*s_socket).options & (1 << d_DONT_ROUTE)) != 0) |
|
{ |
|
if (setsockopt((*s_socket).socket, SOL_SOCKET, SO_DONTROUTE, &drapeau, |
|
sizeof(drapeau)) != 0) |
|
{ |
|
return(d_erreur); |
|
} |
|
} |
|
|
|
if (((*s_socket).options & (1 << d_KEEP_ALIVE)) != 0) |
|
{ |
|
if (setsockopt((*s_socket).socket, SOL_SOCKET, SO_KEEPALIVE, &drapeau, |
|
sizeof(drapeau)) != 0) |
|
{ |
|
return(d_erreur); |
|
} |
|
} |
|
|
|
# ifdef SO_PRIORITY |
|
if (((*s_socket).options & (1 << d_PRIORITY)) != 0) |
|
{ |
|
if (setsockopt((*s_socket).socket, SOL_SOCKET, SO_PRIORITY, |
|
&((*s_socket).priorite), sizeof((*s_socket).priorite)) != 0) |
|
{ |
|
return(d_erreur); |
|
} |
|
} |
|
# endif |
|
|
|
// Les deux options suivantes ne peuvent être positionnées simultanément. |
|
|
|
if (((*s_socket).options & (1 << d_RECEIVE_BUFFER)) != 0) |
|
{ |
|
if (setsockopt((*s_socket).socket, SOL_SOCKET, SO_RCVBUF, |
|
&((*s_socket).buffer_reception), |
|
sizeof((*s_socket).buffer_reception)) != 0) |
|
{ |
|
return(d_erreur); |
|
} |
|
} |
|
|
|
# ifdef SO_RCVBUFFORCE |
|
if (((*s_socket).options & (1 << d_FORCE_RECEIVE_BUFFER)) != 0) |
|
{ |
|
if (setsockopt((*s_socket).socket, SOL_SOCKET, SO_RCVBUFFORCE, |
|
&((*s_socket).buffer_reception), |
|
sizeof((*s_socket).buffer_reception)) != 0) |
|
{ |
|
return(d_erreur); |
|
} |
|
} |
|
# endif |
|
|
|
// Même remarque |
|
|
|
if (((*s_socket).options & (1 << d_SEND_BUFFER)) != 0) |
|
{ |
|
if (setsockopt((*s_socket).socket, SOL_SOCKET, SO_SNDBUF, |
|
&((*s_socket).buffer_emission), |
|
sizeof((*s_socket).buffer_emission)) != 0) |
|
{ |
|
return(d_erreur); |
|
} |
|
} |
|
|
|
# ifdef SO_SNDBUFFORCE |
|
if (((*s_socket).options & (1 << d_FORCE_SEND_BUFFER)) != 0) |
|
{ |
|
if (setsockopt((*s_socket).socket, SOL_SOCKET, SO_SNDBUFFORCE, |
|
&((*s_socket).buffer_emission), |
|
sizeof((*s_socket).buffer_emission)) != 0) |
|
{ |
|
return(d_erreur); |
|
} |
|
} |
|
# endif |
|
|
|
if (((*s_socket).options & (1 << d_RECEIVING_TIMEOUT)) != 0) |
|
{ |
|
if (setsockopt((*s_socket).socket, SOL_SOCKET, SO_RCVTIMEO, |
|
&((*s_socket).timeout_emission), |
|
sizeof((*s_socket).timeout_emission)) != 0) |
|
{ |
|
return(d_erreur); |
|
} |
|
} |
|
|
|
if (((*s_socket).options & (1 << d_SENDING_TIMEOUT)) != 0) |
|
{ |
|
if (setsockopt((*s_socket).socket, SOL_SOCKET, SO_SNDTIMEO, |
|
&((*s_socket).timeout_emission), |
|
sizeof((*s_socket).timeout_emission)) != 0) |
|
{ |
|
return(d_erreur); |
|
} |
|
} |
|
|
|
return(d_absence_erreur);; |
|
} |
|
|
|
|
void |
void |
instruction_wfsock(struct_processus *s_etat_processus) |
instruction_wfsock(struct_processus *s_etat_processus) |
{ |
{ |
Line 3058 instruction_wfsock(struct_processus *s_e
|
Line 3237 instruction_wfsock(struct_processus *s_e
|
struct sockaddr_in6 adresse_ipv6; |
struct sockaddr_in6 adresse_ipv6; |
# endif |
# endif |
|
|
unsigned long i; |
|
|
|
if ((*s_etat_processus).affichage_arguments == 'Y') |
if ((*s_etat_processus).affichage_arguments == 'Y') |
{ |
{ |
printf("\n WFSOCK "); |
printf("\n WFSOCK "); |
Line 3222 instruction_wfsock(struct_processus *s_e
|
Line 3399 instruction_wfsock(struct_processus *s_e
|
{ |
{ |
drapeau = d_vrai; |
drapeau = d_vrai; |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) |
!= 0) |
!= 0) |
# else |
# else |
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
# endif |
# endif |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
Line 3242 instruction_wfsock(struct_processus *s_e
|
Line 3419 instruction_wfsock(struct_processus *s_e
|
erreur = errno; |
erreur = errno; |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus) |
while(sem_wait(&((*s_etat_processus) |
.semaphore_fork)) != 0) |
.semaphore_fork)) != 0) |
# else |
# else |
while(sem_wait((*s_etat_processus).semaphore_fork) |
while(sem_wait((*s_etat_processus).semaphore_fork) |
!= 0) |
!= 0) |
# endif |
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
Line 3280 instruction_wfsock(struct_processus *s_e
|
Line 3457 instruction_wfsock(struct_processus *s_e
|
} |
} |
else |
else |
{ |
{ |
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus) |
while(sem_wait(&((*s_etat_processus) |
.semaphore_fork)) != 0) |
.semaphore_fork)) != 0) |
# else |
# else |
while(sem_wait((*s_etat_processus).semaphore_fork) |
while(sem_wait((*s_etat_processus).semaphore_fork) |
!= 0) |
!= 0) |
# endif |
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 3295 instruction_wfsock(struct_processus *s_e
|
Line 3472 instruction_wfsock(struct_processus *s_e
|
return; |
return; |
} |
} |
} |
} |
|
|
|
if (options_sockets(s_etat_processus, |
|
(*s_objet_resultat).objet) != d_absence_erreur) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument); |
|
liberation(s_etat_processus, s_objet_resultat); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return; |
|
} |
} |
} |
} while(drapeau == d_faux); |
} while(drapeau == d_faux); |
|
|
Line 3325 instruction_wfsock(struct_processus *s_e
|
Line 3513 instruction_wfsock(struct_processus *s_e
|
{ |
{ |
drapeau = d_vrai; |
drapeau = d_vrai; |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) |
!= 0) |
!= 0) |
# else |
# else |
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
# endif |
# endif |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
Line 3343 instruction_wfsock(struct_processus *s_e
|
Line 3531 instruction_wfsock(struct_processus *s_e
|
{ |
{ |
erreur = errno; |
erreur = errno; |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus) |
while(sem_wait(&((*s_etat_processus) |
.semaphore_fork)) != 0) |
.semaphore_fork)) != 0) |
# else |
# else |
while(sem_wait((*s_etat_processus).semaphore_fork) |
while(sem_wait((*s_etat_processus).semaphore_fork) |
!= 0) |
!= 0) |
# endif |
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 3382 instruction_wfsock(struct_processus *s_e
|
Line 3570 instruction_wfsock(struct_processus *s_e
|
} |
} |
else |
else |
{ |
{ |
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus) |
while(sem_wait(&((*s_etat_processus) |
.semaphore_fork)) != 0) |
.semaphore_fork)) != 0) |
# else |
# else |
while(sem_wait((*s_etat_processus).semaphore_fork) |
while(sem_wait((*s_etat_processus).semaphore_fork) |
!= 0) |
!= 0) |
# endif |
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 3397 instruction_wfsock(struct_processus *s_e
|
Line 3585 instruction_wfsock(struct_processus *s_e
|
return; |
return; |
} |
} |
} |
} |
|
|
|
if (options_sockets(s_etat_processus, |
|
(*s_objet_resultat).objet) != d_absence_erreur) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument); |
|
liberation(s_etat_processus, s_objet_resultat); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return; |
|
} |
} |
} |
} while(drapeau == d_faux); |
} while(drapeau == d_faux); |
|
|
if (((*((struct_socket *) (*s_objet_resultat).objet)) |
if (((*((struct_socket *) (*s_objet_resultat).objet)) |
.adresse_distante = malloc(55 * |
.adresse_distante = malloc(47 * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
Line 3409 instruction_wfsock(struct_processus *s_e
|
Line 3608 instruction_wfsock(struct_processus *s_e
|
return; |
return; |
} |
} |
|
|
(*((struct_socket *) (*s_objet_resultat).objet)) |
|
.adresse_distante = d_code_fin_chaine; |
|
|
|
for(i = 0; i < 16; i++) |
|
{ |
|
sprintf((*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse_distante, (i == 0) ? "%s%X" |
|
: "%s:%X", (*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse_distante, |
|
adresse_ipv6.sin6_addr.s6_addr[i]); |
|
} |
|
|
|
sprintf((*((struct_socket *) (*s_objet_resultat) |
sprintf((*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse_distante, "%s(%u)", |
|
(*((struct_socket *) (*s_objet_resultat) |
|
.objet)).adresse_distante, |
.objet)).adresse_distante, |
|
"%02X%02X:%02X%02X:%02X%02X:%02X%02X:" |
|
"%02X%02X:%02X%02X:%02X%02X:%02X%02X(%u)", |
|
adresse_ipv6.sin6_addr.s6_addr[0], |
|
adresse_ipv6.sin6_addr.s6_addr[1], |
|
adresse_ipv6.sin6_addr.s6_addr[2], |
|
adresse_ipv6.sin6_addr.s6_addr[3], |
|
adresse_ipv6.sin6_addr.s6_addr[4], |
|
adresse_ipv6.sin6_addr.s6_addr[5], |
|
adresse_ipv6.sin6_addr.s6_addr[6], |
|
adresse_ipv6.sin6_addr.s6_addr[7], |
|
adresse_ipv6.sin6_addr.s6_addr[8], |
|
adresse_ipv6.sin6_addr.s6_addr[9], |
|
adresse_ipv6.sin6_addr.s6_addr[10], |
|
adresse_ipv6.sin6_addr.s6_addr[11], |
|
adresse_ipv6.sin6_addr.s6_addr[12], |
|
adresse_ipv6.sin6_addr.s6_addr[13], |
|
adresse_ipv6.sin6_addr.s6_addr[14], |
|
adresse_ipv6.sin6_addr.s6_addr[15], |
ntohs(adresse_ipv6.sin6_port)); |
ntohs(adresse_ipv6.sin6_port)); |
# else |
# else |
if ((*s_etat_processus).langue == 'F') |
if ((*s_etat_processus).langue == 'F') |
Line 3447 instruction_wfsock(struct_processus *s_e
|
Line 3650 instruction_wfsock(struct_processus *s_e
|
{ |
{ |
drapeau = d_vrai; |
drapeau = d_vrai; |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) |
!= 0) |
!= 0) |
# else |
# else |
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
# endif |
# endif |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
Line 3465 instruction_wfsock(struct_processus *s_e
|
Line 3668 instruction_wfsock(struct_processus *s_e
|
{ |
{ |
erreur = errno; |
erreur = errno; |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus) |
while(sem_wait(&((*s_etat_processus) |
.semaphore_fork)) != 0) |
.semaphore_fork)) != 0) |
# else |
# else |
while(sem_wait((*s_etat_processus).semaphore_fork) |
while(sem_wait((*s_etat_processus).semaphore_fork) |
!= 0) |
!= 0) |
# endif |
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 3504 instruction_wfsock(struct_processus *s_e
|
Line 3707 instruction_wfsock(struct_processus *s_e
|
} |
} |
else |
else |
{ |
{ |
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus) |
while(sem_wait(&((*s_etat_processus) |
.semaphore_fork)) != 0) |
.semaphore_fork)) != 0) |
# else |
# else |
while(sem_wait((*s_etat_processus).semaphore_fork) |
while(sem_wait((*s_etat_processus).semaphore_fork) |
!= 0) |
!= 0) |
# endif |
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 3519 instruction_wfsock(struct_processus *s_e
|
Line 3722 instruction_wfsock(struct_processus *s_e
|
return; |
return; |
} |
} |
} |
} |
|
|
|
if (options_sockets(s_etat_processus, |
|
(*s_objet_resultat).objet) != d_absence_erreur) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument); |
|
liberation(s_etat_processus, s_objet_resultat); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_parametre_fichier; |
|
return; |
|
} |
} |
} |
} while(drapeau == d_faux); |
} while(drapeau == d_faux); |
} |
} |