VirtualBox

Changeset 21199 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Jul 3, 2009 1:23:29 PM (16 years ago)
Author:
vboxsync
Message:

VBoxGuest-linux.c,VBoxGuestR3Lib.cpp: Fixed ioctl error check for linux. Made sure no more VBox error status codes are lost in translation (linux only, but the principle is portable to *BSD and Solaris).

Location:
trunk/src/VBox/Additions/common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-linux.c

    r21170 r21199  
    330330{
    331331    bool fTaken = VBoxGuestCommonISR(&g_DevExt);
    332     /** @todo  if (vboxDev->irqAckRequest->events &
    333      *             VMMDEV_EVENT_MOUSE_POSITION_CHANGED)
    334      *             kill_fasync(&vboxDev->async_queue, SIGIO, POLL_IN);
    335      */
    336332    return IRQ_RETVAL(fTaken);
    337333}
     
    458454    /*
    459455     * Create the release log.
     456     * (We do that here instead of common code because we want to log               .
     457     * early failures using the LogRel macro.)
    460458     */
    461459    rc = RTLogCreate(&pRelLogger, 0 /* fFlags */, "all",
     
    647645         * Copy ioctl data and output buffer back to user space.
    648646         */
    649         if (RT_LIKELY(!rc))
     647        if (RT_SUCCESS(rc))
    650648        {
    651649            rc = 0;
     
    668666        {
    669667            Log(("vboxguestLinuxIOCtl: pFilp=%p uCmd=%#x ulArg=%p failed, rc=%d\n", pFilp, uCmd, (void *)ulArg, rc));
    670             rc = vboxguestLinuxConvertToNegErrno(rc);
     668            rc = -rc; Assert(rc > 0); /* Positive returns == negated VBox error status codes. */
    671669        }
    672670    }
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3Lib.cpp

    r18452 r21199  
    3232# include <os2.h>
    3333
    34 #elif defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
     34#elif defined(RT_OS_FREEBSD) \
     35   || defined(RT_OS_LINUX) \
     36   || defined(RT_OS_SOLARIS)
    3537# include <sys/types.h>
    3638# include <sys/stat.h>
     39# if defined(RT_OS_LINUX) /** @todo check this on solaris+freebsd as well. */
     40#  include <sys/ioctl.h>
     41# endif
    3742# include <errno.h>
    3843# include <unistd.h>
     
    375380    return VINF_SUCCESS;
    376381
     382#elif defined(RT_OS_LINUX)
     383    int rc = ioctl((int)g_File, iFunction, pvData);
     384    if (RT_LIKELY(rc == 0))
     385        return VINF_SUCCESS;
     386
     387    /* Positive values are negated VBox error status codes. */
     388    if (rc > 0)
     389        rc = -rc;
     390    else
     391        rc = RTErrConvertFromErrno(errno);
     392    NOREF(cbData);
     393    return rc;
     394
    377395#elif defined(VBOX_VBGLR3_XFREE86)
    378396    /* PORTME - This is preferred over the RTFileIOCtl variant below, just be careful with the (int). */
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