Changeset 52222 in vbox
- Timestamp:
- Jul 29, 2014 6:33:59 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3Lib.cpp
r52210 r52222 394 394 return RTErrConvertFromOS2(rc); 395 395 396 #elif defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD) 396 #else 397 # if defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD) 397 398 VBGLBIGREQ Hdr; 398 399 Hdr.u32Magic = VBGLBIGREQ_MAGIC; 399 400 Hdr.cbData = cbData; 400 401 Hdr.pvDataR3 = pvData; 401 # if HC_ARCH_BITS == 32402 # if HC_ARCH_BITS == 32 402 403 Hdr.u32Padding = 0; 403 # endif 404 # endif 405 pvData = &Hdr; 404 406 405 407 /** @todo test status code passing! Check that the kernel doesn't do any … … 408 410 * header with an error code return field (much better alternative 409 411 * actually). */ 410 #ifdef VBOX_VBGLR3_XSERVER 411 int rc = xf86ioctl(g_File, iFunction, &Hdr); 412 #else 413 if (g_File == NIL_RTFILE) 414 return VERR_INVALID_HANDLE; 415 int rc = ioctl(RTFileToNative(g_File), iFunction, &Hdr); 416 #endif 417 if (rc == -1) 418 { 419 rc = errno; 420 return RTErrConvertFromErrno(rc); 421 } 422 return VINF_SUCCESS; 423 424 #elif defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) 425 # ifdef VBOX_VBGLR3_XSERVER 412 # elif defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) 413 NOREF(cbData); 414 # endif 415 416 # if defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD) || defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) 417 # ifdef VBOX_VBGLR3_XSERVER 426 418 int rc = xf86ioctl((int)g_File, iFunction, pvData); 427 # else419 # else 428 420 if (g_File == NIL_RTFILE) 429 421 return VERR_INVALID_HANDLE; 430 422 int rc = ioctl(RTFileToNative(g_File), iFunction, pvData); 423 # endif 424 # elif defined(RT_OS_HAIKU) 425 /* The ioctl hook in Haiku does take the len parameter when specified, 426 * so just use it. */ 427 int rc = ioctl((int)g_File, iFunction, pvData, cbData); 428 # else 429 # error Port me! 431 430 # endif 432 431 if (RT_LIKELY(rc == 0)) … … 442 441 rc = RTErrConvertFromErrno(errno); 443 442 # endif 444 NOREF(cbData);445 443 return rc; 446 444 447 #elif defined(RT_OS_HAIKU)448 /* The ioctl hook in Haiku does take the len parameter when specified,449 * so just use it. */450 int rc = ioctl((int)g_File, iFunction, pvData, cbData);451 if (RT_LIKELY(rc == 0))452 return VINF_SUCCESS;453 454 /* Positive values are negated VBox error status codes. */455 if (rc > 0)456 rc = -rc;457 else458 rc = RTErrConvertFromErrno(errno);459 return rc;460 461 #elif defined(VBOX_VBGLR3_XSERVER)462 /* PORTME - This is preferred over the RTFileIOCtl variant below, just be careful with the (int). */463 /** @todo test status code passing! */464 int rc = xf86ioctl(g_File, iFunction, pvData);465 if (rc == -1)466 return VERR_FILE_IO_ERROR; /* This is purely legacy stuff, it has to work and no more. */467 return VINF_SUCCESS;468 469 #else470 /* Default implementation - PORTME: Do not use this without testings that passing errors works! */471 /** @todo test status code passing! */472 int rc2 = VERR_INTERNAL_ERROR;473 int rc = RTFileIoCtl(g_File, (int)iFunction, pvData, cbData, &rc2);474 if (RT_SUCCESS(rc))475 rc = rc2;476 return rc;477 445 #endif 478 446 }
Note:
See TracChangeset
for help on using the changeset viewer.