VirtualBox

Changeset 10902 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jul 27, 2008 7:57:55 PM (16 years ago)
Author:
vboxsync
Message:

Fix ioctl error on guest shutdown in the serial device

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Serial/DrvHostSerial.cpp

    r8155 r10902  
    780780    PDRVHOSTSERIAL pData = PDMINS2DATA(pDrvIns, PDRVHOSTSERIAL);
    781781    int rc;
     782    unsigned int uSerialLineFlags;
     783    unsigned int uSerialLineStatus;
     784    unsigned int uIoctl;
    782785
    783786    /*
     
    788791     * This should make the ioctl call return.
    789792     */
    790     rc = ioctl(pData->DeviceFile, TIOCMBIS, TIOCM_LOOP);
     793
     794    /* Get current status of control lines. */
     795    rc = ioctl(pData->DeviceFile, TIOCMGET, &uSerialLineStatus);
    791796    if (rc < 0)
    792797        goto ioctl_error;
    793798
    794     rc = ioctl(pData->DeviceFile, TIOCMBIS, TIOCM_RTS);
     799    uSerialLineFlags = TIOCM_LOOP;
     800    rc = ioctl(pData->DeviceFile, TIOCMBIS, &uSerialLineFlags);
     801    if (rc < 0)
     802        goto ioctl_error;
     803
     804    /*
     805     * Change current level on the RTS pin to make the ioctl call return in the
     806     * monitor thread.
     807     */
     808    uIoctl = (uSerialLineStatus & TIOCM_CTS) ? TIOCMBIC : TIOCMBIS;
     809    uSerialLineFlags = TIOCM_RTS;
     810
     811    rc = ioctl(pData->DeviceFile, uIoctl, &uSerialLineFlags);
     812    if (rc < 0)
     813        goto ioctl_error;
     814
     815    /* Change RTS back to the previous level. */
     816    uIoctl = (uIoctl == TIOCMBIC) ? TIOCMBIS : TIOCMBIC;
     817
     818    rc = ioctl(pData->DeviceFile, uIoctl, &uSerialLineFlags);
    795819    if (rc < 0)
    796820        goto ioctl_error;
     
    799823     * Set serial device into normal state.
    800824     */
    801     rc = ioctl(pData->DeviceFile, TIOCMBIC, TIOCM_LOOP);
     825    uSerialLineFlags = TIOCM_LOOP;
     826    rc = ioctl(pData->DeviceFile, TIOCMBIC, &uSerialLineFlags);
    802827    if (rc >= 0)
    803828        return VINF_SUCCESS;
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