代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/distributed-beget 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 7bb770c0810e4e972ce50bd2041a6e6652a28ebd Mon Sep 17 00:00:00 2001
From: s_c_c <shichuchao@huawei.com>
Date: Mon, 8 Apr 2024 17:55:58 +0800
Subject: [PATCH] feat for embedded fix compile errors after refactor
---
services/param/base/BUILD.gn | 3 +++
services/param/linux/BUILD.gn | 1 +
services/param/linux/param_request.c | 1 +
services/param_service/include/base_task.h | 4 ++--
services/param_service/src/base_task.c | 2 +-
services/param_service/src/le_utils.c | 2 ++
services/param_service/src/main.c | 4 +++-
services/param_service/src/param_server.c | 4 ++--
services/param_service/src/trie_comm.c | 7 ++++---
services/utils/BUILD.gn | 3 +++
services/utils/init_utils.c | 2 +-
11 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/services/param/base/BUILD.gn b/services/param/base/BUILD.gn
index b253055..66f5668 100644
--- a/services/param/base/BUILD.gn
+++ b/services/param/base/BUILD.gn
@@ -11,6 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/ohos.gni")
+import("//build/config/sysroot.gni")
config("exported_header_files") {
visibility = [ ":*" ]
@@ -19,6 +20,7 @@ config("exported_header_files") {
"//base/startup/init/services/include/param",
"//base/startup/init/services/include",
"//base/hiviewdfx/hilog/interfaces/native/innerkits/include",
+ "${sysroot}/usr/include/hilog",
]
}
@@ -30,6 +32,7 @@ base_include_dirs = [
"//base/startup/init/services/param/include",
"//base/startup/init/services/param/base",
"//base/hiviewdfx/hilog/interfaces/native/innerkits/include",
+ "${sysroot}/usr/include/hilog",
]
source_set("parameterbase") {
diff --git a/services/param/linux/BUILD.gn b/services/param/linux/BUILD.gn
index 87881f6..4b7d641 100644
--- a/services/param/linux/BUILD.gn
+++ b/services/param/linux/BUILD.gn
@@ -41,4 +41,5 @@ ohos_static_library("param_client") {
deps = [ "//base/startup/init/services/utils:libinit_utils" ]
part_name = "init"
subsystem_name = "startup"
+ cflags = [ "-Wno-stringop-truncation" ]
}
diff --git a/services/param/linux/param_request.c b/services/param/linux/param_request.c
index 76947f2..3392c1d 100644
--- a/services/param/linux/param_request.c
+++ b/services/param/linux/param_request.c
@@ -29,6 +29,7 @@
#include <stdio.h>
#include "beget_ext.h"
+#include "param_manager.h"
static void ClearEnv(ParamReqMsg* pmsg, ParamRespMsg* respmsg, int fd)
{
diff --git a/services/param_service/include/base_task.h b/services/param_service/include/base_task.h
index 372c33e..a7a7f73 100644
--- a/services/param_service/include/base_task.h
+++ b/services/param_service/include/base_task.h
@@ -11,12 +11,12 @@
typedef void* LoopHandle;
-typedef enum : uint32_t {
+typedef enum {
Event_Read,
Event_Write,
} EventType;
-typedef enum : uint32_t {
+typedef enum {
NORMAL_TYPE,
WAIT_TYPE,
} ClientType;
diff --git a/services/param_service/src/base_task.c b/services/param_service/src/base_task.c
index e97d7dc..944fd4f 100644
--- a/services/param_service/src/base_task.c
+++ b/services/param_service/src/base_task.c
@@ -81,7 +81,7 @@ static int CreateLoop(EventLoop **loop)
handle->ModEvent = ModEvent_;
handle->DelEvent = DelEvent_;
handle->maxevents = DEFAULT_MAX_EVENTS;
- handle->tab == NULL;
+ handle->tab = NULL;
*loop = handle;
return 0;
}
diff --git a/services/param_service/src/le_utils.c b/services/param_service/src/le_utils.c
index c4f5b69..8fa0401 100644
--- a/services/param_service/src/le_utils.c
+++ b/services/param_service/src/le_utils.c
@@ -3,6 +3,8 @@
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
+#include <sys/stat.h>
+#include "securec.h"
#define MAX_BUF 1024
diff --git a/services/param_service/src/main.c b/services/param_service/src/main.c
index 58ef853..07a05b7 100644
--- a/services/param_service/src/main.c
+++ b/services/param_service/src/main.c
@@ -6,7 +6,9 @@
#include <sys/prctl.h>
#include <string.h>
#include "beget_ext.h"
-#include "base_task.h";
+#include "base_task.h"
+#include "trie_comm.h"
+#include "param_server.h"
int main(int argc, char* argv[])
{
diff --git a/services/param_service/src/param_server.c b/services/param_service/src/param_server.c
index 9ae06a3..6058319 100644
--- a/services/param_service/src/param_server.c
+++ b/services/param_service/src/param_server.c
@@ -197,7 +197,6 @@ static void OnSendMessage(LoopHandle handle, BaseTask *task)
static void OnRecvMessage(LoopHandle handle, BaseTask *task)
{
BEGET_ERROR_CHECK(handle != NULL && task != NULL, return, "%s : invalid param", __func__);
- EventLoop *loop = (EventLoop*)handle;
uint32_t payload = (uint32_t)sizeof(ParamReqMsg);
EventBuffer *buf = (EventBuffer*)calloc(1, sizeof(EventBuffer) + payload);
BEGET_ERROR_CHECK(buf != NULL, return, "%s, fail to allocate recv buf", __func__);
@@ -324,7 +323,8 @@ static void HandleTimerEvent(LoopHandle handle, BaseTask *task, EventType type)
{
(void)type;
uint64_t exp;
- read(task->taskId, &exp, sizeof(uint64_t));
+ int ret = read(task->taskId, &exp, sizeof(uint64_t));
+ (void)ret;
CheckWaitParamTimeout(handle, exp);
BEGET_LOGI("Entry timer task, exp : %ld", exp);
}
diff --git a/services/param_service/src/trie_comm.c b/services/param_service/src/trie_comm.c
index ac31243..0d758d6 100644
--- a/services/param_service/src/trie_comm.c
+++ b/services/param_service/src/trie_comm.c
@@ -392,7 +392,8 @@ int ParamWorkSpaceInit()
BEGET_ERROR_CHECK(paramWorkSpace != NULL, return -1, "failed to malloc for param workspace");
int fd = open(WORKSPACE_NAME, O_CREAT | O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
BEGET_ERROR_CHECK(fd > 0, return -1, "failed to open %s", WORKSPACE_NAME);
- ftruncate(fd, WORKSPACE_SIZE);
+ int ret = ftruncate(fd, WORKSPACE_SIZE);
+ (void)ret;
paramWorkSpace->shareAddr = mmap(NULL, WORKSPACE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
BEGET_ERROR_CHECK(paramWorkSpace->shareAddr != MAP_FAILED, return -1, "failed to create mmap");
paramWorkSpace->rootOffest = 0;
@@ -424,7 +425,7 @@ int SetParamtoMem(const char* key, const char* value)
if (root == NULL || current == NULL)
return -1;
- char* remainKey = key;
+ char* remainKey = (char *)key;
pthread_rwlock_wrlock(&rwlock);
while(1) {
char* subKey;
@@ -493,7 +494,7 @@ int GetParamFromMem(const char* key, char* value, uint32_t len)
return -1;
ParamNode* paramData;
- char* remainKey = key;
+ char* remainKey = (char *)key;
pthread_rwlock_rdlock(&rwlock);
while (1) {
char* subKey;
diff --git a/services/utils/BUILD.gn b/services/utils/BUILD.gn
index 30529be..1fbc2c0 100644
--- a/services/utils/BUILD.gn
+++ b/services/utils/BUILD.gn
@@ -10,12 +10,14 @@
# 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.
+import("//build/config/sysroot.gni")
config("exported_header_files") {
visibility = [ ":*" ]
include_dirs = [
"//base/startup/init/services/include",
"//base/hiviewdfx/hilog/interfaces/native/innerkits/include",
+ "${sysroot}/usr/include/hilog",
]
}
@@ -30,6 +32,7 @@ ohos_static_library("libinit_utils") {
"//base/startup/init/interfaces/innerkits/include",
"//third_party/bounds_checking_function/include",
"//base/hiviewdfx/hilog/interfaces/native/innerkits/include",
+ "${sysroot}/usr/include/hilog",
"//base/startup/init/services/include"
]
deps = [
diff --git a/services/utils/init_utils.c b/services/utils/init_utils.c
index 733f863..8b4b2e0 100644
--- a/services/utils/init_utils.c
+++ b/services/utils/init_utils.c
@@ -49,7 +49,7 @@ float ConvertMicrosecondToSecond(int x)
}
#ifndef __LITEOS_M__
-static bool CheckDigit(const char *name)
+__attribute__((unused)) static bool CheckDigit(const char *name)
{
size_t nameLen = strlen(name);
for (size_t i = 0; i < nameLen; ++i) {
--
2.20.1 (Apple Git-117)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。