From 486c4ec4e83690a0336a8136529d87eb4e55282a Mon Sep 17 00:00:00 2001 From: zcy <290198252@qq.com> Date: Mon, 26 Jul 2021 23:57:45 +0800 Subject: [PATCH] no message --- general/src/function/daemon.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/general/src/function/daemon.cpp b/general/src/function/daemon.cpp index 02e4c7b..bde8137 100644 --- a/general/src/function/daemon.cpp +++ b/general/src/function/daemon.cpp @@ -1,7 +1,7 @@ /* * @Author: your name * @Date: 2021-07-23 23:39:57 - * @LastEditTime: 2021-07-26 23:44:58 + * @LastEditTime: 2021-07-26 23:49:33 * @LastEditors: Please set LastEditors * @Description: In User Settings Edit * @FilePath: \generallib\general\src\function\daemon.c @@ -9,6 +9,8 @@ #include "daemon.h" +#ifdef _WIN32 + static BOOL KillProcess(DWORD dwPid) { HANDLE hPrc; @@ -146,6 +148,7 @@ static int test_fork() } return 0; } +#endif DaemonizeMonitor::DaemonizeMonitor(string path){ this->m_path_process.push_back(path); @@ -154,6 +157,7 @@ DaemonizeMonitor::DaemonizeMonitor(string path){ int DaemonizeMonitor::AddNewProcess(string path){ this->m_path_process.push_back(path); +#ifdef _WIN32 STARTUPINFO si = {sizeof(si)}; PROCESS_INFORMATION pi; si.dwFlags = STARTF_USESHOWWINDOW; //指定wShowWindow成员有效 @@ -180,9 +184,12 @@ int DaemonizeMonitor::AddNewProcess(string path){ return 0; } return -1; + +#endif } int DaemonizeMonitor::StartMonitor(){ +#ifdef _WIN32 DWORD Proc_pid[1024], Retn_bytes, Proc_count, Retn_bytes2; unsigned int i; HMODULE hMod[1024]; @@ -236,18 +243,21 @@ int DaemonizeMonitor::StartMonitor(){ } } return 0; +#endif } int DaemonizeMonitor::StopMonitor(string){ - +#ifdef _WIN32 return 0; +#endif } /* */ int DaemonizeMonitor::StopProcess(string path){ +#ifdef _WIN32 if(m_running_pid.find(path) != m_running_pid.end()){ DWORD pid = m_running_pid.at(path); m_running_pid.erase(path); @@ -258,4 +268,5 @@ int DaemonizeMonitor::StopProcess(string path){ } } return 0; +#endif } \ No newline at end of file