Changeset 2211


Ignore:
Timestamp:
Jul 6, 2005, 5:45:59 AM (20 years ago)
Author:
bird
Message:

o Fixed spawn/fork + fork() + exec/spawn/fork in the child.
o Kill any known decentants to prevent them from being

adopted by our parent. (On UNIX processes begin made
orphants are adopted and killed by the init process.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/lib/sys/b_processWait.c

    • Property cvs2svn:cvs-rev changed from 1.8 to 1.9
    r2210 r2211  
    5050#include <InnoTekLIBC/backend.h>
    5151#include <InnoTekLIBC/FastInfoBlocks.h>
     52
    5253#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_BACK_PROCESS
    5354#include <InnoTekLIBC/logstrict.h>
     
    119120/** List of known children. */
    120121static volatile PWAITCHILD  gpChildrenHead;
     122
     123
    121124/** Number of known child processes. */
    122125static volatile unsigned    gcChildren;
     
    149152static int  waitAllocInsert(const PWAITINFO pWaitInsert);
    150153static inline void waitInfoToSigInfo(const PWAITINFO pWait, siginfo_t *pSigInfo);
     154
    151155
    152156
     
    192196    if (gtidThread)
    193197    {
    194         /* kill the thread */
     198        /* kill the thread */
    195199        __atomic_xchg(&gfTerminate, 1);
    196200        DosKillThread(gtidThread);
     
    214218        DosPostEventSem(hev);
    215219        DosCloseEventSem(hev);
     220
     221
     222
     223
     224
     225
     226
     227
     228
     229
     230
     231
     232
     233
     234
     235
     236
     237
     238
     239
     240
     241
     242
     243
     244
     245
     246
     247
     248
     249
     250
     251
     252
     253
     254
     255
     256
    216257    }
    217258}
     
    328369                    else
    329370                        gpChildrenHead = pChild->pNext;
     371
     372
    330373                    __atomic_decrement_min(&gcChildren, 0);
    331374                    break;
     
    570613void __libc_back_processWaitNotifyExec(pid_t pid)
    571614{
    572     PWAITCHILD pChild = _hmalloc(sizeof(*pChild));
    573     waitSemRequest(0);
     615    /*
     616     * Allocate and enter semaphore protection.
     617     */
     618    PWAITCHILD pChild = NULL;
     619    if (gpChildrenFree)
     620    {
     621        waitSemRequest(0);
     622        pChild = gpChildrenFree;
     623        if (pChild)
     624            gpChildrenFree = pChild->pNext;
     625        else
     626            waitSemRelease();
     627    }
     628    if (!pChild)
     629    {
     630        pChild = _hmalloc(sizeof(*pChild));
     631        waitSemRequest(0);
     632    }
    574633
    575634    /*
     
    9791038                       rc, pSigInfo->si_pid, pSigInfo->si_code, pSigInfo->si_status);
    9801039}
     1040
     1041
     1042
     1043
     1044
     1045
     1046
     1047
     1048
     1049
     1050
     1051
     1052
     1053
     1054
     1055
     1056
     1057
     1058
     1059
     1060
     1061
     1062
     1063
     1064
     1065
     1066
     1067
     1068
     1069
     1070
     1071
     1072
     1073
     1074
     1075
     1076
     1077
     1078
     1079
     1080
     1081
     1082
     1083
     1084
     1085
     1086
     1087
     1088
     1089
     1090
     1091
     1092
     1093
     1094
     1095
Note: See TracChangeset for help on using the changeset viewer.