version 1.41, 2010/08/18 12:56:55
|
version 1.56, 2010/12/21 13:47:19
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.18 |
RPL/2 (R) version 4.0.20 |
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 23
|
Line 23
|
#define MAIN_RPL |
#define MAIN_RPL |
#include "rpl-conv.h" |
#include "rpl-conv.h" |
|
|
#ifdef SEMAPHORES_SYSV |
#ifdef IPCS_SYSV |
#ifndef OS2 |
#ifndef OS2 |
unsigned char *chemin_semaphores_SysV; |
unsigned char *chemin_semaphores_SysV; |
#endif |
#endif |
Line 107 rplinit(int argc, char *argv[], unsigned
|
Line 107 rplinit(int argc, char *argv[], unsigned
|
|
|
errno = 0; |
errno = 0; |
|
|
|
# ifdef DMALLOC |
|
atexit(dmalloc_shutdown()); |
|
# endif |
|
|
# ifdef DEBUG_MEMOIRE |
# ifdef DEBUG_MEMOIRE |
debug_memoire_initialisation(); |
debug_memoire_initialisation(); |
# endif |
# endif |
Line 189 rplinit(int argc, char *argv[], unsigned
|
Line 193 rplinit(int argc, char *argv[], unsigned
|
|
|
(*s_etat_processus).rpl_home = rpl_home; |
(*s_etat_processus).rpl_home = rpl_home; |
|
|
insertion_thread(s_etat_processus, d_vrai); |
|
|
|
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); |
pthread_mutex_init(&((*s_etat_processus).mutex), &attributs_mutex); |
pthread_mutex_init(&((*s_etat_processus).mutex), &attributs_mutex); |
Line 242 rplinit(int argc, char *argv[], unsigned
|
Line 244 rplinit(int argc, char *argv[], unsigned
|
(*s_etat_processus).chemin_fichiers_temporaires = |
(*s_etat_processus).chemin_fichiers_temporaires = |
recherche_chemin_fichiers_temporaires(s_etat_processus); |
recherche_chemin_fichiers_temporaires(s_etat_processus); |
|
|
# ifdef SEMAPHORES_SYSV |
# ifdef IPCS_SYSV |
# ifndef OS2 |
# ifndef OS2 |
chemin_semaphores_SysV = (*s_etat_processus).chemin_fichiers_temporaires; |
chemin_semaphores_SysV = (*s_etat_processus).chemin_fichiers_temporaires; |
# endif |
# endif |
Line 250 rplinit(int argc, char *argv[], unsigned
|
Line 252 rplinit(int argc, char *argv[], unsigned
|
|
|
# ifdef _BROKEN_SIGINFO |
# ifdef _BROKEN_SIGINFO |
creation_fifos_signaux(s_etat_processus); |
creation_fifos_signaux(s_etat_processus); |
|
|
# ifdef return |
# ifdef return |
# undef return |
# undef return |
# endif |
# endif |
# define return destruction_fifos_signaux(s_etat_processus); return |
# define return destruction_fifos_signaux(s_etat_processus); return |
# endif |
# endif |
|
|
|
insertion_thread(s_etat_processus, d_vrai); |
|
|
|
# ifndef OS2 |
localisation_courante(s_etat_processus); |
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; |
(*s_etat_processus).erreur_systeme = d_es; |
|
|
if ((*s_etat_processus).localisation == NULL) |
if ((*s_etat_processus).localisation == NULL) |
Line 416 rplinit(int argc, char *argv[], unsigned
|
Line 442 rplinit(int argc, char *argv[], unsigned
|
return(EXIT_FAILURE); |
return(EXIT_FAILURE); |
} |
} |
|
|
|
if (sigaction(SIGTERM, &action, NULL) != 0) |
|
{ |
|
erreur = d_es_signal; |
|
|
|
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
printf("+++Système : Initialisation des signaux POSIX " |
|
"impossible\n"); |
|
} |
|
else |
|
{ |
|
printf("+++System : Initialization of POSIX signals failed\n"); |
|
} |
|
|
|
return(EXIT_FAILURE); |
|
} |
|
|
# ifndef _BROKEN_SIGINFO |
# ifndef _BROKEN_SIGINFO |
action.sa_sigaction = interruption2; |
action.sa_sigaction = interruption2; |
# else |
# else |
Line 443 rplinit(int argc, char *argv[], unsigned
|
Line 486 rplinit(int argc, char *argv[], unsigned
|
# else |
# else |
action.sa_handler = interruption4; |
action.sa_handler = interruption4; |
# endif |
# endif |
|
// SIGCONT ne doit pas pouvoir être appelé depuis son gestionnaire. |
action.sa_flags = SA_ONSTACK | SA_SIGINFO; |
action.sa_flags = SA_ONSTACK | SA_SIGINFO; |
|
|
if (sigaction(SIGSTART, &action, NULL) != 0) |
if (sigaction(SIGSTART, &action, NULL) != 0) |
Line 576 rplinit(int argc, char *argv[], unsigned
|
Line 620 rplinit(int argc, char *argv[], unsigned
|
# else |
# else |
action.sa_handler = interruption6; |
action.sa_handler = interruption6; |
# endif |
# endif |
action.sa_flags = SA_ONSTACK | SA_SIGINFO; |
action.sa_flags = SA_ONSTACK | SA_SIGINFO | SA_NODEFER; |
|
|
if (sigaction(SIGINJECT, &action, NULL) != 0) |
if (sigaction(SIGINJECT, &action, NULL) != 0) |
{ |
{ |
Line 600 rplinit(int argc, char *argv[], unsigned
|
Line 644 rplinit(int argc, char *argv[], unsigned
|
# else |
# else |
action.sa_handler = interruption9; |
action.sa_handler = interruption9; |
# endif |
# endif |
action.sa_flags = SA_ONSTACK | SA_SIGINFO; |
action.sa_flags = SA_ONSTACK | SA_SIGINFO | SA_NODEFER; |
|
|
if (sigaction(SIGABORT, &action, NULL) != 0) |
if (sigaction(SIGABORT, &action, NULL) != 0) |
{ |
{ |
Line 1797 rplinit(int argc, char *argv[], unsigned
|
Line 1841 rplinit(int argc, char *argv[], unsigned
|
(*s_etat_processus).autorisation_empilement_programme = 'N'; |
(*s_etat_processus).autorisation_empilement_programme = 'N'; |
(*s_etat_processus).requete_arret = 'N'; |
(*s_etat_processus).requete_arret = 'N'; |
(*s_etat_processus).evaluation_forcee = 'N'; |
(*s_etat_processus).evaluation_forcee = 'N'; |
|
(*s_etat_processus).recherche_type = 'N'; |
|
|
(*s_etat_processus).constante_symbolique = 'N'; |
(*s_etat_processus).constante_symbolique = 'N'; |
(*s_etat_processus).traitement_symbolique = 'N'; |
(*s_etat_processus).traitement_symbolique = 'N'; |
Line 1952 rplinit(int argc, char *argv[], unsigned
|
Line 1997 rplinit(int argc, char *argv[], unsigned
|
(*s_etat_processus).pid_processus_pere = getpid(); |
(*s_etat_processus).pid_processus_pere = getpid(); |
(*s_etat_processus).processus_detache = d_vrai; |
(*s_etat_processus).processus_detache = d_vrai; |
(*s_etat_processus).var_volatile_processus_pere = -1; |
(*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_traitement_retarde_stop = 0; |
(*s_etat_processus).var_volatile_alarme = 0; |
(*s_etat_processus).var_volatile_alarme = 0; |
(*s_etat_processus).var_volatile_requete_arret = 0; |
(*s_etat_processus).var_volatile_requete_arret = 0; |
Line 3533 rplinit(int argc, char *argv[], unsigned
|
Line 3579 rplinit(int argc, char *argv[], unsigned
|
} |
} |
} |
} |
|
|
# if !defined(Cygwin) && !defined(OpenBSD) |
|
(*s_etat_processus).pile_signal.ss_flags = SS_DISABLE; |
|
sigaltstack(&((*s_etat_processus).pile_signal), NULL); |
|
free((*s_etat_processus).pile_signal.ss_sp); |
|
# endif |
|
|
|
closelog(); |
closelog(); |
|
|
pthread_mutex_destroy(&((*s_etat_processus).protection_liste_mutexes)); |
pthread_mutex_destroy(&((*s_etat_processus).protection_liste_mutexes)); |