VirtualBox

Ignore:
Timestamp:
Sep 7, 2015 1:47:08 PM (9 years ago)
Author:
vboxsync
Message:

IPRT: Added RTVfsIoStrmFromRTPipe (and RTPipeQueryInfo) for the purpose of making RTVfsIoStrmFromStdHandle be able to work with pipes. Mostly untested.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/os2/pipe-os2.cpp

    r57358 r57643  
    879879
    880880
     881RTDECL(int) RTPipeQueryInfo(RTPIPE hPipe, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr)
     882{
     883    RTPIPEINTERNAL *pThis = hPipe;
     884    AssertPtrReturn(pThis, 0);
     885    AssertReturn(pThis->u32Magic == RTPIPE_MAGIC, 0);
     886
     887    int rc = RTCritSectEnter(&pThis->CritSect);
     888    AssertRCReturn(rc, 0);
     889
     890    rtPipeFakeQueryInfo(pObjInfo, enmAddAttr, pThis->fRead);
     891
     892    if (pThis->fRead)
     893    {
     894        ULONG       cbActual = 0;
     895        ULONG       ulState  = 0;
     896        AVAILDATA   Avail    = { 0, 0 };
     897        APIRET orc = DosPeekNPipe(pThis->hPipe, NULL, 0, &cbActual, &Avail, &ulState);
     898        if (orc == NO_ERROR && (Avail.cbpipe > 0 || ulState == NP_STATE_CONNECTED))
     899            pObjInfo->cbObject = Avail.cbpipe;
     900    }
     901    else
     902        pObjInfo->cbObject = rtPipeOs2GetSpace(pThis)
     903    pObjInfo->cbAllocated = RTPIPE_OS2_SIZE; /** @todo this isn't necessarily true if we didn't create it... but, whatever */
     904
     905    RTCritSectLeave(&pThis->CritSect);
     906    return VINF_SUCCESS;
     907}
     908
     909
    881910int rtPipePollGetHandle(RTPIPE hPipe, uint32_t fEvents, PRTHCINTPTR phNative)
    882911{
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