--- rpl/src/instructions_w1.c 2011/05/09 13:52:22 1.34.2.4 +++ rpl/src/instructions_w1.c 2011/09/26 15:57:16 1.52 @@ -1,6 +1,6 @@ /* ================================================================================ - RPL/2 (R) version 4.0.24 + RPL/2 (R) version 4.1.4 Copyright (C) 1989-2011 Dr. BERTRAND Joël This file is part of RPL/2. @@ -262,26 +262,22 @@ instruction_wait(struct_processus *s_eta do { # ifndef SEMAPHORES_NOMMES - if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } + if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) # else - if (sem_post((*s_etat_processus).semaphore_fork) != 0) + if (sem_post((*s_etat_processus).semaphore_fork) != 0) +# endif { (*s_etat_processus).erreur_systeme = d_es_processus; return; } -# endif code_retour = nanosleep(&temporisation, &temporisation); erreur = errno; # ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) # else - while(sem_wait((*s_etat_processus).semaphore_fork) == -1) + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) # endif { if (errno != EINTR) @@ -1460,9 +1456,9 @@ instruction_write(struct_processus *s_et } # ifndef SEMAPHORES_NOMMES - if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) + if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) # else - if (sem_post((*s_etat_processus).semaphore_fork) != 0) + if (sem_post((*s_etat_processus).semaphore_fork) != 0) # endif { if (sigaction(SIGPIPE, ®istre, NULL) != 0) @@ -1487,9 +1483,9 @@ instruction_write(struct_processus *s_et } # ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) # else - while(sem_wait((*s_etat_processus).semaphore_fork) == -1) + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) # endif { if (errno != EINTR) @@ -1511,9 +1507,9 @@ instruction_write(struct_processus *s_et } # ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) # else - while(sem_wait((*s_etat_processus).semaphore_fork) == -1) + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) # endif { if (errno != EINTR) @@ -1568,18 +1564,14 @@ instruction_write(struct_processus *s_et d_code_fin_chaine; # ifndef SEMAPHORES_NOMMES - if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } + if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) # else - if (sem_post((*s_etat_processus).semaphore_fork) != 0) + if (sem_post((*s_etat_processus).semaphore_fork) != 0) +# endif { (*s_etat_processus).erreur_systeme = d_es_processus; return; } -# endif if (sendto((*((struct_socket *) (*s_objet_argument_1).objet)).socket, chaine, @@ -1589,17 +1581,15 @@ instruction_write(struct_processus *s_et ios = errno; # ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus) - .semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) + != 0) # else - while(sem_wait((*s_etat_processus) - .semaphore_fork) == -1) + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) # endif { if (errno != EINTR) { - (*s_etat_processus).erreur_systeme = - d_es_processus; + (*s_etat_processus).erreur_systeme = d_es_processus; return; } } @@ -1617,9 +1607,9 @@ instruction_write(struct_processus *s_et } # ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) # else - while(sem_wait((*s_etat_processus).semaphore_fork) == -1) + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) # endif { if (errno != EINTR) @@ -1648,19 +1638,15 @@ instruction_write(struct_processus *s_et adresse_ipv4.sin_addr.s_addr = htonl(calcul_adresse); # ifndef SEMAPHORES_NOMMES - if (sem_post(&((*s_etat_processus) - .semaphore_fork)) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } + if (sem_post(&((*s_etat_processus).semaphore_fork)) + != 0) # else - if (sem_post((*s_etat_processus) .semaphore_fork) != 0) + if (sem_post((*s_etat_processus).semaphore_fork) != 0) +# endif { (*s_etat_processus).erreur_systeme = d_es_processus; return; } -# endif if (sendto((*((struct_socket *) (*s_objet_argument_1).objet)).socket, chaine, @@ -1668,11 +1654,11 @@ instruction_write(struct_processus *s_et &adresse_ipv4, sizeof(adresse_ipv4)) < 0) { # ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus) - .semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus) + .semaphore_fork)) != 0) # else - while(sem_wait((*s_etat_processus) - .semaphore_fork) == -1) + while(sem_wait((*s_etat_processus) + .semaphore_fork) != 0) # endif { if (errno != EINTR) @@ -1689,17 +1675,15 @@ instruction_write(struct_processus *s_et } # ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus) - .semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) + != 0) # else - while(sem_wait((*s_etat_processus) - .semaphore_fork) == -1) + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) # endif { if (errno != EINTR) { - (*s_etat_processus).erreur_systeme = - d_es_processus; + (*s_etat_processus).erreur_systeme = d_es_processus; return; } } @@ -1737,19 +1721,15 @@ instruction_write(struct_processus *s_et adresse[i], i++); # ifndef SEMAPHORES_NOMMES - if (sem_post(&((*s_etat_processus) - .semaphore_fork)) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } + if (sem_post(&((*s_etat_processus).semaphore_fork)) + != 0) # else - if (sem_post((*s_etat_processus) .semaphore_fork) != 0) + if (sem_post((*s_etat_processus).semaphore_fork) != 0) +# endif { (*s_etat_processus).erreur_systeme = d_es_processus; return; } -# endif if (sendto((*((struct_socket *) (*s_objet_argument_1).objet)).socket, chaine, @@ -1757,11 +1737,11 @@ instruction_write(struct_processus *s_et &adresse_ipv6, sizeof(adresse_ipv6)) < 0) { # ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus) - .semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus) + .semaphore_fork)) != 0) # else - while(sem_wait((*s_etat_processus) - .semaphore_fork) == -1) + while(sem_wait((*s_etat_processus) + .semaphore_fork) != 0) # endif { if (errno != EINTR) @@ -1778,11 +1758,10 @@ instruction_write(struct_processus *s_et } # ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus) - .semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) + != 0) # else - while(sem_wait((*s_etat_processus) - .semaphore_fork) == -1) + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) # endif { if (errno != EINTR) @@ -1988,23 +1967,19 @@ instruction_wflock(struct_processus *s_e } # ifndef SEMAPHORES_NOMMES - if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } + if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) # else - if (sem_post((*s_etat_processus).semaphore_fork) != 0) + if (sem_post((*s_etat_processus).semaphore_fork) != 0) +# endif { (*s_etat_processus).erreur_systeme = d_es_processus; return; } -# endif # ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) # else - while(sem_wait((*s_etat_processus).semaphore_fork) == -1) + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) # endif { if (errno != EINTR) @@ -2228,9 +2203,9 @@ instruction_wfproc(struct_processus *s_e if ((*(*((struct_processus_fils *) (*(*l_element_courant) .donnee).objet)).thread).processus_detache == d_vrai) { - if (kill((*(*((struct_processus_fils *) + if (envoi_signal_processus((*(*((struct_processus_fils *) (*(*l_element_courant).donnee).objet)).thread).pid, - 0) != 0) + rpl_signull) != 0) { drapeau_fin = d_vrai; } @@ -2315,25 +2290,23 @@ instruction_wfproc(struct_processus *s_e } # ifndef SEMAPHORES_NOMMES - if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } + if (sem_post(&((*s_etat_processus).semaphore_fork)) + != 0) # else - if (sem_post((*s_etat_processus).semaphore_fork) != 0) + if (sem_post((*s_etat_processus).semaphore_fork) != 0) +# endif { (*s_etat_processus).erreur_systeme = d_es_processus; return; } -# endif nanosleep(&attente, NULL); # ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) + != 0) # else - while(sem_wait((*s_etat_processus).semaphore_fork) == -1) + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) # endif { if (errno != EINTR) @@ -2586,25 +2559,23 @@ instruction_wfdata(struct_processus *s_e } # ifndef SEMAPHORES_NOMMES - if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } + if (sem_post(&((*s_etat_processus).semaphore_fork)) + != 0) # else - if (sem_post((*s_etat_processus).semaphore_fork) != 0) + if (sem_post((*s_etat_processus).semaphore_fork) != 0) +# endif { (*s_etat_processus).erreur_systeme = d_es_processus; return; } -# endif nanosleep(&attente, NULL); # ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) + != 0) # else - while(sem_wait((*s_etat_processus).semaphore_fork) == -1) + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) # endif { if (errno != EINTR) @@ -2792,18 +2763,14 @@ instruction_wfsock(struct_processus *s_e drapeau = d_vrai; # ifndef SEMAPHORES_NOMMES - if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } + if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) # else - if (sem_post((*s_etat_processus).semaphore_fork) != 0) + if (sem_post((*s_etat_processus).semaphore_fork) != 0) +# endif { (*s_etat_processus).erreur_systeme = d_es_processus; return; } -# endif if (((*((struct_socket *) (*s_objet_resultat).objet)).socket = accept((*((struct_socket *) (*s_objet_argument).objet)) @@ -2813,9 +2780,10 @@ instruction_wfsock(struct_processus *s_e erreur = errno; # ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) + != 0) # else - while(sem_wait((*s_etat_processus).semaphore_fork) == -1) + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) # endif { if (errno != EINTR) @@ -2849,9 +2817,10 @@ instruction_wfsock(struct_processus *s_e else { # ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) + != 0) # else - while(sem_wait((*s_etat_processus).semaphore_fork) == -1) + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) # endif { if (errno != EINTR) @@ -2891,18 +2860,14 @@ instruction_wfsock(struct_processus *s_e drapeau = d_vrai; # ifndef SEMAPHORES_NOMMES - if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } + if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) # else - if (sem_post((*s_etat_processus).semaphore_fork) != 0) + if (sem_post((*s_etat_processus).semaphore_fork) != 0) +# endif { (*s_etat_processus).erreur_systeme = d_es_processus; return; } -# endif if (((*((struct_socket *) (*s_objet_resultat).objet)).socket = accept((*((struct_socket *) (*s_objet_argument).objet)) @@ -2912,9 +2877,10 @@ instruction_wfsock(struct_processus *s_e erreur = errno; # ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) + != 0) # else - while(sem_wait((*s_etat_processus).semaphore_fork) == -1) + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) # endif { if (errno != EINTR) @@ -2948,9 +2914,10 @@ instruction_wfsock(struct_processus *s_e else { # ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) + != 0) # else - while(sem_wait((*s_etat_processus).semaphore_fork) == -1) + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) # endif { if (errno != EINTR) @@ -3009,18 +2976,14 @@ instruction_wfsock(struct_processus *s_e drapeau = d_vrai; # ifndef SEMAPHORES_NOMMES - if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } + if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) # else - if (sem_post((*s_etat_processus).semaphore_fork) != 0) + if (sem_post((*s_etat_processus).semaphore_fork) != 0) +# endif { (*s_etat_processus).erreur_systeme = d_es_processus; return; } -# endif if (((*((struct_socket *) (*s_objet_resultat).objet)).socket = accept((*((struct_socket *) (*s_objet_argument).objet)) @@ -3029,9 +2992,10 @@ instruction_wfsock(struct_processus *s_e erreur = errno; # ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) + != 0) # else - while(sem_wait((*s_etat_processus).semaphore_fork) == -1) + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) # endif { if (errno != EINTR) @@ -3065,9 +3029,10 @@ instruction_wfsock(struct_processus *s_e else { # ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) + != 0) # else - while(sem_wait((*s_etat_processus).semaphore_fork) == -1) + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) # endif { if (errno != EINTR) @@ -3355,25 +3320,21 @@ instruction_wfpoke(struct_processus *s_e do { # ifndef SEMAPHORES_NOMMES - if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } + if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) # else - if (sem_post((*s_etat_processus).semaphore_fork) != 0) + if (sem_post((*s_etat_processus).semaphore_fork) != 0) +# endif { (*s_etat_processus).erreur_systeme = d_es_processus; return; } -# endif nanosleep(&attente, NULL); # ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) # else - while(sem_wait((*s_etat_processus).semaphore_fork) == -1) + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) # endif { if (errno != EINTR) @@ -3517,26 +3478,22 @@ instruction_wfack(struct_processus *s_et } # ifndef SEMAPHORES_NOMMES - if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } + if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) # else - if (sem_post((*s_etat_processus).semaphore_fork) != 0) + if (sem_post((*s_etat_processus).semaphore_fork) != 0) +# endif { (*s_etat_processus).erreur_systeme = d_es_processus; return; } -# endif nanosleep(&attente, NULL); INCR_GRANULARITE(attente.tv_nsec); # ifndef SEMAPHORES_NOMMES - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) # else - while(sem_wait((*s_etat_processus).semaphore_fork) == -1) + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) # endif { if (errno != EINTR)