summaryrefslogtreecommitdiff
path: root/src/VBox/HostDrivers/Support/darwin/SUPLib-darwin.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2014-03-26 19:21:20 +0000
committer <>2014-05-08 15:03:54 +0000
commitfb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch)
treec2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/HostDrivers/Support/darwin/SUPLib-darwin.cpp
parent58ed4748338f9466599adfc8a9171280ed99e23f (diff)
downloadVirtualBox-master.tar.gz
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/HostDrivers/Support/darwin/SUPLib-darwin.cpp')
-rw-r--r--src/VBox/HostDrivers/Support/darwin/SUPLib-darwin.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/VBox/HostDrivers/Support/darwin/SUPLib-darwin.cpp b/src/VBox/HostDrivers/Support/darwin/SUPLib-darwin.cpp
index 5d5b03d3..69567b8a 100644
--- a/src/VBox/HostDrivers/Support/darwin/SUPLib-darwin.cpp
+++ b/src/VBox/HostDrivers/Support/darwin/SUPLib-darwin.cpp
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -61,8 +61,10 @@
/*******************************************************************************
* Defined Constants And Macros *
*******************************************************************************/
-/** BSD Device name. */
-#define DEVICE_NAME "/dev/vboxdrv"
+/** System device name. */
+#define DEVICE_NAME_SYS "/dev/vboxdrv"
+/** User device name. */
+#define DEVICE_NAME_USR "/dev/vboxdrvu"
/** The IOClass key of the service (see SUPDrv-darwin.cpp / Info.plist). */
#define IOCLASS_NAME "org_virtualbox_SupDrv"
@@ -73,14 +75,14 @@
*
* @returns VBox status code.
*/
-static int suplibDarwinOpenDevice(PSUPLIBDATA pThis)
+static int suplibDarwinOpenDevice(PSUPLIBDATA pThis, bool fUnrestricted)
{
/*
* Open the BSD device.
* This will connect to the session created when the SupDrvClient was
* started, so it has to be done after opening the service (IOC v9.1+).
*/
- int hDevice = open(DEVICE_NAME, O_RDWR, 0);
+ int hDevice = open(fUnrestricted ? DEVICE_NAME_SYS : DEVICE_NAME_USR, O_RDWR, 0);
if (hDevice < 0)
{
int rc;
@@ -92,7 +94,7 @@ static int suplibDarwinOpenDevice(PSUPLIBDATA pThis)
case ENOENT: rc = VERR_VM_DRIVER_NOT_INSTALLED; break;
default: rc = VERR_VM_DRIVER_OPEN_ERROR; break;
}
- LogRel(("SUP: Failed to open \"%s\", errno=%d, rc=%Rrc\n", DEVICE_NAME, errno, rc));
+ LogRel(("SUP: Failed to open \"%s\", errno=%d, rc=%Rrc\n", fUnrestricted ? DEVICE_NAME_SYS : DEVICE_NAME_USR, errno, rc));
return rc;
}
@@ -112,7 +114,8 @@ static int suplibDarwinOpenDevice(PSUPLIBDATA pThis)
return rc;
}
- pThis->hDevice = hDevice;
+ pThis->hDevice = hDevice;
+ pThis->fUnrestricted = fUnrestricted;
return VINF_SUCCESS;
}
@@ -182,7 +185,7 @@ static int suplibDarwinOpenService(PSUPLIBDATA pThis)
}
-int suplibOsInit(PSUPLIBDATA pThis, bool fPreInited)
+int suplibOsInit(PSUPLIBDATA pThis, bool fPreInited, bool fUnrestricted)
{
/*
* Nothing to do if pre-inited.
@@ -197,7 +200,7 @@ int suplibOsInit(PSUPLIBDATA pThis, bool fPreInited)
int rc = suplibDarwinOpenService(pThis);
if (RT_SUCCESS(rc))
{
- rc = suplibDarwinOpenDevice(pThis);
+ rc = suplibDarwinOpenDevice(pThis, fUnrestricted);
if (RT_FAILURE(rc))
{
kern_return_t kr = IOServiceClose((io_connect_t)pThis->uConnection);