version 1.8, 2010/03/08 14:28:20
|
version 1.14, 2010/05/24 10:58:36
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.12 |
RPL/2 (R) version 4.0.16 |
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 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 462 instruction_write(struct_processus *s_et
|
Line 474 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 698 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 742 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 756 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 776 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 904 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 913 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 935 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 945 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 955 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 962 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 969 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 979 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 989 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 996 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 1006 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 1014 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 1022 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 1041 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 1050 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 1057 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 1064 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 1077 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 1086 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 1185 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 1212 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 1221 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 1228 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 1235 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 1376 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 1403 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 1427 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 1511 instruction_write(struct_processus *s_et
|
Line 1483 instruction_write(struct_processus *s_et
|
108); |
108); |
adresse_unix.sun_path[108 - 1] = d_code_fin_chaine; |
adresse_unix.sun_path[108 - 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 1523 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 1554 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 1595 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 1635 instruction_write(struct_processus *s_et
|
Line 1642 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 1683 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 1870 instruction_wflock(struct_processus *s_e
|
Line 1895 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 2222 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 2493 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 2636 instruction_wfsock(struct_processus *s_e
|
Line 2697 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 2718 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 2754 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 2718 instruction_wfsock(struct_processus *s_e
|
Line 2795 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 2731 instruction_wfsock(struct_processus *s_e
|
Line 2816 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 2852 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 2808 instruction_wfsock(struct_processus *s_e
|
Line 2901 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 2921 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 2957 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 3247 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 3409 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) |
{ |
{ |