VirtualBox

Ignore:
Timestamp:
Feb 26, 2010 10:36:08 AM (15 years ago)
Author:
vboxsync
Message:

iprt: Adjustments to RTPipeReadBlocking and RTPipeWriteBlocking. RTPoll and RTProcCreateEx testcases.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/poll-posix.cpp

    r26805 r26824  
    4141#include <iprt/mem.h>
    4242#include <iprt/pipe.h>
     43#include <iprt/string.h>
    4344#include <iprt/thread.h>
    4445#include <iprt/time.h>
     
    234235RTDECL(int)  RTPollSetCreate(PRTPOLLSET phPollSet)
    235236{
    236     AssertPtr(phPollSet);
     237    AssertPtrReturn(phPollSet, VERR_INVALID_POINTER);
    237238    RTPOLLSETINTERNAL *pThis = (RTPOLLSETINTERNAL *)RTMemAlloc(sizeof(RTPOLLSETINTERNAL));
    238239    if (!pThis)
     
    279280    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    280281    AssertReturn(pThis->u32Magic == RTPOLLSET_MAGIC, VERR_INVALID_HANDLE);
    281     AssertReturn(!(fEvents & (RTPOLL_EVT_VALID_MASK)), VERR_INVALID_PARAMETER);
     282    AssertReturn(!(fEvents & ~RTPOLL_EVT_VALID_MASK), VERR_INVALID_PARAMETER);
    282283    AssertReturn(fEvents, VERR_INVALID_PARAMETER);
    283284    AssertReturn(id != UINT32_MAX, VERR_INVALID_PARAMETER);
     
    413414        {
    414415            pThis->cHandles--;
    415             if (i != pThis->cHandles)
    416             {
    417                 pThis->paHandles[i] = pThis->paHandles[pThis->cHandles];
    418                 pThis->paPollFds[i] = pThis->paPollFds[pThis->cHandles];
     416            size_t const cToMove = pThis->cHandles - i;
     417            if (cToMove)
     418            {
     419                memmove(&pThis->paHandles[i], &pThis->paHandles[i + 1], cToMove * sizeof(pThis->paHandles[i]));
     420                memmove(&pThis->paPollFds[i], &pThis->paPollFds[i + 1], cToMove * sizeof(pThis->paPollFds[i]));
    419421            }
    420422            rc = VINF_SUCCESS;
     
    436438    AssertReturn(pThis->u32Magic == RTPOLLSET_MAGIC, VERR_INVALID_HANDLE);
    437439    AssertReturn(id != UINT32_MAX, VERR_INVALID_PARAMETER);
    438     AssertPtrReturn(pHandle, VERR_INVALID_POINTER);
     440    AssertPtrNullReturn(pHandle, VERR_INVALID_POINTER);
    439441
    440442    /*
Note: See TracChangeset for help on using the changeset viewer.

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