#pragma once #include "dll/kernel32/internal.h" #include #include #include #include #include using kernel32::ProcessObject; namespace wibo { class ProcessManager { public: ~ProcessManager(); bool init(); void shutdown(); bool addProcess(Pin po); bool running() const { return mRunning.load(std::memory_order_acquire); } private: void runLoop(); void wake() const; void checkPidfd(int pidfd); mutable std::shared_mutex m; std::atomic mRunning = false; std::thread mThread; int mEpollFd = -1; int mWakeFd = -1; std::unordered_map> mReg; }; ProcessManager &processes(); std::optional resolveExecutable(const std::string &command, bool searchPath); int spawnWithCommandLine(const std::string &applicationName, const std::string &commandLine, Pin &pinOut); int spawnWithArgv(const std::string &applicationName, const std::vector &argv, Pin &pinOut); std::vector splitCommandLine(const char *commandLine); } // namespace wibo