version 1.5, 2010/03/09 10:18:48
|
version 1.73, 2013/04/01 15:29:37
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.13 |
RPL/2 (R) version 4.1.14 |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
Copyright (C) 1989-2013 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 20
|
Line 20
|
*/ |
*/ |
|
|
|
|
#include "rpl.conv.h" |
#include "rpl-conv.h" |
|
|
|
|
/* |
/* |
Line 45 instruction_spawn(struct_processus *s_et
|
Line 45 instruction_spawn(struct_processus *s_et
|
|
|
pthread_mutexattr_t attributs_mutex; |
pthread_mutexattr_t attributs_mutex; |
|
|
pthread_t thread_id; |
|
pthread_t thread_surveillance; |
pthread_t thread_surveillance; |
|
|
sigset_t oldset; |
|
sigset_t set; |
|
|
|
struct_descripteur_thread *s_argument_thread; |
struct_descripteur_thread *s_argument_thread; |
|
|
struct_liste_chainee *l_element_courant; |
struct_liste_chainee *l_element_courant; |
Line 111 instruction_spawn(struct_processus *s_et
|
Line 107 instruction_spawn(struct_processus *s_et
|
* d'une fonction ou d'une expression RPN. |
* d'une fonction ou d'une expression RPN. |
*/ |
*/ |
|
|
if (((*s_objet).type != NOM) && |
if (((*s_objet).type != NOM) && ((*s_objet).type != RPN)) |
((*s_objet).type != RPN)) |
|
{ |
{ |
liberation(s_etat_processus, s_objet); |
liberation(s_etat_processus, s_objet); |
|
|
Line 133 instruction_spawn(struct_processus *s_et
|
Line 128 instruction_spawn(struct_processus *s_et
|
if (recherche_variable(s_etat_processus, (*((struct_nom *) |
if (recherche_variable(s_etat_processus, (*((struct_nom *) |
(*s_objet).objet)).nom) == d_vrai) |
(*s_objet).objet)).nom) == d_vrai) |
{ |
{ |
if ((*s_etat_processus).s_liste_variables |
if ((*(*s_etat_processus).pointeur_variable_courante).objet == NULL) |
[(*s_etat_processus).position_variable_courante].objet |
|
== NULL) |
|
{ |
{ |
if (pthread_mutex_lock(&((*(*s_etat_processus) |
|
.s_liste_variables_partagees).mutex)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
|
if (recherche_variable_partagee(s_etat_processus, |
if (recherche_variable_partagee(s_etat_processus, |
(*s_etat_processus).s_liste_variables |
(*(*s_etat_processus).pointeur_variable_courante).nom, |
[(*s_etat_processus).position_variable_courante].nom, |
(*(*s_etat_processus).pointeur_variable_courante) |
(*s_etat_processus).s_liste_variables |
.variable_partagee, (*(*s_etat_processus) |
[(*s_etat_processus).position_variable_courante] |
.pointeur_variable_courante).origine) == NULL) |
.variable_partagee, (*s_etat_processus) |
|
.s_liste_variables[(*s_etat_processus) |
|
.position_variable_courante].origine) == d_faux) |
|
{ |
{ |
if (pthread_mutex_unlock(&((*(*s_etat_processus) |
|
.s_liste_variables_partagees).mutex)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
|
liberation(s_etat_processus, s_objet); |
liberation(s_etat_processus, s_objet); |
|
|
(*s_etat_processus).erreur_systeme = d_es; |
(*s_etat_processus).erreur_systeme = d_es; |
Line 168 instruction_spawn(struct_processus *s_et
|
Line 144 instruction_spawn(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
if (((*(*(*s_etat_processus).s_liste_variables_partagees) |
if (((*(*(*s_etat_processus) |
.table[(*(*s_etat_processus) |
.pointeur_variable_partagee_courante).objet).type |
.s_liste_variables_partagees).position_variable].objet) |
!= RPN) && ((*(*(*s_etat_processus) |
.type != RPN) && ((*(*(*s_etat_processus) |
.pointeur_variable_partagee_courante).objet).type |
.s_liste_variables_partagees).table |
!= ADR)) |
[(*(*s_etat_processus).s_liste_variables_partagees) |
|
.position_variable].objet).type != ADR)) |
|
{ |
{ |
if (pthread_mutex_unlock(&((*(*s_etat_processus) |
if (pthread_mutex_unlock(&((*(*s_etat_processus) |
.s_liste_variables_partagees).mutex)) != 0) |
.pointeur_variable_partagee_courante).mutex)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
Line 192 instruction_spawn(struct_processus *s_et
|
Line 166 instruction_spawn(struct_processus *s_et
|
|
|
if ((s_copie = copie_objet(s_etat_processus, |
if ((s_copie = copie_objet(s_etat_processus, |
(*(*s_etat_processus) |
(*(*s_etat_processus) |
.s_liste_variables_partagees).table |
.pointeur_variable_partagee_courante).objet, 'P')) |
[(*(*s_etat_processus).s_liste_variables_partagees) |
== NULL) |
.position_variable].objet, 'P')) == NULL) |
|
{ |
{ |
if (pthread_mutex_unlock(&((*(*s_etat_processus) |
if (pthread_mutex_unlock(&((*(*s_etat_processus) |
.s_liste_variables_partagees).mutex)) != 0) |
.pointeur_variable_partagee_courante).mutex)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
Line 212 instruction_spawn(struct_processus *s_et
|
Line 185 instruction_spawn(struct_processus *s_et
|
variable_partagee = d_vrai; |
variable_partagee = d_vrai; |
|
|
if (pthread_mutex_unlock(&((*(*s_etat_processus) |
if (pthread_mutex_unlock(&((*(*s_etat_processus) |
.s_liste_variables_partagees).mutex)) != 0) |
.pointeur_variable_partagee_courante).mutex)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
Line 220 instruction_spawn(struct_processus *s_et
|
Line 193 instruction_spawn(struct_processus *s_et
|
} |
} |
else |
else |
{ |
{ |
if (((*(*s_etat_processus).s_liste_variables |
if (((*(*(*s_etat_processus).pointeur_variable_courante).objet) |
[(*s_etat_processus).position_variable_courante].objet) |
.type != RPN) && ((*(*(*s_etat_processus) |
.type != RPN) && ((*(*s_etat_processus) |
.pointeur_variable_courante).objet).type != ADR)) |
.s_liste_variables[(*s_etat_processus) |
|
.position_variable_courante].objet).type != ADR)) |
|
{ |
{ |
liberation(s_etat_processus, s_objet); |
liberation(s_etat_processus, s_objet); |
|
|
Line 244 instruction_spawn(struct_processus *s_et
|
Line 215 instruction_spawn(struct_processus *s_et
|
} |
} |
} |
} |
|
|
if (sigemptyset(&set) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
|
if (sigaddset(&set, SIGSTART) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
|
/* |
|
* Le signal SIGFSTOP doit être traité ! |
|
*/ |
|
|
|
if (sigaddset(&set, SIGFSTOP) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
|
if (sigaddset(&set, SIGURG) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
|
if (pthread_sigmask(SIG_BLOCK, &set, &oldset) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
|
if ((s_argument_thread = malloc(sizeof(struct_descripteur_thread))) == NULL) |
if ((s_argument_thread = malloc(sizeof(struct_descripteur_thread))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
Line 343 instruction_spawn(struct_processus *s_et
|
Line 280 instruction_spawn(struct_processus *s_et
|
pthread_mutex_init(&((*s_argument_thread).mutex), &attributs_mutex); |
pthread_mutex_init(&((*s_argument_thread).mutex), &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(&((*s_argument_thread).mutex_nombre_references), |
|
&attributs_mutex); |
|
pthread_mutexattr_destroy(&attributs_mutex); |
|
|
(*s_argument_thread).processus_detache = d_faux; |
(*s_argument_thread).processus_detache = d_faux; |
(*s_argument_thread).thread_actif = d_faux; |
(*s_argument_thread).thread_actif = d_faux; |
(*s_argument_thread).thread_pere = pthread_self(); |
(*s_argument_thread).thread_pere = pthread_self(); |
Line 392 instruction_spawn(struct_processus *s_et
|
Line 335 instruction_spawn(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
|
# ifdef SCHED_OTHER |
if (pthread_attr_setschedpolicy(&attributs, SCHED_OTHER) != 0) |
if (pthread_attr_setschedpolicy(&attributs, SCHED_OTHER) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# endif |
|
|
|
# ifdef PTHREAD_EXPLICIT_SCHED |
if (pthread_attr_setinheritsched(&attributs, PTHREAD_EXPLICIT_SCHED) != 0) |
if (pthread_attr_setinheritsched(&attributs, PTHREAD_EXPLICIT_SCHED) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# endif |
|
|
|
# ifdef PTHREAD_SCOPE_SYSTEM |
if (pthread_attr_setscope(&attributs, PTHREAD_SCOPE_SYSTEM) != 0) |
if (pthread_attr_setscope(&attributs, PTHREAD_SCOPE_SYSTEM) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# endif |
|
|
/* |
/* |
* Création de l'objet à retourner |
* Création de l'objet à retourner |
Line 432 instruction_spawn(struct_processus *s_et
|
Line 381 instruction_spawn(struct_processus *s_et
|
|
|
// Lancement du thread fils |
// Lancement du thread fils |
|
|
if (pthread_mutex_lock(&((*s_nouvel_etat_processus).mutex)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
|
(*s_argument_thread).s_nouvel_etat_processus = s_nouvel_etat_processus; |
(*s_argument_thread).s_nouvel_etat_processus = s_nouvel_etat_processus; |
(*s_argument_thread).s_etat_processus = s_etat_processus; |
(*s_argument_thread).s_etat_processus = s_etat_processus; |
|
|
Line 452 instruction_spawn(struct_processus *s_et
|
Line 395 instruction_spawn(struct_processus *s_et
|
(*s_argument_thread).destruction_objet = d_faux; |
(*s_argument_thread).destruction_objet = d_faux; |
} |
} |
|
|
(*s_argument_thread).set = set; |
(*s_argument_thread).thread_actif = d_faux; |
(*s_argument_thread).oldset = oldset; |
|
|
|
if (pthread_create(&thread_id, &attributs, lancement_thread, |
if (pthread_create(&(*s_nouvel_etat_processus).tid, |
s_argument_thread) != 0) |
&attributs, lancement_thread, s_argument_thread) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
|
|
attente.tv_sec = 0; |
|
attente.tv_nsec = GRANULARITE_us * 1000; |
|
|
|
while((*s_argument_thread).thread_actif == d_faux) |
|
{ |
|
scrutation_interruptions(s_etat_processus); |
|
nanosleep(&attente, NULL); |
|
INCR_GRANULARITE(attente.tv_nsec); |
|
} |
|
|
if (pthread_attr_destroy(&attributs) != 0) |
if (pthread_attr_destroy(&attributs) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
Line 481 instruction_spawn(struct_processus *s_et
|
Line 433 instruction_spawn(struct_processus *s_et
|
return; |
return; |
} |
} |
|
|
|
# ifdef SCHED_OTHER |
if (pthread_attr_setschedpolicy(&attributs, SCHED_OTHER) != 0) |
if (pthread_attr_setschedpolicy(&attributs, SCHED_OTHER) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# endif |
|
|
|
# ifdef PTHREAD_EXPLICIT_SCHED |
if (pthread_attr_setinheritsched(&attributs, |
if (pthread_attr_setinheritsched(&attributs, |
PTHREAD_EXPLICIT_SCHED) != 0) |
PTHREAD_EXPLICIT_SCHED) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# endif |
|
|
|
# ifdef PTHREAD_SCOPE_SYSTEM |
if (pthread_attr_setscope(&attributs, PTHREAD_SCOPE_SYSTEM) != 0) |
if (pthread_attr_setscope(&attributs, PTHREAD_SCOPE_SYSTEM) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# endif |
// Attente de l'affectation de la grandeur processus.tid par le thread fils. |
|
|
|
if (pthread_mutex_lock(&((*s_nouvel_etat_processus).mutex)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
|
/* |
/* |
* On copie l'objet plutôt que le pointeur car cet objet peut être |
* On copie l'objet plutôt que le pointeur car cet objet peut être |
Line 523 instruction_spawn(struct_processus *s_et
|
Line 473 instruction_spawn(struct_processus *s_et
|
|
|
if (pthread_mutex_lock(&((*s_etat_processus).mutex)) != 0) |
if (pthread_mutex_lock(&((*s_etat_processus).mutex)) != 0) |
{ |
{ |
|
pthread_mutex_unlock(&((*s_nouvel_etat_processus).mutex)); |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
Line 584 instruction_spawn(struct_processus *s_et
|
Line 535 instruction_spawn(struct_processus *s_et
|
} |
} |
} |
} |
|
|
|
scrutation_interruptions(s_etat_processus); |
l_element_courant = (*l_element_courant).suivant; |
l_element_courant = (*l_element_courant).suivant; |
} |
} |
} while(drapeau == d_vrai); |
} while(drapeau == d_vrai); |
Line 593 instruction_spawn(struct_processus *s_et
|
Line 545 instruction_spawn(struct_processus *s_et
|
.l_base_pile_processus), s_objet_systeme) == d_erreur) |
.l_base_pile_processus), s_objet_systeme) == d_erreur) |
{ |
{ |
pthread_mutex_unlock(&((*s_etat_processus).mutex)); |
pthread_mutex_unlock(&((*s_etat_processus).mutex)); |
pthread_mutex_unlock(&((*s_nouvel_etat_processus).mutex)); |
|
return; |
return; |
} |
} |
|
|
Line 606 instruction_spawn(struct_processus *s_et
|
Line 557 instruction_spawn(struct_processus *s_et
|
if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
s_objet_resultat) == d_erreur) |
s_objet_resultat) == d_erreur) |
{ |
{ |
pthread_mutex_unlock(&((*s_nouvel_etat_processus).mutex)); |
|
return; |
return; |
} |
} |
|
|
if (pthread_mutex_lock(&(*s_argument_thread).mutex) != 0) |
if (pthread_mutex_lock(&(*s_argument_thread).mutex) != 0) |
{ |
{ |
pthread_mutex_unlock(&((*s_nouvel_etat_processus).mutex)); |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
Line 622 instruction_spawn(struct_processus *s_et
|
Line 571 instruction_spawn(struct_processus *s_et
|
// Le thread n'existe plus. |
// Le thread n'existe plus. |
|
|
pthread_join((*s_argument_thread).tid, NULL); |
pthread_join((*s_argument_thread).tid, NULL); |
pthread_mutex_unlock(&((*s_nouvel_etat_processus).mutex)); |
|
pthread_mutex_unlock(&(*s_argument_thread).mutex); |
pthread_mutex_unlock(&(*s_argument_thread).mutex); |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
Line 630 instruction_spawn(struct_processus *s_et
|
Line 578 instruction_spawn(struct_processus *s_et
|
|
|
if (pthread_mutex_unlock(&(*s_argument_thread).mutex) != 0) |
if (pthread_mutex_unlock(&(*s_argument_thread).mutex) != 0) |
{ |
{ |
pthread_mutex_unlock(&((*s_nouvel_etat_processus).mutex)); |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
|
if (pthread_mutex_unlock(&((*s_nouvel_etat_processus).mutex)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
Line 658 instruction_spawn(struct_processus *s_et
|
Line 599 instruction_spawn(struct_processus *s_et
|
|
|
// Le fils peut être présent sans être en attente du signal de départ. |
// Le fils peut être présent sans être en attente du signal de départ. |
|
|
if (pthread_kill((*s_argument_thread).tid, SIGSTART) != 0) |
if (envoi_signal_thread((*s_argument_thread).tid, rpl_sigstart) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
|
if (pthread_sigmask(SIG_SETMASK, &oldset, NULL) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
|
|
sigpending(&set); |
|
|
|
return; |
return; |
} |
} |
|
|
Line 724 instruction_sqlconnect(struct_processus
|
Line 657 instruction_sqlconnect(struct_processus
|
|
|
printf(" { \"mysql\" \"server\" \"database\" " |
printf(" { \"mysql\" \"server\" \"database\" " |
"\"user\" \"password\" } SQLCONNECT\n"); |
"\"user\" \"password\" } SQLCONNECT\n"); |
|
printf(" { \"sqlite\" \"file\" } SQLCONNECT\n"); |
printf(" { \"postgresql:iso-8859-1\" \"server\" " |
printf(" { \"postgresql:iso-8859-1\" \"server\" " |
"\"database\" \"user\" \"password\" port }\n"); |
"\"database\" \"user\" \"password\" port }\n"); |
printf(" SQLCONNECT\n"); |
printf(" SQLCONNECT\n"); |
Line 756 instruction_sqlconnect(struct_processus
|
Line 690 instruction_sqlconnect(struct_processus
|
if ((s_objet_resultat = parametres_sql(s_etat_processus, |
if ((s_objet_resultat = parametres_sql(s_etat_processus, |
s_objet_argument)) == NULL) |
s_objet_argument)) == NULL) |
{ |
{ |
|
liberation(s_etat_processus, s_objet_resultat); |
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_argument); |
return; |
return; |
} |
} |
|
|
|
if ((*s_etat_processus).erreur_execution == |
|
d_ex_instruction_indisponible) |
|
{ |
|
liberation(s_etat_processus, s_objet_resultat); |
|
return; |
|
} |
|
|
if ((s_objet_systeme = copie_objet(s_etat_processus, s_objet_resultat, |
if ((s_objet_systeme = copie_objet(s_etat_processus, s_objet_resultat, |
'O')) == NULL) |
'O')) == NULL) |
{ |
{ |
Line 795 instruction_sqlconnect(struct_processus
|
Line 737 instruction_sqlconnect(struct_processus
|
|
|
/* |
/* |
================================================================================ |
================================================================================ |
Fonction 'sqlconnect' |
Fonction 'sqldisconnect' |
================================================================================ |
================================================================================ |
Entrées : |
Entrées : |
-------------------------------------------------------------------------------- |
-------------------------------------------------------------------------------- |
Line 883 instruction_sqldisconnect(struct_process
|
Line 825 instruction_sqldisconnect(struct_process
|
"MYSQL") == 0) |
"MYSQL") == 0) |
{ |
{ |
# ifdef MYSQL_SUPPORT |
# ifdef MYSQL_SUPPORT |
|
|
if ((*((struct_connecteur_sql *) (*(*l_element_courant) |
if ((*((struct_connecteur_sql *) (*(*l_element_courant) |
.donnee).objet)).descripteur.mysql == |
.donnee).objet)).descripteur.mysql == |
(*((struct_connecteur_sql *) (*s_objet).objet)) |
(*((struct_connecteur_sql *) (*s_objet).objet)) |
Line 894 instruction_sqldisconnect(struct_process
|
Line 837 instruction_sqldisconnect(struct_process
|
{ |
{ |
drapeau = d_faux; |
drapeau = d_faux; |
} |
} |
|
|
# else |
# else |
|
|
if ((*s_etat_processus).langue == 'F') |
if ((*s_etat_processus).langue == 'F') |
Line 915 instruction_sqldisconnect(struct_process
|
Line 859 instruction_sqldisconnect(struct_process
|
.type, "POSTGRESQL") == 0) |
.type, "POSTGRESQL") == 0) |
{ |
{ |
# ifdef POSTGRESQL_SUPPORT |
# ifdef POSTGRESQL_SUPPORT |
|
|
if ((*((struct_connecteur_sql *) (*(*l_element_courant) |
if ((*((struct_connecteur_sql *) (*(*l_element_courant) |
.donnee).objet)).descripteur.postgresql == |
.donnee).objet)).descripteur.postgresql == |
(*((struct_connecteur_sql *) (*s_objet).objet)) |
(*((struct_connecteur_sql *) (*s_objet).objet)) |
Line 945 instruction_sqldisconnect(struct_process
|
Line 890 instruction_sqldisconnect(struct_process
|
drapeau = d_faux; |
drapeau = d_faux; |
# endif |
# endif |
} |
} |
|
else if (strcmp((*((struct_connecteur_sql *) (*s_objet).objet)) |
|
.type, "SQLITE") == 0) |
|
{ |
|
if ((*((struct_connecteur_sql *) (*(*l_element_courant) |
|
.donnee).objet)).descripteur.sqlite == |
|
(*((struct_connecteur_sql *) (*s_objet).objet)) |
|
.descripteur.sqlite) |
|
{ |
|
drapeau = d_vrai; |
|
} |
|
else |
|
{ |
|
drapeau = d_faux; |
|
} |
|
} |
else |
else |
{ |
{ |
BUG(1, printf("SQL type '%s' not allowed!", |
BUG(1, printf("SQL type '%s' not allowed!", |
Line 1155 instruction_smphrdecr(struct_processus *
|
Line 1115 instruction_smphrdecr(struct_processus *
|
} |
} |
} |
} |
|
|
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
# 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; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
Line 1166 instruction_smphrdecr(struct_processus *
|
Line 1130 instruction_smphrdecr(struct_processus *
|
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
|
# ifndef SEMAPHORES_NOMMES |
|
sem_post(&((*s_etat_processus).semaphore_fork)); |
|
# else |
|
sem_post((*s_etat_processus).semaphore_fork); |
|
# endif |
|
|
(*s_etat_processus).erreur_execution = d_ex_semaphore; |
(*s_etat_processus).erreur_execution = d_ex_semaphore; |
|
|
if ((*s_etat_processus).profilage == d_vrai) |
if ((*s_etat_processus).profilage == d_vrai) |
Line 1178 instruction_smphrdecr(struct_processus *
|
Line 1148 instruction_smphrdecr(struct_processus *
|
} |
} |
} |
} |
|
|
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
# 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 (errno != EINTR) |
{ |
{ |
Line 1226 instruction_smphrdecr(struct_processus *
|
Line 1200 instruction_smphrdecr(struct_processus *
|
void |
void |
instruction_smphrtrydecr(struct_processus *s_etat_processus) |
instruction_smphrtrydecr(struct_processus *s_etat_processus) |
{ |
{ |
struct_objet *s_objet_argument; |
real8 partie_entiere; |
|
|
|
struct_objet *s_objet_argument_1; |
|
struct_objet *s_objet_argument_2; |
struct_objet *s_objet_resultat; |
struct_objet *s_objet_resultat; |
|
|
|
struct timeval horodatage; |
|
|
|
struct timespec horodatage_absolu; |
|
|
unsigned char *tampon; |
unsigned char *tampon; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
Line 1246 instruction_smphrtrydecr(struct_processu
|
Line 1227 instruction_smphrtrydecr(struct_processu
|
printf("(try to decremente semaphore)\n\n"); |
printf("(try to decremente semaphore)\n\n"); |
} |
} |
|
|
printf(" 1: %s\n", d_SPH); |
printf(" 2: %s\n", d_SPH); |
|
printf(" 1: %s, %s\n", d_INT, d_REL); |
printf("-> 1: %s\n", d_INT); |
printf("-> 1: %s\n", d_INT); |
return; |
return; |
} |
} |
Line 1258 instruction_smphrtrydecr(struct_processu
|
Line 1240 instruction_smphrtrydecr(struct_processu
|
|
|
if (test_cfsf(s_etat_processus, 31) == d_vrai) |
if (test_cfsf(s_etat_processus, 31) == d_vrai) |
{ |
{ |
if (empilement_pile_last(s_etat_processus, 1) == d_erreur) |
if (empilement_pile_last(s_etat_processus, 2) == d_erreur) |
{ |
{ |
return; |
return; |
} |
} |
} |
} |
|
|
if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
&s_objet_argument) == d_erreur) |
&s_objet_argument_1) == d_erreur) |
{ |
{ |
(*s_etat_processus).erreur_execution = d_ex_manque_argument; |
(*s_etat_processus).erreur_execution = d_ex_manque_argument; |
return; |
return; |
} |
} |
|
|
if ((*s_objet_argument).type == SPH) |
if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile), |
|
&s_objet_argument_2) == d_erreur) |
{ |
{ |
|
(*s_etat_processus).erreur_execution = d_ex_manque_argument; |
|
return; |
|
} |
|
|
|
if (((*s_objet_argument_2).type == SPH) && (((*s_objet_argument_1).type |
|
== INT) || ((*s_objet_argument_1).type == REL))) |
|
{ |
|
gettimeofday(&horodatage, NULL); |
|
|
|
if ((*s_objet_argument_1).type == INT) |
|
{ |
|
if ((*((integer8 *) (*s_objet_argument_1).objet)) < 0) |
|
{ |
|
(*s_etat_processus).erreur_execution = d_ex_argument_invalide; |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
return; |
|
} |
|
|
|
horodatage.tv_sec += (time_t) (*((integer8 *) |
|
(*s_objet_argument_1).objet)); |
|
} |
|
else |
|
{ |
|
if ((*((real8 *) (*s_objet_argument_1).objet)) < 0) |
|
{ |
|
(*s_etat_processus).erreur_execution = d_ex_argument_invalide; |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
return; |
|
} |
|
|
|
partie_entiere = floor((*((real8 *) (*s_objet_argument_1).objet))); |
|
horodatage.tv_sec += (time_t) partie_entiere; |
|
horodatage.tv_usec += ((suseconds_t) ((*((real8 *) |
|
(*s_objet_argument_1).objet)) - partie_entiere)) * 1000000; |
|
|
|
if (horodatage.tv_usec > 1000000) |
|
{ |
|
horodatage.tv_usec -= 1000000; |
|
horodatage.tv_sec += 1; |
|
} |
|
} |
|
|
|
horodatage_absolu.tv_sec = horodatage.tv_sec; |
|
horodatage_absolu.tv_nsec = horodatage.tv_usec * 1000; |
|
|
if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL) |
if ((s_objet_resultat = allocation(s_etat_processus, INT)) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 1281 instruction_smphrtrydecr(struct_processu
|
Line 1313 instruction_smphrtrydecr(struct_processu
|
|
|
if ((*s_etat_processus).profilage == d_vrai) |
if ((*s_etat_processus).profilage == d_vrai) |
{ |
{ |
if ((tampon = formateur(s_etat_processus, 0, s_objet_argument)) |
if ((tampon = formateur(s_etat_processus, 0, s_objet_argument_2)) |
== NULL) |
== NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
Line 1297 instruction_smphrtrydecr(struct_processu
|
Line 1329 instruction_smphrtrydecr(struct_processu
|
} |
} |
} |
} |
|
|
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
# ifndef SEMAPHORES_NOMMES |
|
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
|
# else |
|
if (sem_post((*s_etat_processus).semaphore_fork) != 0) |
|
# endif |
{ |
{ |
|
if ((*s_etat_processus).profilage == d_vrai) |
|
{ |
|
profilage(s_etat_processus, NULL); |
|
} |
|
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
|
(*((integer8 *) (*s_objet_resultat).objet)) = 0; |
(*((integer8 *) (*s_objet_resultat).objet)) = -1; |
|
|
while(sem_trywait((*((struct_semaphore *) (*s_objet_argument).objet)) |
while(sem_timedwait((*((struct_semaphore *) (*s_objet_argument_2) |
.semaphore) == -1) |
.objet)).semaphore, &horodatage_absolu) == -1) |
{ |
{ |
switch(errno) |
switch(errno) |
{ |
{ |
Line 1324 instruction_smphrtrydecr(struct_processu
|
Line 1365 instruction_smphrtrydecr(struct_processu
|
profilage(s_etat_processus, NULL); |
profilage(s_etat_processus, NULL); |
} |
} |
|
|
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
return; |
return; |
} |
} |
|
|
case EAGAIN : |
case ETIMEDOUT : |
{ |
{ |
(*((integer8 *) (*s_objet_resultat).objet)) = -1; |
(*((integer8 *) (*s_objet_resultat).objet)) = 0; |
break; |
break; |
} |
} |
} |
} |
|
|
if ((*((integer8 *) (*s_objet_resultat).objet)) != 0) |
if ((*((integer8 *) (*s_objet_resultat).objet)) == 0) |
{ |
{ |
break; |
break; |
} |
} |
} |
} |
|
|
while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) |
# 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 (errno != EINTR) |
{ |
{ |
Line 1360 instruction_smphrtrydecr(struct_processu
|
Line 1406 instruction_smphrtrydecr(struct_processu
|
profilage(s_etat_processus, NULL); |
profilage(s_etat_processus, NULL); |
} |
} |
|
|
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
} |
} |
else |
else |
{ |
{ |
(*s_etat_processus).erreur_execution = d_ex_erreur_type_argument; |
(*s_etat_processus).erreur_execution = d_ex_erreur_type_argument; |
|
|
liberation(s_etat_processus, s_objet_argument); |
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
return; |
return; |
} |
} |
|
|
Line 1600 instruction_svd(struct_processus *s_etat
|
Line 1648 instruction_svd(struct_processus *s_etat
|
|
|
struct_vecteur s_vecteur; |
struct_vecteur s_vecteur; |
|
|
unsigned long i; |
integer8 i; |
unsigned long j; |
integer8 j; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
|
|
Line 1693 instruction_svd(struct_processus *s_etat
|
Line 1741 instruction_svd(struct_processus *s_etat
|
.nombre_lignes; |
.nombre_lignes; |
|
|
if (((*((struct_matrice *) (*s_objet_resultat_2).objet)).tableau = |
if (((*((struct_matrice *) (*s_objet_resultat_2).objet)).tableau = |
malloc((*((struct_matrice *) (*s_objet_resultat_2).objet)) |
malloc(((size_t) (*((struct_matrice *) (*s_objet_resultat_2) |
.nombre_lignes * sizeof(real8 *))) == NULL) |
.objet)).nombre_lignes) * sizeof(real8 *))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 1704 instruction_svd(struct_processus *s_etat
|
Line 1752 instruction_svd(struct_processus *s_etat
|
.nombre_lignes; i++) |
.nombre_lignes; i++) |
{ |
{ |
if ((((real8 **) (*((struct_matrice *) (*s_objet_resultat_2) |
if ((((real8 **) (*((struct_matrice *) (*s_objet_resultat_2) |
.objet)).tableau)[i] = malloc((*((struct_matrice *) |
.objet)).tableau)[i] = malloc(((size_t) |
(*s_objet_resultat_2).objet)).nombre_colonnes * |
(*((struct_matrice *) (*s_objet_resultat_2).objet)) |
sizeof(real8 *))) == NULL) |
.nombre_colonnes) * sizeof(real8 *))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 1793 instruction_svd(struct_processus *s_etat
|
Line 1841 instruction_svd(struct_processus *s_etat
|
.nombre_lignes; |
.nombre_lignes; |
|
|
if (((*((struct_matrice *) (*s_objet_resultat_2).objet)).tableau = |
if (((*((struct_matrice *) (*s_objet_resultat_2).objet)).tableau = |
malloc((*((struct_matrice *) (*s_objet_resultat_2).objet)) |
malloc(((size_t) (*((struct_matrice *) (*s_objet_resultat_2) |
.nombre_lignes * sizeof(real8 *))) == NULL) |
.objet)).nombre_lignes) * sizeof(real8 *))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 1804 instruction_svd(struct_processus *s_etat
|
Line 1852 instruction_svd(struct_processus *s_etat
|
.nombre_lignes; i++) |
.nombre_lignes; i++) |
{ |
{ |
if ((((real8 **) (*((struct_matrice *) (*s_objet_resultat_2) |
if ((((real8 **) (*((struct_matrice *) (*s_objet_resultat_2) |
.objet)).tableau)[i] = malloc((*((struct_matrice *) |
.objet)).tableau)[i] = malloc(((size_t) |
(*s_objet_resultat_2).objet)).nombre_colonnes * |
(*((struct_matrice *) (*s_objet_resultat_2).objet)) |
sizeof(real8 *))) == NULL) |
.nombre_colonnes) * sizeof(real8 *))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |