- Timestamp:
- Mar 20, 2012 3:00:41 PM (13 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxGuest
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-solaris-streams.c
r40550 r40552 575 575 } g_asTestWPut[] = 576 576 { 577 /* iDBType iIOCCmd cbData pvDataIn cbDataIn 578 pvDataOut cbDataOut rcExp pfnExtra */ 579 { M_IOCTL, VUIDGFORMAT, sizeof(int), NULL, 0, 580 PVGFORMAT, CBGFORMAT, 0, NULL }, 581 { M_IOCTL, VUIDSFORMAT, sizeof(int), PVGFORMAT, CBGFORMAT, 582 NULL, 0, 0, NULL }, 583 { M_IOCTL, MSIOSRESOLUTION, CBMSIOSRES, PMSIOSRES, CBMSIOSRES, 584 NULL, 0, 0, testSetResolution } 577 /* iDBType iIOCCmd cbData pvDataIn cbDataIn 578 pvDataOut cbDataOut rcExp pfnExtra */ 579 { M_IOCTL, VUIDGFORMAT, sizeof(int), NULL, 0, 580 PVGFORMAT, CBGFORMAT, 0, NULL }, 581 { M_IOCTL, VUIDGFORMAT, sizeof(int) - 1, NULL, 0, 582 NULL, 0, EINVAL, NULL }, 583 { M_IOCTL, VUIDGFORMAT, sizeof(int) + 1, NULL, 0, 584 PVGFORMAT, CBGFORMAT, 0, NULL }, 585 { M_IOCTL, VUIDSFORMAT, sizeof(int), PVGFORMAT, CBGFORMAT, 586 NULL, 0, 0, NULL }, 587 { M_IOCTL, MSIOSRESOLUTION, CBMSIOSRES, PMSIOSRES, CBMSIOSRES, 588 NULL, 0, 0, testSetResolution }, 589 { M_IOCTL, VUIDGWHEELINFO, 0, NULL, 0, 590 NULL, 0, EINVAL, NULL } 585 591 }; 586 592 … … 619 625 RT_ZERO(IOCBlk); 620 626 RT_ZERO(MBlkCont); 627 RT_ZERO(acData); 621 628 DBlk.db_type = g_asTestWPut[i].iDBType; 622 629 IOCBlk.ioc_cmd = g_asTestWPut[i].iIOCCmd; 623 630 IOCBlk.ioc_count = g_asTestWPut[i].cbData; 624 AssertReturnVoid(g_asTestWPut[i].cbDataIn <= sizeof(acData)); 631 AssertReturnVoid(g_asTestWPut[i].cbData <= sizeof(acData)); 632 AssertReturnVoid(g_asTestWPut[i].cbDataIn <= g_asTestWPut[i].cbData); 633 AssertReturnVoid(g_asTestWPut[i].cbDataOut <= g_asTestWPut[i].cbData); 625 634 memcpy(acData, g_asTestWPut[i].pvDataIn, g_asTestWPut[i].cbDataIn); 626 635 MBlkCont.b_rptr = acData; 627 MBlkCont.b_wptr = acData + g_asTestWPut[i].cbData In;636 MBlkCont.b_wptr = acData + g_asTestWPut[i].cbData; 628 637 MBlk.b_cont = &MBlkCont; 629 638 MBlk.b_rptr = (unsigned char *)&IOCBlk; … … 631 640 MBlk.b_datap = &DBlk; 632 641 rc = vbgr0SolWPut(WR(&aQueues[0]), &MBlk); 633 RTTEST_CHECK_MSG(hTest, rc == g_asTestWPut[i].rcExp, 634 (hTest, "i=%u, rc=%d\n", i, rc)); 642 RTTEST_CHECK_MSG(hTest, IOCBlk.ioc_error == g_asTestWPut[i].rcExp, 643 (hTest, "i=%u, IOCBlk.ioc_error=%d\n", i, 644 IOCBlk.ioc_error)); 635 645 RTTEST_CHECK_MSG(hTest, IOCBlk.ioc_count == g_asTestWPut[i].cbDataOut, 636 646 (hTest, "i=%u, ioc_count=%u\n", i, IOCBlk.ioc_count)); … … 638 648 g_asTestWPut[i].cbDataOut), 639 649 (hTest, "i=%u\n", i)); 650 /* Hack to ensure that miocpullup() gets called when needed. */ 651 if ( g_asTestWPut[i].iDBType == M_IOCTL 652 && g_asTestWPut[i].cbData > 0) /* TRANSPARENT == -1 */ 653 RTTEST_CHECK_MSG(hTest, MBlk.b_flag == 1, (hTest, "i=%u\n", i)); 640 654 if (g_asTestWPut[i].pfnExtra) 641 655 g_asTestWPut[i].pfnExtra(hTest, WR(&aQueues[0]), &MBlk); … … 957 971 { 958 972 LogFlowFunc(("VUIDGFORMAT\n")); 959 AssertReturn(cbBuffer >= sizeof(int), EINVAL); 973 if (cbBuffer < sizeof(int)) 974 return EINVAL; 960 975 *(int *)pvData = VUID_FIRM_EVENT; 961 976 *pcbData = sizeof(int); … … 977 992 978 993 LogFlowFunc(("MSIOGETPARMS\n")); 979 AssertReturn(cbBuffer >= sizeof(Ms_parms), EINVAL); 994 if (cbBuffer < sizeof(Ms_parms)) 995 return EINVAL; 980 996 *(Ms_parms *)pvData = parms; 981 997 *pcbData = sizeof(Ms_parms); … … 991 1007 992 1008 LogFlowFunc(("MSIOSRESOLUTION\n")); 993 AssertReturn(cbBuffer >= sizeof(Ms_screen_resolution), EINVAL); 1009 if (cbBuffer < sizeof(Ms_screen_resolution)) 1010 return EINVAL; 994 1011 pState->cMaxScreenX = pResolution->width - 1; 995 1012 pState->cMaxScreenY = pResolution->height - 1; … … 1007 1024 { 1008 1025 LogFlowFunc(("MSIOBUTTONS\n")); 1009 AssertReturn(cbBuffer >= sizeof(int), EINVAL); 1026 if (cbBuffer < sizeof(int)) 1027 return EINVAL; 1010 1028 *(int *)pvData = 0; 1011 1029 *pcbData = sizeof(int); … … 1015 1033 { 1016 1034 LogFlowFunc(("VUIDGWHEELCOUNT\n")); 1017 AssertReturn(cbBuffer >= sizeof(int), EINVAL); 1035 if (cbBuffer < sizeof(int)) 1036 return EINVAL; 1018 1037 *(int *)pvData = 0; 1019 1038 *pcbData = sizeof(int); -
trunk/src/VBox/Additions/common/VBoxGuest/testcase/solaris.h
r40550 r40552 326 326 #define freemsg(...) do {} while(0) 327 327 #define putnext(...) do {} while(0) 328 #define miocpullup(...) 0329 328 #define ddi_get_instance(...) 0 330 329 #define pci_config_setup(...) DDI_SUCCESS … … 409 408 } 410 409 410 /* This does not work like the real version, but does some sanity testing 411 * and sets a flag. */ 412 static inline int miocpullup(mblk_t *pMBlk, size_t cbMsg) 413 { 414 struct iocblk *pIOCBlk = (struct iocblk *)pMBlk->b_rptr; 415 416 if (pIOCBlk->ioc_count == TRANSPARENT) 417 return EINVAL; 418 if ( !pMBlk->b_cont 419 || pMBlk->b_cont->b_wptr < pMBlk->b_cont->b_rptr + cbMsg) 420 return EINVAL; 421 pMBlk->b_flag = 1; /* Test for this to be sure miocpullup was called. */ 422 return 0; 423 } 424 411 425 /* API stubs with controllable logic */ 412 426
Note:
See TracChangeset
for help on using the changeset viewer.