Changeset 3783


Ignore:
Timestamp:
Mar 22, 2012, 7:10:19 PM (13 years ago)
Author:
bird
Message:

0.6/sharedpm.c: Disabled some racy/buggy code in libc_spmSelf.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/libc-0.6/src/emx/src/lib/sys/sharedpm.c

    r3781 r3783  
    384384        if (spmRequestMutexErrno(&RegRec))
    385385            LIBCLOG_RETURN_P(NULL);
     386        /* bird: The following code is broken (bad test). Since it never worked
     387           and the fix on trunk involves adding another parameter, I'll just
     388           disable the path that will screw up badly and leave the result NULL
     389           like most calls already returns. See r2937. */
     390#if 0
    386391        if (!gpSPMSelf)
    387392            pProcess = gpSPMSelf;
     
    403408            FS_RESTORE();
    404409        }
     410#else
     411        pProcess = gpSPMSelf;
     412#endif
    405413        spmReleaseMutex(&RegRec);
    406414    }
     
    629637
    630638/**
    631  * Wait for a embryo to become a live process and complete 
     639 * Wait for a embryo to become a live process and complete
    632640 * inheriting (file handles / sockets issues).
    633641 *
     
    646654    DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &ulStart, sizeof(ulStart));
    647655
    648     /* 
     656    /*
    649657     * Wait for the process to become ready, 8 ms max.
    650      * However, if it becomes alive in that period we know it's a libc 
     658     * However, if it becomes alive in that period we know it's a libc
    651659     * process and will wait a bit more (130 ms) for it to finishing
    652660     * initialization and inheritance.
    653661     */
    654     for (cLoops = 0; ; cLoops++) 
    655     {
    656         /* 
    657          * Reset the notification event sem. 
     662    for (cLoops = 0; ; cLoops++)
     663    {
     664        /*
     665         * Reset the notification event sem.
    658666         */
    659667        spmRequestMutex(&RegRec);
    660668        fAlive = pEmbryo->enmState > __LIBC_PROCSTATE_ALIVE
    661               || (   pEmbryo->pInherit == NULL 
     669              || (   pEmbryo->pInherit == NULL
    662670                  && pEmbryo->pInheritLocked == NULL
    663671                  && pEmbryo->enmState == __LIBC_PROCSTATE_ALIVE);
     
    668676            break; /* done */
    669677
    670         /* 
    671          * Calc the time we should sleep. 
     678        /*
     679         * Calc the time we should sleep.
    672680         */
    673681        ULONG ulNow = 0;
     
    688696            LIBCLOG_MSG("libc child - wait %lu ms (cLoops=%d rc=%ld)\n", ulSleep, cLoops, rc);
    689697        }
    690         else 
     698        else
    691699            break; /* giving up */
    692700
    693         /* 
    694          * Recheck before going to sleep on the event sem. 
     701        /*
     702         * Recheck before going to sleep on the event sem.
    695703         */
    696704        fAlive = pEmbryo->enmState > __LIBC_PROCSTATE_ALIVE
    697               || (   pEmbryo->pInherit == NULL 
     705              || (   pEmbryo->pInherit == NULL
    698706                  && pEmbryo->pInheritLocked == NULL
    699707                  && pEmbryo->enmState == __LIBC_PROCSTATE_ALIVE);
     
    701709            break; /* done */
    702710
    703         if (    gpSPMHdr->hevNotify 
     711        if (    gpSPMHdr->hevNotify
    704712            &&  (rc == NO_ERROR || rc == ERROR_TIMEOUT || rc == ERROR_SEM_TIMEOUT))
    705713            rc = DosWaitEventSem(gpSPMHdr->hevNotify, ulSleep);
     
    26672675                    *pParent->ppChildNotifyTail = pTerm;
    26682676                    pParent->ppChildNotifyTail = &pTerm->pNext;
    2669                    
     2677
    26702678                    LIBCLOG_MSG("posting %#lx\n", gpSPMHdr->hevNotify);
    26712679                    APIRET rc2 = DosPostEventSem(gpSPMHdr->hevNotify);
     
    34963504                    spmFreeProcess(pProcess);
    34973505                    pProcess = pProcessNext;
    3498                    
     3506
    34993507                    /* Wake up the embryo waiters (paranoia). */
    35003508                    LIBCLOG_MSG("posting %#lx\n", gpSPMHdr->hevNotify);
     
    35923600                        spmFreeProcess(pProcess);
    35933601                        pProcess = pProcessNext;
    3594                        
     3602
    35953603                        /* Wake up the embryo waiters (paranoia). */
    35963604                        LIBCLOG_MSG("posting %#lx\n", gpSPMHdr->hevNotify);
Note: See TracChangeset for help on using the changeset viewer.