Created
March 6, 2014 21:11
-
-
Save Amanieu/9399706 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/common/IPC.h b/src/common/IPC.h | |
index f2af815..0706646 100644 | |
--- a/src/common/IPC.h | |
+++ b/src/common/IPC.h | |
@@ -119,6 +119,13 @@ public: | |
void Close(); | |
+ OSHandleType ReleaseHandle() | |
+ { | |
+ OSHandleType out = handle; | |
+ handle = INVALID_HANDLE; | |
+ return out; | |
+ } | |
+ | |
Desc GetDesc() const; | |
static Socket FromDesc(const Desc& desc); | |
static Socket FromHandle(OSHandleType handle); | |
diff --git a/src/engine/framework/VirtualMachine.cpp b/src/engine/framework/VirtualMachine.cpp | |
index 229e5de..437763a 100644 | |
--- a/src/engine/framework/VirtualMachine.cpp | |
+++ b/src/engine/framework/VirtualMachine.cpp | |
@@ -226,7 +226,7 @@ static std::pair<IPC::OSHandleType, IPC::Socket> InternalLoadModule(std::pair<IP | |
int VMBase::Create(Str::StringRef name, vmType_t type) | |
{ | |
- if (type != TYPE_NACL && type != TYPE_NATIVE && type != TYPE_NATIVE_DEBUG && type != TYPE_NACL_DEBUG) | |
+ if (type != TYPE_NACL && type != TYPE_NATIVE && type != TYPE_NATIVE_DEBUG && type != TYPE_NACL_DEBUG && type != TYPE_SHAREDLIB) | |
Com_Error(ERR_DROP, "VM: Invalid type %d", type); | |
// Free the VM if it exists | |
@@ -281,7 +281,7 @@ int VMBase::Create(Str::StringRef name, vmType_t type) | |
args.push_back(rootSocketRedir); | |
args.push_back("--"); | |
args.push_back(module.c_str()); | |
- } else { | |
+ } else if (type == TYPE_NATIVE || type == TYPE_NATIVE_DEBUG) { | |
module = FS::Path::Build(libPath, name + "-nacl-native" + EXE_EXT); | |
if (type == TYPE_NATIVE_DEBUG) { | |
args.push_back("/usr/bin/gdbserver"); | |
diff --git a/src/engine/framework/VirtualMachine.h b/src/engine/framework/VirtualMachine.h | |
index d18ec21..3c35530 100644 | |
--- a/src/engine/framework/VirtualMachine.h | |
+++ b/src/engine/framework/VirtualMachine.h | |
@@ -40,14 +40,15 @@ enum vmType_t { | |
TYPE_NATIVE, | |
TYPE_NACL, | |
TYPE_NATIVE_DEBUG, | |
- TYPE_NACL_DEBUG | |
+ TYPE_NACL_DEBUG, | |
+ TYPE_SHAREDLIB | |
}; | |
// Base class for a virtual machine instance | |
class VMBase { | |
public: | |
VMBase() | |
- : processHandle(IPC::INVALID_HANDLE) {} | |
+ : handle(NULL) {} | |
// Create the VM for the named module. Returns the ABI version reported | |
// by the module. | |
@@ -59,7 +60,7 @@ public: | |
// Check if the VM is active | |
bool IsActive() const | |
{ | |
- return processHandle != IPC::INVALID_HANDLE; | |
+ return handle != nullptr; | |
} | |
// Make sure the VM is closed on exit | |
@@ -81,7 +82,7 @@ protected: | |
virtual void Syscall(uint32_t id, IPC::Reader reader, const IPC::Socket& socket) const = 0; | |
private: | |
- IPC::OSHandleType processHandle; | |
+ void* handle; | |
IPC::Socket rootSocket; | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment