version 1.4, 2010/03/04 10:17:54
|
version 1.5, 2010/03/06 18:29:07
|
Line 374 instruction_wireframe(struct_processus *
|
Line 374 instruction_wireframe(struct_processus *
|
void |
void |
instruction_write(struct_processus *s_etat_processus) |
instruction_write(struct_processus *s_etat_processus) |
{ |
{ |
file *descripteur; |
|
|
|
int adresse[16]; |
int adresse[16]; |
int port; |
int port; |
|
|
Line 384 instruction_write(struct_processus *s_et
|
Line 382 instruction_write(struct_processus *s_et
|
|
|
ssize_t ios; |
ssize_t ios; |
|
|
|
struct_descripteur_fichier *descripteur; |
|
|
struct_objet *s_objet_argument_2; |
struct_objet *s_objet_argument_2; |
struct_objet *s_objet_argument_1; |
struct_objet *s_objet_argument_1; |
|
|
Line 399 instruction_write(struct_processus *s_et
|
Line 399 instruction_write(struct_processus *s_et
|
uint32_t calcul_adresse; |
uint32_t calcul_adresse; |
|
|
unsigned char *chaine; |
unsigned char *chaine; |
|
unsigned char *chaine_utf8; |
|
|
unsigned long i; |
unsigned long i; |
|
|
Line 455 instruction_write(struct_processus *s_et
|
Line 456 instruction_write(struct_processus *s_et
|
if (((*s_objet_argument_2).type == LST) && |
if (((*s_objet_argument_2).type == LST) && |
((*s_objet_argument_1).type == FCH)) |
((*s_objet_argument_1).type == FCH)) |
{ |
{ |
|
if ((descripteur = descripteur_fichier(s_etat_processus, |
|
(struct_fichier *) (*s_objet_argument_1).objet)) == NULL) |
|
{ |
|
return; |
|
} |
|
|
/* |
/* |
* Vérification des verrous |
* Vérification des verrous |
*/ |
*/ |
Line 466 instruction_write(struct_processus *s_et
|
Line 473 instruction_write(struct_processus *s_et
|
lock.l_pid = getpid(); |
lock.l_pid = getpid(); |
recursivite = 0; |
recursivite = 0; |
|
|
if ((descripteur = descripteur_fichier(s_etat_processus, |
if (fcntl(fileno((*descripteur).descripteur_c), F_GETLK, &lock) |
(struct_fichier *) (*s_objet_argument_1).objet)) == NULL) |
== -1) |
{ |
|
return; |
|
} |
|
|
|
if (fcntl(fileno(descripteur), F_GETLK, &lock) == -1) |
|
{ |
{ |
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 525 instruction_write(struct_processus *s_et
|
Line 527 instruction_write(struct_processus *s_et
|
if ((*((struct_fichier *) (*s_objet_argument_1).objet)).acces |
if ((*((struct_fichier *) (*s_objet_argument_1).objet)).acces |
== 'S') |
== 'S') |
{ |
{ |
if (fseek(descripteur, (long) 0, SEEK_END) != 0) |
BUG(((*descripteur).type != 'C'), uprintf("Bad filetype !\n")); |
|
|
|
if (fseek((*descripteur).descripteur_c, (long) 0, SEEK_END) |
|
!= 0) |
{ |
{ |
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 534 instruction_write(struct_processus *s_et
|
Line 539 instruction_write(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
if (fprintf(descripteur, "%s\n", chaine) < 0) |
if ((chaine_utf8 = transliteration(s_etat_processus, |
|
chaine, d_locale, "UTF-8")) == NULL) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
|
|
return; |
|
} |
|
|
|
if (fprintf((*descripteur).descripteur_c, "%s\n", chaine) < 0) |
{ |
{ |
|
free(chaine_utf8); |
|
|
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
return; |
return; |
} |
} |
|
|
|
free(chaine_utf8); |
} |
} |
else if ((*((struct_fichier *) (*s_objet_argument_1).objet)).acces |
else if ((*((struct_fichier *) (*s_objet_argument_1).objet)).acces |
== 'D') |
== 'D') |
Line 572 instruction_write(struct_processus *s_et
|
Line 590 instruction_write(struct_processus *s_et
|
if ((*((struct_fichier *) (*s_objet_argument_1).objet)).acces |
if ((*((struct_fichier *) (*s_objet_argument_1).objet)).acces |
== 'S') |
== 'S') |
{ |
{ |
if (fseek(descripteur, (long) 0, SEEK_END) != 0) |
BUG(((*descripteur).type != 'C'), uprintf("Bad filetype !\n")); |
|
|
|
if (fseek((*descripteur).descripteur_c, (long) 0, SEEK_END) |
|
!= 0) |
{ |
{ |
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 582 instruction_write(struct_processus *s_et
|
Line 603 instruction_write(struct_processus *s_et
|
} |
} |
|
|
if (fwrite(chaine, sizeof(unsigned char), longueur_effective, |
if (fwrite(chaine, sizeof(unsigned char), longueur_effective, |
descripteur) != (size_t) longueur_effective) |
(*descripteur).descripteur_c) != |
|
(size_t) longueur_effective) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
return; |
return; |
Line 982 instruction_write(struct_processus *s_et
|
Line 1004 instruction_write(struct_processus *s_et
|
void |
void |
instruction_wflock(struct_processus *s_etat_processus) |
instruction_wflock(struct_processus *s_etat_processus) |
{ |
{ |
file *descripteur; |
|
|
|
logical1 drapeau; |
logical1 drapeau; |
|
|
struct flock lock; |
struct flock lock; |
|
|
struct timespec attente; |
struct timespec attente; |
|
|
|
struct_descripteur_fichier *descripteur; |
|
|
struct_objet *s_objet_argument_1; |
struct_objet *s_objet_argument_1; |
struct_objet *s_objet_argument_2; |
struct_objet *s_objet_argument_2; |
|
|
Line 1100 instruction_wflock(struct_processus *s_e
|
Line 1122 instruction_wflock(struct_processus *s_e
|
return; |
return; |
} |
} |
|
|
if (fcntl(fileno(descripteur), F_GETLK, &lock) == -1) |
if (fcntl(fileno((*descripteur).descripteur_c), F_GETLK, &lock) |
|
== -1) |
{ |
{ |
liberation(s_etat_processus, s_objet_argument_1); |
liberation(s_etat_processus, s_objet_argument_1); |
liberation(s_etat_processus, s_objet_argument_2); |
liberation(s_etat_processus, s_objet_argument_2); |