--- rpl/src/rpl.c 2010/08/15 14:46:25 1.39 +++ rpl/src/rpl.c 2010/11/26 11:46:38 1.51 @@ -1,6 +1,6 @@ /* ================================================================================ - RPL/2 (R) version 4.0.18 + RPL/2 (R) version 4.0.20 Copyright (C) 1989-2010 Dr. BERTRAND Joël This file is part of RPL/2. @@ -23,7 +23,7 @@ #define MAIN_RPL #include "rpl-conv.h" -#ifdef SEMAPHORES_SYSV +#ifdef IPCS_SYSV #ifndef OS2 unsigned char *chemin_semaphores_SysV; #endif @@ -189,8 +189,6 @@ rplinit(int argc, char *argv[], unsigned (*s_etat_processus).rpl_home = rpl_home; - insertion_thread(s_etat_processus, d_vrai); - pthread_mutexattr_init(&attributs_mutex); pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_NORMAL); pthread_mutex_init(&((*s_etat_processus).mutex), &attributs_mutex); @@ -239,7 +237,49 @@ rplinit(int argc, char *argv[], unsigned .mutex), &attributs_mutex); pthread_mutexattr_destroy(&attributs_mutex); + (*s_etat_processus).chemin_fichiers_temporaires = + recherche_chemin_fichiers_temporaires(s_etat_processus); + +# ifdef IPCS_SYSV +# ifndef OS2 + chemin_semaphores_SysV = (*s_etat_processus).chemin_fichiers_temporaires; +# endif +# endif + +# ifdef _BROKEN_SIGINFO + creation_fifos_signaux(s_etat_processus); +# ifdef return +# undef return +# endif +# define return destruction_fifos_signaux(s_etat_processus); return +# endif + + insertion_thread(s_etat_processus, d_vrai); + +# ifndef OS2 localisation_courante(s_etat_processus); +# else + if ((*s_etat_processus).erreur_systeme != d_es) + { + if (((*s_etat_processus).localisation = malloc((strlen(d_locale) + 1) * + sizeof(unsigned char))) == NULL) + { + if ((*s_etat_processus).langue == 'F') + { + uprintf("+++Système : Mémoire insuffisante\n"); + } + else + { + uprintf("+++System : Not enough memory\n"); + } + + return(EXIT_FAILURE); + } + + strcpy((*s_etat_processus).localisation, d_locale); + } +# endif + (*s_etat_processus).erreur_systeme = d_es; if ((*s_etat_processus).localisation == NULL) @@ -374,8 +414,12 @@ rplinit(int argc, char *argv[], unsigned } # endif +# ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption1; - action.sa_flags = SA_ONSTACK | SA_SIGINFO; +# else + action.sa_handler = interruption1; +# endif + action.sa_flags = SA_ONSTACK | SA_SIGINFO | SA_NODEFER; if (sigaction(SIGINT, &action, NULL) != 0) { @@ -394,7 +438,11 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } +# ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption2; +# else + action.sa_handler = interruption2; +# endif action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO; if (sigaction(SIGTSTP, &action, NULL) != 0) @@ -412,8 +460,12 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } +# ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption4; - action.sa_flags = SA_ONSTACK | SA_SIGINFO; +# else + action.sa_handler = interruption4; +# endif + action.sa_flags = SA_ONSTACK | SA_SIGINFO | SA_NODEFER; if (sigaction(SIGSTART, &action, NULL) != 0) { @@ -445,7 +497,11 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } +# ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption5; +# else + action.sa_handler = interruption5; +# endif action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO; if (sigaction(SIGFSTOP, &action, NULL) != 0) @@ -465,7 +521,11 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } +# ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption11; +# else + action.sa_handler = interruption11; +# endif action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO; if (sigaction(SIGFABORT, &action, NULL) != 0) @@ -485,7 +545,11 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } +# ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption8; +# else + action.sa_handler = interruption8; +# endif action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO; if (sigaction(SIGURG, &action, NULL) != 0) @@ -505,7 +569,11 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } +# ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption7; +# else + action.sa_handler = interruption7; +# endif action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO; if (sigaction(SIGPIPE, &action, NULL) != 0) @@ -525,8 +593,12 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } +# ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption6; - action.sa_flags = SA_ONSTACK | SA_SIGINFO; +# else + action.sa_handler = interruption6; +# endif + action.sa_flags = SA_ONSTACK | SA_SIGINFO | SA_NODEFER; if (sigaction(SIGINJECT, &action, NULL) != 0) { @@ -545,8 +617,12 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } +# ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption9; - action.sa_flags = SA_ONSTACK | SA_SIGINFO; +# else + action.sa_handler = interruption9; +# endif + action.sa_flags = SA_ONSTACK | SA_SIGINFO | SA_NODEFER; if (sigaction(SIGABORT, &action, NULL) != 0) { @@ -565,7 +641,11 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } +# ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption1; +# else + action.sa_handler = interruption1; +# endif action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO; if (sigaction(SIGALRM, &action, NULL) != 0) @@ -585,17 +665,12 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } +# ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption3; - action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO; - - (*s_etat_processus).chemin_fichiers_temporaires = - recherche_chemin_fichiers_temporaires(s_etat_processus); - -# ifdef SEMAPHORES_SYSV -# ifndef OS2 - chemin_semaphores_SysV = (*s_etat_processus).chemin_fichiers_temporaires; -# endif +# else + action.sa_handler = interruption3; # endif + action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO; erreur = d_absence_erreur; core = d_faux; @@ -1519,8 +1594,12 @@ rplinit(int argc, char *argv[], unsigned if (option_n == d_vrai) { +# ifndef _BROKEN_SIGINFO action.sa_sigaction = interruption10; - action.sa_flags = SA_ONSTACK | SA_SIGINFO; +# else + action.sa_handler = interruption10; +# endif + action.sa_flags = SA_ONSTACK | SA_SIGINFO | SA_NODEFER; if (sigaction(SIGHUP, &action, NULL) != 0) { @@ -1740,6 +1819,7 @@ rplinit(int argc, char *argv[], unsigned (*s_etat_processus).autorisation_empilement_programme = 'N'; (*s_etat_processus).requete_arret = 'N'; (*s_etat_processus).evaluation_forcee = 'N'; + (*s_etat_processus).recherche_type = 'N'; (*s_etat_processus).constante_symbolique = 'N'; (*s_etat_processus).traitement_symbolique = 'N'; @@ -1895,6 +1975,7 @@ rplinit(int argc, char *argv[], unsigned (*s_etat_processus).pid_processus_pere = getpid(); (*s_etat_processus).processus_detache = d_vrai; (*s_etat_processus).var_volatile_processus_pere = -1; + (*s_etat_processus).var_volatile_processus_racine = -1; (*s_etat_processus).var_volatile_traitement_retarde_stop = 0; (*s_etat_processus).var_volatile_alarme = 0; (*s_etat_processus).var_volatile_requete_arret = 0; @@ -1974,7 +2055,7 @@ rplinit(int argc, char *argv[], unsigned free((*s_etat_processus).instruction_courante); - if ((*s_etat_processus).erreur_systeme == d_es_allocation_memoire) + if ((*s_etat_processus).erreur_systeme != d_es) { erreur = d_es_allocation_memoire; } @@ -3425,8 +3506,6 @@ rplinit(int argc, char *argv[], unsigned l_element_courant = l_element_suivant; } - free((*s_etat_processus).chemin_fichiers_temporaires); - l_element_courant = (*s_etat_processus).s_marques; while(l_element_courant != NULL) { @@ -3521,6 +3600,12 @@ rplinit(int argc, char *argv[], unsigned sem_gestionnaires_signaux_atomique); # endif +# ifdef _BROKEN_SIGINFO + destruction_fifos_signaux(s_etat_processus); +# undef return +# endif + + free((*s_etat_processus).chemin_fichiers_temporaires); free(s_etat_processus); # ifdef DEBUG_MEMOIRE