未验证 提交 1f372278 编写于 作者: O openharmony_ci 提交者: Gitee

!29 ipc统一接口切换

Merge pull request !29 from 周礼亭/master
......@@ -23,7 +23,7 @@
"components": [
"hilog_lite",
"samgr_lite",
"ipc_lite",
"ipc_single",
"kv_store",
"aafwk_lite",
"ace_engine_lite",
......
......@@ -51,7 +51,7 @@ executable("appspawn") {
deps = [
"${aafwk_lite_path}/frameworks/ability_lite:aafwk_abilitykit_lite",
"//build/lite/config/component/cJSON:cjson_shared",
"//foundation/communication/ipc_lite:liteipc_adapter",
"//foundation/communication/ipc/interfaces/innerkits/c/ipc:ipc_single",
"//foundation/distributeddatamgr/appdatamgr/frameworks/native/kv_store:kv_store",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//third_party/bounds_checking_function:libsec_shared",
......
......@@ -24,7 +24,7 @@
#include "appspawn_process.h"
#include "iproxy_server.h"
#include "iunknown.h"
#include "liteipc_adapter.h"
#include "ipc_skeleton.h"
#include "log.h"
#include "message.h"
#include "ohos_errno.h"
......@@ -99,29 +99,14 @@ static int GetMessageSt(MessageSt* msgSt, IpcIo* req)
if (msgSt == NULL || req == NULL) {
return EC_FAILURE;
}
#ifdef __LINUX__
size_t len = 0;
char* str = IpcIoPopString(req, &len);
char* str = ReadString(req, &len);
if (str == NULL || len == 0) {
HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] invoke, get data failed.");
return EC_FAILURE;
}
int ret = SplitMessage(str, len, msgSt); // after split message, str no need to free(linux version)
#else
BuffPtr* dataPtr = IpcIoPopDataBuff(req);
if (dataPtr == NULL) {
HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] invoke, get data failed.");
return EC_FAILURE;
}
int ret = SplitMessage((char*)dataPtr->buff, dataPtr->buffSz, msgSt);
// release buffer
if (FreeBuffer(NULL, dataPtr->buff) != LITEIPC_OK) {
HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] invoke, free buffer failed!");
}
#endif
return ret;
}
......@@ -138,14 +123,14 @@ static int Invoke(IServerProxy* iProxy, int funcId, void* origin, IpcIo* req, Ip
if (reply == NULL || funcId != ID_CALL_CREATE_SERVICE || req == NULL) {
HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] invoke, funcId %{public}d invalid, reply %{public}d.", \
funcId, INVALID_PID);
IpcIoPushInt64(reply, INVALID_PID);
WriteInt64(reply, INVALID_PID);
return EC_BADPTR;
}
MessageSt msgSt = {0};
if (GetMessageSt(&msgSt, req) != EC_SUCCESS) {
HILOG_ERROR(HILOG_MODULE_HIVIEW, "[appspawn] invoke, parse failed! reply %{public}d.", INVALID_PID);
IpcIoPushInt64(reply, INVALID_PID);
WriteInt64(reply, INVALID_PID);
return EC_FAILURE;
}
......@@ -154,7 +139,7 @@ static int Invoke(IServerProxy* iProxy, int funcId, void* origin, IpcIo* req, Ip
pid_t newPid = CreateProcess(&msgSt);
FreeMessageSt(&msgSt);
IpcIoPushInt64(reply, newPid);
WriteInt64(reply, newPid);
#ifdef OHOS_DEBUG
struct timespec tmEnd = {0};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册