version 1.78, 2015/01/05 15:32:25
|
version 1.98, 2019/02/03 14:41:31
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.20 |
RPL/2 (R) version 4.1.31 |
Copyright (C) 1989-2015 Dr. BERTRAND Joël |
Copyright (C) 1989-2019 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 291 localisation_courante(struct_processus *
|
Line 291 localisation_courante(struct_processus *
|
|
|
verrouillage_threads_concurrents(s_etat_processus); |
verrouillage_threads_concurrents(s_etat_processus); |
pid = fork(); |
pid = fork(); |
deverrouillage_threads_concurrents(s_etat_processus); |
|
|
|
if (pid < 0) |
if (pid < 0) |
{ |
{ |
Line 419 localisation_courante(struct_processus *
|
Line 418 localisation_courante(struct_processus *
|
} |
} |
else |
else |
{ |
{ |
|
deverrouillage_threads_concurrents(s_etat_processus); |
|
|
if (close(pipes_entree[0]) != 0) |
if (close(pipes_entree[0]) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
Line 464 localisation_courante(struct_processus *
|
Line 465 localisation_courante(struct_processus *
|
return; |
return; |
} |
} |
|
|
if (waitpid(pid, &status, 0) == -1) |
while(waitpid(pid, &status, 0) == -1) |
{ |
{ |
# ifndef SEMAPHORES_NOMMES |
if (errno != EINTR) |
while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) != 0) |
|
# endif |
|
{ |
{ |
if (errno != EINTR) |
# ifndef SEMAPHORES_NOMMES |
|
while(sem_wait(&((*s_etat_processus).semaphore_fork)) |
|
!= 0) |
|
# else |
|
while(sem_wait((*s_etat_processus).semaphore_fork) != 0) |
|
# endif |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
if (errno != EINTR) |
return; |
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
} |
} |
} |
|
|
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
|
} |
} |
} |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
Line 690 transliterated_fprintf(struct_processus
|
Line 695 transliterated_fprintf(struct_processus
|
unsigned long i; |
unsigned long i; |
# endif |
# endif |
|
|
if (valsprintf(&tampon, format, arguments) < 0) |
if (valsprintf(s_etat_processus, &tampon, format, arguments) < 0) |
{ |
{ |
va_end(arguments); |
va_end(arguments); |
|
|
Line 789 transliterated_fprintf(struct_processus
|
Line 794 transliterated_fprintf(struct_processus
|
|
|
|
|
int |
int |
|
std_fprintf(file *flux, const char *format, ...) |
|
{ |
|
int ios; |
|
|
|
va_list arguments; |
|
|
|
va_start(arguments, format); |
|
ios = vfprintf(flux, format, arguments); |
|
va_end(arguments); |
|
|
|
// Pas de parenthèses pour ne pas appeler la macro. |
|
return ios; |
|
} |
|
|
|
|
|
int |
tex_fprintf(struct_processus *s_etat_processus, |
tex_fprintf(struct_processus *s_etat_processus, |
file *flux, const char *format, ...) |
file *flux, const char *format, ...) |
{ |
{ |
Line 801 tex_fprintf(struct_processus *s_etat_pro
|
Line 822 tex_fprintf(struct_processus *s_etat_pro
|
|
|
va_start(arguments, format); |
va_start(arguments, format); |
|
|
if (valsprintf(&tampon, format, arguments) < 0) |
if (valsprintf(s_etat_processus, &tampon, format, arguments) < 0) |
{ |
{ |
va_end(arguments); |
va_end(arguments); |
|
|
Line 844 tex_fprintf(struct_processus *s_etat_pro
|
Line 865 tex_fprintf(struct_processus *s_etat_pro
|
#undef readline |
#undef readline |
|
|
unsigned char * |
unsigned char * |
readline_wrapper(unsigned char *invite) |
readline_wrapper(struct_processus *s_etat_processus, unsigned char *invite) |
{ |
{ |
unsigned char *chaine; |
unsigned char *rpl_chaine; |
|
unsigned char *sys_chaine; |
|
|
|
association_etat_processus_readline(s_etat_processus); |
|
sys_chaine = readline(invite); |
|
|
chaine = readline(invite); |
# ifdef OS2 |
printf("\r"); |
printf("\r"); |
|
# endif |
|
|
|
if (sys_chaine == NULL) |
|
{ |
|
return(NULL); |
|
} |
|
|
|
if ((rpl_chaine = rpl_malloc(s_etat_processus, (strlen(sys_chaine) + 1) * |
|
sizeof(unsigned char *))) == NULL) |
|
{ |
|
sys_free(sys_chaine); |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return(NULL); |
|
} |
|
|
|
strcpy(rpl_chaine, sys_chaine); |
|
sys_free(sys_chaine); |
|
|
return(chaine); |
return(rpl_chaine); |
} |
} |
|
|
|
|