version 1.183, 2016/03/22 17:12:14
|
version 1.221, 2023/11/22 10:55:15
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.25 |
RPL/2 (R) version 4.1.35 |
Copyright (C) 1989-2016 Dr. BERTRAND Joël |
Copyright (C) 1989-2023 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 86 rplinit(int argc, char *argv[], char *en
|
Line 86 rplinit(int argc, char *argv[], char *en
|
|
|
struct_processus *s_etat_processus; |
struct_processus *s_etat_processus; |
|
|
|
struct_liste_chainee *l_bibliotheques; |
|
struct_liste_chainee *l_bibliotheque_courante; |
|
struct_liste_chainee *l_nouvelle_bibliotheque; |
|
|
struct_liste_variables_partagees *l_element_partage_courant; |
struct_liste_variables_partagees *l_element_partage_courant; |
struct_liste_variables_partagees *l_element_partage_suivant; |
struct_liste_variables_partagees *l_element_partage_suivant; |
|
|
Line 123 rplinit(int argc, char *argv[], char *en
|
Line 127 rplinit(int argc, char *argv[], char *en
|
errno = 0; |
errno = 0; |
s_queue_signaux = NULL; |
s_queue_signaux = NULL; |
routine_recursive = 0; |
routine_recursive = 0; |
nombre_thread_surveillance_processus = 0; |
nombre_threads_surveillance_processus = 0; |
pid_processus_pere = getpid(); |
pid_processus_pere = getpid(); |
|
|
|
# ifdef DEBUG_PROC |
|
__proc = 0; |
|
# endif |
|
|
# ifdef DEBUG_MEMOIRE |
# ifdef DEBUG_MEMOIRE |
debug_memoire_initialisation(); |
debug_memoire_initialisation(); |
# endif |
# endif |
Line 305 rplinit(int argc, char *argv[], char *en
|
Line 313 rplinit(int argc, char *argv[], char *en
|
pthread_mutex_init(&mutex_liste_threads, &attributs_mutex); |
pthread_mutex_init(&mutex_liste_threads, &attributs_mutex); |
pthread_mutexattr_destroy(&attributs_mutex); |
pthread_mutexattr_destroy(&attributs_mutex); |
|
|
|
pthread_mutexattr_init(&attributs_mutex); |
|
pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_RECURSIVE); |
|
pthread_mutex_init(&mutex_liste_threads_surveillance, &attributs_mutex); |
|
pthread_mutexattr_destroy(&attributs_mutex); |
|
|
|
pthread_mutexattr_init(&attributs_mutex); |
|
pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_RECURSIVE); |
|
pthread_mutex_init(&mutex_sigaction, &attributs_mutex); |
|
pthread_mutexattr_destroy(&attributs_mutex); |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
sem_init(&((*s_etat_processus).semaphore_fork), 0, 0); |
if (sem_init(&((*s_etat_processus).semaphore_fork), 0, 0) != 0) |
# else |
# else |
if (((*s_etat_processus).semaphore_fork = sem_init3(0, getpid(), |
if (((*s_etat_processus).semaphore_fork = sem_init3(0, getpid(), |
pthread_self(), SEM_FORK)) == SEM_FAILED) |
pthread_self(), SEM_FORK)) == SEM_FAILED) |
{ |
# endif |
liberation_contexte_cas(s_etat_processus); |
{ |
|
liberation_contexte_cas(s_etat_processus); |
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
uprintf("+++Système : Mémoire insuffisante\n"); |
|
} |
|
else |
|
{ |
|
uprintf("+++System : Not enough memory\n"); |
|
} |
|
|
|
return(EXIT_FAILURE); |
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
uprintf("+++Système : Mémoire insuffisante\n"); |
} |
} |
# endif |
else |
|
{ |
|
uprintf("+++System : Not enough memory\n"); |
|
} |
|
|
|
return(EXIT_FAILURE); |
|
} |
|
|
pthread_mutexattr_init(&attributs_mutex); |
pthread_mutexattr_init(&attributs_mutex); |
pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL); |
pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL); |
Line 441 rplinit(int argc, char *argv[], char *en
|
Line 459 rplinit(int argc, char *argv[], char *en
|
|
|
if ((*s_etat_processus).langue == 'F') |
if ((*s_etat_processus).langue == 'F') |
{ |
{ |
printf("+++Copyright (C) 1989 à 2015, 2016 BERTRAND Joël\n"); |
printf("+++Copyright (C) 1989 à 2022, 2023 BERTRAND Joël\n"); |
} |
} |
else |
else |
{ |
{ |
printf("+++Copyright (C) 1989 to 2015, 2016 BERTRAND Joel\n"); |
printf("+++Copyright (C) 1989 to 2022, 2023 BERTRAND Joel\n"); |
} |
} |
} |
} |
|
|
Line 672 rplinit(int argc, char *argv[], char *en
|
Line 690 rplinit(int argc, char *argv[], char *en
|
return(EXIT_FAILURE); |
return(EXIT_FAILURE); |
} |
} |
|
|
if (sigaction(SIGALRM, &action, NULL) != 0) |
if (sigaction(SIGUSR2, &action, NULL) != 0) |
{ |
{ |
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
sem_post(&((*s_etat_processus).semaphore_fork)); |
sem_post(&((*s_etat_processus).semaphore_fork)); |
Line 706 rplinit(int argc, char *argv[], char *en
|
Line 724 rplinit(int argc, char *argv[], char *en
|
} |
} |
|
|
signal_test = SIGTEST; |
signal_test = SIGTEST; |
raise(SIGALRM); |
raise(SIGUSR2); |
|
|
attente.tv_sec = 0; |
attente.tv_sec = 0; |
attente.tv_nsec = 1000000; |
attente.tv_nsec = 1000000; |
Line 716 rplinit(int argc, char *argv[], char *en
|
Line 734 rplinit(int argc, char *argv[], char *en
|
nanosleep(&attente, NULL); |
nanosleep(&attente, NULL); |
} |
} |
|
|
if (signal_test != SIGALRM) |
if (signal_test != SIGUSR2) |
{ |
{ |
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
sem_post(&((*s_etat_processus).semaphore_fork)); |
sem_post(&((*s_etat_processus).semaphore_fork)); |
Line 830 rplinit(int argc, char *argv[], char *en
|
Line 848 rplinit(int argc, char *argv[], char *en
|
action.sa_handler = interruption5; |
action.sa_handler = interruption5; |
action.sa_flags = 0; |
action.sa_flags = 0; |
|
|
|
#if 0 |
if (sigaction(SIGPIPE, &action, NULL) != 0) |
if (sigaction(SIGPIPE, &action, NULL) != 0) |
{ |
{ |
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
Line 906 rplinit(int argc, char *argv[], char *en
|
Line 925 rplinit(int argc, char *argv[], char *en
|
|
|
return(EXIT_FAILURE); |
return(EXIT_FAILURE); |
} |
} |
|
#endif |
|
|
action.sa_handler = interruption1; |
action.sa_handler = interruption1; |
action.sa_flags = 0; |
action.sa_flags = 0; |
Line 1000 rplinit(int argc, char *argv[], char *en
|
Line 1020 rplinit(int argc, char *argv[], char *en
|
drapeau_encart = 'Y'; |
drapeau_encart = 'Y'; |
debug = d_faux; |
debug = d_faux; |
arguments = NULL; |
arguments = NULL; |
|
l_bibliotheques = NULL; |
|
|
(*s_etat_processus).s_fichiers = NULL; |
(*s_etat_processus).s_fichiers = NULL; |
(*s_etat_processus).s_sockets = NULL; |
(*s_etat_processus).s_sockets = NULL; |
Line 1590 rplinit(int argc, char *argv[], char *en
|
Line 1611 rplinit(int argc, char *argv[], char *en
|
break; |
break; |
} |
} |
|
|
|
case 'm' : |
|
{ |
|
while(*(++argv[0]) == ' '); |
|
argv[0]--; |
|
|
|
if ((*(++argv[0])) != '\0') |
|
{ |
|
if ((l_nouvelle_bibliotheque = malloc( |
|
sizeof(struct_liste_chainee))) == NULL) |
|
{ |
|
# ifndef SEMAPHORES_NOMMES |
|
sem_post(&((*s_etat_processus) |
|
.semaphore_fork)); |
|
sem_destroy(&((*s_etat_processus) |
|
.semaphore_fork)); |
|
# else |
|
sem_post((*s_etat_processus) |
|
.semaphore_fork); |
|
sem_destroy3((*s_etat_processus) |
|
.semaphore_fork, getpid(), |
|
pthread_self(), SEM_FORK); |
|
# endif |
|
|
|
liberation_contexte_cas(s_etat_processus); |
|
destruction_queue_signaux(s_etat_processus); |
|
|
|
# ifdef HAVE_STACK_OVERFLOW_RECOVERY |
|
stackoverflow_deinstall_handler(); |
|
# endif |
|
|
|
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
printf("+++Système : Mémoire " |
|
"insuffisante\n"); |
|
} |
|
else |
|
{ |
|
printf("+++System : Not enough " |
|
"memory\n"); |
|
} |
|
|
|
return(EXIT_FAILURE); |
|
} |
|
|
|
(*l_nouvelle_bibliotheque).suivant = |
|
l_bibliotheques; |
|
|
|
if (((*l_nouvelle_bibliotheque).donnee = |
|
allocation(s_etat_processus, CHN)) |
|
== NULL) |
|
{ |
|
# ifndef SEMAPHORES_NOMMES |
|
sem_post(&((*s_etat_processus) |
|
.semaphore_fork)); |
|
sem_destroy(&((*s_etat_processus) |
|
.semaphore_fork)); |
|
# else |
|
sem_post((*s_etat_processus) |
|
.semaphore_fork); |
|
sem_destroy3((*s_etat_processus) |
|
.semaphore_fork, getpid(), |
|
pthread_self(), SEM_FORK); |
|
# endif |
|
|
|
liberation_contexte_cas(s_etat_processus); |
|
destruction_queue_signaux(s_etat_processus); |
|
|
|
# ifdef HAVE_STACK_OVERFLOW_RECOVERY |
|
stackoverflow_deinstall_handler(); |
|
# endif |
|
|
|
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
printf("+++Système : Mémoire " |
|
"insuffisante\n"); |
|
} |
|
else |
|
{ |
|
printf("+++System : Not enough " |
|
"memory\n"); |
|
} |
|
|
|
return(EXIT_FAILURE); |
|
} |
|
|
|
if (((*(*l_nouvelle_bibliotheque).donnee) |
|
.objet = malloc((strlen(argv[0]) + 1) * |
|
sizeof(unsigned char))) == NULL) |
|
{ |
|
# ifndef SEMAPHORES_NOMMES |
|
sem_post(&((*s_etat_processus) |
|
.semaphore_fork)); |
|
sem_destroy(&((*s_etat_processus) |
|
.semaphore_fork)); |
|
# else |
|
sem_post((*s_etat_processus) |
|
.semaphore_fork); |
|
sem_destroy3((*s_etat_processus) |
|
.semaphore_fork, getpid(), |
|
pthread_self(), SEM_FORK); |
|
# endif |
|
|
|
liberation_contexte_cas(s_etat_processus); |
|
destruction_queue_signaux(s_etat_processus); |
|
|
|
# ifdef HAVE_STACK_OVERFLOW_RECOVERY |
|
stackoverflow_deinstall_handler(); |
|
# endif |
|
|
|
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
printf("+++Système : Mémoire " |
|
"insuffisante\n"); |
|
} |
|
else |
|
{ |
|
printf("+++System : Not enough " |
|
"memory\n"); |
|
} |
|
|
|
return(EXIT_FAILURE); |
|
} |
|
|
|
strcpy((*(*l_nouvelle_bibliotheque).donnee) |
|
.objet, argv[0]); |
|
argv[0] += strlen((unsigned char *) |
|
(*(*l_nouvelle_bibliotheque).donnee) |
|
.objet) - 1; |
|
|
|
l_bibliotheques = l_nouvelle_bibliotheque; |
|
} |
|
else if ((--argc) > 0) |
|
{ |
|
argv++; |
|
|
|
if ((l_nouvelle_bibliotheque = malloc( |
|
sizeof(struct_liste_chainee))) == NULL) |
|
{ |
|
# ifndef SEMAPHORES_NOMMES |
|
sem_post(&((*s_etat_processus) |
|
.semaphore_fork)); |
|
sem_destroy(&((*s_etat_processus) |
|
.semaphore_fork)); |
|
# else |
|
sem_post((*s_etat_processus) |
|
.semaphore_fork); |
|
sem_destroy3((*s_etat_processus) |
|
.semaphore_fork, getpid(), |
|
pthread_self(), SEM_FORK); |
|
# endif |
|
|
|
liberation_contexte_cas(s_etat_processus); |
|
destruction_queue_signaux(s_etat_processus); |
|
|
|
# ifdef HAVE_STACK_OVERFLOW_RECOVERY |
|
stackoverflow_deinstall_handler(); |
|
# endif |
|
|
|
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
printf("+++Système : Mémoire " |
|
"insuffisante\n"); |
|
} |
|
else |
|
{ |
|
printf("+++System : Not enough " |
|
"memory\n"); |
|
} |
|
|
|
return(EXIT_FAILURE); |
|
} |
|
|
|
(*l_nouvelle_bibliotheque).suivant = |
|
l_bibliotheques; |
|
|
|
if (((*l_nouvelle_bibliotheque).donnee = |
|
allocation(s_etat_processus, CHN)) |
|
== NULL) |
|
{ |
|
# ifndef SEMAPHORES_NOMMES |
|
sem_post(&((*s_etat_processus) |
|
.semaphore_fork)); |
|
sem_destroy(&((*s_etat_processus) |
|
.semaphore_fork)); |
|
# else |
|
sem_post((*s_etat_processus) |
|
.semaphore_fork); |
|
sem_destroy3((*s_etat_processus) |
|
.semaphore_fork, getpid(), |
|
pthread_self(), SEM_FORK); |
|
# endif |
|
|
|
liberation_contexte_cas(s_etat_processus); |
|
destruction_queue_signaux(s_etat_processus); |
|
|
|
# ifdef HAVE_STACK_OVERFLOW_RECOVERY |
|
stackoverflow_deinstall_handler(); |
|
# endif |
|
|
|
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
printf("+++Système : Mémoire " |
|
"insuffisante\n"); |
|
} |
|
else |
|
{ |
|
printf("+++System : Not enough " |
|
"memory\n"); |
|
} |
|
|
|
return(EXIT_FAILURE); |
|
} |
|
|
|
if (((*(*l_nouvelle_bibliotheque).donnee) |
|
.objet = malloc((strlen(argv[0]) + 1) * |
|
sizeof(unsigned char))) == NULL) |
|
{ |
|
# ifndef SEMAPHORES_NOMMES |
|
sem_post(&((*s_etat_processus) |
|
.semaphore_fork)); |
|
sem_destroy(&((*s_etat_processus) |
|
.semaphore_fork)); |
|
# else |
|
sem_post((*s_etat_processus) |
|
.semaphore_fork); |
|
sem_destroy3((*s_etat_processus) |
|
.semaphore_fork, getpid(), |
|
pthread_self(), SEM_FORK); |
|
# endif |
|
|
|
liberation_contexte_cas(s_etat_processus); |
|
destruction_queue_signaux(s_etat_processus); |
|
|
|
# ifdef HAVE_STACK_OVERFLOW_RECOVERY |
|
stackoverflow_deinstall_handler(); |
|
# endif |
|
|
|
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
printf("+++Système : Mémoire " |
|
"insuffisante\n"); |
|
} |
|
else |
|
{ |
|
printf("+++System : Not enough " |
|
"memory\n"); |
|
} |
|
|
|
return(EXIT_FAILURE); |
|
} |
|
|
|
strcpy((*(*l_nouvelle_bibliotheque).donnee) |
|
.objet, argv[0]); |
|
argv[0] += strlen((unsigned char *) |
|
(*(*l_nouvelle_bibliotheque).donnee) |
|
.objet) - 1; |
|
|
|
l_bibliotheques = l_nouvelle_bibliotheque; |
|
} |
|
else |
|
{ |
|
# ifndef SEMAPHORES_NOMMES |
|
sem_post(&((*s_etat_processus).semaphore_fork)); |
|
sem_destroy(&((*s_etat_processus) |
|
.semaphore_fork)); |
|
# else |
|
sem_post((*s_etat_processus).semaphore_fork); |
|
sem_destroy3((*s_etat_processus).semaphore_fork, |
|
getpid(), pthread_self(), SEM_FORK); |
|
# endif |
|
|
|
liberation_contexte_cas(s_etat_processus); |
|
destruction_queue_signaux(s_etat_processus); |
|
|
|
# ifdef HAVE_STACK_OVERFLOW_RECOVERY |
|
stackoverflow_deinstall_handler(); |
|
# endif |
|
|
|
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
printf("+++Erreur : Aucune bibliothèque " |
|
"spécifiée après l'option -A\n"); |
|
} |
|
else |
|
{ |
|
printf("+++Error : Library required after " |
|
"-m option\n"); |
|
} |
|
|
|
return(EXIT_FAILURE); |
|
} |
|
|
|
break; |
|
} |
|
|
case 'n' : |
case 'n' : |
{ |
{ |
if (option_n == d_vrai) |
if (option_n == d_vrai) |
Line 3761 rplinit(int argc, char *argv[], char *en
|
Line 4077 rplinit(int argc, char *argv[], char *en
|
} |
} |
} |
} |
|
|
|
/* |
|
* Chargement des bibliothèques pour gérer des |
|
* types externes lors des l'analyse syntaxique et |
|
* compilation. |
|
*/ |
|
|
|
l_bibliotheque_courante = l_bibliotheques; |
|
|
|
while(l_bibliotheque_courante != NULL) |
|
{ |
|
if (empilement(s_etat_processus, &((*s_etat_processus) |
|
.l_base_pile), (*l_bibliotheque_courante) |
|
.donnee) == d_erreur) |
|
{ |
|
# ifndef SEMAPHORES_NOMMES |
|
sem_post(&((*s_etat_processus).semaphore_fork)); |
|
sem_destroy(&((*s_etat_processus) |
|
.semaphore_fork)); |
|
# else |
|
sem_post((*s_etat_processus).semaphore_fork); |
|
sem_destroy3((*s_etat_processus).semaphore_fork, |
|
getpid(), pthread_self(), SEM_FORK); |
|
# endif |
|
|
|
liberation_contexte_cas(s_etat_processus); |
|
destruction_queue_signaux(s_etat_processus); |
|
|
|
# ifdef HAVE_STACK_OVERFLOW_RECOVERY |
|
stackoverflow_deinstall_handler(); |
|
# endif |
|
|
|
# ifdef HAVE_SIGSEGV_RECOVERY |
|
if (debug == d_faux) |
|
{ |
|
sigsegv_deinstall_handler(); |
|
} |
|
# endif |
|
|
|
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
printf("+++Fatal :" |
|
" Chargement de la bibliothèse %s" |
|
" impossible\n", (unsigned char *) |
|
(*(*l_bibliotheque_courante).donnee) |
|
.objet); |
|
} |
|
else |
|
{ |
|
printf("+++Fatal : Cannot load library %s\n", |
|
(*(*l_bibliotheque_courante).donnee) |
|
.objet); |
|
} |
|
|
|
if (traitement_fichier_temporaire == 'Y') |
|
{ |
|
if (destruction_fichier( |
|
nom_fichier_temporaire) |
|
== d_erreur) |
|
{ |
|
return(EXIT_FAILURE); |
|
} |
|
|
|
free(nom_fichier_temporaire); |
|
} |
|
|
|
return(EXIT_FAILURE); |
|
} |
|
|
|
instruction_use(s_etat_processus); |
|
|
|
if (depilement(s_etat_processus, &((*s_etat_processus) |
|
.l_base_pile), &((*l_bibliotheque_courante) |
|
.donnee)) == d_erreur) |
|
{ |
|
# ifndef SEMAPHORES_NOMMES |
|
sem_post(&((*s_etat_processus).semaphore_fork)); |
|
sem_destroy(&((*s_etat_processus) |
|
.semaphore_fork)); |
|
# else |
|
sem_post((*s_etat_processus).semaphore_fork); |
|
sem_destroy3((*s_etat_processus).semaphore_fork, |
|
getpid(), pthread_self(), SEM_FORK); |
|
# endif |
|
|
|
liberation_contexte_cas(s_etat_processus); |
|
destruction_queue_signaux(s_etat_processus); |
|
|
|
# ifdef HAVE_STACK_OVERFLOW_RECOVERY |
|
stackoverflow_deinstall_handler(); |
|
# endif |
|
|
|
# ifdef HAVE_SIGSEGV_RECOVERY |
|
if (debug == d_faux) |
|
{ |
|
sigsegv_deinstall_handler(); |
|
} |
|
# endif |
|
|
|
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
printf("+++Fatal :" |
|
" Chargement de la bibliothèse %s" |
|
" impossible\n", (unsigned char *) |
|
(*(*l_bibliotheque_courante).donnee) |
|
.objet); |
|
} |
|
else |
|
{ |
|
printf("+++Fatal : Cannot load library %s\n", |
|
(*(*l_bibliotheque_courante).donnee) |
|
.objet); |
|
} |
|
|
|
if (traitement_fichier_temporaire == 'Y') |
|
{ |
|
if (destruction_fichier( |
|
nom_fichier_temporaire) |
|
== d_erreur) |
|
{ |
|
return(EXIT_FAILURE); |
|
} |
|
|
|
free(nom_fichier_temporaire); |
|
} |
|
|
|
return(EXIT_FAILURE); |
|
} |
|
|
|
l_bibliotheque_courante = |
|
(*l_bibliotheque_courante).suivant; |
|
} |
|
|
if ((erreur = compilation(s_etat_processus)) != |
if ((erreur = compilation(s_etat_processus)) != |
d_absence_erreur) |
d_absence_erreur) |
{ |
{ |
Line 4747 rplinit(int argc, char *argv[], char *en
|
Line 5195 rplinit(int argc, char *argv[], char *en
|
{ |
{ |
if (setjmp(contexte_initial) == 0) |
if (setjmp(contexte_initial) == 0) |
{ |
{ |
erreur = sequenceur_optimise(s_etat_processus); |
erreur = sequenceur_optimise(s_etat_processus, |
|
l_bibliotheques); |
|
|
if (erreur == d_absence_erreur) |
if (erreur == d_absence_erreur) |
{ |
{ |
Line 4996 rplinit(int argc, char *argv[], char *en
|
Line 5445 rplinit(int argc, char *argv[], char *en
|
if ((*s_etat_processus).var_volatile_alarme |
if ((*s_etat_processus).var_volatile_alarme |
!= 0) |
!= 0) |
{ |
{ |
envoi_signal_thread( |
envoi_signal_thread(s_etat_processus, |
(*(*((struct_processus_fils *) |
(*(*((struct_processus_fils *) |
(*(*((struct_liste_chainee *) |
(*(*((struct_liste_chainee *) |
l_element_courant)).donnee).objet)) |
l_element_courant)).donnee).objet)) |
Line 5007 rplinit(int argc, char *argv[], char *en
|
Line 5456 rplinit(int argc, char *argv[], char *en
|
if ((*s_etat_processus).arret_depuis_abort |
if ((*s_etat_processus).arret_depuis_abort |
== -1) |
== -1) |
{ |
{ |
envoi_signal_thread( |
envoi_signal_thread(s_etat_processus, |
(*(*((struct_processus_fils *) |
(*(*((struct_processus_fils *) |
(*(*((struct_liste_chainee *) |
(*(*((struct_liste_chainee *) |
l_element_courant)).donnee) |
l_element_courant)).donnee) |
Line 5016 rplinit(int argc, char *argv[], char *en
|
Line 5465 rplinit(int argc, char *argv[], char *en
|
} |
} |
else |
else |
{ |
{ |
envoi_signal_thread( |
envoi_signal_thread(s_etat_processus, |
(*(*((struct_processus_fils *) |
(*(*((struct_processus_fils *) |
(*(*((struct_liste_chainee *) |
(*(*((struct_liste_chainee *) |
l_element_courant)).donnee) |
l_element_courant)).donnee) |
Line 5463 rplinit(int argc, char *argv[], char *en
|
Line 5912 rplinit(int argc, char *argv[], char *en
|
l_element_courant = l_element_suivant; |
l_element_courant = l_element_suivant; |
} |
} |
|
|
for(i = 0; i < (*s_etat_processus) |
|
.nombre_instructions_externes; i++) |
|
{ |
|
free((*s_etat_processus).s_instructions_externes[i] |
|
.nom); |
|
free((*s_etat_processus).s_instructions_externes[i] |
|
.nom_bibliotheque); |
|
} |
|
|
|
if ((*s_etat_processus).nombre_instructions_externes != 0) |
|
{ |
|
free((*s_etat_processus).s_instructions_externes); |
|
} |
|
|
|
l_element_courant = (void *) (*s_etat_processus) |
|
.s_bibliotheques; |
|
|
|
while(l_element_courant != NULL) |
|
{ |
|
l_element_suivant = (*((struct_liste_chainee *) |
|
l_element_courant)).suivant; |
|
|
|
free((*((struct_bibliotheque *) |
|
(*((struct_liste_chainee *) |
|
l_element_courant)).donnee)).nom); |
|
dlclose((*((struct_bibliotheque *) |
|
(*((struct_liste_chainee *) |
|
l_element_courant)).donnee)).descripteur); |
|
free((*((struct_liste_chainee *) l_element_courant)) |
|
.donnee); |
|
free(l_element_courant); |
|
|
|
l_element_courant = l_element_suivant; |
|
} |
|
|
|
l_element_courant = (void *) (*s_etat_processus) |
l_element_courant = (void *) (*s_etat_processus) |
.l_base_pile_last; |
.l_base_pile_last; |
while(l_element_courant != NULL) |
while(l_element_courant != NULL) |
Line 5513 rplinit(int argc, char *argv[], char *en
|
Line 5927 rplinit(int argc, char *argv[], char *en
|
l_element_courant = l_element_suivant; |
l_element_courant = l_element_suivant; |
} |
} |
|
|
|
while((*s_etat_processus).s_bibliotheques != NULL) |
|
{ |
|
retrait_bibliotheque(s_etat_processus, |
|
(struct_bibliotheque *) |
|
(*((struct_liste_chainee *) |
|
(*s_etat_processus).s_bibliotheques)).donnee); |
|
} |
|
|
l_element_courant = (void *) (*s_etat_processus) |
l_element_courant = (void *) (*s_etat_processus) |
.l_base_pile_systeme; |
.l_base_pile_systeme; |
while(l_element_courant != NULL) |
while(l_element_courant != NULL) |
Line 5697 rplinit(int argc, char *argv[], char *en
|
Line 6119 rplinit(int argc, char *argv[], char *en
|
|
|
retrait_thread(s_etat_processus); |
retrait_thread(s_etat_processus); |
|
|
|
attente.tv_sec = 0; |
|
attente.tv_nsec = GRANULARITE_us * 1000; |
|
|
|
pthread_mutex_lock(&((*s_etat_processus).mutex_pile_processus)); |
|
|
|
while(nombre_threads_surveillance_processus != 0) |
|
{ |
|
pthread_mutex_unlock(&((*s_etat_processus).mutex_pile_processus)); |
|
nanosleep(&attente, NULL); |
|
INCR_GRANULARITE(attente.tv_nsec); |
|
pthread_mutex_lock(&((*s_etat_processus).mutex_pile_processus)); |
|
} |
|
|
|
pthread_mutex_unlock(&((*s_etat_processus).mutex_pile_processus)); |
|
|
|
attente.tv_sec = 0; |
|
attente.tv_nsec = GRANULARITE_us * 1000; |
|
|
|
while(pthread_mutex_trylock(&((*s_etat_processus).mutex_pile_processus)) |
|
== EBUSY) |
|
{ |
|
nanosleep(&attente, NULL); |
|
INCR_GRANULARITE(attente.tv_nsec); |
|
} |
|
|
|
pthread_mutex_unlock(&((*s_etat_processus).mutex_pile_processus)); |
pthread_mutex_destroy(&((*s_etat_processus).mutex_pile_processus)); |
pthread_mutex_destroy(&((*s_etat_processus).mutex_pile_processus)); |
pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation)); |
pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation)); |
pthread_mutex_destroy(&((*s_etat_processus).mutex_interruptions)); |
pthread_mutex_destroy(&((*s_etat_processus).mutex_interruptions)); |
pthread_mutex_destroy(&((*s_etat_processus).mutex_signaux)); |
|
pthread_mutex_destroy(&mutex_sections_critiques); |
pthread_mutex_destroy(&mutex_sections_critiques); |
pthread_mutex_destroy(&mutex_liste_variables_partagees); |
pthread_mutex_destroy(&mutex_liste_variables_partagees); |
|
|
|
free((*s_etat_processus).localisation); |
|
|
|
destruction_queue_signaux(s_etat_processus); |
|
pthread_mutex_destroy(&((*s_etat_processus).mutex_signaux)); |
|
liberation_contexte_cas(s_etat_processus); |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
sem_post(&((*s_etat_processus).semaphore_fork)); |
sem_post(&((*s_etat_processus).semaphore_fork)); |
sem_destroy(&((*s_etat_processus).semaphore_fork)); |
sem_destroy(&((*s_etat_processus).semaphore_fork)); |
Line 5713 rplinit(int argc, char *argv[], char *en
|
Line 6166 rplinit(int argc, char *argv[], char *en
|
SEM_FORK); |
SEM_FORK); |
# endif |
# endif |
|
|
free((*s_etat_processus).localisation); |
|
|
|
destruction_queue_signaux(s_etat_processus); |
|
liberation_contexte_cas(s_etat_processus); |
|
|
|
free((*s_etat_processus).chemin_fichiers_temporaires); |
free((*s_etat_processus).chemin_fichiers_temporaires); |
|
|
if ((*s_etat_processus).requete_redemarrage == d_vrai) |
if ((*s_etat_processus).requete_redemarrage == d_vrai) |
Line 5734 rplinit(int argc, char *argv[], char *en
|
Line 6182 rplinit(int argc, char *argv[], char *en
|
|
|
liberation_allocateur_buffer(s_etat_processus); |
liberation_allocateur_buffer(s_etat_processus); |
pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation_buffer)); |
pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation_buffer)); |
|
pthread_mutex_destroy(&mutex_liste_threads); |
|
pthread_mutex_destroy(&mutex_liste_threads_surveillance); |
|
pthread_mutex_destroy(&mutex_sigaction); |
|
|
sys_free(s_etat_processus); |
sys_free(s_etat_processus); |
sys_free(arg_exec); |
sys_free(arg_exec); |
Line 5775 informations(struct_processus *s_etat_pr
|
Line 6226 informations(struct_processus *s_etat_pr
|
printf(" -i : fonctionnement interactif\n"); |
printf(" -i : fonctionnement interactif\n"); |
printf(" -l : licence d'utilisation\n"); |
printf(" -l : licence d'utilisation\n"); |
printf(" -n : ignorance du signal HUP\n"); |
printf(" -n : ignorance du signal HUP\n"); |
|
printf(" -m : chargement d'un module RPL/SO avant la " |
|
"compilation\n"); |
printf(" -p : précompilation du script avant exécution\n"); |
printf(" -p : précompilation du script avant exécution\n"); |
printf(" -P : profilage (-P ou -PP)\n"); |
printf(" -P : profilage (-P ou -PP)\n"); |
printf(" -s : empêchement de l'ouverture de l'écran initial\n"); |
printf(" -s : empêchement de l'ouverture de l'écran initial\n"); |
Line 5796 informations(struct_processus *s_etat_pr
|
Line 6249 informations(struct_processus *s_etat_pr
|
printf(" -i : runs the RPL/2 sequencer in interactive mode\n"); |
printf(" -i : runs the RPL/2 sequencer in interactive mode\n"); |
printf(" -l : prints the user licence of the software\n"); |
printf(" -l : prints the user licence of the software\n"); |
printf(" -n : ignores HUP signal\n"); |
printf(" -n : ignores HUP signal\n"); |
|
printf(" -m : loads RPL/SO object before compilation\n"); |
printf(" -p : precompiles script\n"); |
printf(" -p : precompiles script\n"); |
printf(" -P : computes profile data (-P or -PP)\n"); |
printf(" -P : computes profile data (-P or -PP)\n"); |
printf(" -s : disables splash screen\n"); |
printf(" -s : disables splash screen\n"); |