|
@@ -28,7 +28,7 @@
|
|
|
#include "toolkit.h"
|
|
|
#include "dbgutil.h"
|
|
|
#include "def.h"
|
|
|
-#ifdef _WIN32
|
|
|
+#ifdef RVC_OS_WIN
|
|
|
#include "CodeSignVerify.h"
|
|
|
#include "sp_checkEntity.h"
|
|
|
#include "sp_firewallControl.h"
|
|
@@ -54,7 +54,7 @@ static void var_callback(sp_var_listener_t *listener,
|
|
|
ISysVarListener *pListener = (ISysVarListener *)user_data;
|
|
|
SpEntity *pEntity = (SpEntity*)sp_var_listener_get_tag(listener);
|
|
|
|
|
|
-#ifdef _WIN32
|
|
|
+#ifdef RVC_OS_WIN
|
|
|
SetthreadGroup(GetCurrentThreadId(), pEntity->get_cfg_ent()->name);
|
|
|
getEntityResource()->m_Entity = pEntity;
|
|
|
#else
|
|
@@ -89,7 +89,7 @@ static void bcm_callback(sp_bcm_listener_t *listener,
|
|
|
SpEntity *pEntity = (SpEntity*)sp_bcm_listener_get_tag(listener);
|
|
|
sp_uid_t uid;
|
|
|
|
|
|
-#ifdef _WIN32
|
|
|
+#ifdef RVC_OS_WIN
|
|
|
SetthreadGroup(GetCurrentThreadId(), pEntity->get_cfg_ent()->name);
|
|
|
getEntityResource()->m_Entity = pEntity;
|
|
|
#else
|
|
@@ -172,7 +172,7 @@ static void task_callback(threadpool_t *threadpool, void *arg, param_size_t para
|
|
|
ITaskSp *pTask = (ITaskSp*)arg;
|
|
|
SpEntity *pEntity = (SpEntity*)param1;
|
|
|
|
|
|
-#ifdef _WIN32
|
|
|
+#ifdef RVC_OS_WIN
|
|
|
SetthreadGroup(GetCurrentThreadId(), pEntity->GetEntityBase()->GetEntityName());
|
|
|
try {
|
|
|
getEntityResource()->m_Entity = pEntity;
|
|
@@ -235,7 +235,7 @@ SpEntity::~SpEntity()
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("run ~SpEntity()");
|
|
|
if (m_ent != nullptr && m_pEntityBase != nullptr) {
|
|
|
-#ifdef _WIN32
|
|
|
+#ifdef RVC_OS_WIN
|
|
|
getEntityResource()->m_Entity = NULL;
|
|
|
#endif //_WIN32
|
|
|
}
|
|
@@ -261,7 +261,7 @@ ErrorCodeEnum SpEntity::Init()
|
|
|
threadpool_set_thread_decorator(m_tpool, &SpEntity::__on_thread_init, &SpEntity::__on_thread_term, this);
|
|
|
threadpool_start(m_tpool, 0, 64, 5*60*1000, 0);
|
|
|
|
|
|
-#ifdef _WIN32
|
|
|
+#ifdef RVC_OS_WIN
|
|
|
setModuleAliasName(GetEntityBase()->GetEntityName());
|
|
|
#endif //_WIN32
|
|
|
|
|
@@ -517,7 +517,7 @@ int SpEntity::on_accept(int epid, int svc_id, int conn_id, iobuffer_t **conn_pkt
|
|
|
|
|
|
void SpEntity::on_thread_init()
|
|
|
{
|
|
|
-#ifdef _WIN32
|
|
|
+#ifdef RVC_OS_WIN
|
|
|
SetthreadGroup(GetCurrentThreadId(), this->get_cfg_ent()->name);
|
|
|
getEntityResource()->m_Entity = this;
|
|
|
#else
|
|
@@ -527,7 +527,7 @@ void SpEntity::on_thread_init()
|
|
|
|
|
|
void SpEntity::on_thread_term()
|
|
|
{
|
|
|
-#ifdef _WIN32
|
|
|
+#ifdef RVC_OS_WIN
|
|
|
SetthreadGroup(GetCurrentThreadId(), this->get_cfg_ent()->name);
|
|
|
getEntityResource()->m_Entity = NULL;
|
|
|
#else
|
|
@@ -539,10 +539,11 @@ void SpEntity::__on_thread_init(threadpool_t *, void *arg)
|
|
|
{
|
|
|
SpEntity *pThis = static_cast<SpEntity*>(arg);
|
|
|
pThis->on_thread_init();
|
|
|
-#ifndef _WIN32
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("thread init, thread id:%u", GetCurrentThreadIdFromSys());
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("thread init, thread id:%u",
|
|
|
+#ifndef RVC_OS_WIN
|
|
|
+ GetCurrentThreadIdFromSys());
|
|
|
#else
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("thread init, thread id:%d", GetCurrentThreadId());
|
|
|
+ GetCurrentThreadId());
|
|
|
#endif //NOT _WIN32
|
|
|
}
|
|
|
|
|
@@ -550,10 +551,12 @@ void SpEntity::__on_thread_term(threadpool_t *, void *arg)
|
|
|
{
|
|
|
SpEntity *pThis = static_cast<SpEntity*>(arg);
|
|
|
pThis->on_thread_term();
|
|
|
+
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("thread term, thread id:%d",
|
|
|
#if defined(_MSC_VER)
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("thread term, thread id:%d", GetCurrentThreadId());
|
|
|
+ GetCurrentThreadId());
|
|
|
#else
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("thread term, thread id:%u", GetCurrentThreadIdFromSys());
|
|
|
+ GetCurrentThreadIdFromSys());
|
|
|
#endif //_MSC_VER
|
|
|
}
|
|
|
|
|
@@ -1756,7 +1759,7 @@ ErrorCodeEnum SpEntity::SetNewPathToFirewall(CSimpleString &pszPath, int maxWait
|
|
|
}
|
|
|
|
|
|
|
|
|
-#ifdef _WIN32
|
|
|
+#ifdef RVC_OS_WIN
|
|
|
auto addFirewall_worker = [this](std::string path)
|
|
|
{
|
|
|
return sp_AddFirewallRuleByPath(path.c_str()) ? Error_Succeed : Error_Bug;
|
|
@@ -2046,7 +2049,7 @@ ErrorCodeEnum SpEntity::VerifySignature(const char *pszSignedFile, CSimpleString
|
|
|
|
|
|
ErrorCodeEnum SpEntity::ShowFatalError(const char *pszMsg, SeverityLevelEnum eLevel)
|
|
|
{
|
|
|
-
|
|
|
+ //TODO: [Gifur@2025730]
|
|
|
#if defined(RVC_OS_WIN)
|
|
|
LogError(Severity_High, Error_Unrecover, 0, pszMsg);
|
|
|
#endif //RVC_OS_WIN
|