version 1.17, 2010/03/08 14:28:20
|
version 1.27, 2010/04/28 11:05:45
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.12 |
RPL/2 (R) version 4.0.15 |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
Copyright (C) 1989-2010 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
Line 26
|
Line 26
|
#define _GNU_SOURCE |
#define _GNU_SOURCE |
#define _REENTRANT |
#define _REENTRANT |
|
|
// Nécessaire pour les systèmes qui ne comprennent pas _GNU_SOURCE |
|
#define _XOPEN_SOURCE 500 |
|
|
|
/* |
/* |
================================================================================ |
================================================================================ |
Line 42
|
Line 40
|
#include <strings.h> |
#include <strings.h> |
#include <syslog.h> |
#include <syslog.h> |
#include <errno.h> |
#include <errno.h> |
|
#include <stdarg.h> |
|
|
#ifndef RPLARGS |
#ifndef RPLARGS |
# include <sys/resource.h> |
# include <sys/resource.h> |
Line 94
|
Line 93
|
# include <ieeefp.h> |
# include <ieeefp.h> |
#endif |
#endif |
|
|
|
// Définition spécifique à Hurd |
|
#ifndef PIPE_BUF |
|
# define fpathconf (".", _PC_PIPE_BUF) |
|
#endif |
|
|
#ifdef MYSQL_SUPPORT |
#ifdef MYSQL_SUPPORT |
# include <mysql.h> |
# include <mysql.h> |
# define mysqlclose(arg) mysql_close(arg.mysql) |
# define mysqlclose(arg) mysql_close(arg.mysql) |
Line 108
|
Line 112
|
# define postgresqlclose(arg) |
# define postgresqlclose(arg) |
#endif |
#endif |
|
|
#ifdef LIBRPL |
#include "librplprototypes.h" |
# include "librplprototypes.h" |
|
#endif |
|
|
|
/* |
/* |
================================================================================ |
================================================================================ |
Line 119
|
Line 121
|
*/ |
*/ |
|
|
#ifndef RPLARGS |
#ifndef RPLARGS |
|
// Arrêt par STOP |
# define SIGFSTOP SIGUSR1 |
# define SIGFSTOP SIGUSR1 |
|
// Démarrage d'un processus fils |
# define SIGSTART SIGUSR2 |
# define SIGSTART SIGUSR2 |
|
// Injection de données |
# define SIGINJECT SIGQUIT |
# define SIGINJECT SIGQUIT |
|
// Arrêt général |
# define SIGABORT SIGPROF |
# define SIGABORT SIGPROF |
|
// Arrêt d'un processus fils depuis autre chose que STOP |
|
# define SIGFABORT SIGPOLL |
# define d_NOMBRE_INTERRUPTIONS 64 |
# define d_NOMBRE_INTERRUPTIONS 64 |
#endif |
#endif |
|
|
Line 183 typedef unsigned char t_8_bits;
|
Line 191 typedef unsigned char t_8_bits;
|
*/ |
*/ |
|
|
#ifndef RPLARGS |
#ifndef RPLARGS |
|
# ifdef SEMAPHORES_NOMMES |
|
# define LONGUEUR_NOM_SEMAPHORE 64 |
|
# endif |
# ifndef MAIN_RPL |
# ifndef MAIN_RPL |
extern jmp_buf contexte; |
extern jmp_buf contexte; |
extern jmp_buf contexte_initial; |
extern jmp_buf contexte_initial; |
|
|
extern pthread_key_t semaphore_fork_processus_courant; |
# ifdef SEMAPHORES_NOMMES |
|
extern pthread_mutex_t mutex_sem; |
|
# endif |
|
|
extern sem_t semaphore_liste_threads; |
extern pthread_key_t semaphore_fork_processus_courant; |
extern sem_t semaphore_gestionnaires_signaux; |
|
extern sem_t semaphore_gestionnaires_signaux_atomique; |
extern sem_t |
|
# ifdef SEMAPHORES_NOMMES |
|
* |
|
# endif |
|
semaphore_liste_threads; |
|
|
|
extern sem_t |
|
# ifdef SEMAPHORES_NOMMES |
|
* |
|
# endif |
|
semaphore_gestionnaires_signaux; |
|
|
|
extern sem_t |
|
# ifdef SEMAPHORES_NOMMES |
|
* |
|
# endif |
|
semaphore_gestionnaires_signaux_atomique; |
|
|
|
# ifdef SEMAPHORES_NOMMES |
|
// 0 -> liste_threads |
|
// 1 -> gestionnaire_signaux |
|
// 2 -> gestionnaire_signaux_atomique |
|
// 3 -> &((*s_etat_processus).semaphore_fork) |
|
extern unsigned char noms_semaphores[4][LONGUEUR_NOM_SEMAPHORE]; |
|
extern sem_t *semaphores_nommes[4]; |
|
# endif |
# else |
# else |
jmp_buf contexte; |
jmp_buf contexte; |
jmp_buf contexte_initial; |
jmp_buf contexte_initial; |
|
|
|
# ifdef SEMAPHORES_NOMMES |
|
pthread_mutex_t mutex_sem = PTHREAD_MUTEX_INITIALIZER; |
|
# endif |
|
|
|
pthread_key_t semaphore_fork_processus_courant; |
|
|
|
sem_t |
|
# ifdef SEMAPHORES_NOMMES |
|
* |
|
# endif |
|
semaphore_liste_threads; |
|
|
pthread_key_t semaphore_fork_processus_courant; |
sem_t |
|
# ifdef SEMAPHORES_NOMMES |
|
* |
|
# endif |
|
semaphore_gestionnaires_signaux; |
|
|
sem_t semaphore_liste_threads; |
sem_t |
sem_t semaphore_gestionnaires_signaux; |
# ifdef SEMAPHORES_NOMMES |
sem_t semaphore_gestionnaires_signaux_atomique; |
* |
|
# endif |
|
semaphore_gestionnaires_signaux_atomique; |
|
|
|
# ifdef SEMAPHORES_NOMMES |
|
unsigned char noms_semaphores[4][LONGUEUR_NOM_SEMAPHORE]; |
|
sem_t *semaphores_nommes[4]; |
|
# endif |
# endif |
# endif |
#endif |
#endif |
|
|
|
#ifdef SEMAPHORES_NOMMES |
|
enum t_semaphore { sem_liste_threads = 0, |
|
sem_gestionnaires_signaux = 1, |
|
sem_gestionnaires_signaux_atomique = 2, |
|
sem_fork = 3 }; |
|
|
|
sem_t *sem_init2(unsigned int valeur, enum t_semaphore semaphore); |
|
int sem_destroy2(sem_t *semaphore_p, enum t_semaphore semaphore); |
|
int sem_getvalue2(sem_t *semaphore, int *valeur); |
|
|
|
#define sem_getvalue(semaphore, value) sem_getvalue2(semaphore, value) |
|
#define sem_post(semaphore) \ |
|
({ int r; pthread_mutex_lock(&mutex_sem); \ |
|
r = sem_post(semaphore), pthread_mutex_unlock(&mutex_sem); r; }) |
|
#define sem_wait(semaphore) \ |
|
({ int r; pthread_mutex_lock(&mutex_sem); \ |
|
r = sem_wait(semaphore), pthread_mutex_unlock(&mutex_sem); r; }) |
|
#define sem_trywait(semaphore) \ |
|
({ int r; pthread_mutex_lock(&mutex_sem); \ |
|
r = sem_trywait(semaphore), pthread_mutex_unlock(&mutex_sem); r; }) |
|
#endif |
|
|
/* |
/* |
================================================================================ |
================================================================================ |
Macros |
Macros |
Line 310 typedef unsigned char t_8_bits;
|
Line 393 typedef unsigned char t_8_bits;
|
if (appels != NULL) \ |
if (appels != NULL) \ |
{ \ |
{ \ |
for(i = 0; i < nb; i++) \ |
for(i = 0; i < nb; i++) \ |
uprintf("%s\n", appels[i]); \ |
uprintf(" %s\n", appels[i]); \ |
free(appels); \ |
free(appels); \ |
} \ |
} \ |
else \ |
else \ |
Line 622 void debug_memoire_retrait(void *ptr);
|
Line 705 void debug_memoire_retrait(void *ptr);
|
# define d_ex_erreur_profilage 78 |
# define d_ex_erreur_profilage 78 |
# define d_ex_enregistrement_inexistant 79 |
# define d_ex_enregistrement_inexistant 79 |
# define d_ex_clef_inexistante 80 |
# define d_ex_clef_inexistante 80 |
|
# define d_ex_nom_implicite 81 |
#endif |
#endif |
|
|
/* |
|
-------------------------------------------------------------------------------- |
|
Erreurs de la ligne de commande |
|
-------------------------------------------------------------------------------- |
|
*/ |
|
|
|
#ifndef RPLARGS |
|
# define d_os 4000 |
|
# define d_os_ligne_de_commande 4001 |
|
# define d_os_fichier_introuvable 4002 |
|
#endif |
|
|
|
/* |
/* |
================================================================================ |
================================================================================ |
Line 1366 typedef struct processus
|
Line 1439 typedef struct processus
|
unsigned char autorisation_conversion_chaine; /*Y/N*/ |
unsigned char autorisation_conversion_chaine; /*Y/N*/ |
unsigned char autorisation_empilement_programme; /*Y/N*/ |
unsigned char autorisation_empilement_programme; /*Y/N*/ |
unsigned char autorisation_evaluation_nom; /*Y/N*/ |
unsigned char autorisation_evaluation_nom; /*Y/N*/ |
|
unsigned char autorisation_nom_implicite; /*Y/N*/ |
unsigned char evaluation_forcee; /*Y/N*/ |
unsigned char evaluation_forcee; /*Y/N*/ |
unsigned char instruction_valide; /*Y/N*/ |
unsigned char instruction_valide; /*Y/N*/ |
unsigned char instruction_intrinseque; /*Y/I/N*/ |
unsigned char instruction_intrinseque; /*Y/I/N*/ |
Line 1692 typedef struct processus
|
Line 1766 typedef struct processus
|
unsigned char traitement_interruption; /* Y/N */ |
unsigned char traitement_interruption; /* Y/N */ |
unsigned char traitement_interruptible; /* Y/N */ |
unsigned char traitement_interruptible; /* Y/N */ |
|
|
|
struct_objet *at_exit; |
|
|
/* Variables volatiles */ |
/* Variables volatiles */ |
|
|
volatile sig_atomic_t var_volatile_alarme; |
volatile sig_atomic_t var_volatile_alarme; |
Line 1705 typedef struct processus
|
Line 1781 typedef struct processus
|
volatile sig_atomic_t var_volatile_processus_pere; |
volatile sig_atomic_t var_volatile_processus_pere; |
volatile sig_atomic_t var_volatile_recursivite; |
volatile sig_atomic_t var_volatile_recursivite; |
|
|
|
volatile sig_atomic_t arret_depuis_abort; |
|
|
volatile int var_volatile_exception_gsl; |
volatile int var_volatile_exception_gsl; |
|
|
/* Autres */ |
/* Autres */ |
Line 1751 typedef struct processus
|
Line 1829 typedef struct processus
|
pthread_mutex_t mutex; |
pthread_mutex_t mutex; |
|
|
// Sémaphore autorisant les fork() |
// Sémaphore autorisant les fork() |
sem_t semaphore_fork; |
sem_t |
|
# ifdef SEMAPHORES_NOMMES |
|
* |
|
# endif |
|
semaphore_fork; |
|
|
/* Mutexes */ |
/* Mutexes */ |
|
|
Line 1875 void instruction_asl(struct_processus *s
|
Line 1957 void instruction_asl(struct_processus *s
|
void instruction_asr(struct_processus *s_etat_processus); |
void instruction_asr(struct_processus *s_etat_processus); |
void instruction_atan(struct_processus *s_etat_processus); |
void instruction_atan(struct_processus *s_etat_processus); |
void instruction_atanh(struct_processus *s_etat_processus); |
void instruction_atanh(struct_processus *s_etat_processus); |
|
void instruction_atexit(struct_processus *s_etat_processus); |
void instruction_autoscale(struct_processus *s_etat_processus); |
void instruction_autoscale(struct_processus *s_etat_processus); |
void instruction_axes(struct_processus *s_etat_processus); |
void instruction_axes(struct_processus *s_etat_processus); |
|
|
Line 2044 void instruction_ifft(struct_processus *
|
Line 2127 void instruction_ifft(struct_processus *
|
void instruction_ift(struct_processus *s_etat_processus); |
void instruction_ift(struct_processus *s_etat_processus); |
void instruction_ifte(struct_processus *s_etat_processus); |
void instruction_ifte(struct_processus *s_etat_processus); |
void instruction_im(struct_processus *s_etat_processus); |
void instruction_im(struct_processus *s_etat_processus); |
|
void instruction_implicit(struct_processus *s_etat_processus); |
void instruction_in(struct_processus *s_etat_processus); |
void instruction_in(struct_processus *s_etat_processus); |
void instruction_incr(struct_processus *s_etat_processus); |
void instruction_incr(struct_processus *s_etat_processus); |
void instruction_indep(struct_processus *s_etat_processus); |
void instruction_indep(struct_processus *s_etat_processus); |
Line 2405 void deverrouillage_threads_concurrents(
|
Line 2489 void deverrouillage_threads_concurrents(
|
void ecriture_pile(struct_processus *s_etat_processus, file *flux, |
void ecriture_pile(struct_processus *s_etat_processus, file *flux, |
struct_liste_chainee *l_element_courant, unsigned long niveau_courant); |
struct_liste_chainee *l_element_courant, unsigned long niveau_courant); |
void ecriture_profil(struct_processus *s_etat_processus); |
void ecriture_profil(struct_processus *s_etat_processus); |
|
void effacement_pile_systeme(struct_processus *s_etat_processus); |
void empilement_pile_systeme(struct_processus *s_etat_processus); |
void empilement_pile_systeme(struct_processus *s_etat_processus); |
void encart(struct_processus *s_etat_processus, unsigned long duree); |
void encart(struct_processus *s_etat_processus, unsigned long duree); |
void evaluation_romberg(struct_processus *s_etat_processus, |
void evaluation_romberg(struct_processus *s_etat_processus, |