mirror of
https://github.com/darlinghq/darlingserver.git
synced 2024-11-26 22:00:26 +00:00
[process] Update architecture upon exec
This commit is contained in:
parent
0a58b40d68
commit
b4e67c25a0
@ -56,6 +56,16 @@ namespace DarlingServer {
|
||||
ARM64 = dserver_rpc_architecture_arm64,
|
||||
};
|
||||
|
||||
static constexpr const char* architectureToString(Architecture architecture) {
|
||||
switch (architecture) {
|
||||
case Architecture::i386: return "i386";
|
||||
case Architecture::x86_64: return "x86_64";
|
||||
case Architecture::ARM32: return "ARM32";
|
||||
case Architecture::ARM64: return "ARM64";
|
||||
default: return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
struct MemoryInfo {
|
||||
uint64_t virtualSize;
|
||||
uint64_t residentSize;
|
||||
|
@ -275,7 +275,7 @@ void DarlingServer::Process::notifyCheckin(Architecture architecture) {
|
||||
if (didExec) {
|
||||
// exec case
|
||||
|
||||
processLog.info() << *this << ": replacing process with a new task" << processLog.endLog;
|
||||
processLog.info() << *this << ": replacing process with a new task (with architecture \"" << architectureToString(architecture) << "\")" << processLog.endLog;
|
||||
|
||||
// clear all threads except the main thread
|
||||
std::shared_ptr<Thread> mainThread = nullptr;
|
||||
@ -299,6 +299,9 @@ void DarlingServer::Process::notifyCheckin(Architecture architecture) {
|
||||
}
|
||||
_threads[mainThread->nsid()] = mainThread;
|
||||
|
||||
// update the process architecture
|
||||
_architecture = architecture;
|
||||
|
||||
// replace the old task with a new task that inherits from it
|
||||
auto oldTask = _dtapeTask;
|
||||
auto newTask = dtape_task_create(oldTask, _nspid, this, static_cast<dserver_rpc_architecture_t>(_architecture));
|
||||
|
Loading…
Reference in New Issue
Block a user