Diff for /rpl/src/rpl.c between versions 1.34 and 1.41

version 1.34, 2010/07/31 10:34:18 version 1.41, 2010/08/18 12:56:55
Line 21 Line 21
   
   
 #define  MAIN_RPL  #define  MAIN_RPL
 #include "rpl.conv.h"  #include "rpl-conv.h"
   
   #ifdef SEMAPHORES_SYSV
   #ifndef OS2
       unsigned char       *chemin_semaphores_SysV;
   #endif
   #endif
   
   
 /*  /*
Line 33 Line 39
 int  int
 rplinit(int argc, char *argv[], unsigned char ***resultats, char *rpl_home)  rplinit(int argc, char *argv[], unsigned char ***resultats, char *rpl_home)
 {  {
 #   include                             "copyright.conv.h"  #   include                             "copyright-conv.h"
 #   include                             "licence.conv.h"  #   include                             "licence-conv.h"
   
     file                                *f_source;      file                                *f_source;
   
Line 99  rplinit(int argc, char *argv[], unsigned Line 105  rplinit(int argc, char *argv[], unsigned
     volatile int                        erreur;      volatile int                        erreur;
     volatile unsigned char              traitement_fichier_temporaire;      volatile unsigned char              traitement_fichier_temporaire;
   
       errno = 0;
   
 #   ifdef DEBUG_MEMOIRE  #   ifdef DEBUG_MEMOIRE
     debug_memoire_initialisation();      debug_memoire_initialisation();
 #   endif  #   endif
Line 231  rplinit(int argc, char *argv[], unsigned Line 239  rplinit(int argc, char *argv[], unsigned
             .mutex), &attributs_mutex);              .mutex), &attributs_mutex);
     pthread_mutexattr_destroy(&attributs_mutex);      pthread_mutexattr_destroy(&attributs_mutex);
   
       (*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
   #   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
   
     localisation_courante(s_etat_processus);      localisation_courante(s_etat_processus);
     (*s_etat_processus).erreur_systeme = d_es;      (*s_etat_processus).erreur_systeme = d_es;
   
Line 327  rplinit(int argc, char *argv[], unsigned Line 353  rplinit(int argc, char *argv[], unsigned
     // Initialisation d'une pile de signal pour récupérer les      // Initialisation d'une pile de signal pour récupérer les
     // débordement de pile      // débordement de pile
   
 #   ifndef Cygwin  #   if !defined(Cygwin) && !defined(OpenBSD)
     if (((*s_etat_processus).pile_signal.ss_sp =      if (((*s_etat_processus).pile_signal.ss_sp =
             malloc((*s_etat_processus).pile_signal.ss_size =              malloc((*s_etat_processus).pile_signal.ss_size =
             SIGSTKSZ)) == NULL)              SIGSTKSZ)) == NULL)
Line 366  rplinit(int argc, char *argv[], unsigned Line 392  rplinit(int argc, char *argv[], unsigned
     }      }
 #   endif  #   endif
   
   #   ifndef _BROKEN_SIGINFO
     action.sa_sigaction = interruption1;      action.sa_sigaction = interruption1;
   #   else
       action.sa_handler = interruption1;
   #   endif
     action.sa_flags = SA_ONSTACK | SA_SIGINFO;      action.sa_flags = SA_ONSTACK | SA_SIGINFO;
   
     if (sigaction(SIGINT, &action, NULL) != 0)      if (sigaction(SIGINT, &action, NULL) != 0)
Line 386  rplinit(int argc, char *argv[], unsigned Line 416  rplinit(int argc, char *argv[], unsigned
         return(EXIT_FAILURE);          return(EXIT_FAILURE);
     }      }
   
   #   ifndef _BROKEN_SIGINFO
     action.sa_sigaction = interruption2;      action.sa_sigaction = interruption2;
   #   else
       action.sa_handler = interruption2;
   #   endif
     action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO;      action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO;
   
     if (sigaction(SIGTSTP, &action, NULL) != 0)      if (sigaction(SIGTSTP, &action, NULL) != 0)
Line 404  rplinit(int argc, char *argv[], unsigned Line 438  rplinit(int argc, char *argv[], unsigned
         return(EXIT_FAILURE);          return(EXIT_FAILURE);
     }      }
   
   #   ifndef _BROKEN_SIGINFO
     action.sa_sigaction = interruption4;      action.sa_sigaction = interruption4;
   #   else
       action.sa_handler = interruption4;
   #   endif
     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 437  rplinit(int argc, char *argv[], unsigned Line 475  rplinit(int argc, char *argv[], unsigned
         return(EXIT_FAILURE);          return(EXIT_FAILURE);
     }      }
   
   #   ifndef _BROKEN_SIGINFO
     action.sa_sigaction = interruption5;      action.sa_sigaction = interruption5;
   #   else
       action.sa_handler = interruption5;
   #   endif
     action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO;      action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO;
   
     if (sigaction(SIGFSTOP, &action, NULL) != 0)      if (sigaction(SIGFSTOP, &action, NULL) != 0)
Line 457  rplinit(int argc, char *argv[], unsigned Line 499  rplinit(int argc, char *argv[], unsigned
         return(EXIT_FAILURE);          return(EXIT_FAILURE);
     }      }
   
   #   ifndef _BROKEN_SIGINFO
     action.sa_sigaction = interruption11;      action.sa_sigaction = interruption11;
   #   else
       action.sa_handler = interruption11;
   #   endif
     action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO;      action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO;
   
     if (sigaction(SIGFABORT, &action, NULL) != 0)      if (sigaction(SIGFABORT, &action, NULL) != 0)
Line 477  rplinit(int argc, char *argv[], unsigned Line 523  rplinit(int argc, char *argv[], unsigned
         return(EXIT_FAILURE);          return(EXIT_FAILURE);
     }      }
   
   #   ifndef _BROKEN_SIGINFO
     action.sa_sigaction = interruption8;      action.sa_sigaction = interruption8;
   #   else
       action.sa_handler = interruption8;
   #   endif
     action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO;      action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO;
   
     if (sigaction(SIGURG, &action, NULL) != 0)      if (sigaction(SIGURG, &action, NULL) != 0)
Line 497  rplinit(int argc, char *argv[], unsigned Line 547  rplinit(int argc, char *argv[], unsigned
         return(EXIT_FAILURE);          return(EXIT_FAILURE);
     }      }
   
   #   ifndef _BROKEN_SIGINFO
     action.sa_sigaction = interruption7;      action.sa_sigaction = interruption7;
   #   else
       action.sa_handler = interruption7;
   #   endif
     action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO;      action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO;
   
     if (sigaction(SIGPIPE, &action, NULL) != 0)      if (sigaction(SIGPIPE, &action, NULL) != 0)
Line 517  rplinit(int argc, char *argv[], unsigned Line 571  rplinit(int argc, char *argv[], unsigned
         return(EXIT_FAILURE);          return(EXIT_FAILURE);
     }      }
   
   #   ifndef _BROKEN_SIGINFO
     action.sa_sigaction = interruption6;      action.sa_sigaction = interruption6;
   #   else
       action.sa_handler = interruption6;
   #   endif
     action.sa_flags = SA_ONSTACK | SA_SIGINFO;      action.sa_flags = SA_ONSTACK | SA_SIGINFO;
   
     if (sigaction(SIGINJECT, &action, NULL) != 0)      if (sigaction(SIGINJECT, &action, NULL) != 0)
Line 537  rplinit(int argc, char *argv[], unsigned Line 595  rplinit(int argc, char *argv[], unsigned
         return(EXIT_FAILURE);          return(EXIT_FAILURE);
     }      }
   
   #   ifndef _BROKEN_SIGINFO
     action.sa_sigaction = interruption9;      action.sa_sigaction = interruption9;
   #   else
       action.sa_handler = interruption9;
   #   endif
     action.sa_flags = SA_ONSTACK | SA_SIGINFO;      action.sa_flags = SA_ONSTACK | SA_SIGINFO;
   
     if (sigaction(SIGABORT, &action, NULL) != 0)      if (sigaction(SIGABORT, &action, NULL) != 0)
Line 557  rplinit(int argc, char *argv[], unsigned Line 619  rplinit(int argc, char *argv[], unsigned
         return(EXIT_FAILURE);          return(EXIT_FAILURE);
     }      }
   
   #   ifndef _BROKEN_SIGINFO
     action.sa_sigaction = interruption1;      action.sa_sigaction = interruption1;
   #   else
       action.sa_handler = interruption1;
   #   endif
     action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO;      action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO;
   
     if (sigaction(SIGALRM, &action, NULL) != 0)      if (sigaction(SIGALRM, &action, NULL) != 0)
Line 577  rplinit(int argc, char *argv[], unsigned Line 643  rplinit(int argc, char *argv[], unsigned
         return(EXIT_FAILURE);          return(EXIT_FAILURE);
     }      }
   
   #   ifndef _BROKEN_SIGINFO
     action.sa_sigaction = interruption3;      action.sa_sigaction = interruption3;
   #   else
       action.sa_handler = interruption3;
   #   endif
     action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO;      action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO;
   
     (*s_etat_processus).chemin_fichiers_temporaires =  
             recherche_chemin_fichiers_temporaires(s_etat_processus);  
   
     erreur = d_absence_erreur;      erreur = d_absence_erreur;
     core = d_faux;      core = d_faux;
     mode_interactif = d_faux;      mode_interactif = d_faux;
Line 1505  rplinit(int argc, char *argv[], unsigned Line 1572  rplinit(int argc, char *argv[], unsigned
   
         if (option_n == d_vrai)          if (option_n == d_vrai)
         {          {
   #           ifndef _BROKEN_SIGINFO
             action.sa_sigaction = interruption10;              action.sa_sigaction = interruption10;
   #           else
               action.sa_handler = interruption10;
   #           endif
             action.sa_flags = SA_ONSTACK | SA_SIGINFO;              action.sa_flags = SA_ONSTACK | SA_SIGINFO;
   
             if (sigaction(SIGHUP, &action, NULL) != 0)              if (sigaction(SIGHUP, &action, NULL) != 0)
Line 1960  rplinit(int argc, char *argv[], unsigned Line 2031  rplinit(int argc, char *argv[], unsigned
   
             free((*s_etat_processus).instruction_courante);              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;                  erreur = d_es_allocation_memoire;
             }              }
Line 3411  rplinit(int argc, char *argv[], unsigned Line 3482  rplinit(int argc, char *argv[], unsigned
                         l_element_courant = l_element_suivant;                          l_element_courant = l_element_suivant;
                     }                      }
   
                     free((*s_etat_processus).chemin_fichiers_temporaires);  
   
                     l_element_courant = (*s_etat_processus).s_marques;                      l_element_courant = (*s_etat_processus).s_marques;
                     while(l_element_courant != NULL)                      while(l_element_courant != NULL)
                     {                      {
Line 3464  rplinit(int argc, char *argv[], unsigned Line 3533  rplinit(int argc, char *argv[], unsigned
         }          }
     }      }
   
 #   ifndef Cygwin  #   if !defined(Cygwin) && !defined(OpenBSD)
     (*s_etat_processus).pile_signal.ss_flags = SS_DISABLE;      (*s_etat_processus).pile_signal.ss_flags = SS_DISABLE;
     sigaltstack(&((*s_etat_processus).pile_signal), NULL);      sigaltstack(&((*s_etat_processus).pile_signal), NULL);
     free((*s_etat_processus).pile_signal.ss_sp);      free((*s_etat_processus).pile_signal.ss_sp);
Line 3507  rplinit(int argc, char *argv[], unsigned Line 3576  rplinit(int argc, char *argv[], unsigned
             sem_gestionnaires_signaux_atomique);              sem_gestionnaires_signaux_atomique);
 #   endif  #   endif
   
   #   ifdef _BROKEN_SIGINFO
       destruction_fifos_signaux(s_etat_processus);
   #   undef return
   #   endif
   
       free((*s_etat_processus).chemin_fichiers_temporaires);
     free(s_etat_processus);      free(s_etat_processus);
   
 #   ifdef DEBUG_MEMOIRE  #   ifdef DEBUG_MEMOIRE

Removed from v.1.34  
changed lines
  Added in v.1.41


CVSweb interface <joel.bertrand@systella.fr>