VirtualBox

Changeset 44181 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 19, 2012 7:10:10 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
82891
Message:

SUPDrv-solaris.c: /dev/vboxdrvu (untested).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c

    r44173 r44181  
    7272*   Defined Constants And Macros                                               *
    7373*******************************************************************************/
    74 /** The module name. */
    75 #define DEVICE_NAME              "vboxdrv"
     74/** The system device name. */
     75#define DEVICE_NAME_SYS          "vboxdrv"
     76/** The user device name. */
     77#define DEVICE_NAME_USR          "vboxdrvu"
    7678/** The module description as seen in 'modinfo'. */
    7779#define DEVICE_DESC              "VirtualBox HostDrv"
     
    344346             */
    345347#ifdef VBOX_WITH_HARDENING
    346             rc = ddi_create_priv_minor_node(pDip, DEVICE_NAME, S_IFCHR, instance, DDI_PSEUDO,
     348            rc = ddi_create_priv_minor_node(pDip, DEVICE_NAME_SYS, S_IFCHR, 0 /*minor*/, DDI_PSEUDO,
    347349                                            0, NULL, NULL, 0600);
    348350#else
    349             rc = ddi_create_priv_minor_node(pDip, DEVICE_NAME, S_IFCHR, instance, DDI_PSEUDO,
     351            rc = ddi_create_priv_minor_node(pDip, DEVICE_NAME_SYS, S_IFCHR, 0 /*minor*/, DDI_PSEUDO,
    350352                                            0, "none", "none", 0666);
    351353#endif
    352354            if (rc == DDI_SUCCESS)
    353355            {
     356                rc = ddi_create_priv_minor_node(pDip, DEVICE_NAME_USR, S_IFCHR, 1 /*minor*/, DDI_PSEUDO,
     357                                                0, "none", "none", 0666);
     358                if (rc == DDI_SUCCESS)
     359                {
    354360#ifdef USE_SESSION_HASH
    355                 pState->pDip = pDip;
     361                    pState->pDip = pDip;
    356362#endif
    357                 ddi_report_dev(pDip);
    358                 return DDI_SUCCESS;
     363                    ddi_report_dev(pDip);
     364                    return DDI_SUCCESS;
     365                }
     366                ddi_remove_minor_node(pDip, NULL);
    359367            }
    360368
     
    434442
    435443/**
    436  * User context entry points
     444 * open() worker.
    437445 */
    438446static int VBoxDrvSolarisOpen(dev_t *pDev, int fFlag, int fType, cred_t *pCred)
    439447{
     448    const bool          fUnrestricted = getminor(*devp) == 0;
     449    PSUPDRVSESSION      pSession;
    440450    int                 rc;
    441     PSUPDRVSESSION      pSession;
     451
    442452    LogFlowFunc(("VBoxDrvSolarisOpen: pDev=%p:%#x\n", pDev, *pDev));
     453
     454    /*
     455     * Validate input
     456     */
     457    if (   (getminor(*devp) != 0 && getminor(*devp) != 1)
     458        || fType != OTYP_CHR)
     459        return EINVAL; /* See mmopen for precedent. */
    443460
    444461#ifndef USE_SESSION_HASH
     
    469486     * Create a new session.
    470487     */
    471     rc = supdrvCreateSession(&g_DevExt, true /* fUser */, true /*fUnrestricted*/, &pSession);
     488    rc = supdrvCreateSession(&g_DevExt, true /* fUser */, fUnrestricted, &pSession);
    472489    if (RT_SUCCESS(rc))
    473490    {
     
    491508     * in VBoxDrvSolarisIOCtlSlow() while calling supdrvIOCtl()
    492509     */
    493     rc = supdrvCreateSession(&g_DevExt, true /* fUser */, true /*fUnrestricted*/, &pSession);
     510    rc = supdrvCreateSession(&g_DevExt, true /* fUser */, fUnrestricted, &pSession);
    494511    if (RT_SUCCESS(rc))
    495512    {
     
    502519         * Insert it into the hash table.
    503520         */
     521# error "Only one entry per process!"
    504522        iHash = SESSION_HASH(pSession->Process);
    505523        RTSpinlockAcquire(g_Spinlock);
     
    659677    const unsigned      iHash = SESSION_HASH(Process);
    660678    PSUPDRVSESSION      pSession;
     679    const bool          fUnrestricted = getminor(Dev) == 0;
    661680
    662681    /*
     
    665684    RTSpinlockAcquire(g_Spinlock);
    666685    pSession = g_apSessionHashTab[iHash];
    667     if (pSession && pSession->Process != Process)
    668     {
    669         do pSession = pSession->pNextHash;
    670         while (pSession && pSession->Process != Process);
    671     }
     686    while (pSession && pSession->Process != Process && pSession->fUnrestricted == fUnrestricted);
     687        pSession = pSession->pNextHash;
    672688    RTSpinlockReleaseNoInts(g_Spinlock);
    673689    if (!pSession)
    674690    {
    675         LogRel(("VBoxSupDrvIOCtl: WHAT?!? pSession == NULL! This must be a mistake... pid=%d iCmd=%#x\n",
    676                     (int)Process, Cmd));
     691        LogRel(("VBoxSupDrvIOCtl: WHAT?!? pSession == NULL! This must be a mistake... pid=%d iCmd=%#x Dev=%#x\n",
     692                    (int)Process, Cmd, (int)Dev));
    677693        return EINVAL;
    678694    }
     
    683699     * the session and iCmd, and only returns a VBox status code.
    684700     */
    685     if (    Cmd == SUP_IOCTL_FAST_DO_RAW_RUN
    686         ||  Cmd == SUP_IOCTL_FAST_DO_HM_RUN
    687         ||  Cmd == SUP_IOCTL_FAST_DO_NOP)
     701    if (   (   Cmd == SUP_IOCTL_FAST_DO_RAW_RUN
     702            || Cmd == SUP_IOCTL_FAST_DO_HM_RUN
     703            || Cmd == SUP_IOCTL_FAST_DO_NOP)
     704        && pSession->fUnrestricted)
    688705    {
    689706        *pVal = supdrvIOCtlFast(Cmd, pArgs, &g_DevExt, pSession);
Note: See TracChangeset for help on using the changeset viewer.

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