Changeset 6231 in vbox
- Timestamp:
- Jan 3, 2008 3:28:30 PM (17 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3Lib.cpp
r6118 r6231 97 97 g_File = hf; 98 98 99 #elif defined(RT_OS_SOLARIS) 99 #elif defined(RT_OS_SOLARIS) || defined(RT_OS_LINUX) 100 100 RTFILE File; 101 101 int rc = RTFileOpen(&File, VBOXGUEST_DEVICE_NAME, RTFILE_O_READWRITE); … … 105 105 106 106 #else 107 # error port me /** @note isn't it nicer to put a todo error here than to 108 put in a flag which will assert where no-one sees it? */ 107 109 /* the default implemenation. */ 108 110 RTFILE File; … … 242 244 return vbglR3DoIOCtl(VBOXGUEST_IOCTL_WAITEVENT_INTERRUPT_ALL, 0, 0); 243 245 } 246 247 /** 248 * Write to the backdoor logger from ring 3 guest code. 249 * @note this currently does not accept more than 255 bytes of data at 250 * one time. It should probably be rewritten to use pass a pointer 251 * in the IOCtl. 252 * 253 * @returns IPRT status code 254 */ 255 VBGLR3DECL(int) VbglR3WriteLog(const char *pch, size_t cb) 256 { 257 int rc = VINF_SUCCESS; 258 259 /* Solaris does not accept more than 255 bytes of data. */ 260 #define STEP 128 261 for (size_t iOffs = 0; (iOffs < cb) && (RT_SUCCESS(rc)); iOffs += STEP) 262 { 263 rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_LOG(cb), (void *) (pch + iOffs), 264 iOffs + STEP < cb ? STEP : cb - iOffs); 265 } 266 #undef STEP 267 return rc; 268 } -
trunk/src/VBox/Additions/linux/module/vboxmod.c
r6042 r6231 362 362 int rc = 0; 363 363 364 switch (cmd) { 365 case IOCTL_VBOXGUEST_WAITEVENT: 366 rc = vboxadd_wait_event((void *) arg); 367 break; 368 369 case VBOXGUEST_IOCTL_WAITEVENT_INTERRUPT_ALL: 370 ++vboxDev->u32GuestInterruptions; 371 break; 372 373 case IOCTL_VBOXGUEST_VMMREQUEST: { 364 /* Deal with variable size ioctls first. */ 365 if (VBOXGUEST_IOCTL_NUMBER(VBOXGUEST_IOCTL_LOG(0)) == VBOXGUEST_IOCTL_NUMBER(cmd)) { 366 char *pszMessage = kmalloc(VBOXGUEST_IOCTL_SIZE(cmd), GFP_KERNEL); 367 if (NULL == pszMessage) { 368 LogRelFunc(("VBOXGUEST_IOCTL_LOG: cannot allocate %d bytes of memory!\n", 369 VBOXGUEST_IOCTL_SIZE(cmd))); 370 rc = -ENOMEM; 371 } 372 if ( (0 == rc) 373 && copy_from_user(pszMessage, (void*)arg, VBOXGUEST_IOCTL_SIZE(cmd))) { 374 LogRelFunc(("VBOXGUEST_IOCTL_LOG: copy_from_user failed!\n")); 375 rc = -EFAULT; 376 } 377 if (0 == rc) { 378 Log(("%.*s", VBOXGUEST_IOCTL_SIZE(cmd), pszMessage)); 379 } 380 if (NULL != pszMessage) { 381 kfree(pszMessage); 382 } 383 return rc; 384 } 385 386 if ( VBOXGUEST_IOCTL_NUMBER(VBOXGUEST_IOCTL_VMMREQUEST(0)) 387 == VBOXGUEST_IOCTL_NUMBER(cmd)) { 374 388 VMMDevRequestHeader reqHeader; 375 389 VMMDevRequestHeader *reqFull = NULL; … … 446 460 } 447 461 VbglGRFree(reqFull); 448 break; 449 } 462 return rc; 463 } 464 465 switch (cmd) { 466 case IOCTL_VBOXGUEST_WAITEVENT: 467 rc = vboxadd_wait_event((void *) arg); 468 break; 469 470 case VBOXGUEST_IOCTL_WAITEVENT_INTERRUPT_ALL: 471 ++vboxDev->u32GuestInterruptions; 472 break; 450 473 451 474 case IOCTL_VBOXGUEST_HGCM_CALL: -
trunk/src/VBox/Runtime/Makefile.kmk
r6147 r6231 540 540 endif 541 541 RuntimeLnx32GuestR3_SOURCES = $(RuntimeR3_SOURCES.linux) $(RuntimeR3_SOURCES) 542 RuntimeLnx32GuestR3_SOURCES += VBox/logbackdoor.cpp 542 543 RuntimeLnx32GuestR3_INCS = $(RuntimeR3_INCS.linux) $(RuntimeR3_INCS) 543 544 -
trunk/src/VBox/Runtime/VBox/logbackdoor.cpp
r5999 r6231 68 68 } 69 69 70 #ifdef IN_GUEST_R0 70 71 71 72 RTDECL(void) RTLogWriteUser(const char *pch, size_t cb) … … 86 87 } 87 88 89 #elif defined(RT_OS_LINUX) && defined(IN_GUEST_R3) 90 91 #include <VBox/VBoxGuest.h> 92 93 RTDECL(void) RTLogWriteUser(const char *pch, size_t cb) 94 { 95 VbglR3WriteLog(pch, cb); 96 } 97 98 #else 99 # error Port me! 100 #endif 88 101 89 102 #if defined(RT_OS_LINUX) && defined(IN_MODULE)
Note:
See TracChangeset
for help on using the changeset viewer.