Diff for /rpl/src/instructions_s1.c between versions 1.112 and 1.113

version 1.112, 2019/07/19 06:53:29 version 1.113, 2019/10/31 09:54:31
Line 3454  instruction_syseval(struct_processus *s_ Line 3454  instruction_syseval(struct_processus *s_
 {  {
     char                        **arguments;      char                        **arguments;
   
     int                         etape;  
     int                         ios;      int                         ios;
     int                         pipes_entree[2];      int                         pipes_entree[2];
     int                         pipes_erreur[2];      int                         pipes_erreur[2];
Line 3465  instruction_syseval(struct_processus *s_ Line 3464  instruction_syseval(struct_processus *s_
   
     logical1                    drapeau_fin;      logical1                    drapeau_fin;
     logical1                    presence_stdin;      logical1                    presence_stdin;
       logical1                    processus_tue;
   
     long                        i;      long                        i;
     long                        nombre_arguments;      long                        nombre_arguments;
Line 4047  instruction_syseval(struct_processus *s_ Line 4047  instruction_syseval(struct_processus *s_
                 return;                  return;
             }              }
   
               processus_tue = d_faux;
   
             while((ios = (int) read_atomic_signal(s_etat_processus,              while((ios = (int) read_atomic_signal(s_etat_processus,
                     pipes_sortie[0], &(tampon[pointeur]),                      pipes_sortie[0], &(tampon[pointeur]),
                     (size_t) longueur_lecture)) >= 0)                      (size_t) longueur_lecture)) >= 0)
Line 4097  instruction_syseval(struct_processus *s_ Line 4099  instruction_syseval(struct_processus *s_
                 if ((*s_etat_processus).var_volatile_requete_arret == -1)                  if ((*s_etat_processus).var_volatile_requete_arret == -1)
                 {                  {
                     gettimeofday(&horodatage_initial, NULL);                      gettimeofday(&horodatage_initial, NULL);
                       kill(pid, SIGTERM);
                     if ((*s_etat_processus).var_volatile_alarme == -1)  
                     {  
                         kill(pid, SIGKILL);  
                     }  
                     else  
                     {  
                         kill(pid, SIGTERM);  
                     }  
   
                     if ((fpipe = fdopen(pipes_sortie[0], "r")) == NULL)                      if ((fpipe = fdopen(pipes_sortie[0], "r")) == NULL)
                     {                      {
Line 4114  instruction_syseval(struct_processus *s_ Line 4108  instruction_syseval(struct_processus *s_
                         return;                          return;
                     }                      }
   
                     etape = 1;  
                     attente.tv_sec = 0;                      attente.tv_sec = 0;
                     attente.tv_nsec = GRANULARITE_us * 1000;                      attente.tv_nsec = GRANULARITE_us * 1000;
   
                     fds.fd = pipes_sortie[0];                      if (kill(pid, 0) == 0)
                     fds.events = POLLIN;  
   
                     while(feof(fpipe) != 0)  
                     {                      {
                         if (poll(&fds, 1, 0) > 0)                          while(feof(fpipe) == 0)
                         {  
                             getc(fpipe);  
                             attente.tv_sec = 0;  
                             attente.tv_nsec = GRANULARITE_us * 1000;  
                         }  
                         else  
                         {                          {
                             nanosleep(&attente, NULL);                              fds.fd = pipes_sortie[0];
                             INCR_GRANULARITE(attente.tv_nsec);                              fds.events = POLLIN;
                         }  
                               if (poll(&fds, 1, 0) > 0)
                               {
                                   getc(fpipe);
                                   attente.tv_sec = 0;
                                   attente.tv_nsec = GRANULARITE_us * 1000;
                               }
                               else
                               {
                                   nanosleep(&attente, NULL);
                                   INCR_GRANULARITE(attente.tv_nsec);
                               }
   
                         if (etape == 1)  
                         {  
                             gettimeofday(&horodatage_final, NULL);                              gettimeofday(&horodatage_final, NULL);
   
                             // Si au bout de 10 secondes après le premier                              // Si au bout de 10 secondes après le premier
Line 4147  instruction_syseval(struct_processus *s_ Line 4140  instruction_syseval(struct_processus *s_
                             if ((horodatage_final.tv_sec -                              if ((horodatage_final.tv_sec -
                                     horodatage_initial.tv_sec) > 10)                                      horodatage_initial.tv_sec) > 10)
                             {                              {
                                 etape = 2;  
                                 kill(pid, SIGKILL);                                  kill(pid, SIGKILL);
                                 gettimeofday(&horodatage_initial, NULL);                                  gettimeofday(&horodatage_initial, NULL);
                                   processus_tue = d_vrai;
                             }                              }
                         }                          }
                     }                      }
                   }
   
                   if (processus_tue == d_vrai)
                   {
                     break;                      break;
                 }                  }
             }              }

Removed from v.1.112  
changed lines
  Added in v.1.113


CVSweb interface <joel.bertrand@systella.fr>