VirtualBox

Ignore:
Timestamp:
Jan 11, 2010 2:45:34 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
56467
Message:

iprt: Use RTMSINTERVAL for timeouts. Fixed missing timeout underflow checks in two RTFileAioCtxWait implementations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/freebsd/fileaio-freebsd.cpp

    r25645 r25724  
    472472}
    473473
    474 RTDECL(int) RTFileAioCtxWait(RTFILEAIOCTX hAioCtx, size_t cMinReqs, unsigned cMillisTimeout,
     474RTDECL(int) RTFileAioCtxWait(RTFILEAIOCTX hAioCtx, size_t cMinReqs, RTMSINTERVAL cMillies,
    475475                             PRTFILEAIOREQ pahReqs, size_t cReqs, uint32_t *pcReqs)
    476476{
     
    498498    struct timespec     Timeout = {0,0};
    499499    uint64_t            StartNanoTS = 0;
    500     if (cMillisTimeout != RT_INDEFINITE_WAIT)
    501     {
    502         Timeout.tv_sec  = cMillisTimeout / 1000;
    503         Timeout.tv_nsec = cMillisTimeout % 1000 * 1000000;
     500    if (cMillies != RT_INDEFINITE_WAIT)
     501    {
     502        Timeout.tv_sec  = cMillies / 1000;
     503        Timeout.tv_nsec = cMillies % 1000 * 1000000;
    504504        pTimeout = &Timeout;
    505505        StartNanoTS = RTTimeNanoTS();
     
    573573        cReqs    -= cDone;
    574574
    575         if (cMillisTimeout != RT_INDEFINITE_WAIT)
     575        if (cMillies != RT_INDEFINITE_WAIT)
    576576        {
    577577            /* The API doesn't return ETIMEDOUT, so we have to fix that ourselves. */
    578578            uint64_t NanoTS = RTTimeNanoTS();
    579579            uint64_t cMilliesElapsed = (NanoTS - StartNanoTS) / 1000000;
    580             if (cMilliesElapsed >= cMillisTimeout)
     580            if (cMilliesElapsed >= cMillies)
    581581            {
    582582                rc = VERR_TIMEOUT;
     
    585585
    586586            /* The syscall supposedly updates it, but we're paranoid. :-) */
    587             Timeout.tv_sec  = (cMillisTimeout - (unsigned)cMilliesElapsed) / 1000;
    588             Timeout.tv_nsec = (cMillisTimeout - (unsigned)cMilliesElapsed) % 1000 * 1000000;
     587            Timeout.tv_sec  = (cMillies - (RTMSINTERVAL)cMilliesElapsed) / 1000;
     588            Timeout.tv_nsec = (cMillies - (RTMSINTERVAL)cMilliesElapsed) % 1000 * 1000000;
    589589        }
    590590    }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette