From 6f3e9c12fbb59c6123aa8e1d9c492a3dbe2ec6d7 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Fri, 18 Sep 2015 16:15:43 +0200 Subject: [PATCH] vbox: support shutdown of VMM - send exit signal to parent - avoid assertion in vbox posix backend Fixes #1687 --- repos/ports/ports/virtualbox.hash | 2 +- repos/ports/run/vbox_win.inc | 2 +- .../ports/src/virtualbox/frontend/console.cc | 27 ++++++++++++++----- .../ports/src/virtualbox/patches/posix.patch | 11 ++++++++ repos/ports/src/virtualbox/patches/series | 1 + 5 files changed, 35 insertions(+), 8 deletions(-) create mode 100644 repos/ports/src/virtualbox/patches/posix.patch diff --git a/repos/ports/ports/virtualbox.hash b/repos/ports/ports/virtualbox.hash index f22e8de12..c3a0e9566 100644 --- a/repos/ports/ports/virtualbox.hash +++ b/repos/ports/ports/virtualbox.hash @@ -1 +1 @@ -7d0320bac1d65391cd0f548126df7399b8fb7f18 +2fc156a977246088b14dc9acad72ea3013c9e596 diff --git a/repos/ports/run/vbox_win.inc b/repos/ports/run/vbox_win.inc index 479ffec60..51c122885 100644 --- a/repos/ports/run/vbox_win.inc +++ b/repos/ports/run/vbox_win.inc @@ -149,7 +149,7 @@ append config_of_app { } append config_of_app " - " + " append config_of_app { diff --git a/repos/ports/src/virtualbox/frontend/console.cc b/repos/ports/src/virtualbox/frontend/console.cc index a69b4d144..5c1c20be0 100644 --- a/repos/ports/src/virtualbox/frontend/console.cc +++ b/repos/ports/src/virtualbox/frontend/console.cc @@ -24,20 +24,29 @@ HRESULT Console::updateMachineState(MachineState_T aMachineState) HRESULT Console::attachToTapInterface(INetworkAdapter *networkAdapter) { - HRESULT rc = S_OK; - ULONG slot = 0; - rc = networkAdapter->COMGETTER(Slot)(&slot); + HRESULT rc = networkAdapter->COMGETTER(Slot)(&slot); AssertComRC(rc); maTapFD[slot] = (RTFILE)1; - TRACE(S_OK) + TRACE(rc) +} + +HRESULT Console::detachFromTapInterface(INetworkAdapter *networkAdapter) +{ + ULONG slot = 0; + HRESULT rc = networkAdapter->COMGETTER(Slot)(&slot); + AssertComRC(rc); + + if (maTapFD[slot] != NIL_RTFILE) + maTapFD[slot] = NIL_RTFILE; + + TRACE(rc) } HRESULT Console::teleporterTrg(PUVM, IMachine*, com::Utf8Str*, bool, Progress*, bool*) DUMMY(E_FAIL) -HRESULT Console::detachFromTapInterface(INetworkAdapter *networkAdapter) DUMMY(E_FAIL) HRESULT Console::saveState(Reason_T aReason, IProgress **aProgress) DUMMY(E_FAIL) STDMETHODIMP Console::COMGETTER(Debugger)(IMachineDebugger **aDebugger) DUMMY(E_FAIL) @@ -103,7 +112,13 @@ HRESULT Console::onlineMergeMedium(IMediumAttachment *aMediumAttachment, IProgress *aProgress) DUMMY(E_FAIL) void fireStateChangedEvent(IEventSource* aSource, - MachineState_T a_state) TRACE() + MachineState_T a_state) +{ + if (a_state != MachineState_PoweredOff) + return; + + Genode::env()->parent()->exit(0); +} void fireRuntimeErrorEvent(IEventSource* aSource, BOOL a_fatal, CBSTR a_id, CBSTR a_message) diff --git a/repos/ports/src/virtualbox/patches/posix.patch b/repos/ports/src/virtualbox/patches/posix.patch new file mode 100644 index 000000000..7aa24b9a5 --- /dev/null +++ b/repos/ports/src/virtualbox/patches/posix.patch @@ -0,0 +1,11 @@ +--- a/src/app/virtualbox/src/VBox/Runtime/r3/posix/path-posix.cpp ++++ b/src/app/virtualbox/src/VBox/Runtime/r3/posix/path-posix.cpp +@@ -401,8 +401,6 @@ + rc = errno == ENOENT ? VINF_SUCCESS : RTErrConvertFromErrno(errno); + else + { +- Assert(SrcStat.st_dev && DstStat.st_dev); +- Assert(SrcStat.st_ino && DstStat.st_ino); + if ( SrcStat.st_dev == DstStat.st_dev + && SrcStat.st_ino == DstStat.st_ino + && (SrcStat.st_mode & S_IFMT) == (DstStat.st_mode & S_IFMT)) diff --git a/repos/ports/src/virtualbox/patches/series b/repos/ports/src/virtualbox/patches/series index 2508d667a..4eb5ca280 100644 --- a/repos/ports/src/virtualbox/patches/series +++ b/repos/ports/src/virtualbox/patches/series @@ -21,3 +21,4 @@ serial.patch rem_irq.patch usb.patch tm_smp.patch +posix.patch