SUPLib-solaris.cpp revision 6efdbcc3d25b1c4533f7a5c323c8b7f4352885a2
/* $Id$ */
/** @file
* VirtualBox Support Library - Solaris specific parts.
*/
/*
* 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;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP LOG_GROUP_SUP
#ifdef IN_SUP_HARDENED_R3
# define LOG_DISABLED
/** @todo RTLOGREL_DISABLED */
#endif
#include "../SUPLibInternal.h"
#include "../SUPDrvIOC.h"
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <zone.h>
/*******************************************************************************
* Defined Constants And Macros *
*******************************************************************************/
/** Solaris device link - system. */
#define DEVICE_NAME_SYS "/devices/pseudo/vboxdrv@0:vboxdrv"
/** Solaris device link - user. */
#define DEVICE_NAME_USR "/devices/pseudo/vboxdrv@0:vboxdrvu"
/** Solaris device link - system (non-global zone). */
#define DEVICE_NAME_SYS_ZONE "/dev/vboxdrv"
/** Solaris device link - user (non-global zone). */
#define DEVICE_NAME_USR_ZONE "/dev/vboxdrvu"
int suplibOsInit(PSUPLIBDATA pThis, bool fPreInited, bool fUnrestricted, SUPINITOP *penmWhat, PRTERRINFO pErrInfo)
{
/*
* Nothing to do if pre-inited.
*/
if (fPreInited)
return VINF_SUCCESS;
/*
* Open dummy files to preallocate file descriptors, see @bugref{4650}.
*/
for (int i = 0; i < SUPLIB_FLT_DUMMYFILES; i++)
{
if (hDummy >= 0)
{
else
{
}
}
else
}
/*
* Try to open the device.
*/
const char *pszDeviceNm;
if (getzoneid() == GLOBAL_ZONEID)
else
if (hDevice < 0)
{
int rc;
switch (errno)
{
case EPERM:
default: rc = VERR_VM_DRIVER_OPEN_ERROR; break;
}
return rc;
}
/*
* Mark the file handle close on exec.
*/
{
#ifdef IN_SUP_HARDENED_R3
int rc = VERR_INTERNAL_ERROR;
#else
#endif
return rc;
}
return VINF_SUCCESS;
}
#ifndef IN_SUP_HARDENED_R3
{
/*
* Close the dummy files first.
*/
for (int i = 0; i < SUPLIB_FLT_DUMMYFILES; i++)
{
{
}
}
/*
* Check if we're initialized
*/
{
AssertFailed();
}
return VINF_SUCCESS;
}
int suplibOsInstall(void)
{
return VERR_NOT_IMPLEMENTED;
}
int suplibOsUninstall(void)
{
return VERR_NOT_IMPLEMENTED;
}
{
return VINF_SUCCESS;
return RTErrConvertFromErrno(errno);
}
{
if (rc == -1)
return rc;
}
{
if (*ppvPages != (void *)-1)
return VINF_SUCCESS;
return VERR_NO_MEMORY;
return RTErrConvertFromErrno(errno);
}
{
return VINF_SUCCESS;
}
#endif /* !IN_SUP_HARDENED_R3 */