VirtualBox

Ignore:
Timestamp:
Jun 22, 2011 7:30:06 PM (14 years ago)
Author:
vboxsync
Message:

*: RTFILE becomes a pointer, RTFileOpen++ expands it's flags paramter from uint32_t to uint64_t.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/NetworkServices/NAT/VBoxNetNAT.cpp

    r36470 r37596  
    3535#include <iprt/path.h>
    3636#include <iprt/param.h>
     37#include <iprt/pipe.h>
    3738#include <iprt/getopt.h>
    3839#include <iprt/string.h>
     
    9091    HANDLE m_hWakeupEvent;
    9192#else
    92     RTFILE m_PipeWrite;
    93     RTFILE m_PipeRead;
     93    RTPIPE m_hPipeWrite;
     94    RTPIPE m_hPipeRead;
    9495#endif
    9596    /** Queue for NAT-thread-external events. */
     
    126127#ifndef RT_OS_WINDOWS
    127128    /* kick select() */
    128     rc = RTFileWrite(g_pNAT->m_PipeWrite, "", 1, NULL);
     129    size_t cbIgnored;
     130    rc = RTPipeWrite(g_pNAT->m_hPipeWrite, "", 1, &cbIgnored);
    129131#else
    130132    /* kick WSAWaitForMultipleEvents */
     
    170172     * Create the control pipe.
    171173     */
    172     int fds[2];
    173     if (pipe(&fds[0]) != 0) /** @todo RTPipeCreate() or something... */
    174     {
    175         rc = RTErrConvertFromErrno(errno);
    176         AssertReleaseRC(rc);
    177         return;
    178     }
    179     m_PipeRead = fds[0];
    180     m_PipeWrite = fds[1];
     174    rc = RTPipeCreate(&m_hPipeRead, &m_hPipeWrite, 0 /*fFlags*/);
     175    AssertReleaseRC(rc);
    181176#else
    182177    m_hWakeupEvent = CreateEvent(NULL, FALSE, FALSE, NULL); /* auto-reset event */
     178    AssertReleaseRC(m_hWakeupEvent != NULL);
    183179    slirp_register_external_event(m_pNATState, m_hWakeupEvent, VBOX_WAKEUP_EVENT_INDEX);
    184180#endif
     
    299295#ifndef RT_OS_WINDOWS
    300296                /* kick select() */
    301                 rc = RTFileWrite(m_PipeWrite, "", 1, NULL);
     297                size_t cbIgnored;
     298                rc = RTPipeWrite(m_hPipeWrite, "", 1, &cbIgnored);
    302299                AssertRC(rc);
    303300#else
     
    468465        unsigned int cMsTimeout = slirp_get_timeout_ms(pThis->m_pNATState);
    469466
    470         polls[0].fd = pThis->m_PipeRead;
     467        polls[0].fd = RTPipeToNative(pThis->m_hPipeRead);
    471468        /* POLLRDBAND usually doesn't used on Linux but seems used on Solaris */
    472469        polls[0].events = POLLRDNORM|POLLPRI|POLLRDBAND;
     
    494491            if (polls[0].revents & (POLLRDNORM|POLLPRI|POLLRDBAND))
    495492            {
    496                 /* drain the pipe */
    497                 char ch[1];
    498                 size_t cbRead;
    499                 int counter = 0;
    500                 /*
     493                /* drain the pipe
     494                 *
     495                 * Note!
    501496                 * drvNATSend decoupled so we don't know how many times
    502497                 * device's thread sends before we've entered multiplex,
     
    506501                 * deep pipe has been filed before drain.
    507502                 *
    508                  * XXX:Make it reading exactly we need to drain the pipe.
    509503                 */
    510                 RTFileRead(pThis->m_PipeRead, &ch, 1, &cbRead);
     504                 /** @todo XXX: Make it reading exactly we need to drain the
     505                  *  pipe.  */
     506                char    ch;
     507                size_t  cbRead;
     508                RTPipeRead(pThis->m_hPipeRead, &ch, 1, &cbRead);
    511509            }
    512510        }
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