Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
communication_ipc
提交
42e14e99
C
communication_ipc
项目概览
OpenHarmony
/
communication_ipc
11 个月 前同步成功
通知
20
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
communication_ipc
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
42e14e99
编写于
12月 29, 2021
作者:
L
liubb_0516
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add rpc adapter file
Signed-off-by:
N
liubb_0516
<
liubeibei8@huawei.com
>
上级
2f98bac9
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
136 addition
and
7 deletion
+136
-7
interfaces/innerkits/c/ipc/BUILD.gn
interfaces/innerkits/c/ipc/BUILD.gn
+2
-0
ipc/native/c/adapter/BUILD.gn
ipc/native/c/adapter/BUILD.gn
+32
-0
ipc/native/c/adapter/Linux/rpc_os_adapter.c
ipc/native/c/adapter/Linux/rpc_os_adapter.c
+27
-0
ipc/native/c/adapter/Liteos_m/rpc_os_adapter.c
ipc/native/c/adapter/Liteos_m/rpc_os_adapter.c
+26
-0
ipc/native/c/adapter/include/rpc_os_adapter.h
ipc/native/c/adapter/include/rpc_os_adapter.h
+35
-0
ipc/native/c/ipc/include/binder_invoker.h
ipc/native/c/ipc/include/binder_invoker.h
+5
-1
ipc/native/c/ipc/src/binder_invoker.c
ipc/native/c/ipc/src/binder_invoker.c
+3
-2
ipc/native/c/manager/src/ipc_process_skeleton.c
ipc/native/c/manager/src/ipc_process_skeleton.c
+3
-2
ipc/native/c/manager/src/ipc_thread_pool.c
ipc/native/c/manager/src/ipc_thread_pool.c
+3
-2
未找到文件。
interfaces/innerkits/c/ipc/BUILD.gn
浏览文件 @
42e14e99
...
...
@@ -52,6 +52,7 @@ if (ohos_kernel_type == "liteos_m") {
"//utils/native/lite/include",
"$hilog_lite_include_path",
]
deps = [ "//foundation/communication/ipc/ipc/native/c/adapter:rpc_adapter" ]
}
} else {
shared_library("rpc_log") {
...
...
@@ -91,6 +92,7 @@ if (ohos_kernel_type == "liteos_m") {
]
public_deps = [
":rpc_log",
"//foundation/communication/ipc/ipc/native/c/adapter:rpc_adapter",
"//third_party/bounds_checking_function/:libsec_shared",
]
...
...
ipc/native/c/adapter/BUILD.gn
0 → 100644
浏览文件 @
42e14e99
# Copyright (c) 2020 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
config("rpc_adapter_interface") {
include_dirs = [ "include" ]
}
if (ohos_kernel_type == "liteos_m") {
static_library("rpc_adapter") {
sources = [ "Liteos_m/rpc_os_adapter.c" ]
public_configs = [ ":rpc_adapter_interface" ]
}
} else {
shared_library("rpc_adapter") {
sources = [ "Linux/rpc_os_adapter.c" ]
public_configs = [ ":rpc_adapter_interface" ]
ldflags = [
"-lstdc++",
"-fPIC",
]
}
}
ipc/native/c/adapter/Linux/rpc_os_adapter.c
0 → 100644
浏览文件 @
42e14e99
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <unistd.h>
#include "rpc_os_adapter.h"
int32_t
RpcGetPid
()
{
return
(
int32_t
)
getpid
();
}
int32_t
RpcGetUid
()
{
return
(
int32_t
)
getuid
();
}
\ No newline at end of file
ipc/native/c/adapter/Liteos_m/rpc_os_adapter.c
0 → 100644
浏览文件 @
42e14e99
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "rpc_os_adapter.h"
int32_t
RpcGetPid
()
{
return
0
;
}
int32_t
RpcGetUid
()
{
return
0
;
}
\ No newline at end of file
ipc/native/c/adapter/include/rpc_os_adapter.h
0 → 100644
浏览文件 @
42e14e99
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OHOS_IPC_RPC_OS_ADAPTER_H
#define OHOS_IPC_RPC_OS_ADAPTER_H
#include <stdint.h>
#ifdef __cplusplus
#if __cplusplus
extern
"C"
{
#endif
#endif
/* __cplusplus */
int32_t
RpcGetPid
();
int32_t
RpcGetUid
();
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
/* __cplusplus */
#endif
/* OHOS_IPC_RPC_OS_ADAPTER_H */
ipc/native/c/ipc/include/binder_invoker.h
浏览文件 @
42e14e99
...
...
@@ -19,8 +19,10 @@
#include "iremote_invoker.h"
#ifdef __cplusplus
#if __cplusplus
extern
"C"
{
#endif
#endif
/* __cplusplus */
RemoteInvoker
*
GetIpcInvoker
(
void
);
int32_t
AcquireHandle
(
int32_t
handle
);
...
...
@@ -35,6 +37,8 @@ int32_t IpcRemoveDeathRecipient(int32_t handle, void *cookie);
void
IpcExitCurrentThread
(
void
);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif // OHOS_IPC_INVOKER_H
\ No newline at end of file
#endif
/* __cplusplus */
#endif
/* OHOS_IPC_INVOKER_H */
\ No newline at end of file
ipc/native/c/ipc/src/binder_invoker.c
浏览文件 @
42e14e99
...
...
@@ -30,6 +30,7 @@
#include "ipc_thread_pool.h"
#include "rpc_errno.h"
#include "rpc_log.h"
#include "rpc_os_adapter.h"
#include "rpc_types.h"
#include "securec.h"
#include "sys_binder.h"
...
...
@@ -141,8 +142,8 @@ static void ToTransData(uint32_t handle, uint32_t code, MessageOption option, co
buf
->
btd
.
code
=
code
;
buf
->
btd
.
flags
=
option
;
buf
->
btd
.
cookie
=
0
;
buf
->
btd
.
sender_pid
=
getp
id
();
buf
->
btd
.
sender_euid
=
getu
id
();
buf
->
btd
.
sender_pid
=
RpcGetP
id
();
buf
->
btd
.
sender_euid
=
RpcGetU
id
();
buf
->
btd
.
data_size
=
(
data
==
NULL
)
?
0
:
(
data
->
bufferCur
-
data
->
bufferBase
);
buf
->
btd
.
data
.
ptr
.
buffer
=
(
data
==
NULL
)
?
0
:
(
binder_uintptr_t
)
data
->
bufferBase
;
buf
->
btd
.
offsets_size
=
(
data
==
NULL
)
?
0
:
((
char
*
)
data
->
offsetsCur
-
(
char
*
)
data
->
offsetsBase
);
...
...
ipc/native/c/manager/src/ipc_process_skeleton.c
浏览文件 @
42e14e99
...
...
@@ -19,6 +19,7 @@
#include "iremote_invoker.h"
#include "rpc_errno.h"
#include "rpc_log.h"
#include "rpc_os_adapter.h"
#include "rpc_types.h"
#include "securec.h"
#include "utils_list.h"
...
...
@@ -125,7 +126,7 @@ pid_t ProcessGetCallingPid()
if
(
currentContext
!=
NULL
)
{
return
currentContext
->
callerPid
;
}
return
getp
id
();
return
RpcGetP
id
();
}
pid_t
ProcessGetCallingUid
()
...
...
@@ -134,7 +135,7 @@ pid_t ProcessGetCallingUid()
if
(
currentContext
!=
NULL
)
{
return
currentContext
->
callerUid
;
}
return
getu
id
();
return
RpcGetU
id
();
}
const
SvcIdentity
*
GetRegistryObject
(
void
)
...
...
ipc/native/c/manager/src/ipc_thread_pool.c
浏览文件 @
42e14e99
...
...
@@ -21,6 +21,7 @@
#include "iremote_invoker.h"
#include "rpc_errno.h"
#include "rpc_log.h"
#include "rpc_os_adapter.h"
#include "rpc_types.h"
#include "securec.h"
...
...
@@ -156,8 +157,8 @@ ThreadContext *GetCurrentThreadContext(void)
}
current
->
threadId
=
pthread_self
();
current
->
proto
=
IF_PROT_DEFAULT
;
current
->
callerPid
=
getp
id
();
current
->
callerUid
=
getu
id
();
current
->
callerPid
=
RpcGetP
id
();
current
->
callerUid
=
RpcGetU
id
();
pthread_setspecific
(
g_localKey
,
current
);
}
return
current
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录