VirtualBox

Ignore:
Timestamp:
Jul 23, 2009 2:13:41 PM (15 years ago)
Author:
vboxsync
Message:

ogl/vboxhgcm.c: adjust ioctl return code check for linux, init the HGCM call result with a failure instead of success (in case it isn't copied back to ring-3).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/util/vboxhgcm.c

    r21523 r21776  
    156156#ifdef IN_GUEST
    157157
    158 #ifdef RT_OS_WINDOWS
     158# ifdef RT_OS_WINDOWS
    159159    DWORD cbReturned;
    160160
     
    170170    crDebug("vboxCall failed with %x\n", GetLastError());
    171171    return VERR_NOT_SUPPORTED;
    172 #else
    173 # ifdef RT_OS_SOLARIS
     172# else
     173    int rc;
     174#  ifdef RT_OS_SOLARIS
    174175    VBGLBIGREQ Hdr;
    175176    Hdr.u32Magic = VBGLBIGREQ_MAGIC;
    176177    Hdr.cbData = cbData;
    177178    Hdr.pvDataR3 = pvData;
    178 if HC_ARCH_BITS == 32
     179 if HC_ARCH_BITS == 32
    179180    Hdr.u32Padding = 0;
     181#   endif
     182    rc = ioctl(g_crvboxhgcm.iGuestDrv, VBOXGUEST_IOCTL_HGCM_CALL(cbData), &Hdr);
     183#  else
     184    rc = ioctl(g_crvboxhgcm.iGuestDrv, VBOXGUEST_IOCTL_HGCM_CALL(cbData), pvData);
    180185#  endif
    181     if (ioctl(g_crvboxhgcm.iGuestDrv, VBOXGUEST_IOCTL_HGCM_CALL(cbData), &Hdr) >= 0)
    182 # else
    183     if (ioctl(g_crvboxhgcm.iGuestDrv, VBOXGUEST_IOCTL_HGCM_CALL(cbData), pvData) >= 0)
    184 # endif
     186#  ifdef RT_OS_LINUX
     187    if (rc == 0)
     188#  else
     189    if (rc >= 0)
     190#  endif
    185191    {
    186192        return VINF_SUCCESS;
    187193    }
    188     crWarning("vboxCall failed with %x\n", errno);
     194#  ifdef RT_OS_LINUX
     195    if (rc >= 0) /* positive values are negated VBox error status codes. */
     196        crWarning("vboxCall failed with VBox status code %d\n", -rc);
     197    else
     198#  endif
     199        crWarning("vboxCall failed with %x\n", errno);
    189200    return VERR_NOT_SUPPORTED;
    190 #endif /*#ifdef RT_OS_WINDOWS*/
     201# endif /*#ifdef RT_OS_WINDOWS*/
    191202
    192203#else /*#ifdef IN_GUEST*/
     
    327338    int rc;
    328339
    329     parms.hdr.result      = VINF_SUCCESS;
     340    parms.hdr.result      = VERR_WRONG_ORDER;
    330341    parms.hdr.u32ClientID = conn->u32ClientID;
    331342    parms.hdr.u32Function = SHCRGL_GUEST_FN_WRITE;
     
    349360    int rc;
    350361
    351     parms.hdr.result      = VINF_SUCCESS;
     362    parms.hdr.result      = VERR_WRONG_ORDER;
    352363    parms.hdr.u32ClientID = conn->u32ClientID;
    353364    parms.hdr.u32Function = SHCRGL_GUEST_FN_READ;
     
    392403    int rc;
    393404
    394     parms.hdr.result      = VINF_SUCCESS;
     405    parms.hdr.result      = VERR_WRONG_ORDER;
    395406    parms.hdr.u32ClientID = conn->u32ClientID;
    396407    parms.hdr.u32Function = SHCRGL_GUEST_FN_WRITE_READ;
     
    511522    CRASSERT(!conn->pBuffer);
    512523
    513     parms.hdr.result      = VINF_SUCCESS;
     524    parms.hdr.result      = VERR_WRONG_ORDER;
    514525    parms.hdr.u32ClientID = conn->u32ClientID;
    515526    parms.hdr.u32Function = SHCRGL_GUEST_FN_READ;
     
    676687    int rc;
    677688
    678     parms.hdr.result      = VINF_SUCCESS;
     689    parms.hdr.result      = VERR_WRONG_ORDER;
    679690    parms.hdr.u32ClientID = conn->u32ClientID;
    680691    parms.hdr.u32Function = SHCRGL_GUEST_FN_SET_VERSION;
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