VirtualBox

source: vbox/trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMisc.cpp@ 6531

Last change on this file since 6531 was 6531, checked in by vboxsync, 17 years ago

Guest Additions (R3 library): fixed todo from r27515

  • Property svn:eol-style set to native
  • Property svn:keyword set to Id
  • Property svn:keywords set to Id
File size: 2.4 KB
Line 
1/* $Id: VBoxGuestR3LibMisc.cpp 6531 2008-01-28 16:40:23Z vboxsync $ */
2/** @file
3 * VBoxGuestR3Lib - Ring-3 Support Library for VirtualBox guest additions, Misc.
4 */
5
6/*
7 * Copyright (C) 2007 innotek GmbH
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18
19/*******************************************************************************
20* Header Files *
21*******************************************************************************/
22#include <iprt/assert.h>
23#include "VBGLR3Internal.h"
24
25
26/**
27 * Cause any pending WaitEvent calls (VBOXGUEST_IOCTL_WAITEVENT) to return
28 * with a VERR_INTERRUPTED status.
29 *
30 * Can be used in combination with a termination flag variable for interrupting
31 * event loops. Avoiding race conditions is the responsibility of the caller.
32 *
33 * @returns IPRT status code
34 */
35VBGLR3DECL(int) VbglR3InterruptEventWaits(void)
36{
37 return vbglR3DoIOCtl(VBOXGUEST_IOCTL_CANCEL_ALL_WAITEVENTS, 0, 0);
38}
39
40
41/**
42 * Write to the backdoor logger from ring 3 guest code.
43 *
44 * @returns IPRT status code
45 *
46 * @remarks This currently does not accept more than 255 bytes of data at
47 * one time. It should probably be rewritten to use pass a pointer
48 * in the IOCtl.
49 */
50VBGLR3DECL(int) VbglR3WriteLog(const char *pch, size_t cb)
51{
52 /*
53 * *BSD does not accept more than 4KB per ioctl request,
54 * so, split it up into 2KB chunks.
55 */
56#define STEP 2048
57 int rc = VINF_SUCCESS;
58 for (size_t off = 0; off < cb && RT_SUCCESS(rc); off += STEP)
59 {
60 size_t cbStep = RT_MIN(cb - off, STEP);
61 rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_LOG(cbStep), (char *)pch + off, cbStep);
62 }
63#undef STEP
64 return rc;
65}
66
67
68/**
69 * Change the IRQ filter mask.
70 *
71 * @returns IPRT status code
72 * @param fOr The OR mask.
73 * @param fNo The NOT mask.
74 */
75VBGLR3DECL(int) VbglR3CtlFilterMask(uint32_t fOr, uint32_t fNot)
76{
77 VBoxGuestFilterMaskInfo Info;
78 Info.u32OrMask = fOr;
79 Info.u32NotMask = fNot;
80 return vbglR3DoIOCtl(VBOXGUEST_IOCTL_CTL_FILTER_MASK, &Info, sizeof(Info));
81}
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette