version 1.70, 2012/12/21 12:09:50
|
version 1.123, 2021/12/09 22:44:59
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.12 |
RPL/2 (R) version 4.1.33 |
Copyright (C) 1989-2012 Dr. BERTRAND Joël |
Copyright (C) 1989-2021 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 245 instruction_wait(struct_processus *s_eta
|
Line 245 instruction_wait(struct_processus *s_eta
|
return; |
return; |
} |
} |
|
|
temporisation.tv_sec = (long) floor((double) attente); |
temporisation.tv_sec = (time_t) floor((double) attente); |
temporisation.tv_nsec = (attente - temporisation.tv_sec) * |
temporisation.tv_nsec = (long) ((attente - |
(long) 1000000000; |
((real8) temporisation.tv_sec)) * (integer8) 1000000000); |
|
|
if ((*s_etat_processus).profilage == d_vrai) |
if ((*s_etat_processus).profilage == d_vrai) |
{ |
{ |
Line 289 instruction_wait(struct_processus *s_eta
|
Line 289 instruction_wait(struct_processus *s_eta
|
|
|
scrutation_injection(s_etat_processus); |
scrutation_injection(s_etat_processus); |
|
|
|
if (pthread_mutex_lock(&(*s_etat_processus).mutex_interruptions) |
|
!= 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
if ((*s_etat_processus).nombre_interruptions_non_affectees != 0) |
if ((*s_etat_processus).nombre_interruptions_non_affectees != 0) |
{ |
{ |
affectation_interruptions_logicielles(s_etat_processus); |
affectation_interruptions_logicielles(s_etat_processus); |
} |
} |
|
|
|
if (pthread_mutex_unlock(&(*s_etat_processus).mutex_interruptions) |
|
!= 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
if ((*s_etat_processus).nombre_interruptions_en_queue != 0) |
if ((*s_etat_processus).nombre_interruptions_en_queue != 0) |
{ |
{ |
traitement_interruptions_logicielles(s_etat_processus); |
traitement_interruptions_logicielles(s_etat_processus); |
Line 390 instruction_write(struct_processus *s_et
|
Line 404 instruction_write(struct_processus *s_et
|
integer8 clef; |
integer8 clef; |
integer8 compteur; |
integer8 compteur; |
integer8 id; |
integer8 id; |
|
integer8 longueur; |
|
integer8 longueur_effective; |
integer8 ordre; |
integer8 ordre; |
|
integer8 recursivite; |
|
|
logical1 format_degenere; |
logical1 format_degenere; |
|
logical1 format_oriente_ligne; |
logical1 mise_a_jour; |
logical1 mise_a_jour; |
|
|
long longueur; |
|
long longueur_effective; |
|
long recursivite; |
|
|
|
sqlite3_stmt *ppStmt; |
sqlite3_stmt *ppStmt; |
|
|
ssize_t ios; |
ssize_t ios; |
Line 592 instruction_write(struct_processus *s_et
|
Line 606 instruction_write(struct_processus *s_et
|
if ((chaine = formateur_fichier(s_etat_processus, |
if ((chaine = formateur_fichier(s_etat_processus, |
s_objet_argument_2, (*((struct_fichier *) |
s_objet_argument_2, (*((struct_fichier *) |
(*s_objet_argument_1).objet)).format, 0, 0, ' ', 'F', |
(*s_objet_argument_1).objet)).format, 0, 0, ' ', 'F', |
&longueur_effective, &recursivite)) == NULL) |
&longueur_effective, &recursivite, d_vrai)) == NULL) |
{ |
{ |
liberation(s_etat_processus, s_objet_argument_2); |
liberation(s_etat_processus, s_objet_argument_2); |
liberation(s_etat_processus, s_objet_argument_1); |
liberation(s_etat_processus, s_objet_argument_1); |
Line 674 instruction_write(struct_processus *s_et
|
Line 688 instruction_write(struct_processus *s_et
|
if ((chaine = formateur_fichier(s_etat_processus, |
if ((chaine = formateur_fichier(s_etat_processus, |
s_objet_argument_3, (*((struct_fichier *) |
s_objet_argument_3, (*((struct_fichier *) |
(*s_objet_argument_1).objet)).format, 0, 0, ' ', |
(*s_objet_argument_1).objet)).format, 0, 0, ' ', |
'F', &longueur_effective, &recursivite)) == NULL) |
'F', &longueur_effective, &recursivite, d_vrai)) |
|
== NULL) |
{ |
{ |
liberation(s_etat_processus, s_objet_argument_3); |
liberation(s_etat_processus, s_objet_argument_3); |
liberation(s_etat_processus, s_objet_argument_2); |
liberation(s_etat_processus, s_objet_argument_2); |
Line 697 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 709 instruction_write(struct_processus *s_et
|
Line 725 instruction_write(struct_processus *s_et
|
free(chaine_utf8); |
free(chaine_utf8); |
|
|
if (sqlite3_prepare_v2((*descripteur).descripteur_sqlite, |
if (sqlite3_prepare_v2((*descripteur).descripteur_sqlite, |
commande, strlen(commande), &ppStmt, &queue) |
commande, (int) strlen(commande), &ppStmt, &queue) |
!= SQLITE_OK) |
!= SQLITE_OK) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
Line 747 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 756 instruction_write(struct_processus *s_et
|
Line 772 instruction_write(struct_processus *s_et
|
} |
} |
|
|
if (sqlite3_prepare_v2((*descripteur).descripteur_sqlite, |
if (sqlite3_prepare_v2((*descripteur).descripteur_sqlite, |
commande, strlen(commande), &ppStmt, &queue) |
commande, (int) strlen(commande), &ppStmt, &queue) |
!= SQLITE_OK) |
!= SQLITE_OK) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
Line 897 instruction_write(struct_processus *s_et
|
Line 913 instruction_write(struct_processus *s_et
|
|
|
if ((chaine = formateur_fichier(s_etat_processus, |
if ((chaine = formateur_fichier(s_etat_processus, |
s_element, s_format, 0, 0, ' ', |
s_element, s_format, 0, 0, ' ', |
'F', &longueur_effective, &recursivite)) == NULL) |
'F', &longueur_effective, &recursivite, d_vrai)) |
|
== NULL) |
{ |
{ |
liberation(s_etat_processus, s_element); |
liberation(s_etat_processus, s_element); |
liberation(s_etat_processus, s_format); |
liberation(s_etat_processus, s_format); |
Line 923 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 932 instruction_write(struct_processus *s_et
|
Line 949 instruction_write(struct_processus *s_et
|
} |
} |
|
|
if (sqlite3_prepare_v2((*descripteur).descripteur_sqlite, |
if (sqlite3_prepare_v2((*descripteur).descripteur_sqlite, |
commande, strlen(commande), &ppStmt, &queue) |
commande, (int) strlen(commande), &ppStmt, &queue) |
!= SQLITE_OK) |
!= SQLITE_OK) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
Line 969 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 978 instruction_write(struct_processus *s_et
|
Line 996 instruction_write(struct_processus *s_et
|
} |
} |
|
|
if (sqlite3_prepare_v2((*descripteur) |
if (sqlite3_prepare_v2((*descripteur) |
.descripteur_sqlite, |
.descripteur_sqlite, commande, |
commande, strlen(commande), &ppStmt, &queue) |
(int) strlen(commande), &ppStmt, &queue) |
!= SQLITE_OK) |
!= SQLITE_OK) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
Line 1003 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 1012 instruction_write(struct_processus *s_et
|
Line 1031 instruction_write(struct_processus *s_et
|
} |
} |
|
|
if (sqlite3_prepare_v2((*descripteur) |
if (sqlite3_prepare_v2((*descripteur) |
.descripteur_sqlite, |
.descripteur_sqlite, commande, |
commande, strlen(commande), &ppStmt, &queue) |
(int) strlen(commande), &ppStmt, &queue) |
!= SQLITE_OK) |
!= SQLITE_OK) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
Line 1067 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 1076 instruction_write(struct_processus *s_et
|
Line 1096 instruction_write(struct_processus *s_et
|
} |
} |
|
|
if (sqlite3_prepare_v2((*descripteur).descripteur_sqlite, |
if (sqlite3_prepare_v2((*descripteur).descripteur_sqlite, |
commande, strlen(commande), &ppStmt, &queue) |
commande, (int) strlen(commande), &ppStmt, &queue) |
!= SQLITE_OK) |
!= SQLITE_OK) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
Line 1103 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 1112 instruction_write(struct_processus *s_et
|
Line 1132 instruction_write(struct_processus *s_et
|
} |
} |
|
|
if (sqlite3_prepare_v2((*descripteur).descripteur_sqlite, |
if (sqlite3_prepare_v2((*descripteur).descripteur_sqlite, |
commande, strlen(commande), &ppStmt, &queue) |
commande, (int) strlen(commande), &ppStmt, &queue) |
!= SQLITE_OK) |
!= SQLITE_OK) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
Line 1211 instruction_write(struct_processus *s_et
|
Line 1231 instruction_write(struct_processus *s_et
|
|
|
if ((chaine = formateur_fichier(s_etat_processus, |
if ((chaine = formateur_fichier(s_etat_processus, |
s_element, s_format, 0, 0, ' ', |
s_element, s_format, 0, 0, ' ', |
'F', &longueur_effective, &recursivite)) == NULL) |
'F', &longueur_effective, &recursivite, d_vrai)) |
|
== NULL) |
{ |
{ |
free(clef_utf8); |
free(clef_utf8); |
|
|
Line 1237 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 1247 instruction_write(struct_processus *s_et
|
Line 1268 instruction_write(struct_processus *s_et
|
} |
} |
|
|
if (sqlite3_prepare_v2((*descripteur).descripteur_sqlite, |
if (sqlite3_prepare_v2((*descripteur).descripteur_sqlite, |
commande, strlen(commande), &ppStmt, &queue) |
commande, (int) strlen(commande), &ppStmt, &queue) |
!= SQLITE_OK) |
!= SQLITE_OK) |
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
Line 1304 instruction_write(struct_processus *s_et
|
Line 1325 instruction_write(struct_processus *s_et
|
* Fichiers non formatés |
* Fichiers non formatés |
*/ |
*/ |
|
|
if ((chaine = formateur_fichier(s_etat_processus, |
|
s_objet_argument_2, (*((struct_fichier *) |
|
(*s_objet_argument_1).objet)).format, 0, 0, ' ', 'U', |
|
&longueur_effective, &recursivite)) == NULL) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
|
|
return; |
|
} |
|
|
|
if ((*((struct_fichier *) (*s_objet_argument_1).objet)).acces |
if ((*((struct_fichier *) (*s_objet_argument_1).objet)).acces |
== 'S') |
== 'S') |
{ |
{ |
|
if ((*s_objet_argument_2).type != LST) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_type_argument; |
|
return; |
|
} |
|
|
|
if ((chaine = formateur_fichier(s_etat_processus, |
|
s_objet_argument_2, (*((struct_fichier *) |
|
(*s_objet_argument_1).objet)).format, 0, 0, ' ', 'U', |
|
&longueur_effective, &recursivite, d_vrai)) == NULL) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
|
|
return; |
|
} |
|
|
BUG(((*descripteur).type != 'C'), uprintf("Bad filetype !\n")); |
BUG(((*descripteur).type != 'C'), uprintf("Bad filetype !\n")); |
|
|
if (fseek((*descripteur).descripteur_c, (long) 0, SEEK_END) |
if (fseek((*descripteur).descripteur_c, (long) 0, SEEK_END) |
Line 1330 instruction_write(struct_processus *s_et
|
Line 1361 instruction_write(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
if (fwrite(chaine, sizeof(unsigned char), longueur_effective, |
if (write(fileno((*descripteur).descripteur_c), |
(*descripteur).descripteur_c) != |
chaine, (size_t) longueur_effective) != |
(size_t) longueur_effective) |
(ssize_t) longueur_effective) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
return; |
return; |
Line 1341 instruction_write(struct_processus *s_et
|
Line 1372 instruction_write(struct_processus *s_et
|
else if ((*((struct_fichier *) (*s_objet_argument_1).objet)).acces |
else if ((*((struct_fichier *) (*s_objet_argument_1).objet)).acces |
== 'D') |
== 'D') |
{ |
{ |
|
if ((*s_objet_argument_2).type != INT) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_type_argument; |
|
return; |
|
} |
|
|
|
if (depilement(s_etat_processus, &((*s_etat_processus) |
|
.l_base_pile), &s_objet_argument_3) == d_erreur) |
|
{ |
|
(*s_etat_processus).erreur_execution = d_ex_manque_argument; |
|
return; |
|
} |
|
|
|
if ((*s_objet_argument_3).type != LST) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_3); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_type_argument; |
|
return; |
|
} |
|
|
|
if ((chaine = formateur_fichier(s_etat_processus, |
|
s_objet_argument_2, (*((struct_fichier *) |
|
(*s_objet_argument_1).objet)).format, 0, 0, ' ', 'U', |
|
&longueur_effective, &recursivite, d_faux)) == NULL) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
|
|
return; |
|
} |
} |
} |
else |
else // Fichiers indexés |
{ |
{ |
/* Fichiers indexés : panique totale ! */ |
if ((*s_objet_argument_2).type != LST) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_type_argument; |
|
return; |
|
} |
|
|
|
if ((chaine = formateur_fichier(s_etat_processus, |
|
s_objet_argument_2, (*((struct_fichier *) |
|
(*s_objet_argument_1).objet)).format, 0, 0, ' ', 'U', |
|
&longueur_effective, &recursivite, d_faux)) == NULL) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
|
|
return; |
|
} |
} |
} |
|
|
free(chaine); |
free(chaine); |
Line 1409 instruction_write(struct_processus *s_et
|
Line 1497 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 = 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]), "%ld", &longueur) != 1) |
if (format_chaine[longueur - 1] != ')') |
{ |
{ |
free(format_chaine); |
free(format_chaine); |
|
|
Line 1466 instruction_write(struct_processus *s_et
|
Line 1540 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 1482 instruction_write(struct_processus *s_et
|
Line 1583 instruction_write(struct_processus *s_et
|
if ((format_degenere == d_vrai) || |
if ((format_degenere == d_vrai) || |
(longueur_effective < longueur)) |
(longueur_effective < longueur)) |
{ |
{ |
if (fwrite(chaine, sizeof(unsigned char), |
if (write(fileno((*descripteur).descripteur_c), |
longueur_effective, |
chaine, (size_t) longueur_effective) |
(*descripteur).descripteur_c) != |
!= (ssize_t) longueur_effective) |
(size_t) longueur_effective) |
|
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_erreur_fichier; |
d_es_erreur_fichier; |
Line 1494 instruction_write(struct_processus *s_et
|
Line 1594 instruction_write(struct_processus *s_et
|
} |
} |
else |
else |
{ |
{ |
if (fwrite(chaine, sizeof(unsigned char), |
if (write(fileno((*descripteur).descripteur_c), |
longueur_effective, |
chaine, (size_t) longueur_effective) |
(*descripteur).descripteur_c) != |
!= (ssize_t) longueur) |
(size_t) longueur) |
|
{ |
{ |
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_erreur_fichier; |
d_es_erreur_fichier; |
Line 1507 instruction_write(struct_processus *s_et
|
Line 1606 instruction_write(struct_processus *s_et
|
|
|
free(chaine); |
free(chaine); |
|
|
|
if (format_oriente_ligne == d_vrai) |
|
{ |
|
if (write(fileno((*descripteur).descripteur_c), |
|
"\n", 1) != 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 1560 instruction_write(struct_processus *s_et
|
Line 1670 instruction_write(struct_processus *s_et
|
if ((chaine = formateur_fichier(s_etat_processus, |
if ((chaine = formateur_fichier(s_etat_processus, |
s_objet_argument_2, (*((struct_socket *) |
s_objet_argument_2, (*((struct_socket *) |
(*s_objet_argument_1).objet)).format, 0, 0, ' ', 'F', |
(*s_objet_argument_1).objet)).format, 0, 0, ' ', 'F', |
&longueur_effective, &recursivite)) == NULL) |
&longueur_effective, &recursivite, d_faux)) == NULL) |
{ |
{ |
liberation(s_etat_processus, s_objet_argument_2); |
liberation(s_etat_processus, s_objet_argument_2); |
liberation(s_etat_processus, s_objet_argument_1); |
liberation(s_etat_processus, s_objet_argument_1); |
Line 1575 instruction_write(struct_processus *s_et
|
Line 1685 instruction_write(struct_processus *s_et
|
* Sockets non formatées |
* Sockets non formatées |
*/ |
*/ |
|
|
chaine = NULL; |
if ((chaine = formateur_fichier(s_etat_processus, |
|
s_objet_argument_2, (*((struct_socket *) |
|
(*s_objet_argument_1).objet)).format, 0, 0, ' ', 'U', |
|
&longueur_effective, &recursivite, d_faux)) == NULL) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
|
|
return; |
|
} |
} |
} |
else |
else |
{ |
{ |
Line 1610 instruction_write(struct_processus *s_et
|
Line 1729 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, longueur_effective, 0) < 0) |
.socket, chaine, (size_t) longueur_effective, 0) < 0) |
{ |
{ |
ios = errno; |
ios = errno; |
|
|
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 1671 instruction_write(struct_processus *s_et
|
Line 1797 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 1689 instruction_write(struct_processus *s_et
|
Line 1850 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 1740 instruction_write(struct_processus *s_et
|
Line 1895 instruction_write(struct_processus *s_et
|
|
|
if (sendto((*((struct_socket *) |
if (sendto((*((struct_socket *) |
(*s_objet_argument_1).objet)).socket, chaine, |
(*s_objet_argument_1).objet)).socket, chaine, |
longueur_effective, 0, (struct sockaddr *) |
(size_t) longueur_effective, 0, (struct sockaddr *) |
&adresse_unix, sizeof(adresse_unix)) < 0) |
&adresse_unix, sizeof(adresse_unix)) < 0) |
{ |
{ |
ios = errno; |
ios = errno; |
Line 1766 instruction_write(struct_processus *s_et
|
Line 1921 instruction_write(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
|
if (ios == EMSGSIZE) |
|
{ |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_taille_message; |
|
return; |
|
} |
|
|
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
return; |
return; |
Line 1795 instruction_write(struct_processus *s_et
|
Line 1956 instruction_write(struct_processus *s_et
|
{ // Adresse IPv4 |
{ // Adresse IPv4 |
calcul_adresse = 0; |
calcul_adresse = 0; |
for(i = 0; i < 4; calcul_adresse = |
for(i = 0; i < 4; calcul_adresse = |
(256 * calcul_adresse) + adresse[i++]); |
(256 * calcul_adresse) + |
|
((unsigned char) adresse[i++])); |
|
|
memset(&adresse_ipv4, 0, sizeof(adresse_ipv4)); |
memset(&adresse_ipv4, 0, sizeof(adresse_ipv4)); |
adresse_ipv4.sin_family = AF_INET; |
adresse_ipv4.sin_family = AF_INET; |
adresse_ipv4.sin_port = htons(port); |
adresse_ipv4.sin_port = htons((uint16_t) port); |
adresse_ipv4.sin_addr.s_addr = htonl(calcul_adresse); |
adresse_ipv4.sin_addr.s_addr = htonl(calcul_adresse); |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
Line 1815 instruction_write(struct_processus *s_et
|
Line 1977 instruction_write(struct_processus *s_et
|
|
|
if (sendto((*((struct_socket *) |
if (sendto((*((struct_socket *) |
(*s_objet_argument_1).objet)).socket, chaine, |
(*s_objet_argument_1).objet)).socket, chaine, |
longueur_effective, 0, (struct sockaddr *) |
(size_t) longueur_effective, 0, (struct sockaddr *) |
&adresse_ipv4, sizeof(adresse_ipv4)) < 0) |
&adresse_ipv4, sizeof(adresse_ipv4)) < 0) |
{ |
{ |
|
ios = 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) |
Line 1834 instruction_write(struct_processus *s_et
|
Line 1998 instruction_write(struct_processus *s_et
|
} |
} |
} |
} |
|
|
|
if ((ios == EPIPE) || (ios == ECONNRESET)) |
|
{ |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_acces_fichier; |
|
return; |
|
} |
|
|
|
if (ios == EMSGSIZE) |
|
{ |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_taille_message; |
|
return; |
|
} |
|
|
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_erreur_fichier; |
d_es_erreur_fichier; |
return; |
return; |
Line 1883 instruction_write(struct_processus *s_et
|
Line 2061 instruction_write(struct_processus *s_et
|
|
|
for(i = 0; i < 16; |
for(i = 0; i < 16; |
adresse_ipv6.sin6_addr.s6_addr[i] = |
adresse_ipv6.sin6_addr.s6_addr[i] = |
adresse[i], i++); |
(unsigned char) adresse[i], i++); |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
if (sem_post(&((*s_etat_processus).semaphore_fork)) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) |
Line 1898 instruction_write(struct_processus *s_et
|
Line 2076 instruction_write(struct_processus *s_et
|
|
|
if (sendto((*((struct_socket *) |
if (sendto((*((struct_socket *) |
(*s_objet_argument_1).objet)).socket, chaine, |
(*s_objet_argument_1).objet)).socket, chaine, |
longueur_effective, 0, (struct sockaddr *) |
(size_t) longueur_effective, 0, (struct sockaddr *) |
&adresse_ipv6, sizeof(adresse_ipv6)) < 0) |
&adresse_ipv6, sizeof(adresse_ipv6)) < 0) |
{ |
{ |
|
ios = 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) |
Line 1917 instruction_write(struct_processus *s_et
|
Line 2097 instruction_write(struct_processus *s_et
|
} |
} |
} |
} |
|
|
|
if ((ios == EPIPE) || (ios == ECONNRESET)) |
|
{ |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_erreur_acces_fichier; |
|
return; |
|
} |
|
|
|
if (ios == EMSGSIZE) |
|
{ |
|
(*s_etat_processus).erreur_execution = |
|
d_ex_taille_message; |
|
return; |
|
} |
|
|
(*s_etat_processus).erreur_systeme = |
(*s_etat_processus).erreur_systeme = |
d_es_erreur_fichier; |
d_es_erreur_fichier; |
return; |
return; |
Line 2078 instruction_wflock(struct_processus *s_e
|
Line 2272 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 2131 instruction_wflock(struct_processus *s_e
|
Line 2325 instruction_wflock(struct_processus *s_e
|
return; |
return; |
} |
} |
|
|
# ifndef SEMAPHORES_NOMMES |
if (lock.l_type == F_UNLCK) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
# endif |
|
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
drapeau = d_vrai; |
return; |
|
} |
} |
|
else |
# 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 (pthread_mutex_lock(&(*s_etat_processus).mutex_interruptions) |
|
!= 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
} |
|
|
|
if (lock.l_type == F_UNLCK) |
|
{ |
|
drapeau = d_vrai; |
|
} |
|
else |
|
{ |
|
if ((*s_etat_processus).nombre_interruptions_non_affectees != 0) |
if ((*s_etat_processus).nombre_interruptions_non_affectees != 0) |
{ |
{ |
affectation_interruptions_logicielles(s_etat_processus); |
affectation_interruptions_logicielles(s_etat_processus); |
} |
} |
|
|
if ((*s_etat_processus).nombre_interruptions_en_queue |
if (pthread_mutex_unlock(&(*s_etat_processus) |
!= 0) |
.mutex_interruptions) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
|
if ((*s_etat_processus).nombre_interruptions_en_queue != 0) |
{ |
{ |
registre_instruction_valide = |
registre_instruction_valide = |
(*s_etat_processus).instruction_valide; |
(*s_etat_processus).instruction_valide; |
Line 2176 instruction_wflock(struct_processus *s_e
|
Line 2360 instruction_wflock(struct_processus *s_e
|
registre_instruction_valide; |
registre_instruction_valide; |
} |
} |
|
|
nanosleep(&attente, NULL); |
|
scrutation_injection(s_etat_processus); |
scrutation_injection(s_etat_processus); |
|
|
|
# ifndef SEMAPHORES_NOMMES |
|
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
# endif |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
|
nanosleep(&attente, NULL); |
|
|
INCR_GRANULARITE(attente.tv_nsec); |
INCR_GRANULARITE(attente.tv_nsec); |
|
|
|
# ifndef SEMAPHORES_NOMMES |
|
while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) != 0) |
|
# endif |
|
{ |
|
if (errno != EINTR) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
} |
} |
} |
} while((drapeau == d_faux) && ((*s_etat_processus) |
} while((drapeau == d_faux) && ((*s_etat_processus) |
.var_volatile_requete_arret != -1)); |
.var_volatile_requete_arret != -1)); |
Line 2280 instruction_wfproc(struct_processus *s_e
|
Line 2488 instruction_wfproc(struct_processus *s_e
|
} |
} |
} |
} |
|
|
if (pthread_mutex_lock(&((*s_etat_processus).mutex)) != 0) |
if (pthread_mutex_lock(&((*s_etat_processus).mutex_pile_processus)) |
|
!= 0) |
{ |
{ |
if ((*s_etat_processus).profilage == d_vrai) |
if ((*s_etat_processus).profilage == d_vrai) |
{ |
{ |
Line 2345 instruction_wfproc(struct_processus *s_e
|
Line 2554 instruction_wfproc(struct_processus *s_e
|
profilage(s_etat_processus, NULL); |
profilage(s_etat_processus, NULL); |
} |
} |
|
|
if (pthread_mutex_unlock(&((*s_etat_processus).mutex)) != 0) |
if (pthread_mutex_unlock(&((*s_etat_processus) |
|
.mutex_pile_processus)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
Line 2370 instruction_wfproc(struct_processus *s_e
|
Line 2580 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 2425 instruction_wfproc(struct_processus *s_e
|
Line 2635 instruction_wfproc(struct_processus *s_e
|
* Le processus n'est pas terminé |
* Le processus n'est pas terminé |
*/ |
*/ |
|
|
if (pthread_mutex_unlock(&((*s_etat_processus).mutex)) != 0) |
if (pthread_mutex_lock(&((*s_etat_processus) |
|
.mutex_interruptions)) != 0) |
{ |
{ |
|
pthread_mutex_unlock(&((*s_etat_processus) |
|
.mutex_pile_processus)); |
|
|
if ((*s_etat_processus).profilage == d_vrai) |
if ((*s_etat_processus).profilage == d_vrai) |
{ |
{ |
profilage(s_etat_processus, NULL); |
profilage(s_etat_processus, NULL); |
Line 2443 instruction_wfproc(struct_processus *s_e
|
Line 2657 instruction_wfproc(struct_processus *s_e
|
affectation_interruptions_logicielles(s_etat_processus); |
affectation_interruptions_logicielles(s_etat_processus); |
} |
} |
|
|
if ((*s_etat_processus).nombre_interruptions_en_queue |
if (pthread_mutex_unlock(&((*s_etat_processus) |
!= 0) |
.mutex_interruptions)) != 0) |
|
{ |
|
pthread_mutex_unlock(&((*s_etat_processus) |
|
.mutex_pile_processus)); |
|
|
|
if ((*s_etat_processus).profilage == d_vrai) |
|
{ |
|
profilage(s_etat_processus, NULL); |
|
} |
|
|
|
(*s_etat_processus).erreur_systeme = |
|
d_es_processus; |
|
return; |
|
} |
|
|
|
if (pthread_mutex_unlock(&((*s_etat_processus) |
|
.mutex_pile_processus)) != 0) |
|
{ |
|
if ((*s_etat_processus).profilage == d_vrai) |
|
{ |
|
profilage(s_etat_processus, NULL); |
|
} |
|
|
|
(*s_etat_processus).erreur_systeme = |
|
d_es_processus; |
|
return; |
|
} |
|
|
|
if ((*s_etat_processus).nombre_interruptions_en_queue != 0) |
{ |
{ |
registre_instruction_valide = |
registre_instruction_valide = |
(*s_etat_processus).instruction_valide; |
(*s_etat_processus).instruction_valide; |
Line 2483 instruction_wfproc(struct_processus *s_e
|
Line 2725 instruction_wfproc(struct_processus *s_e
|
|
|
scrutation_injection(s_etat_processus); |
scrutation_injection(s_etat_processus); |
|
|
if (pthread_mutex_lock(&((*s_etat_processus).mutex)) != 0) |
if (pthread_mutex_lock(&((*s_etat_processus) |
|
.mutex_pile_processus)) != 0) |
{ |
{ |
if ((*s_etat_processus).profilage == d_vrai) |
if ((*s_etat_processus).profilage == d_vrai) |
{ |
{ |
Line 2505 instruction_wfproc(struct_processus *s_e
|
Line 2748 instruction_wfproc(struct_processus *s_e
|
profilage(s_etat_processus, NULL); |
profilage(s_etat_processus, NULL); |
} |
} |
|
|
if (pthread_mutex_unlock(&((*s_etat_processus).mutex)) != 0) |
if (pthread_mutex_unlock(&((*s_etat_processus).mutex_pile_processus)) |
|
!= 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
Line 2608 instruction_wfdata(struct_processus *s_e
|
Line 2852 instruction_wfdata(struct_processus *s_e
|
} |
} |
} |
} |
|
|
if (pthread_mutex_lock(&((*s_etat_processus).mutex)) != 0) |
if (pthread_mutex_lock(&((*s_etat_processus).mutex_pile_processus)) |
|
!= 0) |
{ |
{ |
if ((*s_etat_processus).profilage == d_vrai) |
if ((*s_etat_processus).profilage == d_vrai) |
{ |
{ |
Line 2668 instruction_wfdata(struct_processus *s_e
|
Line 2913 instruction_wfdata(struct_processus *s_e
|
profilage(s_etat_processus, NULL); |
profilage(s_etat_processus, NULL); |
} |
} |
|
|
if (pthread_mutex_unlock(&((*s_etat_processus).mutex)) != 0) |
if (pthread_mutex_unlock(&((*s_etat_processus) |
|
.mutex_pile_processus)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
Line 2711 instruction_wfdata(struct_processus *s_e
|
Line 2957 instruction_wfdata(struct_processus *s_e
|
return; |
return; |
} |
} |
|
|
if (pthread_mutex_unlock(&((*s_etat_processus).mutex)) != 0) |
if (pthread_mutex_unlock(&((*s_etat_processus) |
|
.mutex_pile_processus)) != 0) |
{ |
{ |
if ((*s_etat_processus).profilage == d_vrai) |
if ((*s_etat_processus).profilage == d_vrai) |
{ |
{ |
Line 2752 instruction_wfdata(struct_processus *s_e
|
Line 2999 instruction_wfdata(struct_processus *s_e
|
|
|
scrutation_injection(s_etat_processus); |
scrutation_injection(s_etat_processus); |
|
|
|
if (pthread_mutex_lock(&(*s_etat_processus) |
|
.mutex_interruptions) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
if ((*s_etat_processus).nombre_interruptions_non_affectees |
if ((*s_etat_processus).nombre_interruptions_non_affectees |
!= 0) |
!= 0) |
{ |
{ |
affectation_interruptions_logicielles(s_etat_processus); |
affectation_interruptions_logicielles(s_etat_processus); |
} |
} |
|
|
|
if (pthread_mutex_unlock(&(*s_etat_processus) |
|
.mutex_interruptions) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
if ((*s_etat_processus).nombre_interruptions_en_queue != 0) |
if ((*s_etat_processus).nombre_interruptions_en_queue != 0) |
{ |
{ |
registre_instruction_valide = |
registre_instruction_valide = |
Line 2777 instruction_wfdata(struct_processus *s_e
|
Line 3038 instruction_wfdata(struct_processus *s_e
|
return; |
return; |
} |
} |
|
|
if (pthread_mutex_lock(&((*s_etat_processus).mutex)) != 0) |
if (pthread_mutex_lock(&((*s_etat_processus) |
|
.mutex_pile_processus)) != 0) |
{ |
{ |
if ((*s_etat_processus).profilage == d_vrai) |
if ((*s_etat_processus).profilage == d_vrai) |
{ |
{ |
Line 2804 instruction_wfdata(struct_processus *s_e
|
Line 3066 instruction_wfdata(struct_processus *s_e
|
profilage(s_etat_processus, NULL); |
profilage(s_etat_processus, NULL); |
} |
} |
|
|
if (pthread_mutex_unlock(&((*s_etat_processus).mutex)) != 0) |
if (pthread_mutex_unlock(&((*s_etat_processus).mutex_pile_processus)) |
|
!= 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
Line 2836 instruction_wfdata(struct_processus *s_e
|
Line 3099 instruction_wfdata(struct_processus *s_e
|
================================================================================ |
================================================================================ |
*/ |
*/ |
|
|
|
static inline logical1 |
|
options_sockets(struct_processus *s_etat_processus, struct_socket *s_socket) |
|
{ |
|
if (((*s_socket).options & (1 << d_BROADCAST)) != 0) |
|
{ |
|
if (setsockopt((*s_socket).socket, SOL_SOCKET, SO_BROADCAST, NULL, 0) |
|
!= 0) |
|
{ |
|
return(d_erreur); |
|
} |
|
} |
|
|
|
if (((*s_socket).options & (1 << d_DONT_ROUTE)) != 0) |
|
{ |
|
if (setsockopt((*s_socket).socket, SOL_SOCKET, SO_DONTROUTE, NULL, 0) |
|
!= 0) |
|
{ |
|
return(d_erreur); |
|
} |
|
} |
|
|
|
if (((*s_socket).options & (1 << d_KEEP_ALIVE)) != 0) |
|
{ |
|
if (setsockopt((*s_socket).socket, SOL_SOCKET, SO_KEEPALIVE, NULL, 0) |
|
!= 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 2857 instruction_wfsock(struct_processus *s_e
|
Line 3233 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 3021 instruction_wfsock(struct_processus *s_e
|
Line 3395 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 3041 instruction_wfsock(struct_processus *s_e
|
Line 3415 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 3079 instruction_wfsock(struct_processus *s_e
|
Line 3453 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 3094 instruction_wfsock(struct_processus *s_e
|
Line 3468 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 3124 instruction_wfsock(struct_processus *s_e
|
Line 3509 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 3142 instruction_wfsock(struct_processus *s_e
|
Line 3527 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 3181 instruction_wfsock(struct_processus *s_e
|
Line 3566 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 3196 instruction_wfsock(struct_processus *s_e
|
Line 3581 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 3208 instruction_wfsock(struct_processus *s_e
|
Line 3604 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 3246 instruction_wfsock(struct_processus *s_e
|
Line 3646 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 3264 instruction_wfsock(struct_processus *s_e
|
Line 3664 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 3303 instruction_wfsock(struct_processus *s_e
|
Line 3703 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 3318 instruction_wfsock(struct_processus *s_e
|
Line 3718 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 3488 instruction_wfswi(struct_processus *s_et
|
Line 3899 instruction_wfswi(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
|
if (pthread_mutex_lock(&(*s_etat_processus).mutex_interruptions) |
|
!= 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
if ((*s_etat_processus).nombre_interruptions_non_affectees != 0) |
if ((*s_etat_processus).nombre_interruptions_non_affectees != 0) |
{ |
{ |
affectation_interruptions_logicielles(s_etat_processus); |
affectation_interruptions_logicielles(s_etat_processus); |
} |
} |
|
|
|
if (pthread_mutex_unlock(&(*s_etat_processus).mutex_interruptions) |
|
!= 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
if ((*s_etat_processus).queue_interruptions[interruption - 1] > 0) |
if ((*s_etat_processus).queue_interruptions[interruption - 1] > 0) |
{ |
{ |
drapeau_fin = d_vrai; |
drapeau_fin = d_vrai; |
} |
} |
else |
else |
{ |
{ |
|
# ifndef SEMAPHORES_NOMMES |
|
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
# endif |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
nanosleep(&attente, NULL); |
nanosleep(&attente, NULL); |
|
|
|
# ifndef SEMAPHORES_NOMMES |
|
while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) != 0) |
|
# endif |
|
{ |
|
if (errno != EINTR) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
} |
|
|
scrutation_injection(s_etat_processus); |
scrutation_injection(s_etat_processus); |
INCR_GRANULARITE(attente.tv_nsec); |
INCR_GRANULARITE(attente.tv_nsec); |
} |
} |
Line 3625 instruction_wfpoke(struct_processus *s_e
|
Line 4073 instruction_wfpoke(struct_processus *s_e
|
|
|
scrutation_injection(s_etat_processus); |
scrutation_injection(s_etat_processus); |
|
|
|
if (pthread_mutex_lock(&(*s_etat_processus).mutex_interruptions) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
if ((*s_etat_processus).nombre_interruptions_non_affectees != 0) |
if ((*s_etat_processus).nombre_interruptions_non_affectees != 0) |
{ |
{ |
affectation_interruptions_logicielles(s_etat_processus); |
affectation_interruptions_logicielles(s_etat_processus); |
} |
} |
|
|
|
if (pthread_mutex_unlock(&(*s_etat_processus).mutex_interruptions) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
if ((*s_etat_processus).nombre_interruptions_en_queue != 0) |
if ((*s_etat_processus).nombre_interruptions_en_queue != 0) |
{ |
{ |
registre_instruction_valide = |
registre_instruction_valide = |
Line 3732 instruction_wfack(struct_processus *s_et
|
Line 4192 instruction_wfack(struct_processus *s_et
|
{ |
{ |
scrutation_injection(s_etat_processus); |
scrutation_injection(s_etat_processus); |
|
|
|
if (pthread_mutex_lock(&(*s_etat_processus).mutex_interruptions) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
if ((*s_etat_processus).nombre_interruptions_non_affectees != 0) |
if ((*s_etat_processus).nombre_interruptions_non_affectees != 0) |
{ |
{ |
affectation_interruptions_logicielles(s_etat_processus); |
affectation_interruptions_logicielles(s_etat_processus); |
} |
} |
|
|
|
if (pthread_mutex_unlock(&(*s_etat_processus).mutex_interruptions) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
if ((*s_etat_processus).nombre_interruptions_en_queue != 0) |
if ((*s_etat_processus).nombre_interruptions_en_queue != 0) |
{ |
{ |
registre_instruction_valide = |
registre_instruction_valide = |