1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-10 13:23:41 +00:00

KVM Fixes

1. Added changes to support MacOS
2. Updated Linux KVM, so X11 is dynamically loaded at runtime
This commit is contained in:
Bryan Roe
2019-01-11 11:15:22 -08:00
parent 5bbdbf2e48
commit 83c1435512
7 changed files with 198 additions and 122 deletions

View File

@@ -85,10 +85,22 @@ __declspec(dllexport) int mainEx(int argc, char **argv, ExternalDispatch ptr)
while (MeshAgent_Start(agentHost, argc, argv) != 0);
retCode = agentHost->exitCode;
MeshAgent_Destroy(agentHost);
agentHost = NULL;
return(retCode);
}
#endif
#if defined(_LINKVM) && defined(__APPLE__)
extern void* kvm_server_mainloop(void *parm);
extern void senddebug(int val);
ILibTransport_DoneState kvm_serviceWriteSink(char *buffer, int bufferLen, void *reserved)
{
int len;
ignore_result(write(STDOUT_FILENO, (void*)buffer, bufferLen));
return ILibTransport_DoneState_COMPLETE;
}
#endif
int main(int argc, char **argv)
{
// Check if .JS file is integrated with executable
@@ -106,6 +118,27 @@ char* crashMemory = ILib_POSIX_InstallCrashHandler(argv[0]);
ILibDuktape_ScriptContainer_CheckEmbedded(&integratedJavaScript, &integratedJavaScriptLen);
if (argc > 1 && strcasecmp(argv[1], "-info") == 0)
{
printf("Compiled on: %s, %s\n", __TIME__, __DATE__);
printf("Using %s\n", SSLeay_version(SSLEAY_VERSION));
return(0);
}
#if defined(_LINKVM) && defined(__APPLE__)
if (argc > 1 && strcasecmp(argv[1], "-kvm0") == 0)
{
kvm_server_mainloop(NULL);
return 0;
}
else if (argc > 1 && strcasecmp(argv[1], "-kvm1") == 0)
{
kvm_server_mainloop((void*)(uint64_t)getpid());
return 0;
}
#endif
if (argc > 2 && strcasecmp(argv[1], "-faddr") == 0)
{
#if !defined(WIN32)
@@ -180,6 +213,7 @@ char* crashMemory = ILib_POSIX_InstallCrashHandler(argv[0]);
while (MeshAgent_Start(agentHost, argc, argv) != 0);
retCode = agentHost->exitCode;
MeshAgent_Destroy(agentHost);
agentHost = NULL;
}
__except (ILib_WindowsExceptionFilter(GetExceptionCode(), GetExceptionInformation(), &winExceptionContext))
{
@@ -193,6 +227,7 @@ char* crashMemory = ILib_POSIX_InstallCrashHandler(argv[0]);
while (MeshAgent_Start(agentHost, argc, argv) != 0);
retCode = agentHost->exitCode;
MeshAgent_Destroy(agentHost);
agentHost = NULL;
#ifndef _NOILIBSTACKDEBUG
if (crashMemory != NULL) { free(crashMemory); }
#endif