version 1.8, 2010/03/08 14:28:20
|
version 1.25, 2010/08/17 11:59:28
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.12 |
RPL/2 (R) version 4.0.18 |
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 20
|
Line 20
|
*/ |
*/ |
|
|
|
|
#include "rpl.conv.h" |
#include "rpl-conv.h" |
|
|
|
|
/* |
/* |
Line 124 instruction_while(struct_processus *s_et
|
Line 124 instruction_while(struct_processus *s_et
|
void |
void |
instruction_warranty(struct_processus *s_etat_processus) |
instruction_warranty(struct_processus *s_etat_processus) |
{ |
{ |
# include "garanties.conv.h" |
# include "garanties-conv.h" |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
|
|
Line 262 instruction_wait(struct_processus *s_eta
|
Line 262 instruction_wait(struct_processus *s_eta
|
|
|
do |
do |
{ |
{ |
|
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
# endif |
|
|
code_retour = nanosleep(&temporisation, &temporisation); |
code_retour = nanosleep(&temporisation, &temporisation); |
erreur = errno; |
erreur = errno; |
|
|
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 408 instruction_write(struct_processus *s_et
|
Line 420 instruction_write(struct_processus *s_et
|
struct sigaction registre; |
struct sigaction registre; |
|
|
struct sockaddr_in adresse_ipv4; |
struct sockaddr_in adresse_ipv4; |
|
# ifdef IPV6 |
struct sockaddr_in6 adresse_ipv6; |
struct sockaddr_in6 adresse_ipv6; |
|
# endif |
struct sockaddr_un adresse_unix; |
struct sockaddr_un adresse_unix; |
|
|
struct flock lock; |
struct flock lock; |
Line 462 instruction_write(struct_processus *s_et
|
Line 476 instruction_write(struct_processus *s_et
|
if ((*(*(*s_etat_processus).l_base_pile).donnee).type == FCH) |
if ((*(*(*s_etat_processus).l_base_pile).donnee).type == FCH) |
{ |
{ |
if ((*((struct_fichier *) (*(*(*s_etat_processus).l_base_pile) |
if ((*((struct_fichier *) (*(*(*s_etat_processus).l_base_pile) |
.donnee).objet)).acces == 'S') |
.donnee).objet)).acces == 'D') |
{ |
{ |
if (empilement_pile_last(s_etat_processus, 2) == d_erreur) |
if (empilement_pile_last(s_etat_processus, 3) == d_erreur) |
{ |
{ |
return; |
return; |
} |
} |
} |
} |
else |
else |
{ |
{ |
if (empilement_pile_last(s_etat_processus, 3) == d_erreur) |
if (empilement_pile_last(s_etat_processus, 2) == d_erreur) |
{ |
{ |
return; |
return; |
} |
} |
Line 686 instruction_write(struct_processus *s_et
|
Line 700 instruction_write(struct_processus *s_et
|
"(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) |
{ |
{ |
free(chaine_utf8); |
(*s_etat_processus).erreur_systeme = |
liberation(s_etat_processus, s_objet_argument_3); |
d_es_allocation_memoire; |
liberation(s_etat_processus, s_objet_argument_2); |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
|
|
return; |
return; |
} |
} |
|
|
Line 733 instruction_write(struct_processus *s_et
|
Line 744 instruction_write(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
// Récupération de la valeur de la clef |
// Récupération de la position de la clef |
|
|
if (alsprintf(&commande, "select key from control " |
if (alsprintf(&commande, "select key from control " |
"where id = 1") < 0) |
"where id = 1") < 0) |
{ |
{ |
liberation(s_etat_processus, s_objet_argument_2); |
(*s_etat_processus).erreur_systeme = |
liberation(s_etat_processus, s_objet_argument_1); |
d_es_allocation_memoire; |
|
|
return; |
return; |
} |
} |
|
|
Line 748 instruction_write(struct_processus *s_et
|
Line 758 instruction_write(struct_processus *s_et
|
commande, strlen(commande), &ppStmt, &queue) |
commande, strlen(commande), &ppStmt, &queue) |
!= SQLITE_OK) |
!= SQLITE_OK) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
d_es_erreur_fichier; |
|
return; |
return; |
} |
} |
|
|
if (sqlite3_step(ppStmt) != SQLITE_ROW) |
if (sqlite3_step(ppStmt) != SQLITE_ROW) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
d_es_erreur_fichier; |
|
return; |
return; |
} |
} |
|
|
if (sqlite3_column_type(ppStmt, 0) != SQLITE_INTEGER) |
if (sqlite3_column_type(ppStmt, 0) != SQLITE_INTEGER) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
d_es_erreur_fichier; |
|
return; |
return; |
} |
} |
|
|
Line 771 instruction_write(struct_processus *s_et
|
Line 778 instruction_write(struct_processus *s_et
|
|
|
if (sqlite3_step(ppStmt) != SQLITE_DONE) |
if (sqlite3_step(ppStmt) != SQLITE_DONE) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
d_es_erreur_fichier; |
|
return; |
return; |
} |
} |
|
|
if (sqlite3_finalize(ppStmt) != SQLITE_OK) |
if (sqlite3_finalize(ppStmt) != SQLITE_OK) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
d_es_erreur_fichier; |
|
return; |
return; |
} |
} |
|
|
Line 901 instruction_write(struct_processus *s_et
|
Line 906 instruction_write(struct_processus *s_et
|
if (alsprintf(&commande, "select id from key where key = " |
if (alsprintf(&commande, "select id from key where key = " |
"'%s'", clef_utf8) < 0) |
"'%s'", clef_utf8) < 0) |
{ |
{ |
free(clef_utf8); |
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
liberation(s_etat_processus, s_objet_argument_2); |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
|
|
return; |
return; |
} |
} |
|
|
Line 913 instruction_write(struct_processus *s_et
|
Line 915 instruction_write(struct_processus *s_et
|
commande, strlen(commande), &ppStmt, &queue) |
commande, strlen(commande), &ppStmt, &queue) |
!= SQLITE_OK) |
!= SQLITE_OK) |
{ |
{ |
free(clef_utf8); |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
(*s_etat_processus).erreur_systeme = |
|
d_es_erreur_fichier; |
|
return; |
return; |
} |
} |
|
|
Line 937 instruction_write(struct_processus *s_et
|
Line 937 instruction_write(struct_processus *s_et
|
|
|
if (sqlite3_finalize(ppStmt) != SQLITE_OK) |
if (sqlite3_finalize(ppStmt) != SQLITE_OK) |
{ |
{ |
free(clef_utf8); |
|
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_erreur_fichier; |
d_es_erreur_fichier; |
return; |
return; |
Line 948 instruction_write(struct_processus *s_et
|
Line 947 instruction_write(struct_processus *s_et
|
if (alsprintf(&commande, "insert into key " |
if (alsprintf(&commande, "insert into key " |
"(key) values ('%s')", clef_utf8) < 0) |
"(key) values ('%s')", clef_utf8) < 0) |
{ |
{ |
free(clef_utf8); |
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
liberation(s_etat_processus, s_objet_argument_2); |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
|
|
return; |
return; |
} |
} |
|
|
Line 961 instruction_write(struct_processus *s_et
|
Line 957 instruction_write(struct_processus *s_et
|
commande, strlen(commande), &ppStmt, &queue) |
commande, strlen(commande), &ppStmt, &queue) |
!= SQLITE_OK) |
!= SQLITE_OK) |
{ |
{ |
free(clef_utf8); |
|
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_erreur_fichier; |
d_es_erreur_fichier; |
return; |
return; |
Line 969 instruction_write(struct_processus *s_et
|
Line 964 instruction_write(struct_processus *s_et
|
|
|
if (sqlite3_step(ppStmt) != SQLITE_DONE) |
if (sqlite3_step(ppStmt) != SQLITE_DONE) |
{ |
{ |
free(clef_utf8); |
|
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_erreur_fichier; |
d_es_erreur_fichier; |
return; |
return; |
Line 977 instruction_write(struct_processus *s_et
|
Line 971 instruction_write(struct_processus *s_et
|
|
|
if (sqlite3_finalize(ppStmt) != SQLITE_OK) |
if (sqlite3_finalize(ppStmt) != SQLITE_OK) |
{ |
{ |
free(clef_utf8); |
|
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_erreur_fichier; |
d_es_erreur_fichier; |
return; |
return; |
Line 988 instruction_write(struct_processus *s_et
|
Line 981 instruction_write(struct_processus *s_et
|
if (alsprintf(&commande, "select id from key " |
if (alsprintf(&commande, "select id from key " |
"where key = '%s'", clef_utf8) < 0) |
"where key = '%s'", clef_utf8) < 0) |
{ |
{ |
free(clef_utf8); |
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
liberation(s_etat_processus, s_objet_argument_2); |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
|
|
return; |
return; |
} |
} |
|
|
Line 1001 instruction_write(struct_processus *s_et
|
Line 991 instruction_write(struct_processus *s_et
|
commande, strlen(commande), &ppStmt, &queue) |
commande, strlen(commande), &ppStmt, &queue) |
!= SQLITE_OK) |
!= SQLITE_OK) |
{ |
{ |
free(clef_utf8); |
|
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_erreur_fichier; |
d_es_erreur_fichier; |
return; |
return; |
Line 1009 instruction_write(struct_processus *s_et
|
Line 998 instruction_write(struct_processus *s_et
|
|
|
if (sqlite3_step(ppStmt) != SQLITE_ROW) |
if (sqlite3_step(ppStmt) != SQLITE_ROW) |
{ |
{ |
free(clef_utf8); |
|
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_erreur_fichier; |
d_es_erreur_fichier; |
return; |
return; |
Line 1020 instruction_write(struct_processus *s_et
|
Line 1008 instruction_write(struct_processus *s_et
|
|
|
default: |
default: |
{ |
{ |
free(clef_utf8); |
|
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_erreur_fichier; |
d_es_erreur_fichier; |
return; |
return; |
Line 1029 instruction_write(struct_processus *s_et
|
Line 1016 instruction_write(struct_processus *s_et
|
|
|
if (sqlite3_column_type(ppStmt, 0) != SQLITE_INTEGER) |
if (sqlite3_column_type(ppStmt, 0) != SQLITE_INTEGER) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
d_es_erreur_fichier; |
|
return; |
return; |
} |
} |
|
|
Line 1038 instruction_write(struct_processus *s_et
|
Line 1024 instruction_write(struct_processus *s_et
|
|
|
if (sqlite3_step(ppStmt) != SQLITE_DONE) |
if (sqlite3_step(ppStmt) != SQLITE_DONE) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
d_es_erreur_fichier; |
|
return; |
return; |
} |
} |
|
|
if (sqlite3_finalize(ppStmt) != SQLITE_OK) |
if (sqlite3_finalize(ppStmt) != SQLITE_OK) |
{ |
{ |
free(clef_utf8); |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
(*s_etat_processus).erreur_systeme = |
|
d_es_erreur_fichier; |
|
return; |
return; |
} |
} |
|
|
Line 1060 instruction_write(struct_processus *s_et
|
Line 1043 instruction_write(struct_processus *s_et
|
if (alsprintf(&commande, "update key set key = '%s' where " |
if (alsprintf(&commande, "update key set key = '%s' where " |
"id = %lld", clef_utf8, id) < 0) |
"id = %lld", clef_utf8, id) < 0) |
{ |
{ |
free(clef_utf8); |
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
liberation(s_etat_processus, s_objet_argument_2); |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
|
|
return; |
return; |
} |
} |
|
|
Line 1072 instruction_write(struct_processus *s_et
|
Line 1052 instruction_write(struct_processus *s_et
|
commande, strlen(commande), &ppStmt, &queue) |
commande, strlen(commande), &ppStmt, &queue) |
!= SQLITE_OK) |
!= SQLITE_OK) |
{ |
{ |
free(clef_utf8); |
|
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_erreur_fichier; |
d_es_erreur_fichier; |
return; |
return; |
Line 1080 instruction_write(struct_processus *s_et
|
Line 1059 instruction_write(struct_processus *s_et
|
|
|
if (sqlite3_step(ppStmt) != SQLITE_DONE) |
if (sqlite3_step(ppStmt) != SQLITE_DONE) |
{ |
{ |
free(clef_utf8); |
|
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_erreur_fichier; |
d_es_erreur_fichier; |
return; |
return; |
Line 1088 instruction_write(struct_processus *s_et
|
Line 1066 instruction_write(struct_processus *s_et
|
|
|
if (sqlite3_finalize(ppStmt) != SQLITE_OK) |
if (sqlite3_finalize(ppStmt) != SQLITE_OK) |
{ |
{ |
free(clef_utf8); |
|
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_erreur_fichier; |
d_es_erreur_fichier; |
return; |
return; |
Line 1102 instruction_write(struct_processus *s_et
|
Line 1079 instruction_write(struct_processus *s_et
|
if (alsprintf(&commande, "delete from data where " |
if (alsprintf(&commande, "delete from data where " |
"key_id = %lld", id) < 0) |
"key_id = %lld", id) < 0) |
{ |
{ |
free(clef_utf8); |
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
liberation(s_etat_processus, s_objet_argument_2); |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
|
|
return; |
return; |
} |
} |
|
|
Line 1114 instruction_write(struct_processus *s_et
|
Line 1088 instruction_write(struct_processus *s_et
|
commande, strlen(commande), &ppStmt, &queue) |
commande, strlen(commande), &ppStmt, &queue) |
!= SQLITE_OK) |
!= SQLITE_OK) |
{ |
{ |
free(clef_utf8); |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
(*s_etat_processus).erreur_systeme = |
|
d_es_erreur_fichier; |
|
return; |
return; |
} |
} |
|
|
if (sqlite3_step(ppStmt) != SQLITE_DONE) |
if (sqlite3_step(ppStmt) != SQLITE_DONE) |
{ |
{ |
free(clef_utf8); |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
(*s_etat_processus).erreur_systeme = |
|
d_es_erreur_fichier; |
|
return; |
return; |
} |
} |
|
|
if (sqlite3_finalize(ppStmt) != SQLITE_OK) |
if (sqlite3_finalize(ppStmt) != SQLITE_OK) |
{ |
{ |
free(clef_utf8); |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
(*s_etat_processus).erreur_systeme = |
|
d_es_erreur_fichier; |
|
return; |
return; |
} |
} |
|
|
Line 1219 instruction_write(struct_processus *s_et
|
Line 1187 instruction_write(struct_processus *s_et
|
'F', &longueur_effective, &recursivite)) == NULL) |
'F', &longueur_effective, &recursivite)) == NULL) |
{ |
{ |
free(clef_utf8); |
free(clef_utf8); |
|
|
liberation(s_etat_processus, s_element); |
liberation(s_etat_processus, s_element); |
liberation(s_etat_processus, s_format); |
liberation(s_etat_processus, s_format); |
liberation(s_etat_processus, s_objet_argument_2); |
liberation(s_etat_processus, s_objet_argument_2); |
Line 1245 instruction_write(struct_processus *s_et
|
Line 1214 instruction_write(struct_processus *s_et
|
"(data, key_id, sequence) values " |
"(data, key_id, sequence) values " |
"('%s', %lld, %lld)", chaine_utf8, id, ordre) < 0) |
"('%s', %lld, %lld)", chaine_utf8, id, ordre) < 0) |
{ |
{ |
free(chaine_utf8); |
(*s_etat_processus).erreur_systeme = |
free(clef_utf8); |
d_es_allocation_memoire; |
liberation(s_etat_processus, s_objet_argument_2); |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
|
|
return; |
return; |
} |
} |
|
|
Line 1257 instruction_write(struct_processus *s_et
|
Line 1223 instruction_write(struct_processus *s_et
|
commande, strlen(commande), &ppStmt, &queue) |
commande, strlen(commande), &ppStmt, &queue) |
!= SQLITE_OK) |
!= SQLITE_OK) |
{ |
{ |
free(clef_utf8); |
|
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_erreur_fichier; |
d_es_erreur_fichier; |
return; |
return; |
Line 1265 instruction_write(struct_processus *s_et
|
Line 1230 instruction_write(struct_processus *s_et
|
|
|
if (sqlite3_step(ppStmt) != SQLITE_DONE) |
if (sqlite3_step(ppStmt) != SQLITE_DONE) |
{ |
{ |
free(clef_utf8); |
|
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_erreur_fichier; |
d_es_erreur_fichier; |
return; |
return; |
Line 1273 instruction_write(struct_processus *s_et
|
Line 1237 instruction_write(struct_processus *s_et
|
|
|
if (sqlite3_finalize(ppStmt) != SQLITE_OK) |
if (sqlite3_finalize(ppStmt) != SQLITE_OK) |
{ |
{ |
free(clef_utf8); |
|
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_erreur_fichier; |
d_es_erreur_fichier; |
return; |
return; |
Line 1415 instruction_write(struct_processus *s_et
|
Line 1378 instruction_write(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
if (sem_post(&((*s_etat_processus).semaphore_fork)) |
# ifndef SEMAPHORES_NOMMES |
!= 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
# endif |
{ |
{ |
if (sigaction(SIGPIPE, ®istre, NULL) != 0) |
if (sigaction(SIGPIPE, ®istre, NULL) != 0) |
{ |
{ |
Line 1439 instruction_write(struct_processus *s_et
|
Line 1405 instruction_write(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 1459 instruction_write(struct_processus *s_et
|
Line 1429 instruction_write(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 1508 instruction_write(struct_processus *s_et
|
Line 1482 instruction_write(struct_processus *s_et
|
adresse_unix.sun_family = AF_UNIX; |
adresse_unix.sun_family = AF_UNIX; |
strncpy(adresse_unix.sun_path, (*((struct_socket *) |
strncpy(adresse_unix.sun_path, (*((struct_socket *) |
(*s_objet_argument_1).objet)).adresse_distante, |
(*s_objet_argument_1).objet)).adresse_distante, |
108); |
UNIX_PATH_MAX); |
adresse_unix.sun_path[108 - 1] = d_code_fin_chaine; |
adresse_unix.sun_path[UNIX_PATH_MAX - 1] = |
|
d_code_fin_chaine; |
|
|
|
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
# endif |
|
|
if (sendto((*((struct_socket *) |
if (sendto((*((struct_socket *) |
(*s_objet_argument_1).objet)).socket, chaine, |
(*s_objet_argument_1).objet)).socket, chaine, |
strlen(chaine), 0, (struct sockaddr *) |
strlen(chaine), 0, (struct sockaddr *) |
&adresse_unix, sizeof(adresse_unix)) < 0) |
&adresse_unix, sizeof(adresse_unix)) < 0) |
{ |
{ |
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus) |
while(sem_wait(&((*s_etat_processus) |
.semaphore_fork)) == -1) |
.semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus) |
|
.semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 1538 instruction_write(struct_processus *s_et
|
Line 1526 instruction_write(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 1565 instruction_write(struct_processus *s_et
|
Line 1557 instruction_write(struct_processus *s_et
|
adresse_ipv4.sin_port = htons(port); |
adresse_ipv4.sin_port = htons(port); |
adresse_ipv4.sin_addr.s_addr = htonl(calcul_adresse); |
adresse_ipv4.sin_addr.s_addr = htonl(calcul_adresse); |
|
|
|
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus) |
if (sem_post(&((*s_etat_processus) |
.semaphore_fork)) != 0) |
.semaphore_fork)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# else |
|
if (sem_post((*s_etat_processus) .semaphore_fork) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
# endif |
|
|
if (sendto((*((struct_socket *) |
if (sendto((*((struct_socket *) |
(*s_objet_argument_1).objet)).socket, chaine, |
(*s_objet_argument_1).objet)).socket, chaine, |
strlen(chaine), 0, (struct sockaddr *) |
strlen(chaine), 0, (struct sockaddr *) |
&adresse_ipv4, sizeof(adresse_ipv4)) < 0) |
&adresse_ipv4, sizeof(adresse_ipv4)) < 0) |
{ |
{ |
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus) |
while(sem_wait(&((*s_etat_processus) |
.semaphore_fork)) == -1) |
.semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus) |
|
.semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 1593 instruction_write(struct_processus *s_et
|
Line 1598 instruction_write(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus) |
while(sem_wait(&((*s_etat_processus) |
.semaphore_fork)) == -1) |
.semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus) |
|
.semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 1627 instruction_write(struct_processus *s_et
|
Line 1637 instruction_write(struct_processus *s_et
|
&(adresse[12]), &(adresse[13]), &(adresse[14]), |
&(adresse[12]), &(adresse[13]), &(adresse[14]), |
&(adresse[15]), &port)== 17) |
&(adresse[15]), &port)== 17) |
{ // Adresse IPv6 |
{ // Adresse IPv6 |
|
# ifdef IPV6 |
memset(&adresse_ipv6, 0, sizeof(adresse_ipv6)); |
memset(&adresse_ipv6, 0, sizeof(adresse_ipv6)); |
adresse_ipv6.sin6_family = AF_INET6; |
adresse_ipv6.sin6_family = AF_INET6; |
adresse_ipv6.sin6_port = htons((uint16_t) port); |
adresse_ipv6.sin6_port = htons((uint16_t) port); |
Line 1635 instruction_write(struct_processus *s_et
|
Line 1646 instruction_write(struct_processus *s_et
|
adresse_ipv6.sin6_addr.s6_addr[i] = |
adresse_ipv6.sin6_addr.s6_addr[i] = |
adresse[i], i++); |
adresse[i], i++); |
|
|
|
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus) |
if (sem_post(&((*s_etat_processus) |
.semaphore_fork)) != 0) |
.semaphore_fork)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# else |
|
if (sem_post((*s_etat_processus) .semaphore_fork) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
# endif |
|
|
if (sendto((*((struct_socket *) |
if (sendto((*((struct_socket *) |
(*s_objet_argument_1).objet)).socket, chaine, |
(*s_objet_argument_1).objet)).socket, chaine, |
strlen(chaine), 0, (struct sockaddr *) |
strlen(chaine), 0, (struct sockaddr *) |
&adresse_ipv6, sizeof(adresse_ipv6)) < 0) |
&adresse_ipv6, sizeof(adresse_ipv6)) < 0) |
{ |
{ |
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus) |
while(sem_wait(&((*s_etat_processus) |
.semaphore_fork)) == -1) |
.semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus) |
|
.semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 1663 instruction_write(struct_processus *s_et
|
Line 1687 instruction_write(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus) |
while(sem_wait(&((*s_etat_processus) |
.semaphore_fork)) == -1) |
.semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus) |
|
.semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 1673 instruction_write(struct_processus *s_et
|
Line 1702 instruction_write(struct_processus *s_et
|
return; |
return; |
} |
} |
} |
} |
|
# else |
|
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
printf("+++Attention : Support du protocole" |
|
" IPv6 indisponible\n"); |
|
} |
|
else |
|
{ |
|
printf("+++Warning : IPv6 support " |
|
"unavailable\n"); |
|
} |
|
# endif |
} |
} |
else |
else |
{ |
{ |
Line 1870 instruction_wflock(struct_processus *s_e
|
Line 1911 instruction_wflock(struct_processus *s_e
|
return; |
return; |
} |
} |
|
|
|
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
# endif |
|
|
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 2185 instruction_wfproc(struct_processus *s_e
|
Line 2238 instruction_wfproc(struct_processus *s_e
|
registre_instruction_valide; |
registre_instruction_valide; |
} |
} |
|
|
|
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
# endif |
|
|
nanosleep(&attente, NULL); |
nanosleep(&attente, NULL); |
|
|
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 2444 instruction_wfdata(struct_processus *s_e
|
Line 2509 instruction_wfdata(struct_processus *s_e
|
return; |
return; |
} |
} |
|
|
|
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
# endif |
|
|
nanosleep(&attente, NULL); |
nanosleep(&attente, NULL); |
|
|
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 2562 instruction_wfsock(struct_processus *s_e
|
Line 2639 instruction_wfsock(struct_processus *s_e
|
struct_objet *s_objet_resultat; |
struct_objet *s_objet_resultat; |
|
|
struct sockaddr_in adresse_ipv4; |
struct sockaddr_in adresse_ipv4; |
|
# ifdef IPV6 |
struct sockaddr_in6 adresse_ipv6; |
struct sockaddr_in6 adresse_ipv6; |
|
# endif |
|
|
unsigned long i; |
unsigned long i; |
|
|
Line 2636 instruction_wfsock(struct_processus *s_e
|
Line 2715 instruction_wfsock(struct_processus *s_e
|
{ |
{ |
drapeau = d_vrai; |
drapeau = d_vrai; |
|
|
|
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
# endif |
|
|
if (((*((struct_socket *) (*s_objet_resultat).objet)).socket = |
if (((*((struct_socket *) (*s_objet_resultat).objet)).socket = |
accept((*((struct_socket *) (*s_objet_argument).objet)) |
accept((*((struct_socket *) (*s_objet_argument).objet)) |
Line 2649 instruction_wfsock(struct_processus *s_e
|
Line 2736 instruction_wfsock(struct_processus *s_e
|
{ |
{ |
erreur = errno; |
erreur = errno; |
|
|
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 2681 instruction_wfsock(struct_processus *s_e
|
Line 2772 instruction_wfsock(struct_processus *s_e
|
} |
} |
else |
else |
{ |
{ |
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 2712 instruction_wfsock(struct_processus *s_e
|
Line 2807 instruction_wfsock(struct_processus *s_e
|
else if ((*((struct_socket *) (*s_objet_resultat).objet)).domaine == |
else if ((*((struct_socket *) (*s_objet_resultat).objet)).domaine == |
PF_INET6) |
PF_INET6) |
{ |
{ |
|
# ifdef IPV6 |
longueur = sizeof(adresse_ipv6); |
longueur = sizeof(adresse_ipv6); |
|
|
do |
do |
{ |
{ |
drapeau = d_vrai; |
drapeau = d_vrai; |
|
|
|
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
# endif |
|
|
if (((*((struct_socket *) (*s_objet_resultat).objet)).socket = |
if (((*((struct_socket *) (*s_objet_resultat).objet)).socket = |
accept((*((struct_socket *) (*s_objet_argument).objet)) |
accept((*((struct_socket *) (*s_objet_argument).objet)) |
Line 2731 instruction_wfsock(struct_processus *s_e
|
Line 2835 instruction_wfsock(struct_processus *s_e
|
{ |
{ |
erreur = errno; |
erreur = errno; |
|
|
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 2763 instruction_wfsock(struct_processus *s_e
|
Line 2871 instruction_wfsock(struct_processus *s_e
|
} |
} |
else |
else |
{ |
{ |
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 2799 instruction_wfsock(struct_processus *s_e
|
Line 2911 instruction_wfsock(struct_processus *s_e
|
.objet)).adresse_distante, "%s(%u)", |
.objet)).adresse_distante, "%s(%u)", |
(*((struct_socket *) (*s_objet_resultat) |
(*((struct_socket *) (*s_objet_resultat) |
.objet)).adresse_distante, ntohs(adresse_ipv6.sin6_port)); |
.objet)).adresse_distante, ntohs(adresse_ipv6.sin6_port)); |
|
# else |
|
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
printf("+++Attention : Support du protocole" |
|
" IPv6 indisponible\n"); |
|
} |
|
else |
|
{ |
|
printf("+++Warning : IPv6 support " |
|
"unavailable\n"); |
|
} |
|
# endif |
} |
} |
else |
else |
{ |
{ |
Line 2808 instruction_wfsock(struct_processus *s_e
|
Line 2932 instruction_wfsock(struct_processus *s_e
|
{ |
{ |
drapeau = d_vrai; |
drapeau = d_vrai; |
|
|
|
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
# endif |
|
|
if (((*((struct_socket *) (*s_objet_resultat).objet)).socket = |
if (((*((struct_socket *) (*s_objet_resultat).objet)).socket = |
accept((*((struct_socket *) (*s_objet_argument).objet)) |
accept((*((struct_socket *) (*s_objet_argument).objet)) |
Line 2820 instruction_wfsock(struct_processus *s_e
|
Line 2952 instruction_wfsock(struct_processus *s_e
|
{ |
{ |
erreur = errno; |
erreur = errno; |
|
|
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 2852 instruction_wfsock(struct_processus *s_e
|
Line 2988 instruction_wfsock(struct_processus *s_e
|
} |
} |
else |
else |
{ |
{ |
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 3138 instruction_wfpoke(struct_processus *s_e
|
Line 3278 instruction_wfpoke(struct_processus *s_e
|
|
|
do |
do |
{ |
{ |
|
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
# endif |
|
|
nanosleep(&attente, NULL); |
nanosleep(&attente, NULL); |
|
|
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
Line 3288 instruction_wfack(struct_processus *s_et
|
Line 3440 instruction_wfack(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
|
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
# endif |
|
|
nanosleep(&attente, NULL); |
nanosleep(&attente, NULL); |
INCR_GRANULARITE(attente.tv_nsec); |
INCR_GRANULARITE(attente.tv_nsec); |
|
|
|
# ifndef SEMAPHORES_NOMMES |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) == -1) |
|
# endif |
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |