diff --git a/ipc/native/c/adapter/Liteos_m/rpc_os_adapter.c b/ipc/native/c/adapter/Liteos_m/rpc_os_adapter.c index faeb00c79813daf01b14ec76df797a1223e63f79..8f16e8b39fcfb9fefbeecf514390e4102e1e75a1 100644 --- a/ipc/native/c/adapter/Liteos_m/rpc_os_adapter.c +++ b/ipc/native/c/adapter/Liteos_m/rpc_os_adapter.c @@ -15,9 +15,11 @@ #include "rpc_os_adapter.h" +#include + int32_t RpcGetPid(void) { - return 0; + return (int32_t)pthread_self(); // Use tid instead of pid on mini system } int32_t RpcGetUid(void) diff --git a/ipc/native/c/manager/include/ipc_process_skeleton.h b/ipc/native/c/manager/include/ipc_process_skeleton.h index e84716f1fa58457e51a93c92d6781fe140b9d0f1..87a31aeb950b0b3888b471fdf47ec49842e5872f 100644 --- a/ipc/native/c/manager/include/ipc_process_skeleton.h +++ b/ipc/native/c/manager/include/ipc_process_skeleton.h @@ -64,7 +64,7 @@ const SvcIdentity *GetRegistryObject(void); int32_t ProcessSendRequest(SvcIdentity target, uint32_t code, IpcIo *data, IpcIo *reply, MessageOption option, uintptr_t *buffer); int32_t ProcessFreeBuffer(void *ptr); -void OnLastStrongRef(int32_t handle); +void OnFirstStrongRef(int32_t handle); int32_t ProcessAddDeathRecipient(int32_t handle, OnRemoteDead deathFunc, void *args, uint32_t *cbId); int32_t ProcessRemoveDeathRecipient(int32_t handle, uint32_t cbId); int32_t OnRemoteRequestInner(uint32_t code, IpcIo *data, IpcIo *reply, diff --git a/ipc/native/c/manager/src/ipc_process_skeleton.c b/ipc/native/c/manager/src/ipc_process_skeleton.c index 2cd04b8b5c6af0c5e770b4e8404d0016b386e21a..c3f976055a1d2accd317a80ea8c16e48dd6dfd2d 100644 --- a/ipc/native/c/manager/src/ipc_process_skeleton.c +++ b/ipc/native/c/manager/src/ipc_process_skeleton.c @@ -240,7 +240,7 @@ static bool FirstAddObject(int32_t handle) return true; } -static void OnFirstStrongRef(int32_t handle) +void OnFirstStrongRef(int32_t handle) { if (handle <= 0) { RPC_LOG_ERROR("invalid handle."); diff --git a/ipc/native/c/manager/src/serializer.c b/ipc/native/c/manager/src/serializer.c index 4c630ddb824ffd996f44a813cb82655b839fb15d..6f3ad1d82fca64faacde026f60c4b97ac5526038 100644 --- a/ipc/native/c/manager/src/serializer.c +++ b/ipc/native/c/manager/src/serializer.c @@ -247,9 +247,11 @@ int32_t ReadFileDescriptor(IpcIo *io) #else bool WriteRemoteObject(IpcIo *io, const SvcIdentity *svc) { - (void)io; - (void)svc; - return false; + if (io == NULL || svc == NULL) { + RPC_LOG_ERROR("push io or svc is NULL ..."); + return false; + } + return WriteBuffer(io, svc, sizeof(SvcIdentity)); } bool WriteFileDescriptor(IpcIo *io, uint32_t fd) @@ -261,9 +263,18 @@ bool WriteFileDescriptor(IpcIo *io, uint32_t fd) bool ReadRemoteObject(IpcIo *io, SvcIdentity *svc) { - (void)io; - (void)svc; - return false; + if (io == NULL || svc == NULL) { + return false; + } + SvcIdentity *svcId = ReadBuffer(io, sizeof(SvcIdentity)); + if (svcId == NULL) { + return false; + } + svc->handle = svcId->handle; + svc->token = svcId->token; + svc->cookie = svcId->cookie; + WaitForProxyInit(svcId->handle); + return true; } int32_t ReadFileDescriptor(IpcIo *io)