Annotation of rpl/src/gestion_processus.c, revision 1.1

1.1     ! bertrand    1: /*
        !             2: ================================================================================
        !             3:   RPL/2 (R) version 4.0.9
        !             4:   Copyright (C) 1989-2010 Dr. BERTRAND Joël
        !             5: 
        !             6:   This file is part of RPL/2.
        !             7: 
        !             8:   RPL/2 is free software; you can redistribute it and/or modify it
        !             9:   under the terms of the CeCILL V2 License as published by the french
        !            10:   CEA, CNRS and INRIA.
        !            11:  
        !            12:   RPL/2 is distributed in the hope that it will be useful, but WITHOUT
        !            13:   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        !            14:   FITNESS FOR A PARTICULAR PURPOSE.  See the CeCILL V2 License
        !            15:   for more details.
        !            16:  
        !            17:   You should have received a copy of the CeCILL License
        !            18:   along with RPL/2. If not, write to info@cecill.info.
        !            19: ================================================================================
        !            20: */
        !            21: 
        !            22: 
        !            23: #include "rpl.conv.h"
        !            24: 
        !            25: 
        !            26: /*
        !            27: ================================================================================
        !            28:   Fonction de surveillance d'un processus fils.
        !            29:   Elle tourne dans un thread séparé et ferme les descripteurs lors
        !            30:   de la mort du fils.
        !            31: ================================================================================
        !            32:   Entrées : pointeur sur une structure
        !            33: --------------------------------------------------------------------------------
        !            34:   Sorties :
        !            35: --------------------------------------------------------------------------------
        !            36:   Effets de bord : néant
        !            37: ================================================================================
        !            38: */
        !            39: 
        !            40: void *
        !            41: surveillance_processus(void *argument)
        !            42: {
        !            43:    int                             iostat;
        !            44:    int                             status;
        !            45: 
        !            46:    integer8                        nombre_donnees;
        !            47: 
        !            48:    logical1                        drapeau;
        !            49:    logical1                        drapeau_fin;
        !            50:    logical1                        drapeau_fin_scrutation;
        !            51:    logical1                        drapeau_interruptions_traitees;
        !            52:    logical1                        drapeau_objets_traites;
        !            53: 
        !            54:    pid_t                           pid;
        !            55:    pid_t                           pid_candidat;
        !            56: 
        !            57:    pthread_t                       tid_candidat;
        !            58: 
        !            59:    sigset_t                        masque;
        !            60: 
        !            61:    ssize_t                         longueur_ecriture;
        !            62: 
        !            63:    struct_descripteur_thread       *s_argument_thread;
        !            64: 
        !            65:    struct_liste_chainee            *l_element_courant;
        !            66:    struct_liste_chainee            *l_element_precedent;
        !            67: 
        !            68:    struct_processus                *s_etat_processus;
        !            69: 
        !            70:    struct timespec                 attente;
        !            71: 
        !            72:    unsigned char                   caractere;
        !            73: 
        !            74:    unsigned int                    tampon_erreur;
        !            75: 
        !            76:    sigemptyset(&masque);
        !            77:    sigaddset(&masque, SIGINJECT);
        !            78:    sigaddset(&masque, SIGFSTOP);
        !            79:    sigaddset(&masque, SIGURG);
        !            80:    sigaddset(&masque, SIGALRM);
        !            81:    sigaddset(&masque, SIGCONT);
        !            82:    sigaddset(&masque, SIGINT);
        !            83:    pthread_sigmask(SIG_BLOCK, &masque, NULL);
        !            84: 
        !            85:    s_argument_thread = argument;
        !            86:    s_etat_processus = (*s_argument_thread).s_etat_processus;
        !            87:    insertion_thread_surveillance(s_etat_processus, s_argument_thread);
        !            88: 
        !            89:    attente.tv_sec = 0;
        !            90:    attente.tv_nsec = GRANULARITE_us * 1000;
        !            91: 
        !            92:    status = 0;
        !            93: 
        !            94:    drapeau_interruptions_traitees = d_faux;
        !            95:    drapeau_objets_traites = d_faux;
        !            96: 
        !            97:    if ((*s_etat_processus).debug == d_vrai)
        !            98:        if (((*s_etat_processus).type_debug &
        !            99:                d_debug_processus) != 0)
        !           100:    {
        !           101:        if ((*s_argument_thread).processus_detache == d_vrai)
        !           102:        {
        !           103:            if ((*s_etat_processus).langue == 'F')
        !           104:            {
        !           105:                printf("[%d] Lancement du thread de surveillance du"
        !           106:                        " processus %d\n", (int) getpid(),
        !           107:                        (int) (*s_argument_thread).pid);
        !           108:            }
        !           109:            else
        !           110:            {
        !           111:                printf("[%d] Start monitoring of process %d\n", (int) getpid(),
        !           112:                        (int) (*s_argument_thread).pid);
        !           113:            }
        !           114:        }
        !           115:        else
        !           116:        {
        !           117:            if ((*s_etat_processus).langue == 'F')
        !           118:            {
        !           119:                printf("[%d] Lancement du thread de surveillance du"
        !           120:                        " thread %llu\n", (int) getpid(), (unsigned long long)
        !           121:                        (*s_argument_thread).tid);
        !           122:            }
        !           123:            else
        !           124:            {
        !           125:                printf("[%d] Start monitoring of thread %llu\n",
        !           126:                        (int) getpid(), (unsigned long long)
        !           127:                        (*s_argument_thread).tid);
        !           128:            }
        !           129:        }
        !           130: 
        !           131:        fflush(stdout);
        !           132:    }
        !           133: 
        !           134:    /*
        !           135:     * On attend une donnée fictive pour être sûr que le processus fils
        !           136:     * est bien démarré.
        !           137:     */
        !           138: 
        !           139:    while(read_atomic(s_etat_processus,
        !           140:            (*s_argument_thread).pipe_nombre_objets_attente[0],
        !           141:            &caractere, sizeof(caractere)) == 0)
        !           142:    {
        !           143:        if ((*s_etat_processus).var_volatile_requete_arret != 0)
        !           144:        {
        !           145:            drapeau_objets_traites = d_vrai;
        !           146:            drapeau_interruptions_traitees = d_vrai;
        !           147:        }
        !           148: 
        !           149:        nanosleep(&attente, NULL);
        !           150:    }
        !           151: 
        !           152:    do
        !           153:    {
        !           154:        if ((*s_argument_thread).processus_detache == d_vrai)
        !           155:        {
        !           156:            /*
        !           157:             * Le processus est un processus détaché.
        !           158:             */
        !           159: 
        !           160:            // Scrutation de l'envoi de données par le fils.
        !           161: 
        !           162:            pid_candidat = 0;
        !           163: 
        !           164:            if (drapeau_objets_traites == d_vrai)
        !           165:            {
        !           166:                nanosleep(&attente, NULL);
        !           167:            }
        !           168:            else if ((iostat = read_atomic(s_etat_processus,
        !           169:                    (*s_argument_thread).pipe_nombre_objets_attente[0],
        !           170:                    &pid_candidat, sizeof(pid_candidat))) == 0)
        !           171:            {
        !           172:                // Rien dans le pipe
        !           173: 
        !           174:                nanosleep(&attente, NULL);
        !           175:            }
        !           176:            else if (iostat != sizeof(pid_candidat))
        !           177:            {
        !           178:                (*s_etat_processus).erreur_systeme_processus_fils =
        !           179:                        d_es_processus;
        !           180:            }
        !           181:            else
        !           182:            {
        !           183:                // Un pid est dans le pipe. On vérifie que les deux pids
        !           184:                // correspondent.
        !           185: 
        !           186:                if (pid_candidat == -2)
        !           187:                {
        !           188:                    drapeau_objets_traites = d_vrai;
        !           189:                }
        !           190:                else if (pid_candidat == -1)
        !           191:                {
        !           192:                }
        !           193:                else if ((iostat = read_atomic(s_etat_processus,
        !           194:                        (*s_argument_thread).pipe_nombre_objets_attente[0],
        !           195:                        &pid_candidat, sizeof(pid_candidat))) ==
        !           196:                        sizeof(pid_candidat))
        !           197:                {
        !           198:                    if ((*s_argument_thread).pid != pid_candidat)
        !           199:                    {
        !           200:                        (*s_etat_processus).erreur_systeme_processus_fils =
        !           201:                                d_es_processus;
        !           202:                        BUG(1, printf("Spurious process identifier"));
        !           203:                    }
        !           204: 
        !           205:                    // Un objet supplémentaire est dans le pipe correspondant
        !           206:                    // au processus surveillé par ce thread.
        !           207: 
        !           208:                    if (pthread_mutex_lock(&((*s_etat_processus).mutex)) != 0)
        !           209:                    {
        !           210:                        (*s_etat_processus).erreur_systeme_processus_fils =
        !           211:                                d_es_processus;
        !           212:                    }
        !           213:                    else
        !           214:                    {
        !           215:                        l_element_courant = (struct_liste_chainee *)
        !           216:                                (*s_etat_processus).l_base_pile_processus;
        !           217: 
        !           218:                        while(l_element_courant != NULL)
        !           219:                        {
        !           220:                            if ((*(*((struct_processus_fils *)
        !           221:                                    (*(*l_element_courant).donnee).objet))
        !           222:                                    .thread).processus_detache == d_faux)
        !           223:                            {
        !           224:                                l_element_courant = (*l_element_courant)
        !           225:                                        .suivant;
        !           226:                                continue;
        !           227:                            }
        !           228: 
        !           229:                            if ((*(*((struct_processus_fils *)
        !           230:                                    (*(*l_element_courant).donnee).objet))
        !           231:                                    .thread).pid == pid_candidat)
        !           232:                            {
        !           233:                                if ((*s_etat_processus).debug == d_vrai)
        !           234:                                    if (((*s_etat_processus).type_debug &
        !           235:                                            d_debug_processus) != 0)
        !           236:                                {
        !           237:                                    if ((*s_etat_processus).langue == 'F')
        !           238:                                    {
        !           239:                                        printf("[%d] Données en provenance "
        !           240:                                                "du processus %d\n",
        !           241:                                                (int) getpid(),
        !           242:                                                (int) (*s_argument_thread).pid);
        !           243:                                        fflush(stdout);
        !           244:                                    }
        !           245:                                    else
        !           246:                                    {
        !           247:                                        printf("[%d] Data from process %d\n",
        !           248:                                                (int) getpid(),
        !           249:                                                (int) (*s_argument_thread).pid);
        !           250:                                        fflush(stdout);
        !           251:                                    }
        !           252:                                }
        !           253: 
        !           254:                                if (pthread_mutex_lock(
        !           255:                                        &((*(*((struct_processus_fils *)
        !           256:                                        (*(*l_element_courant).donnee).objet))
        !           257:                                        .thread).mutex)) != 0)
        !           258:                                {
        !           259:                                    (*s_etat_processus).erreur_systeme =
        !           260:                                            d_es_processus;
        !           261:                                }
        !           262: 
        !           263:                                (*(*((struct_processus_fils *)
        !           264:                                        (*(*l_element_courant).donnee).objet))
        !           265:                                        .thread).nombre_objets_dans_pipe++;
        !           266: 
        !           267:                                if (pthread_mutex_unlock(
        !           268:                                        &((*(*((struct_processus_fils *)
        !           269:                                        (*(*l_element_courant).donnee).objet))
        !           270:                                        .thread).mutex)) != 0)
        !           271:                                {
        !           272:                                    (*s_etat_processus).erreur_systeme =
        !           273:                                            d_es_processus;
        !           274:                                }
        !           275: 
        !           276:                                while((longueur_ecriture =
        !           277:                                        write_atomic(s_etat_processus,
        !           278:                                        (*(*((struct_processus_fils *)
        !           279:                                        (*(*l_element_courant).donnee).objet))
        !           280:                                        .thread).pipe_acquittement[1], "-",
        !           281:                                        sizeof(unsigned char))) !=
        !           282:                                        sizeof(unsigned char))
        !           283:                                {
        !           284:                                    if (longueur_ecriture == -1)
        !           285:                                    {
        !           286:                                        (*s_etat_processus)
        !           287:                                                .erreur_systeme_processus_fils =
        !           288:                                                d_es_processus;
        !           289:                                    }
        !           290:                                }
        !           291: 
        !           292:                                if ((*s_etat_processus).debug == d_vrai)
        !           293:                                    if (((*s_etat_processus).type_debug &
        !           294:                                            d_debug_processus) != 0)
        !           295:                                {
        !           296:                                    if ((*s_etat_processus).langue == 'F')
        !           297:                                    {
        !           298:                                        printf("[%d] Données acquittées "
        !           299:                                                "en provenance du "
        !           300:                                                "processus %d\n",
        !           301:                                                (int) getpid(),
        !           302:                                                (int) (*s_argument_thread).pid);
        !           303:                                        fflush(stdout);
        !           304:                                    }
        !           305:                                    else
        !           306:                                    {
        !           307:                                        printf("[%d] Data acknowklegment "
        !           308:                                                "from process %d\n",
        !           309:                                                (int) getpid(),
        !           310:                                                (int) (*s_argument_thread).pid);
        !           311:                                        fflush(stdout);
        !           312:                                    }
        !           313:                                }
        !           314: 
        !           315:                                break;
        !           316:                            }
        !           317: 
        !           318:                            l_element_courant = (*l_element_courant).suivant;
        !           319:                        }
        !           320: 
        !           321:                        BUG(l_element_courant == NULL,
        !           322:                                printf("Process or thread not found"));
        !           323: 
        !           324:                        if (pthread_mutex_unlock(&((*s_etat_processus).mutex))
        !           325:                                != 0)
        !           326:                        {
        !           327:                            (*s_etat_processus).erreur_systeme_processus_fils =
        !           328:                                    d_es_processus;
        !           329:                        }
        !           330: 
        !           331:                        pthread_kill((*s_argument_thread).thread_pere,
        !           332:                                SIGINJECT);
        !           333:                    }
        !           334:                }
        !           335:                else
        !           336:                {
        !           337:                    (*s_etat_processus).erreur_systeme_processus_fils =
        !           338:                            d_es_processus;
        !           339:                }
        !           340:            }
        !           341: 
        !           342:            // Scrutation de l'envoi d'interruptions par le fils.
        !           343: 
        !           344:            if (drapeau_interruptions_traitees == d_vrai)
        !           345:            {
        !           346:                nanosleep(&attente, NULL);
        !           347:            }
        !           348:            else if ((iostat = read_atomic(s_etat_processus,
        !           349:                    (*s_argument_thread).pipe_nombre_interruptions_attente[0],
        !           350:                    &pid_candidat, sizeof(pid_candidat))) == 0)
        !           351:            {
        !           352:                // Rien dans le pipe
        !           353: 
        !           354:                nanosleep(&attente, NULL);
        !           355:            }
        !           356:            else if (iostat != sizeof(pid_candidat))
        !           357:            {
        !           358:                (*s_etat_processus).erreur_systeme_processus_fils =
        !           359:                        d_es_processus;
        !           360:            }
        !           361:            else
        !           362:            {
        !           363:                // Un pid est dans le pipe. On vérifie que les deux pids
        !           364:                // correspondent.
        !           365: 
        !           366:                if (pid_candidat == -2)
        !           367:                {
        !           368:                    drapeau_interruptions_traitees = d_vrai;
        !           369:                }
        !           370:                else if (pid_candidat == -1)
        !           371:                {
        !           372:                }
        !           373:                else if ((iostat = read_atomic(s_etat_processus,
        !           374:                        (*s_argument_thread).pipe_nombre_interruptions_attente
        !           375:                        [0], &pid_candidat, sizeof(pid_candidat)))
        !           376:                        == sizeof(pid_candidat))
        !           377:                {
        !           378:                    if ((*s_argument_thread).pid != pid_candidat)
        !           379:                    {
        !           380:                        (*s_etat_processus).erreur_systeme_processus_fils =
        !           381:                                d_es_processus;
        !           382:                        BUG(1, printf("Spurious interrupt"));
        !           383:                    }
        !           384: 
        !           385:                    // Une interruption supplémentaire est dans le pipe
        !           386:                    // correspondant au processus surveillé par ce thread.
        !           387: 
        !           388:                    if (pthread_mutex_lock(&((*s_etat_processus).mutex)) != 0)
        !           389:                    {
        !           390:                        (*s_etat_processus).erreur_systeme_processus_fils =
        !           391:                                d_es_processus;
        !           392:                    }
        !           393:                    else
        !           394:                    {
        !           395:                        l_element_courant = (struct_liste_chainee *)
        !           396:                                (*s_etat_processus).l_base_pile_processus;
        !           397: 
        !           398:                        while(l_element_courant != NULL)
        !           399:                        {
        !           400:                            if ((*(*((struct_processus_fils *)
        !           401:                                    (*(*l_element_courant).donnee).objet))
        !           402:                                    .thread).processus_detache == d_faux)
        !           403:                            {
        !           404:                                l_element_courant = (*l_element_courant)
        !           405:                                        .suivant;
        !           406:                                continue;
        !           407:                            }
        !           408: 
        !           409:                            if ((*(*((struct_processus_fils *)
        !           410:                                    (*(*l_element_courant).donnee).objet))
        !           411:                                    .thread).pid == pid_candidat)
        !           412:                            {
        !           413:                                if ((*s_etat_processus).debug == d_vrai)
        !           414:                                    if (((*s_etat_processus).type_debug &
        !           415:                                            d_traitement_interruption) != 0)
        !           416:                                {
        !           417:                                    if ((*s_etat_processus).langue == 'F')
        !           418:                                    {
        !           419:                                        printf("[%d] Interrution logicielle "
        !           420:                                                "en provenance du processus "
        !           421:                                                "%d\n", (int) getpid(),
        !           422:                                                (int) (*s_argument_thread).pid);
        !           423:                                        fflush(stdout);
        !           424:                                    }
        !           425:                                    else
        !           426:                                    {
        !           427:                                        printf("[%d] Software interrupt "
        !           428:                                                "from process %d\n",
        !           429:                                                (int) getpid(),
        !           430:                                                (int) (*s_argument_thread).pid);
        !           431:                                        fflush(stdout);
        !           432:                                    }
        !           433:                                }
        !           434: 
        !           435:                                if (pthread_mutex_lock(
        !           436:                                        &((*(*((struct_processus_fils *)
        !           437:                                        (*(*l_element_courant).donnee).objet))
        !           438:                                        .thread).mutex)) != 0)
        !           439:                                {
        !           440:                                    (*s_etat_processus).erreur_systeme =
        !           441:                                            d_es_processus;
        !           442:                                }
        !           443: 
        !           444:                                (*(*((struct_processus_fils *)
        !           445:                                        (*(*l_element_courant).donnee)
        !           446:                                        .objet)).thread)
        !           447:                                        .nombre_interruptions_dans_pipe++;
        !           448: 
        !           449:                                if (pthread_mutex_unlock(
        !           450:                                        &((*(*((struct_processus_fils *)
        !           451:                                        (*(*l_element_courant).donnee).objet))
        !           452:                                        .thread).mutex)) != 0)
        !           453:                                {
        !           454:                                    (*s_etat_processus).erreur_systeme =
        !           455:                                            d_es_processus;
        !           456:                                }
        !           457: 
        !           458:                                (*s_etat_processus)
        !           459:                                        .nombre_interruptions_non_affectees++;
        !           460: 
        !           461:                                while((longueur_ecriture =
        !           462:                                        write_atomic(s_etat_processus,
        !           463:                                        (*(*((struct_processus_fils *)
        !           464:                                        (*(*l_element_courant).donnee).objet))
        !           465:                                        .thread).pipe_acquittement[1], "-",
        !           466:                                        sizeof(unsigned char))) !=
        !           467:                                        sizeof(unsigned char))
        !           468:                                {
        !           469:                                    if (longueur_ecriture == -1)
        !           470:                                    {
        !           471:                                        (*s_etat_processus)
        !           472:                                                .erreur_systeme_processus_fils =
        !           473:                                                d_es_processus;
        !           474:                                    }
        !           475:                                }
        !           476: 
        !           477:                                if ((*s_etat_processus).debug == d_vrai)
        !           478:                                    if (((*s_etat_processus).type_debug &
        !           479:                                            d_traitement_interruption) != 0)
        !           480:                                {
        !           481:                                    if ((*s_etat_processus).langue == 'F')
        !           482:                                    {
        !           483:                                        printf("[%d] Interruption logicielle "
        !           484:                                                "acquittée en provenance "
        !           485:                                                "du processus %d\n",
        !           486:                                                (int) getpid(),
        !           487:                                                (int) (*s_argument_thread).pid);
        !           488:                                        fflush(stdout);
        !           489:                                    }
        !           490:                                    else
        !           491:                                    {
        !           492:                                        printf("[%d] Software interrupt "
        !           493:                                                "acknowklegment from "
        !           494:                                                "process %d\n",
        !           495:                                                (int) getpid(),
        !           496:                                                (int) (*s_argument_thread).pid);
        !           497:                                        fflush(stdout);
        !           498:                                    }
        !           499:                                }
        !           500: 
        !           501:                                break;
        !           502:                            }
        !           503: 
        !           504:                            l_element_courant = (*l_element_courant).suivant;
        !           505:                        }
        !           506: 
        !           507:                        BUG(l_element_courant == NULL,
        !           508:                                printf("Process or thread not found"));
        !           509: 
        !           510:                        if (pthread_mutex_unlock(&((*s_etat_processus).mutex))
        !           511:                                != 0)
        !           512:                        {
        !           513:                            (*s_etat_processus).erreur_systeme_processus_fils =
        !           514:                                    d_es_processus;
        !           515:                        }
        !           516: 
        !           517:                        pthread_kill((*s_argument_thread).thread_pere,
        !           518:                                SIGINJECT);
        !           519:                    }
        !           520:                }
        !           521:                else
        !           522:                {
        !           523:                    (*s_etat_processus).erreur_systeme_processus_fils =
        !           524:                            d_es_processus;
        !           525:                }
        !           526:            }
        !           527: 
        !           528:            if ((pid = waitpid((*s_argument_thread).pid, &status, WNOHANG)) < 0)
        !           529:            {
        !           530:                break;
        !           531:            }
        !           532: 
        !           533:            drapeau_fin_scrutation = (!WIFEXITED(status)) ||
        !           534:                    (!WIFSIGNALED(status)) || (pid == 0);
        !           535: 
        !           536:            if (WIFEXITED(status))
        !           537:            {
        !           538:                if (WEXITSTATUS(status) == (0xFF & EXIT_FAILURE))
        !           539:                {
        !           540:                    (*s_etat_processus).erreur_systeme = d_es_processus;
        !           541:                }
        !           542:            }
        !           543:        }
        !           544:        else
        !           545:        {
        !           546:            /*
        !           547:             * Le processus n'est pas détaché.
        !           548:             */
        !           549: 
        !           550:            // Scrutation de l'envoi de données par le fils.
        !           551: 
        !           552:            tid_candidat = (pthread_t) 0;
        !           553: 
        !           554:            if (drapeau_objets_traites == d_vrai)
        !           555:            {
        !           556:                nanosleep(&attente, NULL);
        !           557:            }
        !           558:            else if ((iostat = read_atomic(s_etat_processus,
        !           559:                    (*s_argument_thread).pipe_nombre_objets_attente[0],
        !           560:                    &tid_candidat, sizeof(tid_candidat))) == 0)
        !           561:            {
        !           562:                // Rien dans le pipe
        !           563: 
        !           564:                nanosleep(&attente, NULL);
        !           565:            }
        !           566:            else if (iostat != sizeof(tid_candidat))
        !           567:            {
        !           568:                (*s_etat_processus).erreur_systeme_processus_fils =
        !           569:                        d_es_processus;
        !           570:            }
        !           571:            else
        !           572:            {
        !           573:                // Un pid est dans le pipe. On vérifie que les deux pids
        !           574:                // correspondent.
        !           575: 
        !           576:                if (tid_candidat == (pthread_t) -2)
        !           577:                {
        !           578:                    drapeau_objets_traites = d_vrai;
        !           579:                }
        !           580:                else if (tid_candidat == (pthread_t) -1)
        !           581:                {
        !           582:                }
        !           583:                else if ((iostat = read_atomic(s_etat_processus,
        !           584:                        (*s_argument_thread).pipe_nombre_objets_attente[0],
        !           585:                        &tid_candidat, sizeof(tid_candidat))) ==
        !           586:                        sizeof(tid_candidat))
        !           587:                {
        !           588:                    if (pthread_equal((*s_argument_thread).tid,
        !           589:                                tid_candidat) == 0)
        !           590:                    {
        !           591:                        (*s_etat_processus).erreur_systeme_processus_fils =
        !           592:                                d_es_processus;
        !           593:                        BUG(1, printf("Spurious thread identifier"));
        !           594:                    }
        !           595: 
        !           596:                    // Un objet supplémentaire est dans le pipe correspondant
        !           597:                    // au processus surveillé par ce thread.
        !           598: 
        !           599:                    if (pthread_mutex_lock(&((*s_etat_processus).mutex)) != 0)
        !           600:                    {
        !           601:                        (*s_etat_processus).erreur_systeme_processus_fils =
        !           602:                                d_es_processus;
        !           603:                    }
        !           604:                    else
        !           605:                    {
        !           606:                        l_element_courant = (struct_liste_chainee *)
        !           607:                                (*s_etat_processus).l_base_pile_processus;
        !           608: 
        !           609:                        while(l_element_courant != NULL)
        !           610:                        {
        !           611:                            if ((*(*((struct_processus_fils *)
        !           612:                                    (*(*l_element_courant).donnee).objet))
        !           613:                                    .thread).processus_detache == d_vrai)
        !           614:                            {
        !           615:                                l_element_courant = (*l_element_courant)
        !           616:                                        .suivant;
        !           617:                                continue;
        !           618:                            }
        !           619: 
        !           620:                            if (pthread_equal((*(*((struct_processus_fils *)
        !           621:                                    (*(*l_element_courant).donnee).objet))
        !           622:                                    .thread).tid, tid_candidat) != 0)
        !           623:                            {
        !           624:                                if ((*s_etat_processus).debug == d_vrai)
        !           625:                                    if (((*s_etat_processus).type_debug &
        !           626:                                            d_debug_processus) != 0)
        !           627:                                {
        !           628:                                    if ((*s_etat_processus).langue == 'F')
        !           629:                                    {
        !           630:                                        printf("[%d] Données en provenance "
        !           631:                                                "du thread %llu\n",
        !           632:                                                (int) getpid(),
        !           633:                                                (unsigned long long)
        !           634:                                                (*s_argument_thread).tid);
        !           635:                                        fflush(stdout);
        !           636:                                    }
        !           637:                                    else
        !           638:                                    {
        !           639:                                        printf("[%d] Data from thread %llu\n",
        !           640:                                                (int) getpid(),
        !           641:                                                (unsigned long long)
        !           642:                                                (*s_argument_thread).tid);
        !           643:                                        fflush(stdout);
        !           644:                                    }
        !           645:                                }
        !           646: 
        !           647:                                if (pthread_mutex_lock(
        !           648:                                        &((*(*((struct_processus_fils *)
        !           649:                                        (*(*l_element_courant).donnee).objet))
        !           650:                                        .thread).mutex)) != 0)
        !           651:                                {
        !           652:                                    (*s_etat_processus).erreur_systeme =
        !           653:                                            d_es_processus;
        !           654:                                }
        !           655: 
        !           656:                                (*(*((struct_processus_fils *)
        !           657:                                        (*(*l_element_courant).donnee).objet))
        !           658:                                        .thread).nombre_objets_dans_pipe++;
        !           659: 
        !           660:                                if (pthread_mutex_unlock(
        !           661:                                        &((*(*((struct_processus_fils *)
        !           662:                                        (*(*l_element_courant).donnee).objet))
        !           663:                                        .thread).mutex)) != 0)
        !           664:                                {
        !           665:                                    (*s_etat_processus).erreur_systeme =
        !           666:                                            d_es_processus;
        !           667:                                }
        !           668: 
        !           669:                                while((longueur_ecriture =
        !           670:                                        write_atomic(s_etat_processus,
        !           671:                                        (*(*((struct_processus_fils *)
        !           672:                                        (*(*l_element_courant).donnee).objet))
        !           673:                                        .thread).pipe_acquittement[1], "-",
        !           674:                                        sizeof(unsigned char))) !=
        !           675:                                        sizeof(unsigned char))
        !           676:                                {
        !           677:                                    if (longueur_ecriture == -1)
        !           678:                                    {
        !           679:                                        (*s_etat_processus)
        !           680:                                                .erreur_systeme_processus_fils =
        !           681:                                                d_es_processus;
        !           682:                                    }
        !           683:                                }
        !           684: 
        !           685:                                if ((*s_etat_processus).debug == d_vrai)
        !           686:                                    if (((*s_etat_processus).type_debug &
        !           687:                                            d_debug_processus) != 0)
        !           688:                                {
        !           689:                                    if ((*s_etat_processus).langue == 'F')
        !           690:                                    {
        !           691:                                        printf("[%d] Données acquittées "
        !           692:                                                "en provenance du thread "
        !           693:                                                "%llu\n", (int) getpid(),
        !           694:                                                (unsigned long long)
        !           695:                                                (*s_argument_thread).tid);
        !           696:                                        fflush(stdout);
        !           697:                                    }
        !           698:                                    else
        !           699:                                    {
        !           700:                                        printf("[%d] Data acknowklegment "
        !           701:                                                "from thread %llu\n",
        !           702:                                                (int) getpid(),
        !           703:                                                (unsigned long long)
        !           704:                                                (*s_argument_thread).tid);
        !           705:                                        fflush(stdout);
        !           706:                                    }
        !           707:                                }
        !           708: 
        !           709:                                break;
        !           710:                            }
        !           711: 
        !           712:                            l_element_courant = (*l_element_courant).suivant;
        !           713:                        }
        !           714: 
        !           715:                        BUG(l_element_courant == NULL,
        !           716:                                printf("Process or thread not found"));
        !           717: 
        !           718:                        if (pthread_mutex_unlock(&((*s_etat_processus).mutex))
        !           719:                                != 0)
        !           720:                        {
        !           721:                            (*s_etat_processus).erreur_systeme_processus_fils =
        !           722:                                    d_es_processus;
        !           723:                        }
        !           724:                    }
        !           725:                }
        !           726:                else
        !           727:                {
        !           728:                    (*s_etat_processus).erreur_systeme_processus_fils =
        !           729:                            d_es_processus;
        !           730:                }
        !           731:            }
        !           732: 
        !           733:            // Scrutation de l'envoi d'interruptions par le fils.
        !           734: 
        !           735:            if (drapeau_interruptions_traitees == d_vrai)
        !           736:            {
        !           737:                nanosleep(&attente, NULL);
        !           738:            }
        !           739:            else if ((iostat = read_atomic(s_etat_processus,
        !           740:                    (*s_argument_thread).pipe_nombre_interruptions_attente[0],
        !           741:                    &tid_candidat, sizeof(tid_candidat))) == 0)
        !           742:            {
        !           743:                // Rien dans le pipe
        !           744: 
        !           745:                nanosleep(&attente, NULL);
        !           746:            }
        !           747:            else if (iostat != sizeof(tid_candidat))
        !           748:            {
        !           749:                (*s_etat_processus).erreur_systeme_processus_fils =
        !           750:                        d_es_processus;
        !           751:            }
        !           752:            else
        !           753:            {
        !           754:                // Un pid est dans le pipe. On vérifie que les deux pids
        !           755:                // correspondent.
        !           756: 
        !           757:                if (tid_candidat == (pthread_t) -2)
        !           758:                {
        !           759:                    drapeau_interruptions_traitees = d_vrai;
        !           760:                }
        !           761:                else if (tid_candidat == (pthread_t) -1)
        !           762:                {
        !           763:                }
        !           764:                else if ((iostat = read_atomic(s_etat_processus,
        !           765:                        (*s_argument_thread).pipe_nombre_interruptions_attente
        !           766:                        [0], &tid_candidat, sizeof(tid_candidat))) ==
        !           767:                        sizeof(tid_candidat))
        !           768:                {
        !           769:                    if (pthread_equal((*s_argument_thread).tid,
        !           770:                            tid_candidat) == 0)
        !           771:                    {
        !           772:                        (*s_etat_processus).erreur_systeme_processus_fils =
        !           773:                                d_es_processus;
        !           774:                        BUG(1, printf("Spurious interrupt"));
        !           775:                    }
        !           776: 
        !           777:                    // Une interruption supplémentaire est dans le pipe
        !           778:                    // correspondant au processus surveillé par ce thread.
        !           779: 
        !           780:                    if (pthread_mutex_lock(&((*s_etat_processus).mutex)) != 0)
        !           781:                    {
        !           782:                        (*s_etat_processus).erreur_systeme_processus_fils =
        !           783:                                d_es_processus;
        !           784:                    }
        !           785:                    else
        !           786:                    {
        !           787:                        l_element_courant = (struct_liste_chainee *)
        !           788:                                (*s_etat_processus).l_base_pile_processus;
        !           789: 
        !           790:                        while(l_element_courant != NULL)
        !           791:                        {
        !           792:                            if ((*(*((struct_processus_fils *)
        !           793:                                    (*(*l_element_courant).donnee).objet))
        !           794:                                    .thread).processus_detache == d_vrai)
        !           795:                            {
        !           796:                                l_element_courant = (*l_element_courant)
        !           797:                                        .suivant;
        !           798:                                continue;
        !           799:                            }
        !           800: 
        !           801:                            if (pthread_equal((*(*((struct_processus_fils *)
        !           802:                                    (*(*l_element_courant).donnee).objet))
        !           803:                                    .thread).tid, tid_candidat) != 0)
        !           804:                            {
        !           805:                                if ((*s_etat_processus).debug == d_vrai)
        !           806:                                    if (((*s_etat_processus).type_debug &
        !           807:                                            d_debug_processus) != 0)
        !           808:                                {
        !           809:                                    if ((*s_etat_processus).langue == 'F')
        !           810:                                    {
        !           811:                                        printf("[%d] Interrution logicielle "
        !           812:                                                "en provenance du thread "
        !           813:                                                "%llu\n", (int) getpid(),
        !           814:                                                (unsigned long long)
        !           815:                                                (*s_argument_thread).tid);
        !           816:                                        fflush(stdout);
        !           817:                                    }
        !           818:                                    else
        !           819:                                    {
        !           820:                                        printf("[%d] Software interrupt "
        !           821:                                                "from thread %llu\n",
        !           822:                                                (int) getpid(),
        !           823:                                                (unsigned long long)
        !           824:                                                (*s_argument_thread).tid);
        !           825:                                        fflush(stdout);
        !           826:                                    }
        !           827:                                }
        !           828: 
        !           829:                                if (pthread_mutex_lock(
        !           830:                                        &((*(*((struct_processus_fils *)
        !           831:                                        (*(*l_element_courant).donnee).objet))
        !           832:                                        .thread).mutex)) != 0)
        !           833:                                {
        !           834:                                    (*s_etat_processus).erreur_systeme =
        !           835:                                            d_es_processus;
        !           836:                                }
        !           837: 
        !           838:                                (*(*((struct_processus_fils *)
        !           839:                                        (*(*l_element_courant).donnee)
        !           840:                                        .objet)).thread)
        !           841:                                        .nombre_interruptions_dans_pipe++;
        !           842: 
        !           843:                                if (pthread_mutex_unlock(
        !           844:                                        &((*(*((struct_processus_fils *)
        !           845:                                        (*(*l_element_courant).donnee).objet))
        !           846:                                        .thread).mutex)) != 0)
        !           847:                                {
        !           848:                                    (*s_etat_processus).erreur_systeme =
        !           849:                                            d_es_processus;
        !           850:                                }
        !           851: 
        !           852:                                (*s_etat_processus)
        !           853:                                        .nombre_interruptions_non_affectees++;
        !           854: 
        !           855:                                while((longueur_ecriture =
        !           856:                                        write_atomic(s_etat_processus,
        !           857:                                        (*(*((struct_processus_fils *)
        !           858:                                        (*(*l_element_courant).donnee).objet))
        !           859:                                        .thread).pipe_acquittement[1], "-",
        !           860:                                        sizeof(unsigned char))) !=
        !           861:                                        sizeof(unsigned char))
        !           862:                                {
        !           863:                                    if (longueur_ecriture == -1)
        !           864:                                    {
        !           865:                                        (*s_etat_processus)
        !           866:                                                .erreur_systeme_processus_fils =
        !           867:                                                d_es_processus;
        !           868:                                    }
        !           869:                                }
        !           870: 
        !           871:                                if ((*s_etat_processus).debug == d_vrai)
        !           872:                                    if (((*s_etat_processus).type_debug &
        !           873:                                            d_traitement_interruption) != 0)
        !           874:                                {
        !           875:                                    if ((*s_etat_processus).langue == 'F')
        !           876:                                    {
        !           877:                                        printf("[%d] Interruption logicielle "
        !           878:                                                "acquittée en provenance "
        !           879:                                                "du thread %llu\n",
        !           880:                                                (int) getpid(),
        !           881:                                                (unsigned long long)
        !           882:                                                (*s_argument_thread).tid);
        !           883:                                        fflush(stdout);
        !           884:                                    }
        !           885:                                    else
        !           886:                                    {
        !           887:                                        printf("[%d] Software interrupt "
        !           888:                                                "acknowklegment from "
        !           889:                                                "thread %llu\n",
        !           890:                                                (int) getpid(),
        !           891:                                                (unsigned long long)
        !           892:                                                (*s_argument_thread).tid);
        !           893:                                        fflush(stdout);
        !           894:                                    }
        !           895:                                }
        !           896: 
        !           897:                                break;
        !           898:                            }
        !           899: 
        !           900:                            l_element_courant = (*l_element_courant).suivant;
        !           901:                        }
        !           902: 
        !           903:                        BUG(l_element_courant == NULL,
        !           904:                                printf("Process or thread not found"));
        !           905: 
        !           906:                        if (pthread_mutex_unlock(&((*s_etat_processus).mutex))
        !           907:                                != 0)
        !           908:                        {
        !           909:                            (*s_etat_processus).erreur_systeme_processus_fils =
        !           910:                                    d_es_processus;
        !           911:                        }
        !           912:                    }
        !           913:                }
        !           914:                else
        !           915:                {
        !           916:                    (*s_etat_processus).erreur_systeme_processus_fils =
        !           917:                            d_es_processus;
        !           918:                }
        !           919:            }
        !           920: 
        !           921:            if (pthread_mutex_lock(&((*s_argument_thread).mutex)) != 0)
        !           922:            {
        !           923:                (*s_etat_processus).erreur_systeme = d_es_processus;
        !           924:            }
        !           925: 
        !           926:            if ((*s_argument_thread).thread_actif == d_faux)
        !           927:            {
        !           928:                if (pthread_mutex_unlock(&((*s_argument_thread).mutex)) != 0)
        !           929:                {
        !           930:                    (*s_etat_processus).erreur_systeme = d_es_processus;
        !           931:                }
        !           932: 
        !           933:                pthread_join((*s_argument_thread).tid, NULL);
        !           934:                drapeau_fin_scrutation = (0 != 0);
        !           935:            }
        !           936:            else
        !           937:            {
        !           938:                if (pthread_mutex_unlock(&((*s_argument_thread).mutex)) != 0)
        !           939:                {
        !           940:                    (*s_etat_processus).erreur_systeme = d_es_processus;
        !           941:                }
        !           942: 
        !           943:                drapeau_fin_scrutation = (0 == 0);
        !           944:            }
        !           945:        }
        !           946:    } while(drapeau_fin_scrutation);
        !           947: 
        !           948:    /*
        !           949:     * Le processus fils est terminé. On s'assure qu'il ne
        !           950:     * reste plus rien dans les tuyaux...
        !           951:     */
        !           952: 
        !           953:    if (pthread_mutex_lock(&((*s_etat_processus).mutex)) != 0)
        !           954:    {
        !           955:        (*s_etat_processus).erreur_systeme_processus_fils =
        !           956:                d_es_processus;
        !           957:    }
        !           958:    else
        !           959:    {
        !           960:        if ((*s_etat_processus).debug == d_vrai)
        !           961:            if (((*s_etat_processus).type_debug &
        !           962:                    d_debug_processus) != 0)
        !           963:        {
        !           964:            if ((*s_argument_thread).processus_detache == d_vrai)
        !           965:            {
        !           966:                if ((*s_etat_processus).langue == 'F')
        !           967:                {
        !           968:                    printf("[%d] Surveillance des tuyaux du processus %d\n",
        !           969:                            (int) getpid(), (int) (*s_argument_thread).pid);
        !           970:                    fflush(stdout);
        !           971:                }
        !           972:                else
        !           973:                {
        !           974:                    printf("[%d] Check remaining pipes of process %d\n",
        !           975:                            (int) getpid(), (int) (*s_argument_thread).pid);
        !           976:                    fflush(stdout);
        !           977:                }
        !           978:            }
        !           979:            else
        !           980:            {
        !           981:                if ((*s_etat_processus).langue == 'F')
        !           982:                {
        !           983:                    printf("[%d] Surveillance des tuyaux du thread %llu\n",
        !           984:                            (int) getpid(), (unsigned long long)
        !           985:                            (*s_argument_thread).tid);
        !           986:                    fflush(stdout);
        !           987:                }
        !           988:                else
        !           989:                {
        !           990:                    printf("[%d] Check remaining pipes of thread %llu\n",
        !           991:                            (int) getpid(), (unsigned long long)
        !           992:                            (*s_argument_thread).tid);
        !           993:                    fflush(stdout);
        !           994:                }
        !           995:            }
        !           996:        }
        !           997: 
        !           998:        l_element_courant = (struct_liste_chainee *)
        !           999:                (*s_etat_processus).l_base_pile_processus;
        !          1000: 
        !          1001:        if (drapeau_objets_traites == d_faux)
        !          1002:        {
        !          1003:            if ((*s_argument_thread).processus_detache == d_vrai)
        !          1004:            {
        !          1005:                while(l_element_courant != NULL)
        !          1006:                {
        !          1007:                    if ((*(*((struct_processus_fils *) (*(*l_element_courant)
        !          1008:                            .donnee).objet)).thread).processus_detache
        !          1009:                            == d_faux)
        !          1010:                    {
        !          1011:                        l_element_courant = (*l_element_courant).suivant;
        !          1012:                        continue;
        !          1013:                    }
        !          1014: 
        !          1015:                    if ((*(*((struct_processus_fils *) (*(*l_element_courant)
        !          1016:                            .donnee).objet)).thread).pid ==
        !          1017:                            (*s_argument_thread).pid)
        !          1018:                    {
        !          1019:                        while(read_atomic(s_etat_processus, (*s_argument_thread)
        !          1020:                                .pipe_nombre_objets_attente[0],
        !          1021:                                &pid_candidat, sizeof(pid_candidat)) ==
        !          1022:                                sizeof(pid_candidat))
        !          1023:                        {
        !          1024:                            /*
        !          1025:                             * -1 est renvoyé par l'instruction SWI
        !          1026:                             */
        !          1027: 
        !          1028:                            if (pid_candidat == -2)
        !          1029:                            {
        !          1030:                                break;
        !          1031:                            }
        !          1032:                            else if (pid_candidat == -1)
        !          1033:                            {
        !          1034:                            }
        !          1035:                            else if (read_atomic(s_etat_processus,
        !          1036:                                    (*s_argument_thread)
        !          1037:                                    .pipe_nombre_objets_attente[0],
        !          1038:                                    &pid_candidat, sizeof(pid_candidat)) ==
        !          1039:                                    sizeof(pid_candidat))
        !          1040:                            {
        !          1041:                                if ((*s_etat_processus).debug == d_vrai)
        !          1042:                                    if (((*s_etat_processus).type_debug &
        !          1043:                                            d_debug_processus) != 0)
        !          1044:                                {
        !          1045:                                    if ((*s_etat_processus).langue == 'F')
        !          1046:                                    {
        !          1047:                                        printf("[%d] Données en provenance du "
        !          1048:                                                "processus %d (processus "
        !          1049:                                                "arrêté)\n", (int) getpid(),
        !          1050:                                                (int) (*s_argument_thread).pid);
        !          1051:                                        fflush(stdout);
        !          1052:                                    }
        !          1053:                                    else
        !          1054:                                    {
        !          1055:                                        printf("[%d] Data from process %d "
        !          1056:                                                "(processus stopped)\n",
        !          1057:                                                (int) getpid(),
        !          1058:                                                (int) (*s_argument_thread).pid);
        !          1059:                                        fflush(stdout);
        !          1060:                                    }
        !          1061:                                }
        !          1062: 
        !          1063:                                if (pthread_mutex_lock(
        !          1064:                                        &((*(*((struct_processus_fils *)
        !          1065:                                        (*(*l_element_courant).donnee).objet))
        !          1066:                                        .thread).mutex)) != 0)
        !          1067:                                {
        !          1068:                                    (*s_etat_processus).erreur_systeme =
        !          1069:                                            d_es_processus;
        !          1070:                                }
        !          1071: 
        !          1072:                                (*(*((struct_processus_fils *)
        !          1073:                                        (*(*l_element_courant).donnee).objet))
        !          1074:                                        .thread).nombre_objets_dans_pipe++;
        !          1075: 
        !          1076:                                if (pthread_mutex_unlock(
        !          1077:                                        &((*(*((struct_processus_fils *)
        !          1078:                                        (*(*l_element_courant).donnee).objet))
        !          1079:                                        .thread).mutex)) != 0)
        !          1080:                                {
        !          1081:                                    (*s_etat_processus).erreur_systeme =
        !          1082:                                            d_es_processus;
        !          1083:                                }
        !          1084:                            }
        !          1085:                        }
        !          1086: 
        !          1087:                        break;
        !          1088:                    }
        !          1089: 
        !          1090:                    l_element_courant = (*l_element_courant).suivant;
        !          1091:                }
        !          1092:            }
        !          1093:            else
        !          1094:            {
        !          1095:                while(l_element_courant != NULL)
        !          1096:                {
        !          1097:                    if ((*(*((struct_processus_fils *) (*(*l_element_courant)
        !          1098:                            .donnee).objet)).thread).processus_detache
        !          1099:                            == d_vrai)
        !          1100:                    {
        !          1101:                        l_element_courant = (*l_element_courant).suivant;
        !          1102:                        continue;
        !          1103:                    }
        !          1104: 
        !          1105:                    if (pthread_equal((*(*((struct_processus_fils *)
        !          1106:                            (*(*l_element_courant).donnee).objet)).thread).tid,
        !          1107:                            (*s_argument_thread).tid) != 0)
        !          1108:                    {
        !          1109:                        while(read_atomic(s_etat_processus, (*s_argument_thread)
        !          1110:                                .pipe_nombre_objets_attente[0],
        !          1111:                                &tid_candidat, sizeof(tid_candidat)) ==
        !          1112:                                sizeof(tid_candidat))
        !          1113:                        {
        !          1114:                            /*
        !          1115:                             * -1 est renvoyé par l'instruction SWI
        !          1116:                             */
        !          1117: 
        !          1118:                            if (tid_candidat == (pthread_t) -2)
        !          1119:                            {
        !          1120:                                break;
        !          1121:                            }
        !          1122:                            else if (tid_candidat == (pthread_t) -1)
        !          1123:                            {
        !          1124:                            }
        !          1125:                            else if (read_atomic(s_etat_processus,
        !          1126:                                    (*s_argument_thread)
        !          1127:                                    .pipe_nombre_objets_attente[0],
        !          1128:                                    &tid_candidat, sizeof(tid_candidat)) ==
        !          1129:                                    sizeof(tid_candidat))
        !          1130:                            {
        !          1131:                                if ((*s_etat_processus).debug == d_vrai)
        !          1132:                                    if (((*s_etat_processus).type_debug &
        !          1133:                                            d_debug_processus) != 0)
        !          1134:                                {
        !          1135:                                    if ((*s_etat_processus).langue == 'F')
        !          1136:                                    {
        !          1137:                                        printf("[%d] Données en provenance du "
        !          1138:                                                "thread %llu (thread "
        !          1139:                                                "arrêté)\n", (int) getpid(),
        !          1140:                                                (unsigned long long)
        !          1141:                                                (*s_argument_thread).tid);
        !          1142:                                        fflush(stdout);
        !          1143:                                    }
        !          1144:                                    else
        !          1145:                                    {
        !          1146:                                        printf("[%d] Data from thread %llu "
        !          1147:                                                "(thread stopped)\n",
        !          1148:                                                (int) getpid(),
        !          1149:                                                (unsigned long long)
        !          1150:                                                (*s_argument_thread).tid);
        !          1151:                                        fflush(stdout);
        !          1152:                                    }
        !          1153:                                }
        !          1154: 
        !          1155:                                if (pthread_mutex_lock(
        !          1156:                                        &((*(*((struct_processus_fils *)
        !          1157:                                        (*(*l_element_courant).donnee).objet))
        !          1158:                                        .thread).mutex)) != 0)
        !          1159:                                {
        !          1160:                                    (*s_etat_processus).erreur_systeme =
        !          1161:                                            d_es_processus;
        !          1162:                                }
        !          1163: 
        !          1164:                                (*(*((struct_processus_fils *)
        !          1165:                                        (*(*l_element_courant).donnee).objet))
        !          1166:                                        .thread).nombre_objets_dans_pipe++;
        !          1167: 
        !          1168:                                if (pthread_mutex_unlock(
        !          1169:                                        &((*(*((struct_processus_fils *)
        !          1170:                                        (*(*l_element_courant).donnee).objet))
        !          1171:                                        .thread).mutex)) != 0)
        !          1172:                                {
        !          1173:                                    (*s_etat_processus).erreur_systeme =
        !          1174:                                            d_es_processus;
        !          1175:                                }
        !          1176:                            }
        !          1177:                        }
        !          1178: 
        !          1179:                        break;
        !          1180:                    }
        !          1181: 
        !          1182:                    l_element_courant = (*l_element_courant).suivant;
        !          1183:                }
        !          1184:            }
        !          1185:        }
        !          1186: 
        !          1187:        l_element_courant = (struct_liste_chainee *)
        !          1188:                (*s_etat_processus).l_base_pile_processus;
        !          1189: 
        !          1190:        if (drapeau_interruptions_traitees == d_faux)
        !          1191:        {
        !          1192:            if ((*s_argument_thread).processus_detache == d_vrai)
        !          1193:            {
        !          1194:                while(l_element_courant != NULL)
        !          1195:                {
        !          1196:                    if ((*(*((struct_processus_fils *) (*(*l_element_courant)
        !          1197:                            .donnee).objet)).thread).processus_detache
        !          1198:                            == d_faux)
        !          1199:                    {
        !          1200:                        l_element_courant = (*l_element_courant).suivant;
        !          1201:                        continue;
        !          1202:                    }
        !          1203: 
        !          1204:                    if ((*(*((struct_processus_fils *) (*(*l_element_courant)
        !          1205:                            .donnee).objet)).thread).pid ==
        !          1206:                            (*s_argument_thread).pid)
        !          1207:                    {
        !          1208:                        while(read_atomic(s_etat_processus, (*s_argument_thread)
        !          1209:                                .pipe_nombre_interruptions_attente[0],
        !          1210:                                &pid_candidat, sizeof(pid_candidat)) ==
        !          1211:                                sizeof(pid_candidat))
        !          1212:                        {
        !          1213:                            if (pid_candidat == -2)
        !          1214:                            {
        !          1215:                                break;
        !          1216:                            }
        !          1217:                            else if (pid_candidat == -1)
        !          1218:                            {
        !          1219:                            }
        !          1220:                            else if (read_atomic(s_etat_processus,
        !          1221:                                    (*s_argument_thread)
        !          1222:                                    .pipe_nombre_interruptions_attente[0],
        !          1223:                                    &pid_candidat, sizeof(pid_candidat)) ==
        !          1224:                                    sizeof(pid_candidat))
        !          1225:                            {
        !          1226:                                if ((*s_etat_processus).debug == d_vrai)
        !          1227:                                    if (((*s_etat_processus).type_debug &
        !          1228:                                            d_traitement_interruption) != 0)
        !          1229:                                {
        !          1230:                                    if ((*s_etat_processus).langue == 'F')
        !          1231:                                    {
        !          1232:                                        printf("[%d] Interruption logicielle "
        !          1233:                                                "en provenance du processus %d"
        !          1234:                                                " (processus arrêté)\n",
        !          1235:                                                (int) getpid(),
        !          1236:                                                (int) (*s_argument_thread).pid);
        !          1237:                                        fflush(stdout);
        !          1238:                                    }
        !          1239:                                    else
        !          1240:                                    {
        !          1241:                                        printf("[%d] Software interrupt "
        !          1242:                                                "from process %d (processus "
        !          1243:                                                "stopped)\n", (int) getpid(),
        !          1244:                                                (int) (*s_argument_thread).pid);
        !          1245:                                        fflush(stdout);
        !          1246:                                    }
        !          1247:                                }
        !          1248: 
        !          1249:                                if (pthread_mutex_lock(
        !          1250:                                        &((*(*((struct_processus_fils *)
        !          1251:                                        (*(*l_element_courant).donnee).objet))
        !          1252:                                        .thread).mutex)) != 0)
        !          1253:                                {
        !          1254:                                    (*s_etat_processus).erreur_systeme =
        !          1255:                                            d_es_processus;
        !          1256:                                }
        !          1257: 
        !          1258:                                (*(*((struct_processus_fils *)
        !          1259:                                        (*(*l_element_courant).donnee)
        !          1260:                                        .objet)).thread)
        !          1261:                                        .nombre_interruptions_dans_pipe++;
        !          1262: 
        !          1263:                                if (pthread_mutex_unlock(
        !          1264:                                        &((*(*((struct_processus_fils *)
        !          1265:                                        (*(*l_element_courant).donnee).objet))
        !          1266:                                        .thread).mutex)) != 0)
        !          1267:                                {
        !          1268:                                    (*s_etat_processus).erreur_systeme =
        !          1269:                                            d_es_processus;
        !          1270:                                }
        !          1271: 
        !          1272:                                (*s_etat_processus)
        !          1273:                                        .nombre_interruptions_non_affectees++;
        !          1274:                            }
        !          1275:                        }
        !          1276: 
        !          1277:                        break;
        !          1278:                    }
        !          1279: 
        !          1280:                    l_element_courant = (*l_element_courant).suivant;
        !          1281:                }
        !          1282:            }
        !          1283:            else
        !          1284:            {
        !          1285:                while(l_element_courant != NULL)
        !          1286:                {
        !          1287:                    if ((*(*((struct_processus_fils *) (*(*l_element_courant)
        !          1288:                            .donnee).objet)).thread).processus_detache
        !          1289:                            == d_vrai)
        !          1290:                    {
        !          1291:                        l_element_courant = (*l_element_courant).suivant;
        !          1292:                        continue;
        !          1293:                    }
        !          1294: 
        !          1295:                    if (pthread_equal((*(*((struct_processus_fils *)
        !          1296:                            (*(*l_element_courant).donnee).objet)).thread).tid,
        !          1297:                            (*s_argument_thread).tid) != 0)
        !          1298:                    {
        !          1299:                        while(read_atomic(s_etat_processus, (*s_argument_thread)
        !          1300:                                .pipe_nombre_interruptions_attente[0],
        !          1301:                                &tid_candidat, sizeof(tid_candidat)) ==
        !          1302:                                sizeof(tid_candidat))
        !          1303:                        {
        !          1304:                            if (tid_candidat == (pthread_t) -2)
        !          1305:                            {
        !          1306:                                break;
        !          1307:                            }
        !          1308:                            else if (tid_candidat == (pthread_t) -1)
        !          1309:                            {
        !          1310:                            }
        !          1311:                            else if (read_atomic(s_etat_processus,
        !          1312:                                    (*s_argument_thread)
        !          1313:                                    .pipe_nombre_interruptions_attente[0],
        !          1314:                                    &tid_candidat, sizeof(tid_candidat)) ==
        !          1315:                                    sizeof(tid_candidat))
        !          1316:                            {
        !          1317:                                if ((*s_etat_processus).debug == d_vrai)
        !          1318:                                    if (((*s_etat_processus).type_debug &
        !          1319:                                            d_traitement_interruption) != 0)
        !          1320:                                {
        !          1321:                                    if ((*s_etat_processus).langue == 'F')
        !          1322:                                    {
        !          1323:                                        printf("[%d] Interruption logicielle "
        !          1324:                                                "en provenance du thread %llu"
        !          1325:                                                " (thread arrêté)\n",
        !          1326:                                                (int) getpid(),
        !          1327:                                                (unsigned long long)
        !          1328:                                                (*s_argument_thread).tid);
        !          1329:                                        fflush(stdout);
        !          1330:                                    }
        !          1331:                                    else
        !          1332:                                    {
        !          1333:                                        printf("[%d] Software interrupt "
        !          1334:                                                "from thread %llu (thread "
        !          1335:                                                "stopped)\n", (int) getpid(),
        !          1336:                                                (unsigned long long)
        !          1337:                                                (*s_argument_thread).tid);
        !          1338:                                        fflush(stdout);
        !          1339:                                    }
        !          1340:                                }
        !          1341: 
        !          1342:                                if (pthread_mutex_lock(
        !          1343:                                        &((*(*((struct_processus_fils *)
        !          1344:                                        (*(*l_element_courant).donnee).objet))
        !          1345:                                        .thread).mutex)) != 0)
        !          1346:                                {
        !          1347:                                    (*s_etat_processus).erreur_systeme =
        !          1348:                                            d_es_processus;
        !          1349:                                }
        !          1350: 
        !          1351:                                (*(*((struct_processus_fils *)
        !          1352:                                        (*(*l_element_courant).donnee)
        !          1353:                                        .objet)).thread)
        !          1354:                                        .nombre_interruptions_dans_pipe++;
        !          1355: 
        !          1356:                                if (pthread_mutex_unlock(
        !          1357:                                        &((*(*((struct_processus_fils *)
        !          1358:                                        (*(*l_element_courant).donnee).objet))
        !          1359:                                        .thread).mutex)) != 0)
        !          1360:                                {
        !          1361:                                    (*s_etat_processus).erreur_systeme =
        !          1362:                                            d_es_processus;
        !          1363:                                }
        !          1364: 
        !          1365:                                (*s_etat_processus)
        !          1366:                                        .nombre_interruptions_non_affectees++;
        !          1367:                            }
        !          1368:                        }
        !          1369: 
        !          1370:                        break;
        !          1371:                    }
        !          1372: 
        !          1373:                    l_element_courant = (*l_element_courant).suivant;
        !          1374:                }
        !          1375:            }
        !          1376:        }
        !          1377: 
        !          1378:        if (pthread_mutex_unlock(&((*s_etat_processus).mutex)) != 0)
        !          1379:        {
        !          1380:            (*s_etat_processus).erreur_systeme_processus_fils =
        !          1381:                    d_es_processus;
        !          1382:        }
        !          1383:    }
        !          1384: 
        !          1385:    /*
        !          1386:     * Traitement des interruptions et des erreurs.
        !          1387:     */
        !          1388: 
        !          1389:    if ((*s_etat_processus).debug == d_vrai)
        !          1390:        if (((*s_etat_processus).type_debug &
        !          1391:                d_debug_processus) != 0)
        !          1392:    {
        !          1393:        if ((*s_argument_thread).processus_detache == d_vrai)
        !          1394:        {
        !          1395:            if ((*s_etat_processus).langue == 'F')
        !          1396:            {
        !          1397:                printf("[%d] Récupération des erreurs du processus "
        !          1398:                        "%d\n", (int) getpid(),
        !          1399:                        (int) (*s_argument_thread).pid);
        !          1400:                fflush(stdout);
        !          1401:            }
        !          1402:            else
        !          1403:            {
        !          1404:                printf("[%d] Check errors from process %d\n", (int) getpid(),
        !          1405:                        (int) (*s_argument_thread).pid);
        !          1406:                fflush(stdout);
        !          1407:            }
        !          1408:        }
        !          1409:        else
        !          1410:        {
        !          1411:            if ((*s_etat_processus).langue == 'F')
        !          1412:            {
        !          1413:                printf("[%d] Récupération des erreurs du thread "
        !          1414:                        "%llu\n", (int) getpid(), (unsigned long long)
        !          1415:                        (*s_argument_thread).tid);
        !          1416:                fflush(stdout);
        !          1417:            }
        !          1418:            else
        !          1419:            {
        !          1420:                printf("[%d] Check errors from process %llu\n", (int) getpid(),
        !          1421:                        (unsigned long long) (*s_argument_thread).tid);
        !          1422:                fflush(stdout);
        !          1423:            }
        !          1424:        }
        !          1425:    }
        !          1426: 
        !          1427:    attente.tv_sec = 0;
        !          1428:    attente.tv_nsec = GRANULARITE_us * 1000;
        !          1429: 
        !          1430:    while(read_atomic(s_etat_processus, (*s_argument_thread).pipe_erreurs[0],
        !          1431:            &((*s_etat_processus).erreur_execution_processus_fils),
        !          1432:            sizeof((*s_etat_processus).erreur_execution_processus_fils)) !=
        !          1433:            sizeof((*s_etat_processus).erreur_execution_processus_fils))
        !          1434:    {
        !          1435:        nanosleep(&attente, NULL);
        !          1436:        INCR_GRANULARITE(attente.tv_nsec);
        !          1437:    }
        !          1438: 
        !          1439:    attente.tv_sec = 0;
        !          1440:    attente.tv_nsec = GRANULARITE_us * 1000;
        !          1441: 
        !          1442:    while(read_atomic(s_etat_processus, (*s_argument_thread).pipe_erreurs[0],
        !          1443:            &tampon_erreur,
        !          1444:            sizeof((*s_etat_processus).erreur_systeme_processus_fils)) !=
        !          1445:            sizeof((*s_etat_processus).erreur_systeme_processus_fils))
        !          1446:    {
        !          1447:        nanosleep(&attente, NULL);
        !          1448:        INCR_GRANULARITE(attente.tv_nsec);
        !          1449:    }
        !          1450: 
        !          1451:    (*s_etat_processus).erreur_systeme_processus_fils = tampon_erreur;
        !          1452: 
        !          1453:    attente.tv_sec = 0;
        !          1454:    attente.tv_nsec = GRANULARITE_us * 1000;
        !          1455: 
        !          1456:    while(read_atomic(s_etat_processus, (*s_argument_thread).pipe_erreurs[0],
        !          1457:            &((*s_etat_processus).pid_erreur_processus_fils),
        !          1458:            sizeof((*s_etat_processus).pid_erreur_processus_fils)) !=
        !          1459:            sizeof((*s_etat_processus).pid_erreur_processus_fils))
        !          1460:    {
        !          1461:        nanosleep(&attente, NULL);
        !          1462:        INCR_GRANULARITE(attente.tv_nsec);
        !          1463:    }
        !          1464: 
        !          1465:    /*
        !          1466:     * Si une erreur est déclarée dans le processus fils, le message
        !          1467:     * d'erreur a déjà été affiché.
        !          1468:     */
        !          1469: 
        !          1470:    if (((*s_etat_processus).erreur_systeme_processus_fils != d_es) ||
        !          1471:            ((*s_etat_processus).erreur_execution_processus_fils != d_ex))
        !          1472:    {
        !          1473:        (*s_etat_processus).erreur_processus_fils = d_vrai;
        !          1474:        (*s_etat_processus).invalidation_message_erreur = d_vrai;
        !          1475:    }
        !          1476: 
        !          1477:    /*
        !          1478:     * Retrait du processus de la pile des processus
        !          1479:     */
        !          1480: 
        !          1481:    if (close((*s_argument_thread).pipe_erreurs[0]) != 0)
        !          1482:    {
        !          1483:        (*s_etat_processus).erreur_systeme_processus_fils = d_es_processus;
        !          1484:    }
        !          1485: 
        !          1486:    if (pthread_mutex_lock(&((*s_etat_processus).mutex)) != 0)
        !          1487:    {
        !          1488:        (*s_etat_processus).erreur_systeme_processus_fils = d_es_processus;
        !          1489:    }
        !          1490:    else
        !          1491:    {
        !          1492:        do
        !          1493:        {
        !          1494:            drapeau_fin = d_faux;
        !          1495:            l_element_courant = (struct_liste_chainee *)
        !          1496:                    (*s_etat_processus).l_base_pile_processus;
        !          1497:            nombre_donnees = -1;
        !          1498: 
        !          1499:            while(l_element_courant != NULL)
        !          1500:            {
        !          1501:                if ((*s_argument_thread).processus_detache == d_vrai)
        !          1502:                {
        !          1503:                    if ((*(*((struct_processus_fils *) (*(*l_element_courant)
        !          1504:                                .donnee).objet)).thread).processus_detache
        !          1505:                                == d_vrai)
        !          1506:                    {
        !          1507:                        if ((*s_argument_thread).pid ==
        !          1508:                                (*(*((struct_processus_fils *)
        !          1509:                                (*(*l_element_courant)
        !          1510:                                .donnee).objet)).thread).pid)
        !          1511:                        {
        !          1512:                            if (pthread_mutex_lock(
        !          1513:                                    &((*(*((struct_processus_fils *)
        !          1514:                                    (*(*l_element_courant).donnee).objet))
        !          1515:                                    .thread).mutex)) != 0)
        !          1516:                            {
        !          1517:                                (*s_etat_processus).erreur_systeme =
        !          1518:                                        d_es_processus;
        !          1519:                            }
        !          1520: 
        !          1521:                            nombre_donnees = (*(*((struct_processus_fils *)
        !          1522:                                    (*(*l_element_courant).donnee).objet))
        !          1523:                                    .thread).nombre_objets_dans_pipe +
        !          1524:                                    (*(*((struct_processus_fils *)
        !          1525:                                    (*(*l_element_courant).donnee).objet))
        !          1526:                                    .thread).nombre_interruptions_dans_pipe;
        !          1527: 
        !          1528:                            if (pthread_mutex_unlock(
        !          1529:                                    &((*(*((struct_processus_fils *)
        !          1530:                                    (*(*l_element_courant).donnee).objet))
        !          1531:                                    .thread).mutex)) != 0)
        !          1532:                            {
        !          1533:                                (*s_etat_processus).erreur_systeme =
        !          1534:                                        d_es_processus;
        !          1535:                            }
        !          1536: 
        !          1537:                            break;
        !          1538:                        }
        !          1539:                    }
        !          1540:                }
        !          1541:                else
        !          1542:                {
        !          1543:                    if ((*(*((struct_processus_fils *) (*(*l_element_courant)
        !          1544:                                .donnee).objet)).thread).processus_detache
        !          1545:                                == d_faux)
        !          1546:                    {
        !          1547:                        if (pthread_equal((*s_argument_thread).tid,
        !          1548:                                (*(*((struct_processus_fils *)
        !          1549:                                (*(*l_element_courant)
        !          1550:                                .donnee).objet)).thread).tid) != 0)
        !          1551:                        {
        !          1552:                            if (pthread_mutex_lock(
        !          1553:                                    &((*(*((struct_processus_fils *)
        !          1554:                                    (*(*l_element_courant).donnee).objet))
        !          1555:                                    .thread).mutex)) != 0)
        !          1556:                            {
        !          1557:                                (*s_etat_processus).erreur_systeme =
        !          1558:                                        d_es_processus;
        !          1559:                            }
        !          1560: 
        !          1561:                            nombre_donnees = (*(*((struct_processus_fils *)
        !          1562:                                    (*(*l_element_courant).donnee).objet))
        !          1563:                                    .thread).nombre_objets_dans_pipe +
        !          1564:                                    (*(*((struct_processus_fils *)
        !          1565:                                    (*(*l_element_courant).donnee).objet))
        !          1566:                                    .thread).nombre_interruptions_dans_pipe;
        !          1567: 
        !          1568:                            if (pthread_mutex_unlock(
        !          1569:                                    &((*(*((struct_processus_fils *)
        !          1570:                                    (*(*l_element_courant).donnee).objet))
        !          1571:                                    .thread).mutex)) != 0)
        !          1572:                            {
        !          1573:                                (*s_etat_processus).erreur_systeme =
        !          1574:                                        d_es_processus;
        !          1575:                            }
        !          1576: 
        !          1577:                            break;
        !          1578:                        }
        !          1579:                    }
        !          1580:                }
        !          1581: 
        !          1582:                l_element_courant = (*l_element_courant).suivant;
        !          1583:            }
        !          1584: 
        !          1585:            if (nombre_donnees == -1)
        !          1586:            {
        !          1587:                (*s_etat_processus).erreur_systeme_processus_fils =
        !          1588:                        d_es_processus;
        !          1589:                drapeau_fin = d_vrai;
        !          1590:                BUG(1, printf("Process or thread not found"));
        !          1591:            }
        !          1592:            else if ((nombre_donnees == 0) ||
        !          1593:                    ((*s_etat_processus).var_volatile_requete_arret == -1))
        !          1594:            {
        !          1595:                if ((*s_etat_processus).debug == d_vrai)
        !          1596:                    if (((*s_etat_processus).type_debug &
        !          1597:                            d_debug_processus) != 0)
        !          1598:                {
        !          1599:                    if ((*s_argument_thread).processus_detache == d_vrai)
        !          1600:                    {
        !          1601:                        if ((*s_etat_processus).langue == 'F')
        !          1602:                        {
        !          1603:                            printf("[%d] Fermeture des tuyaux du processus "
        !          1604:                                    "%d\n", (int) getpid(), (int)
        !          1605:                                    (*s_argument_thread).pid);
        !          1606:                            fflush(stdout);
        !          1607:                        }
        !          1608:                        else
        !          1609:                        {
        !          1610:                            printf("[%d] Close remaining pipes "
        !          1611:                                    "of process %d\n", (int) getpid(),
        !          1612:                                    (int) (*s_argument_thread).pid);
        !          1613:                            fflush(stdout);
        !          1614:                        }
        !          1615:                    }
        !          1616:                    else
        !          1617:                    {
        !          1618:                        if ((*s_etat_processus).langue == 'F')
        !          1619:                        {
        !          1620:                            printf("[%d] Fermeture des tuyaux du thread "
        !          1621:                                    "%llu\n", (int) getpid(),
        !          1622:                                    (unsigned long long)
        !          1623:                                    (*s_argument_thread).tid);
        !          1624:                            fflush(stdout);
        !          1625:                        }
        !          1626:                        else
        !          1627:                        {
        !          1628:                            printf("[%d] Close remaining pipes "
        !          1629:                                    "of thread %llu\n", (int) getpid(),
        !          1630:                                    (unsigned long long) (*s_argument_thread)
        !          1631:                                    .tid);
        !          1632:                            fflush(stdout);
        !          1633:                        }
        !          1634:                    }
        !          1635:                }
        !          1636: 
        !          1637:                if (close((*s_argument_thread).pipe_objets[0]) != 0)
        !          1638:                {
        !          1639:                    (*s_etat_processus).erreur_systeme_processus_fils =
        !          1640:                            d_es_processus;
        !          1641:                }
        !          1642: 
        !          1643:                if (close((*s_argument_thread).pipe_acquittement[1]) != 0)
        !          1644:                {
        !          1645:                    (*s_etat_processus).erreur_systeme_processus_fils =
        !          1646:                            d_es_processus;
        !          1647:                }
        !          1648: 
        !          1649:                if (close((*s_argument_thread).pipe_injections[1]) != 0)
        !          1650:                {
        !          1651:                    (*s_etat_processus).erreur_systeme_processus_fils =
        !          1652:                            d_es_processus;
        !          1653:                }
        !          1654: 
        !          1655:                if (close((*s_argument_thread).pipe_nombre_injections[1]) != 0)
        !          1656:                {
        !          1657:                    (*s_etat_processus).erreur_systeme_processus_fils =
        !          1658:                            d_es_processus;
        !          1659:                }
        !          1660: 
        !          1661:                if (close((*s_argument_thread)
        !          1662:                        .pipe_nombre_objets_attente[0]) != 0)
        !          1663:                {
        !          1664:                    (*s_etat_processus).erreur_systeme_processus_fils =
        !          1665:                            d_es_processus;
        !          1666:                }
        !          1667: 
        !          1668:                if (close((*s_argument_thread)
        !          1669:                        .pipe_interruptions[0]) != 0)
        !          1670:                {
        !          1671:                    (*s_etat_processus).erreur_systeme_processus_fils =
        !          1672:                            d_es_processus;
        !          1673:                }
        !          1674: 
        !          1675:                if (close((*s_argument_thread)
        !          1676:                        .pipe_nombre_interruptions_attente[0]) != 0)
        !          1677:                {
        !          1678:                    (*s_etat_processus).erreur_systeme_processus_fils =
        !          1679:                            d_es_processus;
        !          1680:                }
        !          1681: 
        !          1682:                drapeau_fin = d_vrai;
        !          1683:            }
        !          1684:            else
        !          1685:            {
        !          1686:                if (pthread_mutex_unlock(&((*s_etat_processus).mutex)) != 0)
        !          1687:                {
        !          1688:                    (*s_etat_processus).erreur_systeme_processus_fils =
        !          1689:                            d_es_processus;
        !          1690:                    drapeau_fin = d_vrai;
        !          1691:                }
        !          1692: 
        !          1693:                nanosleep(&attente, NULL);
        !          1694:                INCR_GRANULARITE(attente.tv_nsec);
        !          1695: 
        !          1696:                if (pthread_mutex_lock(&((*s_etat_processus).mutex)) != 0)
        !          1697:                {
        !          1698:                    (*s_etat_processus).erreur_systeme_processus_fils =
        !          1699:                            d_es_processus;
        !          1700:                    drapeau_fin = d_vrai;
        !          1701:                }
        !          1702:            }
        !          1703:        } while(drapeau_fin == d_faux);
        !          1704: 
        !          1705:        l_element_courant = (struct_liste_chainee *)
        !          1706:                (*s_etat_processus).l_base_pile_processus;
        !          1707:        l_element_precedent = NULL;
        !          1708: 
        !          1709:        while(l_element_courant != NULL)
        !          1710:        {
        !          1711:            drapeau = d_faux;
        !          1712: 
        !          1713:            if ((*s_argument_thread).processus_detache ==
        !          1714:                    (*(*((struct_processus_fils *) (*(*l_element_courant)
        !          1715:                    .donnee).objet)).thread).processus_detache)
        !          1716:            {
        !          1717:                if ((*s_argument_thread).processus_detache == d_vrai)
        !          1718:                {
        !          1719:                    if ((*(*((struct_processus_fils *)
        !          1720:                            (*(*l_element_courant).donnee).objet))
        !          1721:                            .thread).pid == (*s_argument_thread).pid)
        !          1722:                    {
        !          1723:                        drapeau = d_vrai;
        !          1724:                    }
        !          1725:                    else
        !          1726:                    {
        !          1727:                        drapeau = d_faux;
        !          1728:                    }
        !          1729:                }
        !          1730:                else
        !          1731:                {
        !          1732:                    if (pthread_equal((*(*((struct_processus_fils *)
        !          1733:                            (*(*l_element_courant).donnee).objet))
        !          1734:                            .thread).tid, (*s_argument_thread).tid) != 0)
        !          1735:                    {
        !          1736:                        drapeau = d_vrai;
        !          1737:                    }
        !          1738:                    else
        !          1739:                    {
        !          1740:                        drapeau = d_faux;
        !          1741:                    }
        !          1742:                }
        !          1743:            }
        !          1744:            else
        !          1745:            {
        !          1746:                drapeau = d_faux;
        !          1747:            }
        !          1748: 
        !          1749:            if (drapeau == d_vrai)
        !          1750:            {
        !          1751:                if (l_element_precedent == NULL)
        !          1752:                {
        !          1753:                    (*s_etat_processus).l_base_pile_processus =
        !          1754:                            (*l_element_courant).suivant;
        !          1755: 
        !          1756:                    free(l_element_courant);
        !          1757: 
        !          1758:                    l_element_courant = (struct_liste_chainee *)
        !          1759:                            (*s_etat_processus).l_base_pile_processus;
        !          1760:                }
        !          1761:                else
        !          1762:                {
        !          1763:                    (*l_element_precedent).suivant =
        !          1764:                            (*l_element_courant).suivant;
        !          1765:                    free(l_element_courant);
        !          1766:                }
        !          1767: 
        !          1768:                break;
        !          1769:            }
        !          1770:            else
        !          1771:            {
        !          1772:                l_element_precedent = l_element_courant;
        !          1773:                l_element_courant = (*l_element_courant).suivant;
        !          1774:            }
        !          1775:        }
        !          1776: 
        !          1777:        if (pthread_mutex_unlock(&((*s_etat_processus).mutex)) != 0)
        !          1778:        {
        !          1779:            (*s_etat_processus).erreur_systeme_processus_fils = d_es_processus;
        !          1780:        }
        !          1781:    }
        !          1782: 
        !          1783:    if ((*s_etat_processus).debug == d_vrai)
        !          1784:        if (((*s_etat_processus).type_debug &
        !          1785:                d_debug_processus) != 0)
        !          1786:    {
        !          1787:        if ((*s_argument_thread).processus_detache == d_vrai)
        !          1788:        {
        !          1789:            if ((*s_etat_processus).langue == 'F')
        !          1790:            {
        !          1791:                printf("[%d] Arrêt du thread de surveillance du"
        !          1792:                        " processus %d\n", (int) getpid(),
        !          1793:                        (int) (*s_argument_thread).pid);
        !          1794:            }
        !          1795:            else
        !          1796:            {
        !          1797:                printf("[%d] Stop monitoring of process %d", (int) getpid(),
        !          1798:                        (int) (*s_argument_thread).pid);
        !          1799:            }
        !          1800:        }
        !          1801:        else
        !          1802:        {
        !          1803:            if ((*s_etat_processus).langue == 'F')
        !          1804:            {
        !          1805:                printf("[%d] Arrêt du thread de surveillance du"
        !          1806:                        " thread %llu\n", (int) getpid(),
        !          1807:                        (unsigned long long) (*s_argument_thread)
        !          1808:                        .tid);
        !          1809:            }
        !          1810:            else
        !          1811:            {
        !          1812:                printf("[%d] Stop monitoring of thread %llu", (int) getpid(),
        !          1813:                        (unsigned long long) (*s_argument_thread)
        !          1814:                        .tid);
        !          1815:            }
        !          1816:        }
        !          1817: 
        !          1818:        fflush(stdout);
        !          1819:    }
        !          1820: 
        !          1821:    retrait_thread_surveillance(s_etat_processus, s_argument_thread);
        !          1822: 
        !          1823:    pthread_exit(NULL);
        !          1824: }
        !          1825: 
        !          1826: 
        !          1827: /*
        !          1828: ================================================================================
        !          1829:   Fonction d'écriture dans un pipe
        !          1830: ================================================================================
        !          1831:   Entrées : pointeur sur une structure de description du processus,
        !          1832:   numéro du pipe et objet à écrire
        !          1833: --------------------------------------------------------------------------------
        !          1834:   Sorties :
        !          1835: --------------------------------------------------------------------------------
        !          1836:   Effets de bord : néant
        !          1837: ================================================================================
        !          1838: */
        !          1839: 
        !          1840: logical1
        !          1841: ecriture_pipe(struct_processus *s_etat_processus, int pipe,
        !          1842:        struct_objet *s_objet)
        !          1843: {
        !          1844:    struct_liste_chainee            *l_element_courant;
        !          1845: 
        !          1846:    struct timespec                 attente;
        !          1847: 
        !          1848:    unsigned long                   i;
        !          1849:    unsigned long                   j;
        !          1850: 
        !          1851:    size_t                          longueur;
        !          1852:    ssize_t                         longueur_ecriture;
        !          1853: 
        !          1854:    if ((*s_objet).type == INT)
        !          1855:    {
        !          1856:        attente.tv_sec = 0;
        !          1857:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          1858: 
        !          1859:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          1860:                pipe, &((*s_objet).type), sizeof((*s_objet).type))) !=
        !          1861:                sizeof((*s_objet).type))
        !          1862:        {
        !          1863:            if (longueur_ecriture == -1)
        !          1864:            {
        !          1865:                return(d_erreur);
        !          1866:            }
        !          1867: 
        !          1868:            nanosleep(&attente, NULL);
        !          1869:            INCR_GRANULARITE(attente.tv_nsec);
        !          1870:        }
        !          1871: 
        !          1872:        attente.tv_sec = 0;
        !          1873:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          1874: 
        !          1875:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          1876:                pipe, (integer8 *)
        !          1877:                (*s_objet).objet, sizeof(integer8))) != sizeof(integer8))
        !          1878:        {
        !          1879:            if (longueur_ecriture == -1)
        !          1880:            {
        !          1881:                return(d_erreur);
        !          1882:            }
        !          1883: 
        !          1884:            nanosleep(&attente, NULL);
        !          1885:            INCR_GRANULARITE(attente.tv_nsec);
        !          1886:        }
        !          1887:    }
        !          1888:    else if ((*s_objet).type == REL)
        !          1889:    {
        !          1890:        attente.tv_sec = 0;
        !          1891:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          1892: 
        !          1893:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          1894:                pipe, &((*s_objet).type), sizeof((*s_objet).type))) !=
        !          1895:                sizeof((*s_objet).type))
        !          1896:        {
        !          1897:            if (longueur_ecriture == -1)
        !          1898:            {
        !          1899:                return(d_erreur);
        !          1900:            }
        !          1901: 
        !          1902:            nanosleep(&attente, NULL);
        !          1903:            INCR_GRANULARITE(attente.tv_nsec);
        !          1904:        }
        !          1905: 
        !          1906:        attente.tv_sec = 0;
        !          1907:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          1908: 
        !          1909:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          1910:                pipe, (real8 *) (*s_objet).objet, sizeof(real8))) !=
        !          1911:                sizeof(real8))
        !          1912:        {
        !          1913:            if (longueur_ecriture == -1)
        !          1914:            {
        !          1915:                return(d_erreur);
        !          1916:            }
        !          1917: 
        !          1918:            nanosleep(&attente, NULL);
        !          1919:            INCR_GRANULARITE(attente.tv_nsec);
        !          1920:        }
        !          1921:    }
        !          1922:    else if ((*s_objet).type == CPL)
        !          1923:    {
        !          1924:        attente.tv_sec = 0;
        !          1925:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          1926: 
        !          1927:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          1928:                pipe, &((*s_objet).type), sizeof((*s_objet).type))) !=
        !          1929:                sizeof((*s_objet).type))
        !          1930:        {
        !          1931:            if (longueur_ecriture == -1)
        !          1932:            {
        !          1933:                return(d_erreur);
        !          1934:            }
        !          1935: 
        !          1936:            nanosleep(&attente, NULL);
        !          1937:            INCR_GRANULARITE(attente.tv_nsec);
        !          1938:        }
        !          1939: 
        !          1940:        attente.tv_sec = 0;
        !          1941:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          1942: 
        !          1943:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          1944:                pipe, (real8 *) (*s_objet).objet, sizeof(complex16)))
        !          1945:                != sizeof(complex16))
        !          1946:        {
        !          1947:            if (longueur_ecriture == -1)
        !          1948:            {
        !          1949:                return(d_erreur);
        !          1950:            }
        !          1951: 
        !          1952:            nanosleep(&attente, NULL);
        !          1953:            INCR_GRANULARITE(attente.tv_nsec);
        !          1954:        }
        !          1955:    }
        !          1956:    else if ((*s_objet).type == VIN)
        !          1957:    {
        !          1958:        attente.tv_sec = 0;
        !          1959:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          1960: 
        !          1961:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          1962:                pipe, &((*s_objet).type), sizeof((*s_objet).type))) !=
        !          1963:                sizeof((*s_objet).type))
        !          1964:        {
        !          1965:            if (longueur_ecriture == -1)
        !          1966:            {
        !          1967:                return(d_erreur);
        !          1968:            }
        !          1969: 
        !          1970:            nanosleep(&attente, NULL);
        !          1971:            INCR_GRANULARITE(attente.tv_nsec);
        !          1972:        }
        !          1973: 
        !          1974:        attente.tv_sec = 0;
        !          1975:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          1976: 
        !          1977:        while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          1978:                &((*((struct_vecteur *) (*s_objet).objet))
        !          1979:                .taille), sizeof(unsigned long))) != sizeof(unsigned long))
        !          1980:        {
        !          1981:            if (longueur_ecriture == -1)
        !          1982:            {
        !          1983:                return(d_erreur);
        !          1984:            }
        !          1985: 
        !          1986:            nanosleep(&attente, NULL);
        !          1987:            INCR_GRANULARITE(attente.tv_nsec);
        !          1988:        }
        !          1989: 
        !          1990:        for(i = 0; i < (*((struct_vecteur *) (*s_objet).objet)).taille; i++)
        !          1991:        {
        !          1992:            attente.tv_sec = 0;
        !          1993:            attente.tv_nsec = GRANULARITE_us * 1000;
        !          1994: 
        !          1995:            while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          1996:                    &(((integer8 *) (*((struct_vecteur *) (*s_objet).objet))
        !          1997:                    .tableau)[i]), sizeof(integer8))) != sizeof(integer8))
        !          1998:            {
        !          1999:                if (longueur_ecriture == -1)
        !          2000:                {
        !          2001:                    return(d_erreur);
        !          2002:                }
        !          2003: 
        !          2004:                nanosleep(&attente, NULL);
        !          2005:                INCR_GRANULARITE(attente.tv_nsec);
        !          2006:            }
        !          2007:        }
        !          2008:    }
        !          2009:    else if ((*s_objet).type == VRL)
        !          2010:    {
        !          2011:        attente.tv_sec = 0;
        !          2012:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2013: 
        !          2014:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          2015:                pipe, &((*s_objet).type), sizeof((*s_objet).type))) !=
        !          2016:                sizeof((*s_objet).type))
        !          2017:        {
        !          2018:            if (longueur_ecriture == -1)
        !          2019:            {
        !          2020:                return(d_erreur);
        !          2021:            }
        !          2022: 
        !          2023:            nanosleep(&attente, NULL);
        !          2024:            INCR_GRANULARITE(attente.tv_nsec);
        !          2025:        }
        !          2026: 
        !          2027:        attente.tv_sec = 0;
        !          2028:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2029: 
        !          2030:        while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          2031:                &((*((struct_vecteur *) (*s_objet).objet))
        !          2032:                .taille), sizeof(unsigned long))) != sizeof(unsigned long))
        !          2033:        {
        !          2034:            if (longueur_ecriture == -1)
        !          2035:            {
        !          2036:                return(d_erreur);
        !          2037:            }
        !          2038: 
        !          2039:            nanosleep(&attente, NULL);
        !          2040:            INCR_GRANULARITE(attente.tv_nsec);
        !          2041:        }
        !          2042: 
        !          2043:        for(i = 0; i < (*((struct_vecteur *) (*s_objet).objet)).taille; i++)
        !          2044:        {
        !          2045:            attente.tv_sec = 0;
        !          2046:            attente.tv_nsec = GRANULARITE_us * 1000;
        !          2047: 
        !          2048:            while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          2049:                    &(((real8 *) (*((struct_vecteur *) (*s_objet).objet))
        !          2050:                    .tableau)[i]), sizeof(real8))) != sizeof(real8))
        !          2051:            {
        !          2052:                if (longueur_ecriture == -1)
        !          2053:                {
        !          2054:                    return(d_erreur);
        !          2055:                }
        !          2056: 
        !          2057:                nanosleep(&attente, NULL);
        !          2058:                INCR_GRANULARITE(attente.tv_nsec);
        !          2059:            }
        !          2060:        }
        !          2061:    }
        !          2062:    else if ((*s_objet).type == VCX)
        !          2063:    {
        !          2064:        attente.tv_sec = 0;
        !          2065:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2066: 
        !          2067:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          2068:                pipe, &((*s_objet).type), sizeof((*s_objet).type))) !=
        !          2069:                sizeof((*s_objet).type))
        !          2070:        {
        !          2071:            if (longueur_ecriture == -1)
        !          2072:            {
        !          2073:                return(d_erreur);
        !          2074:            }
        !          2075: 
        !          2076:            nanosleep(&attente, NULL);
        !          2077:            INCR_GRANULARITE(attente.tv_nsec);
        !          2078:        }
        !          2079: 
        !          2080:        attente.tv_sec = 0;
        !          2081:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2082: 
        !          2083:        while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          2084:                &((*((struct_vecteur *) (*s_objet).objet))
        !          2085:                .taille), sizeof(unsigned long))) != sizeof(unsigned long))
        !          2086:        {
        !          2087:            if (longueur_ecriture == -1)
        !          2088:            {
        !          2089:                return(d_erreur);
        !          2090:            }
        !          2091: 
        !          2092:            nanosleep(&attente, NULL);
        !          2093:            INCR_GRANULARITE(attente.tv_nsec);
        !          2094:        }
        !          2095: 
        !          2096:        for(i = 0; i < (*((struct_vecteur *) (*s_objet).objet)).taille; i++)
        !          2097:        {
        !          2098:            attente.tv_sec = 0;
        !          2099:            attente.tv_nsec = GRANULARITE_us * 1000;
        !          2100: 
        !          2101:            while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          2102:                    &(((complex16 *) (*((struct_vecteur *) (*s_objet).objet))
        !          2103:                    .tableau)[i]), sizeof(complex16))) != sizeof(complex16))
        !          2104:            {
        !          2105:                if (longueur_ecriture == -1)
        !          2106:                {
        !          2107:                    return(d_erreur);
        !          2108:                }
        !          2109: 
        !          2110:                nanosleep(&attente, NULL);
        !          2111:                INCR_GRANULARITE(attente.tv_nsec);
        !          2112:            }
        !          2113:        }
        !          2114:    }
        !          2115:    else if ((*s_objet).type == MIN)
        !          2116:    {
        !          2117:        attente.tv_sec = 0;
        !          2118:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2119: 
        !          2120:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          2121:                pipe, &((*s_objet).type), sizeof((*s_objet).type))) !=
        !          2122:                sizeof((*s_objet).type))
        !          2123:        {
        !          2124:            if (longueur_ecriture == -1)
        !          2125:            {
        !          2126:                return(d_erreur);
        !          2127:            }
        !          2128: 
        !          2129:            nanosleep(&attente, NULL);
        !          2130:            INCR_GRANULARITE(attente.tv_nsec);
        !          2131:        }
        !          2132: 
        !          2133:        attente.tv_sec = 0;
        !          2134:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2135: 
        !          2136:        while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          2137:                &((*((struct_matrice *) (*s_objet).objet)).nombre_lignes),
        !          2138:                sizeof(unsigned long))) != sizeof(unsigned long))
        !          2139:        {
        !          2140:            if (longueur_ecriture == -1)
        !          2141:            {
        !          2142:                return(d_erreur);
        !          2143:            }
        !          2144: 
        !          2145:            nanosleep(&attente, NULL);
        !          2146:            INCR_GRANULARITE(attente.tv_nsec);
        !          2147:        }
        !          2148: 
        !          2149:        attente.tv_sec = 0;
        !          2150:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2151: 
        !          2152:        while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          2153:                &((*((struct_matrice *) (*s_objet).objet)).nombre_colonnes),
        !          2154:                sizeof(unsigned long))) != sizeof(unsigned long))
        !          2155:        {
        !          2156:            if (longueur_ecriture == -1)
        !          2157:            {
        !          2158:                return(d_erreur);
        !          2159:            }
        !          2160: 
        !          2161:            nanosleep(&attente, NULL);
        !          2162:            INCR_GRANULARITE(attente.tv_nsec);
        !          2163:        }
        !          2164: 
        !          2165:        for(i = 0; i < (*((struct_matrice *)
        !          2166:                (*s_objet).objet)).nombre_lignes; i++)
        !          2167:        {
        !          2168:            for(j = 0; j < (*((struct_matrice *)
        !          2169:                    (*s_objet).objet)).nombre_colonnes; j++)
        !          2170:            {
        !          2171:                attente.tv_sec = 0;
        !          2172:                attente.tv_nsec = GRANULARITE_us * 1000;
        !          2173: 
        !          2174:                while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          2175:                        &(((integer8 **) (*((struct_matrice *)
        !          2176:                        (*s_objet).objet)).tableau)[i][j]),
        !          2177:                        sizeof(integer8))) != sizeof(integer8))
        !          2178:                {
        !          2179:                    if (longueur_ecriture == -1)
        !          2180:                    {
        !          2181:                        return(d_erreur);
        !          2182:                    }
        !          2183: 
        !          2184:                    nanosleep(&attente, NULL);
        !          2185:                    INCR_GRANULARITE(attente.tv_nsec);
        !          2186:                }
        !          2187:            }
        !          2188:        }
        !          2189:    }
        !          2190:    else if ((*s_objet).type == MRL)
        !          2191:    {
        !          2192:        attente.tv_sec = 0;
        !          2193:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2194: 
        !          2195:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          2196:                pipe, &((*s_objet).type), sizeof((*s_objet).type))) !=
        !          2197:                sizeof((*s_objet).type))
        !          2198:        {
        !          2199:            if (longueur_ecriture == -1)
        !          2200:            {
        !          2201:                return(d_erreur);
        !          2202:            }
        !          2203: 
        !          2204:            nanosleep(&attente, NULL);
        !          2205:            INCR_GRANULARITE(attente.tv_nsec);
        !          2206:        }
        !          2207: 
        !          2208:        attente.tv_sec = 0;
        !          2209:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2210: 
        !          2211:        while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          2212:                &((*((struct_matrice *) (*s_objet).objet)).nombre_lignes),
        !          2213:                sizeof(unsigned long))) != sizeof(unsigned long))
        !          2214:        {
        !          2215:            if (longueur_ecriture == -1)
        !          2216:            {
        !          2217:                return(d_erreur);
        !          2218:            }
        !          2219: 
        !          2220:            nanosleep(&attente, NULL);
        !          2221:            INCR_GRANULARITE(attente.tv_nsec);
        !          2222:        }
        !          2223: 
        !          2224:        attente.tv_sec = 0;
        !          2225:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2226: 
        !          2227:        while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          2228:                &((*((struct_matrice *) (*s_objet).objet)).nombre_colonnes),
        !          2229:                sizeof(unsigned long))) != sizeof(unsigned long))
        !          2230:        {
        !          2231:            if (longueur_ecriture == -1)
        !          2232:            {
        !          2233:                return(d_erreur);
        !          2234:            }
        !          2235: 
        !          2236:            nanosleep(&attente, NULL);
        !          2237:            INCR_GRANULARITE(attente.tv_nsec);
        !          2238:        }
        !          2239: 
        !          2240:        for(i = 0; i < (*((struct_matrice *)
        !          2241:                (*s_objet).objet)).nombre_lignes; i++)
        !          2242:        {
        !          2243:            for(j = 0; j < (*((struct_matrice *)
        !          2244:                    (*s_objet).objet)).nombre_colonnes; j++)
        !          2245:            {
        !          2246:                attente.tv_sec = 0;
        !          2247:                attente.tv_nsec = GRANULARITE_us * 1000;
        !          2248: 
        !          2249:                while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          2250:                        &(((real8 **) (*((struct_matrice *)
        !          2251:                        (*s_objet).objet)).tableau)[i][j]),
        !          2252:                        sizeof(real8))) != sizeof(real8))
        !          2253:                {
        !          2254:                    if (longueur_ecriture == -1)
        !          2255:                    {
        !          2256:                        return(d_erreur);
        !          2257:                    }
        !          2258: 
        !          2259:                    nanosleep(&attente, NULL);
        !          2260:                    INCR_GRANULARITE(attente.tv_nsec);
        !          2261:                }
        !          2262:            }
        !          2263:        }
        !          2264:    }
        !          2265:    else if ((*s_objet).type == MCX)
        !          2266:    {
        !          2267:        attente.tv_sec = 0;
        !          2268:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2269: 
        !          2270:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          2271:                pipe, &((*s_objet).type), sizeof((*s_objet).type))) !=
        !          2272:                sizeof((*s_objet).type))
        !          2273:        {
        !          2274:            if (longueur_ecriture == -1)
        !          2275:            {
        !          2276:                return(d_erreur);
        !          2277:            }
        !          2278: 
        !          2279:            nanosleep(&attente, NULL);
        !          2280:            INCR_GRANULARITE(attente.tv_nsec);
        !          2281:        }
        !          2282: 
        !          2283:        attente.tv_sec = 0;
        !          2284:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2285: 
        !          2286:        while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          2287:                &((*((struct_matrice *) (*s_objet).objet)).nombre_lignes),
        !          2288:                sizeof(unsigned long))) != sizeof(unsigned long))
        !          2289:        {
        !          2290:            if (longueur_ecriture == -1)
        !          2291:            {
        !          2292:                return(d_erreur);
        !          2293:            }
        !          2294: 
        !          2295:            nanosleep(&attente, NULL);
        !          2296:            INCR_GRANULARITE(attente.tv_nsec);
        !          2297:        }
        !          2298: 
        !          2299:        attente.tv_sec = 0;
        !          2300:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2301: 
        !          2302:        while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          2303:                &((*((struct_matrice *) (*s_objet).objet)).nombre_colonnes),
        !          2304:                sizeof(unsigned long))) != sizeof(unsigned long))
        !          2305:        {
        !          2306:            if (longueur_ecriture == -1)
        !          2307:            {
        !          2308:                return(d_erreur);
        !          2309:            }
        !          2310: 
        !          2311:            nanosleep(&attente, NULL);
        !          2312:            INCR_GRANULARITE(attente.tv_nsec);
        !          2313:        }
        !          2314: 
        !          2315:        for(i = 0; i < (*((struct_matrice *)
        !          2316:                (*s_objet).objet)).nombre_lignes; i++)
        !          2317:        {
        !          2318:            for(j = 0; j < (*((struct_matrice *)
        !          2319:                    (*s_objet).objet)).nombre_colonnes; j++)
        !          2320:            {
        !          2321:                attente.tv_sec = 0;
        !          2322:                attente.tv_nsec = GRANULARITE_us * 1000;
        !          2323: 
        !          2324:                while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          2325:                        &(((complex16 **) (*((struct_matrice *)
        !          2326:                        (*s_objet).objet)).tableau)[i][j]),
        !          2327:                        sizeof(complex16))) != sizeof(complex16))
        !          2328:                {
        !          2329:                    if (longueur_ecriture == -1)
        !          2330:                    {
        !          2331:                        return(d_erreur);
        !          2332:                    }
        !          2333: 
        !          2334:                    nanosleep(&attente, NULL);
        !          2335:                    INCR_GRANULARITE(attente.tv_nsec);
        !          2336:                }
        !          2337:            }
        !          2338:        }
        !          2339:    }
        !          2340:    else if ((*s_objet).type == BIN)
        !          2341:    {
        !          2342:        attente.tv_sec = 0;
        !          2343:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2344: 
        !          2345:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          2346:                pipe, &((*s_objet).type), sizeof((*s_objet).type))) !=
        !          2347:                sizeof((*s_objet).type))
        !          2348:        {
        !          2349:            if (longueur_ecriture == -1)
        !          2350:            {
        !          2351:                return(d_erreur);
        !          2352:            }
        !          2353: 
        !          2354:            nanosleep(&attente, NULL);
        !          2355:            INCR_GRANULARITE(attente.tv_nsec);
        !          2356:        }
        !          2357: 
        !          2358:        attente.tv_sec = 0;
        !          2359:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2360: 
        !          2361:        while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          2362:                (integer8 *) (*s_objet).objet,
        !          2363:                sizeof(integer8))) != sizeof(integer8))
        !          2364:        {
        !          2365:            if (longueur_ecriture == -1)
        !          2366:            {
        !          2367:                return(d_erreur);
        !          2368:            }
        !          2369: 
        !          2370:            nanosleep(&attente, NULL);
        !          2371:            INCR_GRANULARITE(attente.tv_nsec);
        !          2372:        }
        !          2373:    }
        !          2374:    else if ((*s_objet).type == NOM)
        !          2375:    {
        !          2376:        attente.tv_sec = 0;
        !          2377:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2378: 
        !          2379:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          2380:                pipe, &((*s_objet).type), sizeof((*s_objet).type))) !=
        !          2381:                sizeof((*s_objet).type))
        !          2382:        {
        !          2383:            if (longueur_ecriture == -1)
        !          2384:            {
        !          2385:                return(d_erreur);
        !          2386:            }
        !          2387: 
        !          2388:            nanosleep(&attente, NULL);
        !          2389:            INCR_GRANULARITE(attente.tv_nsec);
        !          2390:        }
        !          2391: 
        !          2392:        longueur = strlen((*((struct_nom *) (*s_objet).objet)).nom) + 1;
        !          2393: 
        !          2394:        attente.tv_sec = 0;
        !          2395:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2396: 
        !          2397:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          2398:                pipe, &longueur, sizeof(size_t))) != sizeof(size_t))
        !          2399:        {
        !          2400:            if (longueur_ecriture == -1)
        !          2401:            {
        !          2402:                return(d_erreur);
        !          2403:            }
        !          2404: 
        !          2405:            nanosleep(&attente, NULL);
        !          2406:            INCR_GRANULARITE(attente.tv_nsec);
        !          2407:        }
        !          2408: 
        !          2409:        attente.tv_sec = 0;
        !          2410:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2411: 
        !          2412:        while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          2413:                (*((struct_nom *) (*s_objet).objet)).nom,
        !          2414:                longueur)) != (ssize_t) longueur)
        !          2415:        {
        !          2416:            if (longueur_ecriture == -1)
        !          2417:            {
        !          2418:                return(d_erreur);
        !          2419:            }
        !          2420: 
        !          2421:            nanosleep(&attente, NULL);
        !          2422:            INCR_GRANULARITE(attente.tv_nsec);
        !          2423:        }
        !          2424: 
        !          2425:        attente.tv_sec = 0;
        !          2426:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2427: 
        !          2428:        while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          2429:                &((*((struct_nom *) (*s_objet).objet))
        !          2430:                .symbole), sizeof(logical1))) != sizeof(logical1))
        !          2431:        {
        !          2432:            if (longueur_ecriture == -1)
        !          2433:            {
        !          2434:                return(d_erreur);
        !          2435:            }
        !          2436: 
        !          2437:            nanosleep(&attente, NULL);
        !          2438:            INCR_GRANULARITE(attente.tv_nsec);
        !          2439:        }
        !          2440:    }
        !          2441:    else if ((*s_objet).type == FCT)
        !          2442:    {
        !          2443:        attente.tv_sec = 0;
        !          2444:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2445: 
        !          2446:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          2447:                pipe, &((*s_objet).type), sizeof((*s_objet).type))) !=
        !          2448:                sizeof((*s_objet).type))
        !          2449:        {
        !          2450:            if (longueur_ecriture == -1)
        !          2451:            {
        !          2452:                return(d_erreur);
        !          2453:            }
        !          2454: 
        !          2455:            nanosleep(&attente, NULL);
        !          2456:            INCR_GRANULARITE(attente.tv_nsec);
        !          2457:        }
        !          2458: 
        !          2459:        longueur = strlen((*((struct_fonction *)
        !          2460:                (*s_objet).objet)).nom_fonction) + 1;
        !          2461: 
        !          2462:        attente.tv_sec = 0;
        !          2463:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2464: 
        !          2465:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          2466:                pipe, &longueur, sizeof(size_t))) != sizeof(size_t))
        !          2467:        {
        !          2468:            if (longueur_ecriture == -1)
        !          2469:            {
        !          2470:                return(d_erreur);
        !          2471:            }
        !          2472: 
        !          2473:            nanosleep(&attente, NULL);
        !          2474:            INCR_GRANULARITE(attente.tv_nsec);
        !          2475:        }
        !          2476: 
        !          2477:        attente.tv_sec = 0;
        !          2478:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2479: 
        !          2480:        while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          2481:                (*((struct_fonction *) (*s_objet).objet))
        !          2482:                .nom_fonction, longueur)) != (ssize_t) longueur)
        !          2483:        {
        !          2484:            if (longueur_ecriture == -1)
        !          2485:            {
        !          2486:                return(d_erreur);
        !          2487:            }
        !          2488: 
        !          2489:            nanosleep(&attente, NULL);
        !          2490:            INCR_GRANULARITE(attente.tv_nsec);
        !          2491:        }
        !          2492: 
        !          2493:        attente.tv_sec = 0;
        !          2494:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2495: 
        !          2496:        while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          2497:                &((*((struct_fonction *) (*s_objet).objet)).nombre_arguments),
        !          2498:                sizeof(unsigned long))) != sizeof(unsigned long))
        !          2499:        {
        !          2500:            if (longueur_ecriture == -1)
        !          2501:            {
        !          2502:                return(d_erreur);
        !          2503:            }
        !          2504: 
        !          2505:            nanosleep(&attente, NULL);
        !          2506:            INCR_GRANULARITE(attente.tv_nsec);
        !          2507:        }
        !          2508:    }
        !          2509:    else if ((*s_objet).type == CHN)
        !          2510:    {
        !          2511:        attente.tv_sec = 0;
        !          2512:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2513: 
        !          2514:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          2515:                pipe, &((*s_objet).type), sizeof((*s_objet).type))) !=
        !          2516:                sizeof((*s_objet).type))
        !          2517:        {
        !          2518:            if (longueur_ecriture == -1)
        !          2519:            {
        !          2520:                return(d_erreur);
        !          2521:            }
        !          2522: 
        !          2523:            nanosleep(&attente, NULL);
        !          2524:            INCR_GRANULARITE(attente.tv_nsec);
        !          2525:        }
        !          2526: 
        !          2527:        longueur = strlen((unsigned char *) (*s_objet).objet) + 1;
        !          2528: 
        !          2529:        attente.tv_sec = 0;
        !          2530:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2531: 
        !          2532:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          2533:                pipe, &longueur, sizeof(size_t))) != sizeof(size_t))
        !          2534:        {
        !          2535:            if (longueur_ecriture == -1)
        !          2536:            {
        !          2537:                return(d_erreur);
        !          2538:            }
        !          2539: 
        !          2540:            nanosleep(&attente, NULL);
        !          2541:            INCR_GRANULARITE(attente.tv_nsec);
        !          2542:        }
        !          2543: 
        !          2544:        attente.tv_sec = 0;
        !          2545:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2546: 
        !          2547:        while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          2548:                (unsigned char *) (*s_objet).objet,
        !          2549:                longueur)) != (ssize_t) longueur)
        !          2550:        {
        !          2551:            if (longueur_ecriture == -1)
        !          2552:            {
        !          2553:                return(d_erreur);
        !          2554:            }
        !          2555: 
        !          2556:            nanosleep(&attente, NULL);
        !          2557:            INCR_GRANULARITE(attente.tv_nsec);
        !          2558:        }
        !          2559:    }
        !          2560:    else if (((*s_objet).type == LST) ||
        !          2561:            ((*s_objet).type == ALG) ||
        !          2562:            ((*s_objet).type == RPN))
        !          2563:    {
        !          2564:        attente.tv_sec = 0;
        !          2565:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2566: 
        !          2567:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          2568:                pipe, &((*s_objet).type), sizeof((*s_objet).type))) !=
        !          2569:                sizeof((*s_objet).type))
        !          2570:        {
        !          2571:            if (longueur_ecriture == -1)
        !          2572:            {
        !          2573:                return(d_erreur);
        !          2574:            }
        !          2575: 
        !          2576:            nanosleep(&attente, NULL);
        !          2577:            INCR_GRANULARITE(attente.tv_nsec);
        !          2578:        }
        !          2579: 
        !          2580:        l_element_courant = (*s_objet).objet;
        !          2581:        i = 0;
        !          2582: 
        !          2583:        while(l_element_courant != NULL)
        !          2584:        {
        !          2585:            i++;
        !          2586:            l_element_courant = (*l_element_courant).suivant;
        !          2587:        }
        !          2588: 
        !          2589:        attente.tv_sec = 0;
        !          2590:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2591: 
        !          2592:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          2593:                pipe, &i, sizeof(i))) != sizeof(i))
        !          2594:        {
        !          2595:            if (longueur_ecriture == -1)
        !          2596:            {
        !          2597:                return(d_erreur);
        !          2598:            }
        !          2599: 
        !          2600:            nanosleep(&attente, NULL);
        !          2601:            INCR_GRANULARITE(attente.tv_nsec);
        !          2602:        }
        !          2603: 
        !          2604:        l_element_courant = (*s_objet).objet;
        !          2605: 
        !          2606:        while(l_element_courant != NULL)
        !          2607:        {
        !          2608:            if (ecriture_pipe(s_etat_processus, pipe,
        !          2609:                    (*l_element_courant).donnee) == d_erreur)
        !          2610:            {
        !          2611:                return(d_erreur);
        !          2612:            }
        !          2613: 
        !          2614:            l_element_courant = (*l_element_courant).suivant;
        !          2615:        }
        !          2616:    }
        !          2617:    else if ((*s_objet).type == TBL)
        !          2618:    {
        !          2619:        attente.tv_sec = 0;
        !          2620:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2621: 
        !          2622:        while((longueur_ecriture = write_atomic(s_etat_processus,
        !          2623:                pipe, &((*s_objet).type), sizeof((*s_objet).type))) !=
        !          2624:                sizeof((*s_objet).type))
        !          2625:        {
        !          2626:            if (longueur_ecriture == -1)
        !          2627:            {
        !          2628:                return(d_erreur);
        !          2629:            }
        !          2630: 
        !          2631:            nanosleep(&attente, NULL);
        !          2632:            INCR_GRANULARITE(attente.tv_nsec);
        !          2633:        }
        !          2634: 
        !          2635:        attente.tv_sec = 0;
        !          2636:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2637: 
        !          2638:        while((longueur_ecriture = write_atomic(s_etat_processus, pipe,
        !          2639:                &((*((struct_tableau *) (*s_objet).objet)).nombre_elements),
        !          2640:                sizeof(unsigned long))) != sizeof(unsigned long))
        !          2641:        {
        !          2642:            if (longueur_ecriture == -1)
        !          2643:            {
        !          2644:                return(d_erreur);
        !          2645:            }
        !          2646: 
        !          2647:            nanosleep(&attente, NULL);
        !          2648:            INCR_GRANULARITE(attente.tv_nsec);
        !          2649:        }
        !          2650: 
        !          2651:        for(i = 0; i < (*((struct_tableau *)
        !          2652:                (*s_objet).objet)).nombre_elements; i++)
        !          2653:        {
        !          2654:            if (ecriture_pipe(s_etat_processus, pipe,
        !          2655:                    (*((struct_tableau *) (*s_objet).objet)).elements[i])
        !          2656:                    == d_erreur)
        !          2657:            {
        !          2658:                return(d_erreur);
        !          2659:            }
        !          2660:        }
        !          2661:    }
        !          2662:    else
        !          2663:    {
        !          2664:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
        !          2665:        return(d_erreur);
        !          2666:    }
        !          2667: 
        !          2668:    return(d_absence_erreur);
        !          2669: }
        !          2670: 
        !          2671: 
        !          2672: /*
        !          2673: ================================================================================
        !          2674:   Fonction de lecture dans un pipe
        !          2675: ================================================================================
        !          2676:   Entrées : pointeur sur une structure de description du processus,
        !          2677:   numéro du pipe et objet à écrire
        !          2678: --------------------------------------------------------------------------------
        !          2679:   Sorties :
        !          2680: --------------------------------------------------------------------------------
        !          2681:   Effets de bord : néant
        !          2682: ================================================================================
        !          2683: */
        !          2684: 
        !          2685: struct_objet *
        !          2686: lecture_pipe(struct_processus *s_etat_processus, int pipe)
        !          2687: {
        !          2688:    size_t                  longueur;
        !          2689: 
        !          2690:    struct_liste_chainee    *l_element_courant;
        !          2691: 
        !          2692:    struct_objet            *s_objet;
        !          2693: 
        !          2694:    struct timespec         attente;
        !          2695: 
        !          2696:    unsigned long           i;
        !          2697:    unsigned long           j;
        !          2698: 
        !          2699:    if ((s_objet = allocation(s_etat_processus, NON)) == NULL)
        !          2700:    {
        !          2701:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          2702:        return(NULL);
        !          2703:    }
        !          2704: 
        !          2705:    attente.tv_sec = 0;
        !          2706:    attente.tv_nsec = GRANULARITE_us * 1000;
        !          2707: 
        !          2708:    while(read_atomic(s_etat_processus, pipe, &((*s_objet).type),
        !          2709:            sizeof((*s_objet).type)) != sizeof((*s_objet).type))
        !          2710:    {
        !          2711:        nanosleep(&attente, NULL);
        !          2712:        INCR_GRANULARITE(attente.tv_nsec);
        !          2713:    }
        !          2714: 
        !          2715:    if ((*s_objet).type == INT)
        !          2716:    {
        !          2717:        if (((*s_objet).objet = malloc(sizeof(integer8))) == NULL)
        !          2718:        {
        !          2719:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          2720:            return(NULL);
        !          2721:        }
        !          2722: 
        !          2723:        attente.tv_sec = 0;
        !          2724:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2725: 
        !          2726:        while(read_atomic(s_etat_processus, pipe,
        !          2727:                (*s_objet).objet, sizeof(integer8)) != sizeof(integer8))
        !          2728:        {
        !          2729:            nanosleep(&attente, NULL);
        !          2730:            INCR_GRANULARITE(attente.tv_nsec);
        !          2731:        }
        !          2732:    }
        !          2733:    else if ((*s_objet).type == REL)
        !          2734:    {
        !          2735:        if (((*s_objet).objet = malloc(sizeof(real8))) == NULL)
        !          2736:        {
        !          2737:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          2738:            return(NULL);
        !          2739:        }
        !          2740: 
        !          2741:        attente.tv_sec = 0;
        !          2742:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2743: 
        !          2744:        while(read_atomic(s_etat_processus, pipe,
        !          2745:                (*s_objet).objet, sizeof(real8)) != sizeof(real8))
        !          2746:        {
        !          2747:            nanosleep(&attente, NULL);
        !          2748:            INCR_GRANULARITE(attente.tv_nsec);
        !          2749:        }
        !          2750:    }
        !          2751:    else if ((*s_objet).type == CPL)
        !          2752:    {
        !          2753:        if (((*s_objet).objet = malloc(sizeof(complex16))) == NULL)
        !          2754:        {
        !          2755:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          2756:            return(NULL);
        !          2757:        }
        !          2758: 
        !          2759:        attente.tv_sec = 0;
        !          2760:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2761: 
        !          2762:        while(read_atomic(s_etat_processus, pipe,
        !          2763:                (*s_objet).objet, sizeof(complex16)) != sizeof(complex16))
        !          2764:        {
        !          2765:            nanosleep(&attente, NULL);
        !          2766:            INCR_GRANULARITE(attente.tv_nsec);
        !          2767:        }
        !          2768:    }
        !          2769:    else if ((*s_objet).type == VIN)
        !          2770:    {
        !          2771:        if (((*s_objet).objet = malloc(sizeof(struct_vecteur))) == NULL)
        !          2772:        {
        !          2773:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          2774:            return(NULL);
        !          2775:        }
        !          2776: 
        !          2777:        (*((struct_vecteur *) (*s_objet).objet)).type = 'I';
        !          2778: 
        !          2779:        attente.tv_sec = 0;
        !          2780:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2781: 
        !          2782:        while(read_atomic(s_etat_processus, pipe, &((*((struct_vecteur *)
        !          2783:                (*s_objet).objet)).taille),
        !          2784:                sizeof(unsigned long)) != sizeof(unsigned long))
        !          2785:        {
        !          2786:            nanosleep(&attente, NULL);
        !          2787:            INCR_GRANULARITE(attente.tv_nsec);
        !          2788:        }
        !          2789: 
        !          2790:        if (((*((struct_vecteur *) (*s_objet).objet)).tableau =
        !          2791:                malloc((*((struct_vecteur *) (*s_objet).objet)).taille *
        !          2792:                sizeof(integer8))) == NULL)
        !          2793:        {
        !          2794:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          2795:            return(NULL);
        !          2796:        }
        !          2797: 
        !          2798:        for(i = 0; i < (*((struct_vecteur *) (*s_objet).objet)).taille; i++)
        !          2799:        {
        !          2800:            attente.tv_sec = 0;
        !          2801:            attente.tv_nsec = GRANULARITE_us * 1000;
        !          2802: 
        !          2803:            while(read_atomic(s_etat_processus, pipe,
        !          2804:                    &(((integer8 *) (*((struct_vecteur *)
        !          2805:                    (*s_objet).objet)).tableau)[i]), sizeof(integer8)) !=
        !          2806:                    sizeof(integer8))
        !          2807:            {
        !          2808:                nanosleep(&attente, NULL);
        !          2809:                INCR_GRANULARITE(attente.tv_nsec);
        !          2810:            }
        !          2811:        }
        !          2812:    }
        !          2813:    else if ((*s_objet).type == VRL)
        !          2814:    {
        !          2815:        if (((*s_objet).objet = malloc(sizeof(struct_vecteur))) == NULL)
        !          2816:        {
        !          2817:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          2818:            return(NULL);
        !          2819:        }
        !          2820: 
        !          2821:        (*((struct_vecteur *) (*s_objet).objet)).type = 'R';
        !          2822: 
        !          2823:        attente.tv_sec = 0;
        !          2824:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2825: 
        !          2826:        while(read_atomic(s_etat_processus, pipe, &((*((struct_vecteur *)
        !          2827:                (*s_objet).objet)).taille),
        !          2828:                sizeof(unsigned long)) != sizeof(unsigned long))
        !          2829:        {
        !          2830:            nanosleep(&attente, NULL);
        !          2831:            INCR_GRANULARITE(attente.tv_nsec);
        !          2832:        }
        !          2833: 
        !          2834:        if (((*((struct_vecteur *) (*s_objet).objet)).tableau =
        !          2835:                malloc((*((struct_vecteur *) (*s_objet).objet)).taille *
        !          2836:                sizeof(real8))) == NULL)
        !          2837:        {
        !          2838:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          2839:            return(NULL);
        !          2840:        }
        !          2841: 
        !          2842:        for(i = 0; i < (*((struct_vecteur *) (*s_objet).objet)).taille; i++)
        !          2843:        {
        !          2844:            attente.tv_sec = 0;
        !          2845:            attente.tv_nsec = GRANULARITE_us * 1000;
        !          2846: 
        !          2847:            while(read_atomic(s_etat_processus, pipe,
        !          2848:                    &(((real8 *) (*((struct_vecteur *)
        !          2849:                    (*s_objet).objet)).tableau)[i]), sizeof(real8)) !=
        !          2850:                    sizeof(real8))
        !          2851:            {
        !          2852:                nanosleep(&attente, NULL);
        !          2853:                INCR_GRANULARITE(attente.tv_nsec);
        !          2854:            }
        !          2855:        }
        !          2856:    }
        !          2857:    else if ((*s_objet).type == VCX)
        !          2858:    {
        !          2859:        if (((*s_objet).objet = malloc(sizeof(struct_vecteur))) == NULL)
        !          2860:        {
        !          2861:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          2862:            return(NULL);
        !          2863:        }
        !          2864: 
        !          2865:        (*((struct_vecteur *) (*s_objet).objet)).type = 'C';
        !          2866: 
        !          2867:        attente.tv_sec = 0;
        !          2868:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2869: 
        !          2870:        while(read_atomic(s_etat_processus, pipe, &((*((struct_vecteur *)
        !          2871:                (*s_objet).objet)).taille),
        !          2872:                sizeof(unsigned long)) != sizeof(unsigned long))
        !          2873:        {
        !          2874:            nanosleep(&attente, NULL);
        !          2875:            INCR_GRANULARITE(attente.tv_nsec);
        !          2876:        }
        !          2877: 
        !          2878:        if (((*((struct_vecteur *) (*s_objet).objet)).tableau =
        !          2879:                malloc((*((struct_vecteur *) (*s_objet).objet)).taille *
        !          2880:                sizeof(complex16))) == NULL)
        !          2881:        {
        !          2882:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          2883:            return(NULL);
        !          2884:        }
        !          2885: 
        !          2886:        for(i = 0; i < (*((struct_vecteur *) (*s_objet).objet)).taille; i++)
        !          2887:        {
        !          2888:            attente.tv_sec = 0;
        !          2889:            attente.tv_nsec = GRANULARITE_us * 1000;
        !          2890: 
        !          2891:            while(read_atomic(s_etat_processus, pipe,
        !          2892:                    &(((complex16 *) (*((struct_vecteur *)
        !          2893:                    (*s_objet).objet)).tableau)[i]), sizeof(complex16)) !=
        !          2894:                    sizeof(complex16))
        !          2895:            {
        !          2896:                nanosleep(&attente, NULL);
        !          2897:                INCR_GRANULARITE(attente.tv_nsec);
        !          2898:            }
        !          2899:        }
        !          2900:    }
        !          2901:    else if ((*s_objet).type == MIN)
        !          2902:    {
        !          2903:        if (((*s_objet).objet = malloc(sizeof(struct_matrice))) == NULL)
        !          2904:        {
        !          2905:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          2906:            return(NULL);
        !          2907:        }
        !          2908: 
        !          2909:        (*((struct_matrice *) (*s_objet).objet)).type = 'I';
        !          2910: 
        !          2911:        attente.tv_sec = 0;
        !          2912:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2913: 
        !          2914:        while(read_atomic(s_etat_processus, pipe, &((*((struct_matrice *)
        !          2915:                (*s_objet).objet)).nombre_lignes),
        !          2916:                sizeof(unsigned long)) != sizeof(unsigned long))
        !          2917:        {
        !          2918:            nanosleep(&attente, NULL);
        !          2919:            INCR_GRANULARITE(attente.tv_nsec);
        !          2920:        }
        !          2921: 
        !          2922:        attente.tv_sec = 0;
        !          2923:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2924: 
        !          2925:        while(read_atomic(s_etat_processus, pipe, &((*((struct_matrice *)
        !          2926:                (*s_objet).objet)).nombre_colonnes),
        !          2927:                sizeof(unsigned long)) != sizeof(unsigned long))
        !          2928:        {
        !          2929:            nanosleep(&attente, NULL);
        !          2930:            INCR_GRANULARITE(attente.tv_nsec);
        !          2931:        }
        !          2932: 
        !          2933:        if (((*((struct_matrice *) (*s_objet).objet)).tableau =
        !          2934:                malloc((*((struct_matrice *) (*s_objet).objet)).nombre_lignes *
        !          2935:                sizeof(integer8 *))) == NULL)
        !          2936:        {
        !          2937:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          2938:            return(NULL);
        !          2939:        }
        !          2940: 
        !          2941:        for(i = 0; i < (*((struct_matrice *)
        !          2942:                (*s_objet).objet)).nombre_lignes; i++)
        !          2943:        {
        !          2944:            if ((((*((struct_matrice *) (*s_objet).objet)).tableau)[i] =
        !          2945:                    malloc((*((struct_matrice *) (*s_objet).objet))
        !          2946:                    .nombre_colonnes * sizeof(integer8))) == NULL)
        !          2947:            {
        !          2948:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          2949:                return(NULL);
        !          2950:            }
        !          2951: 
        !          2952:            for(j = 0; j < (*((struct_matrice *)
        !          2953:                    (*s_objet).objet)).nombre_colonnes; j++)
        !          2954:            {
        !          2955:                attente.tv_sec = 0;
        !          2956:                attente.tv_nsec = GRANULARITE_us * 1000;
        !          2957: 
        !          2958:                while(read_atomic(s_etat_processus,
        !          2959:                        pipe, &(((integer8 **) (*((struct_matrice *)
        !          2960:                        (*s_objet).objet)).tableau)[i][j]),
        !          2961:                        sizeof(integer8)) != sizeof(integer8))
        !          2962:                {
        !          2963:                    nanosleep(&attente, NULL);
        !          2964:                    INCR_GRANULARITE(attente.tv_nsec);
        !          2965:                }
        !          2966:            }
        !          2967:        }
        !          2968:    }
        !          2969:    else if ((*s_objet).type == MRL)
        !          2970:    {
        !          2971:        if (((*s_objet).objet = malloc(sizeof(struct_matrice))) == NULL)
        !          2972:        {
        !          2973:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          2974:            return(NULL);
        !          2975:        }
        !          2976: 
        !          2977:        (*((struct_matrice *) (*s_objet).objet)).type = 'R';
        !          2978: 
        !          2979:        attente.tv_sec = 0;
        !          2980:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2981: 
        !          2982:        while(read_atomic(s_etat_processus, pipe, &((*((struct_matrice *)
        !          2983:                (*s_objet).objet)).nombre_lignes),
        !          2984:                sizeof(unsigned long)) != sizeof(unsigned long))
        !          2985:        {
        !          2986:            nanosleep(&attente, NULL);
        !          2987:            INCR_GRANULARITE(attente.tv_nsec);
        !          2988:        }
        !          2989: 
        !          2990:        attente.tv_sec = 0;
        !          2991:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          2992: 
        !          2993:        while(read_atomic(s_etat_processus, pipe, &((*((struct_matrice *)
        !          2994:                (*s_objet).objet)).nombre_colonnes),
        !          2995:                sizeof(unsigned long)) != sizeof(unsigned long))
        !          2996:        {
        !          2997:            nanosleep(&attente, NULL);
        !          2998:            INCR_GRANULARITE(attente.tv_nsec);
        !          2999:        }
        !          3000: 
        !          3001:        if (((*((struct_matrice *) (*s_objet).objet)).tableau =
        !          3002:                malloc((*((struct_matrice *) (*s_objet).objet)).nombre_lignes *
        !          3003:                sizeof(real8 *))) == NULL)
        !          3004:        {
        !          3005:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          3006:            return(NULL);
        !          3007:        }
        !          3008: 
        !          3009:        for(i = 0; i < (*((struct_matrice *)
        !          3010:                (*s_objet).objet)).nombre_lignes; i++)
        !          3011:        {
        !          3012:            if ((((*((struct_matrice *) (*s_objet).objet)).tableau)[i] =
        !          3013:                    malloc((*((struct_matrice *) (*s_objet).objet))
        !          3014:                    .nombre_colonnes * sizeof(real8))) == NULL)
        !          3015:            {
        !          3016:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          3017:                return(NULL);
        !          3018:            }
        !          3019: 
        !          3020:            for(j = 0; j < (*((struct_matrice *)
        !          3021:                    (*s_objet).objet)).nombre_colonnes; j++)
        !          3022:            {
        !          3023:                attente.tv_sec = 0;
        !          3024:                attente.tv_nsec = GRANULARITE_us * 1000;
        !          3025: 
        !          3026:                while(read_atomic(s_etat_processus,
        !          3027:                        pipe, &(((real8 **) (*((struct_matrice *)
        !          3028:                        (*s_objet).objet)).tableau)[i][j]),
        !          3029:                        sizeof(real8)) != sizeof(real8))
        !          3030:                {
        !          3031:                    nanosleep(&attente, NULL);
        !          3032:                    INCR_GRANULARITE(attente.tv_nsec);
        !          3033:                }
        !          3034:            }
        !          3035:        }
        !          3036:    }
        !          3037:    else if ((*s_objet).type == MCX)
        !          3038:    {
        !          3039:        if (((*s_objet).objet = malloc(sizeof(struct_matrice))) == NULL)
        !          3040:        {
        !          3041:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          3042:            return(NULL);
        !          3043:        }
        !          3044: 
        !          3045:        (*((struct_matrice *) (*s_objet).objet)).type = 'C';
        !          3046: 
        !          3047:        attente.tv_sec = 0;
        !          3048:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          3049: 
        !          3050:        while(read_atomic(s_etat_processus, pipe, &((*((struct_matrice *)
        !          3051:                (*s_objet).objet)).nombre_lignes),
        !          3052:                sizeof(unsigned long)) != sizeof(unsigned long))
        !          3053:        {
        !          3054:            nanosleep(&attente, NULL);
        !          3055:            INCR_GRANULARITE(attente.tv_nsec);
        !          3056:        }
        !          3057: 
        !          3058:        attente.tv_sec = 0;
        !          3059:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          3060: 
        !          3061:        while(read_atomic(s_etat_processus, pipe, &((*((struct_matrice *)
        !          3062:                (*s_objet).objet)).nombre_colonnes),
        !          3063:                sizeof(unsigned long)) != sizeof(unsigned long))
        !          3064:        {
        !          3065:            nanosleep(&attente, NULL);
        !          3066:            INCR_GRANULARITE(attente.tv_nsec);
        !          3067:        }
        !          3068: 
        !          3069:        if (((*((struct_matrice *) (*s_objet).objet)).tableau =
        !          3070:                malloc((*((struct_matrice *) (*s_objet).objet)).nombre_lignes *
        !          3071:                sizeof(complex16 *))) == NULL)
        !          3072:        {
        !          3073:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          3074:            return(NULL);
        !          3075:        }
        !          3076: 
        !          3077:        for(i = 0; i < (*((struct_matrice *)
        !          3078:                (*s_objet).objet)).nombre_lignes; i++)
        !          3079:        {
        !          3080:            if ((((*((struct_matrice *) (*s_objet).objet)).tableau)[i] =
        !          3081:                    malloc((*((struct_matrice *) (*s_objet).objet))
        !          3082:                    .nombre_colonnes * sizeof(complex16))) == NULL)
        !          3083:            {
        !          3084:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          3085:                return(NULL);
        !          3086:            }
        !          3087: 
        !          3088:            for(j = 0; j < (*((struct_matrice *)
        !          3089:                    (*s_objet).objet)).nombre_colonnes; j++)
        !          3090:            {
        !          3091:                attente.tv_sec = 0;
        !          3092:                attente.tv_nsec = GRANULARITE_us * 1000;
        !          3093: 
        !          3094:                while(read_atomic(s_etat_processus, pipe,
        !          3095:                        &(((complex16 **) (*((struct_matrice *)
        !          3096:                        (*s_objet).objet)).tableau)[i][j]),
        !          3097:                        sizeof(complex16)) != sizeof(complex16))
        !          3098:                {
        !          3099:                    nanosleep(&attente, NULL);
        !          3100:                    INCR_GRANULARITE(attente.tv_nsec);
        !          3101:                }
        !          3102:            }
        !          3103:        }
        !          3104:    }
        !          3105:    else if ((*s_objet).type == BIN)
        !          3106:    {
        !          3107:        if (((*s_objet).objet = malloc(sizeof(integer8))) == NULL)
        !          3108:        {
        !          3109:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          3110:            return(NULL);
        !          3111:        }
        !          3112: 
        !          3113:        attente.tv_sec = 0;
        !          3114:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          3115: 
        !          3116:        while(read_atomic(s_etat_processus, pipe,
        !          3117:                (*s_objet).objet, sizeof(integer8)) != sizeof(integer8))
        !          3118:        {
        !          3119:            nanosleep(&attente, NULL);
        !          3120:            INCR_GRANULARITE(attente.tv_nsec);
        !          3121:        }
        !          3122:    }
        !          3123:    else if ((*s_objet).type == NOM)
        !          3124:    {
        !          3125:        if (((*s_objet).objet = malloc(sizeof(struct_nom))) == NULL)
        !          3126:        {
        !          3127:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          3128:            return(NULL);
        !          3129:        }
        !          3130: 
        !          3131:        attente.tv_sec = 0;
        !          3132:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          3133: 
        !          3134:        while(read_atomic(s_etat_processus,
        !          3135:                pipe, &longueur, sizeof(size_t)) != sizeof(size_t))
        !          3136:        {
        !          3137:            nanosleep(&attente, NULL);
        !          3138:            INCR_GRANULARITE(attente.tv_nsec);
        !          3139:        }
        !          3140: 
        !          3141:        if (((*((struct_nom *) (*s_objet).objet)).nom = malloc(longueur *
        !          3142:                sizeof(unsigned char))) == NULL)
        !          3143:        {
        !          3144:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          3145:            return(NULL);
        !          3146:        }
        !          3147: 
        !          3148:        attente.tv_sec = 0;
        !          3149:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          3150: 
        !          3151:        while(read_atomic(s_etat_processus, pipe, (*((struct_nom *)
        !          3152:                (*s_objet).objet)).nom, longueur) != (ssize_t) longueur)
        !          3153:        {
        !          3154:            nanosleep(&attente, NULL);
        !          3155:            INCR_GRANULARITE(attente.tv_nsec);
        !          3156:        }
        !          3157: 
        !          3158:        attente.tv_sec = 0;
        !          3159:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          3160: 
        !          3161:        while(read_atomic(s_etat_processus, pipe,
        !          3162:                &((*((struct_nom *) (*s_objet).objet)).symbole),
        !          3163:                sizeof(logical1)) != sizeof(logical1))
        !          3164:        {
        !          3165:            nanosleep(&attente, NULL);
        !          3166:            INCR_GRANULARITE(attente.tv_nsec);
        !          3167:        }
        !          3168:    }
        !          3169:    else if ((*s_objet).type == FCT)
        !          3170:    {
        !          3171:        if (((*s_objet).objet = allocation(s_etat_processus, FCT)) == NULL)
        !          3172:        {
        !          3173:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          3174:            return(NULL);
        !          3175:        }
        !          3176: 
        !          3177:        attente.tv_sec = 0;
        !          3178:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          3179: 
        !          3180:        while(read_atomic(s_etat_processus, pipe,
        !          3181:                &longueur, sizeof(size_t)) != sizeof(size_t))
        !          3182:        {
        !          3183:            nanosleep(&attente, NULL);
        !          3184:            INCR_GRANULARITE(attente.tv_nsec);
        !          3185:        }
        !          3186: 
        !          3187:        if (((*((struct_fonction *) (*s_objet).objet)).nom_fonction =
        !          3188:                malloc(longueur * sizeof(unsigned char))) == NULL)
        !          3189:        {
        !          3190:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          3191:            return(NULL);
        !          3192:        }
        !          3193: 
        !          3194:        attente.tv_sec = 0;
        !          3195:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          3196: 
        !          3197:        while(read_atomic(s_etat_processus, pipe,
        !          3198:                (*((struct_fonction *) (*s_objet).objet))
        !          3199:                .nom_fonction, longueur) != (ssize_t) longueur)
        !          3200:        {
        !          3201:            nanosleep(&attente, NULL);
        !          3202:            INCR_GRANULARITE(attente.tv_nsec);
        !          3203:        }
        !          3204: 
        !          3205:        attente.tv_sec = 0;
        !          3206:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          3207: 
        !          3208:        while(read_atomic(s_etat_processus, pipe,
        !          3209:                &((*((struct_fonction *) (*s_objet).objet))
        !          3210:                .nombre_arguments), sizeof(unsigned long)) !=
        !          3211:                sizeof(unsigned long))
        !          3212:        {
        !          3213:            nanosleep(&attente, NULL);
        !          3214:            INCR_GRANULARITE(attente.tv_nsec);
        !          3215:        }
        !          3216: 
        !          3217:        (*((struct_fonction *) (*s_objet).objet)).fonction = NULL;
        !          3218:        (*((struct_fonction *) (*s_objet).objet)).prediction_saut = NULL;
        !          3219:        (*((struct_fonction *) (*s_objet).objet)).prediction_execution = d_faux;
        !          3220:    }
        !          3221:    else if ((*s_objet).type == CHN)
        !          3222:    {
        !          3223:        attente.tv_sec = 0;
        !          3224:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          3225: 
        !          3226:        while(read_atomic(s_etat_processus, pipe,
        !          3227:                &longueur, sizeof(size_t)) != sizeof(size_t))
        !          3228:        {
        !          3229:            nanosleep(&attente, NULL);
        !          3230:            INCR_GRANULARITE(attente.tv_nsec);
        !          3231:        }
        !          3232: 
        !          3233:        if (((*s_objet).objet = malloc(longueur *
        !          3234:                sizeof(unsigned char))) == NULL)
        !          3235:        {
        !          3236:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          3237:            return(NULL);
        !          3238:        }
        !          3239: 
        !          3240:        attente.tv_sec = 0;
        !          3241:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          3242: 
        !          3243:        while(read_atomic(s_etat_processus, pipe, (unsigned char *)
        !          3244:                (*s_objet).objet, longueur) != (ssize_t) longueur)
        !          3245:        {
        !          3246:            nanosleep(&attente, NULL);
        !          3247:            INCR_GRANULARITE(attente.tv_nsec);
        !          3248:        }
        !          3249:    }
        !          3250:    else if (((*s_objet).type == LST) ||
        !          3251:            ((*s_objet).type == ALG) ||
        !          3252:            ((*s_objet).type == RPN))
        !          3253:    {
        !          3254:        attente.tv_sec = 0;
        !          3255:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          3256: 
        !          3257:        while(read_atomic(s_etat_processus, pipe, &j, sizeof(j)) != sizeof(j))
        !          3258:        {
        !          3259:            nanosleep(&attente, NULL);
        !          3260:            INCR_GRANULARITE(attente.tv_nsec);
        !          3261:        }
        !          3262: 
        !          3263:        l_element_courant = NULL;
        !          3264: 
        !          3265:        for(i = 0; i < j; i++)
        !          3266:        {
        !          3267:            if (l_element_courant == NULL)
        !          3268:            {
        !          3269:                if ((l_element_courant =
        !          3270:                        malloc(sizeof(struct_liste_chainee))) == NULL)
        !          3271:                {
        !          3272:                    (*s_etat_processus).erreur_systeme =
        !          3273:                            d_es_allocation_memoire;
        !          3274:                    return(NULL);
        !          3275:                }
        !          3276: 
        !          3277:                (*s_objet).objet = l_element_courant;
        !          3278:            }
        !          3279:            else
        !          3280:            {
        !          3281:                if (((*l_element_courant).suivant =
        !          3282:                        malloc(sizeof(struct_liste_chainee))) == NULL)
        !          3283:                {
        !          3284:                    (*s_etat_processus).erreur_systeme =
        !          3285:                            d_es_allocation_memoire;
        !          3286:                    return(NULL);
        !          3287:                }
        !          3288: 
        !          3289:                l_element_courant = (*l_element_courant).suivant;
        !          3290:                (*l_element_courant).suivant = NULL;
        !          3291:            }
        !          3292: 
        !          3293:            attente.tv_sec = 0;
        !          3294:            attente.tv_nsec = GRANULARITE_us * 1000;
        !          3295: 
        !          3296:            while(((*l_element_courant).donnee = lecture_pipe(s_etat_processus,
        !          3297:                    pipe)) == NULL)
        !          3298:            {
        !          3299:                if ((*s_etat_processus).erreur_systeme != d_es)
        !          3300:                {
        !          3301:                    return(NULL);
        !          3302:                }
        !          3303: 
        !          3304:                nanosleep(&attente, NULL);
        !          3305:                INCR_GRANULARITE(attente.tv_nsec);
        !          3306:            }
        !          3307:        }
        !          3308: 
        !          3309:        if (l_element_courant == NULL)
        !          3310:        {
        !          3311:            (*s_objet).objet = NULL;
        !          3312:        }
        !          3313:        else
        !          3314:        {
        !          3315:            (*l_element_courant).suivant = NULL;
        !          3316:        }
        !          3317:    }
        !          3318:    else if ((*s_objet).type == TBL)
        !          3319:    {
        !          3320:        if (((*s_objet).objet = malloc(sizeof(struct_tableau))) == NULL)
        !          3321:        {
        !          3322:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          3323:            return(NULL);
        !          3324:        }
        !          3325: 
        !          3326:        attente.tv_sec = 0;
        !          3327:        attente.tv_nsec = GRANULARITE_us * 1000;
        !          3328: 
        !          3329:        while(read_atomic(s_etat_processus, pipe, &((*((struct_tableau *)
        !          3330:                (*s_objet).objet)).nombre_elements),
        !          3331:                sizeof(unsigned long)) != sizeof(unsigned long))
        !          3332:        {
        !          3333:            nanosleep(&attente, NULL);
        !          3334:            INCR_GRANULARITE(attente.tv_nsec);
        !          3335:        }
        !          3336: 
        !          3337:        if (((*((struct_tableau *) (*s_objet).objet)).elements = malloc(
        !          3338:                (*((struct_tableau *) (*s_objet).objet)).nombre_elements *
        !          3339:                sizeof(struct_objet *))) == NULL)
        !          3340:        {
        !          3341:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
        !          3342:            return(NULL);
        !          3343:        }
        !          3344: 
        !          3345:        for(i = 0; i < (*((struct_tableau *) (*s_objet).objet)).nombre_elements;
        !          3346:                i++)
        !          3347:        {
        !          3348:            attente.tv_sec = 0;
        !          3349:            attente.tv_nsec = GRANULARITE_us * 1000;
        !          3350: 
        !          3351:            while(((*((struct_tableau *) (*s_objet).objet)).elements[i] =
        !          3352:                    lecture_pipe(s_etat_processus, pipe)) == NULL)
        !          3353:            {
        !          3354:                if ((*s_etat_processus).erreur_systeme != d_es)
        !          3355:                {
        !          3356:                    return(NULL);
        !          3357:                }
        !          3358: 
        !          3359:                nanosleep(&attente, NULL);
        !          3360:                INCR_GRANULARITE(attente.tv_nsec);
        !          3361:            }
        !          3362:        }
        !          3363:    }
        !          3364: 
        !          3365:    return(s_objet);
        !          3366: }
        !          3367: 
        !          3368: 
        !          3369: /*
        !          3370: ================================================================================
        !          3371:   Fonction de scrutation des données injectées par le processus père
        !          3372: ================================================================================
        !          3373:   Entrées : pointeur sur une structure
        !          3374: --------------------------------------------------------------------------------
        !          3375:   Sorties :
        !          3376: --------------------------------------------------------------------------------
        !          3377:   Effets de bord : néant
        !          3378: ================================================================================
        !          3379: */
        !          3380: 
        !          3381: inline void
        !          3382: scrutation_injection(struct_processus *s_etat_processus)
        !          3383: {
        !          3384:    fd_set                          ensemble_descripteurs;
        !          3385: 
        !          3386:    struct timespec                 timeout;
        !          3387: 
        !          3388:    unsigned char                   tampon;
        !          3389: 
        !          3390:    // Si on est dans le processus père, il n'y a rien à surveiller.
        !          3391: 
        !          3392:    if ((*s_etat_processus).var_volatile_processus_pere == 0)
        !          3393:    {
        !          3394:        FD_ZERO(&ensemble_descripteurs);
        !          3395:        FD_SET((*s_etat_processus).pipe_nombre_injections,
        !          3396:                &ensemble_descripteurs);
        !          3397: 
        !          3398:        timeout.tv_sec = 0;
        !          3399:        timeout.tv_nsec = 0;
        !          3400: 
        !          3401:        if (pselect((*s_etat_processus).pipe_nombre_injections + 1,
        !          3402:                &ensemble_descripteurs, NULL, NULL, &timeout, NULL) > 0)
        !          3403:        {
        !          3404:            if (read_atomic(s_etat_processus,
        !          3405:                    (*s_etat_processus).pipe_nombre_injections,
        !          3406:                    &tampon, sizeof(unsigned char)) == sizeof(unsigned char))
        !          3407:            {
        !          3408:                if (tampon == '-')
        !          3409:                {
        !          3410:                    (*s_etat_processus).nombre_objets_injectes++;
        !          3411:                }
        !          3412:                else if (tampon == '+')
        !          3413:                {
        !          3414:                    (*s_etat_processus).nombre_objets_envoyes_non_lus--;
        !          3415: 
        !          3416:                    BUG((*s_etat_processus).nombre_objets_envoyes_non_lus < 0,
        !          3417:                            printf("(*s_etat_processus).nombre_objets_envoyes_"
        !          3418:                            "non_lus=%d\n", (*s_etat_processus)
        !          3419:                            .nombre_objets_envoyes_non_lus));
        !          3420:                }
        !          3421:                else
        !          3422:                {
        !          3423:                    BUG(1, printf("tampon='%c' (%d)\n", tampon, tampon));
        !          3424:                }
        !          3425:            }
        !          3426:        }
        !          3427:    }
        !          3428: 
        !          3429:    return;
        !          3430: }
        !          3431: 
        !          3432: 
        !          3433: /*
        !          3434: ================================================================================
        !          3435:   Fonction de test du draeau d'arrêt
        !          3436: ================================================================================
        !          3437:   Entrées : pointeur sur une structure
        !          3438: --------------------------------------------------------------------------------
        !          3439:   Sorties :
        !          3440: --------------------------------------------------------------------------------
        !          3441:   Effets de bord : néant
        !          3442: ================================================================================
        !          3443: */
        !          3444: 
        !          3445: inline int test_arret(struct_processus *s_etat_processus)
        !          3446: {
        !          3447:    return((int) (*s_etat_processus).var_volatile_requete_arret);
        !          3448: }
        !          3449: 
        !          3450: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>