VirtualBox

儲存庫 vbox 的更動 12381


忽略:
時間撮記:
2008-9-10 下午11:37:41 (16 年 以前)
作者:
vboxsync
訊息:

DrvHostSerial: Open a new descriptor for reading the device to get around issue that the read select seems to block writing (fd lock?). Increase the buffer (darwin only) to make it possible to handle medium sized transfers (DevSerial *is* sending us data at the wrong rate).

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Devices/Serial/DrvHostSerial.cpp

    r12380 r12381  
    7474
    7575/** Size of the send fifo queue (in bytes) */
    76 #define CHAR_MAX_SEND_QUEUE             0x80
    77 #define CHAR_MAX_SEND_QUEUE_MASK        0x7f
     76#ifdef RT_OS_DARWIN
     77# define CHAR_MAX_SEND_QUEUE             0x400
     78# define CHAR_MAX_SEND_QUEUE_MASK        0x3ff
     79#else
     80# define CHAR_MAX_SEND_QUEUE             0x80
     81# define CHAR_MAX_SEND_QUEUE_MASK        0x7f
     82#endif
    7883
    7984/*******************************************************************************
     
    107112    /** the device handle */
    108113    RTFILE                      DeviceFile;
     114# ifdef RT_OS_DARWIN
     115    /** The device handle used for reading. */
     116    RTFILE                      DeviceFileR;
     117# endif
    109118    /** The read end of the control pipe */
    110119    RTFILE                      WakeupPipeR;
     
    524533                    FD_ZERO(&WrSet);
    525534                    FD_SET(pThis->DeviceFile, &WrSet);
    526                     //FD_SET(pThis->WakeupPipeR, &WrSet);
    527535                    fd_set XcptSet;
    528536                    FD_ZERO(&XcptSet);
    529537                    FD_SET(pThis->DeviceFile, &XcptSet);
    530                     //FD_SET(pThis->WakeupPipeR, &XcptSet);
    531                     rc = select(RT_MAX(pThis->WakeupPipeR, pThis->DeviceFile) + 1, NULL, &WrSet, &XcptSet, NULL);
     538                    rc = select(pThis->DeviceFile + 1, NULL, &WrSet, &XcptSet, NULL);
    532539                    /** @todo check rc? */
    533540
     
    700707            fd_set RdSet;
    701708            FD_ZERO(&RdSet);
    702             FD_SET(pThis->DeviceFile, &RdSet);
     709            FD_SET(pThis->DeviceFileR, &RdSet);
    703710            FD_SET(pThis->WakeupPipeR, &RdSet);
    704711            fd_set XcptSet;
    705712            FD_ZERO(&XcptSet);
    706             FD_SET(pThis->DeviceFile, &XcptSet);
     713            FD_SET(pThis->DeviceFileR, &XcptSet);
    707714            FD_SET(pThis->WakeupPipeR, &XcptSet);
    708715# if 1 /* it seems like this select is blocking the write... */
    709             rc = select(RT_MAX(pThis->WakeupPipeR, pThis->DeviceFile) + 1, &RdSet, NULL, &XcptSet, NULL);
     716            rc = select(RT_MAX(pThis->WakeupPipeR, pThis->DeviceFileR) + 1, &RdSet, NULL, &XcptSet, NULL);
    710717# else
    711718            struct timeval tv = { 0, 1000 };
    712             rc = select(RT_MAX(pThis->WakeupPipeR, pThis->DeviceFile) + 1, &RdSet, NULL, &XcptSet, &tv);
     719            rc = select(RT_MAX(pThis->WakeupPipeR, pThis->DeviceFileR) + 1, &RdSet, NULL, &XcptSet, &tv);
    713720# endif
    714721            if (rc == -1)
     
    742749
    743750            /* read data from the serial port. */
    744             rc = RTFileRead(pThis->DeviceFile, abBuffer, sizeof(abBuffer), &cbRead);
     751            rc = RTFileRead(pThis->DeviceFileR, abBuffer, sizeof(abBuffer), &cbRead);
    745752            if (RT_FAILURE(rc))
    746753            {
     
    980987        if (!((statusLines ^ pThis->fStatusLines) & uStatusLinesToCheck))
    981988        {
    982             PDMR3ThreadSleep(pThread, 1000); /* 1 sec */
     989            PDMR3ThreadSleep(pThread, 500); /* 0.5 sec */
    983990            continue;
    984991        }
     
    12091216#if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN)
    12101217    pThis->DeviceFile  = NIL_RTFILE;
     1218# ifdef RT_OS_DARWIN
     1219    pThis->DeviceFileR = NIL_RTFILE;
     1220# endif
    12111221    pThis->WakeupPipeR = NIL_RTFILE;
    12121222    pThis->WakeupPipeW = NIL_RTFILE;
     
    12701280
    12711281    rc = RTFileOpen(&pThis->DeviceFile, pThis->pszDevicePath, RTFILE_O_OPEN | RTFILE_O_READWRITE);
     1282# ifdef RT_OS_DARWIN
     1283    if (RT_SUCCESS(rc))
     1284        rc = RTFileOpen(&pThis->DeviceFileR, pThis->pszDevicePath, RTFILE_O_OPEN | RTFILE_O_READ);
     1285# endif
     1286
    12721287
    12731288#endif
     
    13011316
    13021317    fcntl(pThis->DeviceFile, F_SETFL, O_NONBLOCK);
     1318# ifdef RT_OS_DARWIN
     1319    fcntl(pThis->DeviceFileR, F_SETFL, O_NONBLOCK);
     1320# endif
    13031321    int aFDs[2];
    13041322    if (pipe(aFDs) != 0)
     
    14041422        pThis->WakeupPipeR = NIL_RTFILE;
    14051423    }
     1424# if defined(RT_OS_DARWIN)
     1425    if (pThis->DeviceFileR != NIL_RTFILE)
     1426    {
     1427        if (pThis->DeviceFile != pThis->DeviceFileR)
     1428        {
     1429            int rc = RTFileClose(pThis->DeviceFileR);
     1430            AssertRC(rc);
     1431        }
     1432        pThis->DeviceFileR = NIL_RTFILE;
     1433    }
     1434# endif
    14061435    if (pThis->DeviceFile != NIL_RTFILE)
    14071436    {
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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