未验证 提交 6253fcec 编写于 作者: O openharmony_ci 提交者: Gitee

!96 Add L0 write/read remote object

Merge pull request !96 from liubb_0516/master
......@@ -15,9 +15,11 @@
#include "rpc_os_adapter.h"
#include <pthread.h>
int32_t RpcGetPid(void)
{
return 0;
return (int32_t)pthread_self(); // Use tid instead of pid on mini system
}
int32_t RpcGetUid(void)
......
......@@ -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,
......
......@@ -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.");
......
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册