mirror of
https://github.com/decompals/wibo.git
synced 2025-10-15 14:45:12 +00:00
Actually add to ProcessManager when spawning
This commit is contained in:
parent
f4cd59b4e0
commit
ffdfa38591
@ -168,7 +168,7 @@ namespace kernel32 {
|
||||
UINT WIN_FUNC SetHandleCount(UINT uNumber) {
|
||||
DEBUG_LOG("SetHandleCount(%u)\n", uNumber);
|
||||
(void)uNumber;
|
||||
return (1u << 17) - 1;
|
||||
return 0x3FFE;
|
||||
}
|
||||
|
||||
DWORD WIN_FUNC FormatMessageA(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPSTR lpBuffer,
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "processes.h"
|
||||
#include "common.h"
|
||||
#include "kernel32/internal.h"
|
||||
#include "files.h"
|
||||
#include "handles.h"
|
||||
#include "kernel32/internal.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
@ -123,6 +123,7 @@ bool ProcessManager::addProcess(Pin<ProcessObject> po) {
|
||||
std::lock_guard lk(m);
|
||||
mReg.emplace(pidfd, std::move(po));
|
||||
}
|
||||
DEBUG_LOG("ProcessManager: tracking pidfd %d\n", pidfd);
|
||||
wake();
|
||||
return true;
|
||||
}
|
||||
@ -162,6 +163,8 @@ void ProcessManager::wake() const {
|
||||
}
|
||||
|
||||
void ProcessManager::checkPidfd(int pidfd) {
|
||||
DEBUG_LOG("ProcessManager: checking pidfd %d\n", pidfd);
|
||||
|
||||
siginfo_t si{};
|
||||
si.si_code = CLD_DUMPED;
|
||||
if (pidfd >= 0) {
|
||||
@ -176,6 +179,8 @@ void ProcessManager::checkPidfd(int pidfd) {
|
||||
close(pidfd);
|
||||
}
|
||||
|
||||
DEBUG_LOG("ProcessManager: pidfd %d exited: code=%d status=%d\n", pidfd, si.si_code, si.si_status);
|
||||
|
||||
Pin<ProcessObject> po;
|
||||
{
|
||||
std::shared_lock lk(m);
|
||||
@ -395,7 +400,9 @@ static int spawnInternal(const std::vector<std::string> &args, Pin<kernel32::Pro
|
||||
return false;
|
||||
}
|
||||
|
||||
pinOut = make_pin<kernel32::ProcessObject>(pid, pidfd);
|
||||
auto obj = make_pin<kernel32::ProcessObject>(pid, pidfd);
|
||||
pinOut = obj.clone();
|
||||
processes().addProcess(std::move(obj));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user