VirtualBox

Changeset 10901 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jul 26, 2008 2:43:29 AM (17 years ago)
Author:
vboxsync
Message:

main: Console::attachToHostInterface and Console::detachFromHostInterface only have meaning on Linux these days.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r10842 r10901  
    53285328HRESULT Console::attachToHostInterface(INetworkAdapter *networkAdapter)
    53295329{
     5330#if !defined(RT_OS_LINUX)
     5331    /*
     5332     * Nothing to do here.
     5333     *
     5334     * Note, the reason for this method in the first place a memory / fork
     5335     * bug on linux. All this code belongs in DrvTAP and similar places.
     5336     */
     5337    NOREF(networkAdapter);
     5338    return S_OK;
     5339
     5340#else /* RT_OS_LINUX */
    53305341    LogFlowThisFunc(("\n"));
    53315342    /* sanity check */
    53325343    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
    53335344
    5334 #ifdef DEBUG
     5345# ifdef VBOX_STRICT
    53355346    /* paranoia */
    53365347    NetworkAttachmentType_T attachment;
    53375348    networkAdapter->COMGETTER(AttachmentType)(&attachment);
    53385349    Assert(attachment == NetworkAttachmentType_HostInterface);
    5339 #endif /* DEBUG */
     5350# endif /* VBOX_STRICT */
    53405351
    53415352    HRESULT rc = S_OK;
    53425353
    5343 #ifdef VBOX_WITH_UNIXY_TAP_NETWORKING
    53445354    ULONG slot = 0;
    53455355    rc = networkAdapter->COMGETTER(Slot)(&slot);
     
    53675377    }
    53685378    else
    5369 #endif /* VBOX_WITH_UNIXY_TAP_NETWORKING */
    53705379    {
    53715380        /*
    53725381         * Allocate a host interface device
    53735382         */
    5374 #ifdef RT_OS_WINDOWS
    5375         /* nothing to do */
    5376         int rcVBox = VINF_SUCCESS;
    5377 #elif defined(RT_OS_LINUX)
    53785383        int rcVBox = RTFileOpen(&maTapFD[slot], "/dev/net/tun",
    53795384                                RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_INHERIT);
     
    54885493            }
    54895494        }
    5490 #elif defined(RT_OS_DARWIN)
    5491         /** @todo Implement tap networking for Darwin. */
    5492         int rcVBox = VERR_NOT_IMPLEMENTED;
    5493 #elif defined(RT_OS_FREEBSD)
    5494         /** @todo Implement tap networking for FreeBSD. */
    5495         int rcVBox = VERR_NOT_IMPLEMENTED;
    5496 #elif defined(RT_OS_OS2)
    5497         /** @todo Implement tap networking for OS/2. */
    5498         int rcVBox = VERR_NOT_IMPLEMENTED;
    5499 #elif defined(RT_OS_SOLARIS)
    5500         /* nothing to do */
    5501         int rcVBox = VINF_SUCCESS;
    5502 #elif defined(VBOX_WITH_UNIXY_TAP_NETWORKING)
    5503 # error "PORTME: Implement OS specific TAP interface open/creation."
    5504 #else
    5505 # error "Unknown host OS"
    5506 #endif
    55075495        /* in case of failure, cleanup. */
    55085496        if (VBOX_FAILURE(rcVBox) && SUCCEEDED(rc))
     
    55145502    LogFlowThisFunc(("rc=%d\n", rc));
    55155503    return rc;
     5504#endif /* RT_OS_LINUX */
    55165505}
    55175506
     
    55265515HRESULT Console::detachFromHostInterface(INetworkAdapter *networkAdapter)
    55275516{
     5517#if !defined(RT_OS_LINUX) && !defined(RT_OS_SOLARIS)
     5518    /*
     5519     * Nothing to do here.
     5520     */
     5521    NOREF(networkAdapter);
     5522    return S_OK;
     5523
     5524#else /* RT_LINUX || RT_OS_SOLARIS */
     5525
    55285526    /* sanity check */
    55295527    LogFlowThisFunc(("\n"));
     
    55315529
    55325530    HRESULT rc = S_OK;
    5533 #ifdef DEBUG
     5531# ifdef VBOX_STRICT
    55345532    /* paranoia */
    55355533    NetworkAttachmentType_T attachment;
    55365534    networkAdapter->COMGETTER(AttachmentType)(&attachment);
    55375535    Assert(attachment == NetworkAttachmentType_HostInterface);
    5538 #endif /* DEBUG */
    5539 
    5540 #ifdef VBOX_WITH_UNIXY_TAP_NETWORKING
     5536# endif /* VBOX_STRICT */
     5537
     5538/** @todo # ifdef VBOX_WITH_UNIXY_TAP_NETWORKING: why wasn't this !defined(RT_OS_SOLARIS)? */
    55415539
    55425540    ULONG slot = 0;
     
    55765574            RTStrPrintf(szCommand, sizeof(szCommand), "%s %d %s", tapTermAppUtf8.raw(),
    55775575                        isStatic ? maTapFD[slot] : 0, maTAPDeviceName[slot].raw());
     5576            /** @todo check for overflow or use RTStrAPrintf! */
    55785577
    55795578            /*
     
    56105609        maTAPDeviceName[slot] = "";
    56115610    }
    5612 #endif
    56135611    LogFlowThisFunc(("returning %d\n", rc));
    56145612    return rc;
     5613#endif /* RT_OS_LINUX || RT_OS_SOLARIS */
    56155614}
    56165615
Note: See TracChangeset for help on using the changeset viewer.

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