VirtualBox

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


Ignore:
Timestamp:
Jan 3, 2008 3:28:30 PM (17 years ago)
Author:
vboxsync
Message:

Guest Additions: add R3 backdoor logging for Linux guests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3Lib.cpp

    r6118 r6231  
    9797    g_File = hf;
    9898
    99 #elif defined(RT_OS_SOLARIS)
     99#elif defined(RT_OS_SOLARIS) || defined(RT_OS_LINUX)
    100100    RTFILE File;
    101101    int rc = RTFileOpen(&File, VBOXGUEST_DEVICE_NAME, RTFILE_O_READWRITE);
     
    105105
    106106#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? */
    107109    /* the default implemenation. */
    108110    RTFILE File;
     
    242244    return vbglR3DoIOCtl(VBOXGUEST_IOCTL_WAITEVENT_INTERRUPT_ALL, 0, 0);
    243245}
     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 */
     255VBGLR3DECL(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}
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