mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-19 17:53:28 +00:00
1. added 'slaveKvmLog' flag to msh, to enable Linux Child KVM logging
2. added support for child process core dumps in Linux (Note: core location must be writable by the process)
This commit is contained in:
@@ -29,12 +29,17 @@ limitations under the License.
|
||||
#include <X11/keysym.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#if !defined(_FREEBSD)
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
#include "linux_events.h"
|
||||
#include "linux_compression.h"
|
||||
|
||||
#define EXIT_SUCCESS 0
|
||||
#define EXIT_FAILURE 1
|
||||
extern uint32_t crc32c(uint32_t crc, const unsigned char* buf, uint32_t len);
|
||||
extern char* g_ILibCrashDump_path;
|
||||
|
||||
typedef enum KVM_MouseCursors
|
||||
{
|
||||
@@ -617,7 +622,6 @@ void* kvm_server_mainloop(void* parm)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_messageQ = ILibQueue_Create();
|
||||
|
||||
// Init the kvm
|
||||
@@ -1010,6 +1014,19 @@ void* kvm_relay_restart(int paused, void *processPipeMgr, ILibKVM_WriteHandler w
|
||||
if (SLAVELOG != 0) { logFile = fopen("/tmp/slave", "w"); }
|
||||
if (uid != 0) { ignore_result(setuid(uid)); }
|
||||
|
||||
if (g_ILibCrashDump_path != NULL)
|
||||
{
|
||||
#if !defined(_FREEBSD)
|
||||
prctl(PR_SET_DUMPABLE, 1);
|
||||
if (logFile) { fprintf(logFile, "SLAVE/KVM DUMPABLE: %s\n", prctl(PR_GET_DUMPABLE, 0)?"YES":"NO"); fflush(logFile); }
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logFile) { fprintf(logFile, "SLAVE/KVM CoreDumps DISABLED\n"); fflush(logFile); }
|
||||
}
|
||||
|
||||
|
||||
//fprintf(logFile, "Starting kvm_server_mainloop\n");
|
||||
if (authToken != NULL) { setenv("XAUTHORITY", authToken, 1); }
|
||||
if (dispid != NULL) { setenv("DISPLAY", dispid, 1); }
|
||||
|
||||
@@ -3390,6 +3390,10 @@ void MeshServer_Connect(MeshAgentHostContainer *agent)
|
||||
agent->fakeUpdate = ILibSimpleDataStore_Get(agent->masterDb, "fakeUpdate", NULL, 0);
|
||||
agent->controlChannelDebug = ILibSimpleDataStore_Get(agent->masterDb, "controlChannelDebug", NULL, 0);
|
||||
|
||||
#if defined(_LINKVM) && defined(_POSIX) && !defined(__APPLE__)
|
||||
SLAVELOG = ILibSimpleDataStore_Get(agent->masterDb, "slaveKvmLog", NULL, 0);
|
||||
#endif
|
||||
|
||||
if (agent->logUpdate != 0) { ILIBLOGMESSAGEX("PLATFORM_TYPE: %d\n", agent->platformType); }
|
||||
if (agent->logUpdate != 0) { ILIBLOGMESSAGEX("Running as Service: %d\n", agent->JSRunningAsService); }
|
||||
|
||||
|
||||
@@ -258,6 +258,7 @@ forceUpdate: If set, will cause the agent to perform a self-update on next st
|
||||
ignoreProxyFile: If set, will cause the agent to ignore any proxy settings
|
||||
logUpdate: If set, will cause the agent to log self-update status
|
||||
jsDebugPort: Specify a JS Debugger Port
|
||||
slaveKvmLog: [Linux] If set, will enable logging inside the Child KVM Process.
|
||||
WebProxy: Manually specify proxy configuration
|
||||
webSocketMaskOverride: If set, will disable the optimzation to skip WebSocket Masking for TLS protected Web Sockets
|
||||
*
|
||||
|
||||
@@ -35,6 +35,10 @@ limitations under the License.
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX) && !defined(__APPLE__) && !defined(_FREEBSD)
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
#include "duktape.h"
|
||||
|
||||
#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(_MINCORE)
|
||||
@@ -1021,6 +1025,9 @@ duk_ret_t ILibDuktape_ScriptContainer_Process_coreDumpLocation_setter(duk_contex
|
||||
duk_put_prop_string(ctx, -2, ILibDuktape_ScriptContainer_Process_CoreDumpPath); // [process]
|
||||
duk_pop(ctx); // ...
|
||||
#ifndef WIN32
|
||||
#if defined(_POSIX) && !defined(__APPLE__) && !defined(_FREEBSD)
|
||||
prctl(PR_SET_DUMPABLE, 1);
|
||||
#endif
|
||||
duk_eval_string_noresult(ctx, "process.rlimit.set(process.RLIMITS.CORE, {soft: -1, hard: -1});");
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user