!42 配合ipc修改linux版本多线程问题

Merge pull request !42 from caochao/local
This commit is contained in:
openharmony_ci 2022-01-18 08:25:57 +00:00 committed by Gitee
commit 6ee164c442
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 8 additions and 0 deletions

View File

@ -27,6 +27,7 @@ shared_library("server") {
"//third_party/bounds_checking_function/include", "//third_party/bounds_checking_function/include",
"//base/security/permission/interfaces/innerkits/permission_lite", "//base/security/permission/interfaces/innerkits/permission_lite",
"//base/security/permission/services/permission_lite/pms_base/include", "//base/security/permission/services/permission_lite/pms_base/include",
"//foundation/communication/ipc_lite/frameworks/liteipc/include",
] ]
deps = [ "//foundation/distributedschedule/samgr_lite:ConfigFiles" ] deps = [ "//foundation/distributedschedule/samgr_lite:ConfigFiles" ]

7
samgr_server/source/samgr_server.c Executable file → Normal file
View File

@ -20,6 +20,7 @@
#include <ohos_init.h> #include <ohos_init.h>
#include <ohos_types.h> #include <ohos_types.h>
#include <ohos_errno.h> #include <ohos_errno.h>
#include <liteipc.h>
#include <liteipc_adapter.h> #include <liteipc_adapter.h>
#include <log.h> #include <log.h>
#include "cJSON.h" #include "cJSON.h"
@ -167,6 +168,12 @@ static int ProcEndpoint(SamgrServer *server, int32 option, void *origin, IpcIo *
SvcIdentity identity = {(uint32)INVALID_INDEX, (uint32)INVALID_INDEX, (uint32)INVALID_INDEX}; SvcIdentity identity = {(uint32)INVALID_INDEX, (uint32)INVALID_INDEX, (uint32)INVALID_INDEX};
(void)GenServiceHandle(&identity, GetCallingTid(origin)); (void)GenServiceHandle(&identity, GetCallingTid(origin));
#ifdef __LINUX__ #ifdef __LINUX__
IpcMsg* data = (IpcMsg*)origin;
if (data == NULL) {
HILOG_ERROR(HILOG_MODULE_SAMGR, "Register Endpoint origin null pointer!");
return EC_FAILURE;
}
identity.handle = data->target.handle;
BinderAcquire(g_server.samgr->context, identity.handle); BinderAcquire(g_server.samgr->context, identity.handle);
#endif #endif