SUPLib-solaris.cpp revision 2456bf2fd0d999aec48bbfeeb60de9005aaf2f6e
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * VirtualBox Support Library - Solaris specific parts.
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * available from http://www.virtualbox.org. This file is free software;
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * you can redistribute it and/or modify it under the terms of the GNU
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * General Public License (GPL) as published by the Free Software
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * The contents of this file may alternatively be used under the terms
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * of the Common Development and Distribution License Version 1.0
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * VirtualBox OSE distribution, in which case the provisions of the
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * CDDL are applicable instead of those of the GPL.
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * You may elect to license modified versions of this file under the
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * terms and conditions of either the GPL or the CDDL or both.
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * additional information or have any questions.
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync/*******************************************************************************
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync* Header Files *
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync*******************************************************************************/
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync /** @todo RTLOGREL_DISABLED */
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync# define LogRelIt(pvInst, fFlags, iGroup, fmtargs) do { } while (0)
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync/*******************************************************************************
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync* Defined Constants And Macros *
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync*******************************************************************************/
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync/** Solaris device link. */
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsyncint suplibOsInit(PSUPLIBDATA pThis, bool fPreInited)
2a0a20dee7f474c26cc8f6f9d7aa12c345c2b73bvboxsync * Nothing to do if pre-inited.
2a0a20dee7f474c26cc8f6f9d7aa12c345c2b73bvboxsync * Open dummy files to preallocate file descriptors, see #4650.
2a0a20dee7f474c26cc8f6f9d7aa12c345c2b73bvboxsync for (int i = 0; i < VBOXFLT_DUMMYFILES; i++)
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync LogRel(("Failed to open[%d] /dev/null! errno=%d\n", i, errno));
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * Try to open the device.
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync case ENODEV: rc = VERR_VM_DRIVER_LOAD_ERROR; break;
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync case EACCES: rc = VERR_VM_DRIVER_NOT_ACCESSIBLE; break;
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync case ENOENT: rc = VERR_VM_DRIVER_NOT_INSTALLED; break;
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync LogRel(("Failed to open \"%s\", errno=%d, rc=%Rrc\n", DEVICE_NAME, errno, rc));
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * Mark the file handle close on exec.
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync LogRel(("suplibOSInit: setting FD_CLOEXEC failed, errno=%d (%Rrc)\n", err, rc));
2a0a20dee7f474c26cc8f6f9d7aa12c345c2b73bvboxsync * Close the dummy files first.
2a0a20dee7f474c26cc8f6f9d7aa12c345c2b73bvboxsync for (int i = 0; i < VBOXFLT_DUMMYFILES; i++)
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync * Check if we're initialized
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsyncint suplibOsIOCtl(PSUPLIBDATA pThis, uintptr_t uFunction, void *pvReq, size_t cbReq)
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync if (RT_LIKELY(ioctl(pThis->hDevice, uFunction, pvReq) >= 0))
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsyncint suplibOsIOCtlFast(PSUPLIBDATA pThis, uintptr_t uFunction, uintptr_t idCpu)
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsyncint suplibOsPageAlloc(PSUPLIBDATA pThis, size_t cPages, void **ppvPages)
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync *ppvPages = mmap(NULL, cPages * PAGE_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE,
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsyncint suplibOsPageFree(PSUPLIBDATA pThis, void *pvPages, size_t cPages)
e52b0dfe3d9ead70e24f2ce4ed3faa6c79c00618vboxsync#endif /* !IN_SUP_HARDENED_R3 */