!13 同步master到24.04-LTS
From: @s-c-c Reviewed-by: @yukaii Signed-off-by: @yukaii
This commit is contained in:
commit
6ac53c958a
12
0001-fixbug_fd_leak_for_init.patch
Normal file
12
0001-fixbug_fd_leak_for_init.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff --git a/services/param/linux/param_request.c b/services/param/linux/param_request.c
|
||||
index 460486d..6bcd72d 100644
|
||||
--- a/services/param/linux/param_request.c
|
||||
+++ b/services/param/linux/param_request.c
|
||||
@@ -50,6 +50,7 @@ static int GetClientSocket()
|
||||
serverAddr.sun_family = PF_UNIX;
|
||||
strncpy(serverAddr.sun_path, PIPE_NAME, strlen(PIPE_NAME));
|
||||
if (connect(cfd, (struct sockaddr*)&serverAddr, sizeof(serverAddr)) < 0) {
|
||||
+ close(cfd);
|
||||
perror("Failed to connect");
|
||||
return -1;
|
||||
}
|
||||
203
0002-feat-for-embedded-fix-compile-errors.patch
Normal file
203
0002-feat-for-embedded-fix-compile-errors.patch
Normal file
@ -0,0 +1,203 @@
|
||||
From 196876e52d4f9bc2665987bf11e616a127f6cdcb Mon Sep 17 00:00:00 2001
|
||||
From: s_c_c <shichuchao@huawei.com>
|
||||
Date: Mon, 18 Mar 2024 17:48:35 +0800
|
||||
Subject: [PATCH] feat for embedded fix compile errors
|
||||
|
||||
---
|
||||
interfaces/innerkits/service_control/service_control.c | 10 +++++-----
|
||||
interfaces/innerkits/service_watcher/service_watcher.c | 2 +-
|
||||
services/param/linux/param_request.c | 9 +++++----
|
||||
services/param_service/src/le_utils.c | 2 ++
|
||||
services/param_service/src/main.c | 2 ++
|
||||
services/param_service/src/param_server.c | 1 +
|
||||
services/param_service/src/trie_comm.c | 7 ++++---
|
||||
services/utils/init_utils.c | 2 +-
|
||||
8 files changed, 21 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/interfaces/innerkits/service_control/service_control.c b/interfaces/innerkits/service_control/service_control.c
|
||||
index 9fadec4..238d4f4 100644
|
||||
--- a/interfaces/innerkits/service_control/service_control.c
|
||||
+++ b/interfaces/innerkits/service_control/service_control.c
|
||||
@@ -16,22 +16,22 @@
|
||||
#include "service_control.h"
|
||||
|
||||
|
||||
-static int StartProcess(const char *name, const char *extArgv[], int extArgc)
|
||||
+__attribute__((unused)) static int StartProcess(const char *name, const char *extArgv[], int extArgc)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
-static int StopProcess(const char *serviceName)
|
||||
+__attribute__((unused)) static int StopProcess(const char *serviceName)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
-static int GetCurrentServiceStatus(const char *serviceName, ServiceStatus *status)
|
||||
+__attribute__((unused)) static int GetCurrentServiceStatus(const char *serviceName, ServiceStatus *status)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
-static int RestartProcess(const char *serviceName, const char *extArgv[], int extArgc)
|
||||
+__attribute__((unused)) static int RestartProcess(const char *serviceName, const char *extArgv[], int extArgc)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@@ -46,7 +46,7 @@ int ServiceControl(const char *serviceName, int action)
|
||||
return -1;
|
||||
}
|
||||
|
||||
-static int GetProcessInfo(const char *serviceName, char *nameBuffer, char *valueBuffer, ServiceStatus status)
|
||||
+__attribute__((unused)) static int GetProcessInfo(const char *serviceName, char *nameBuffer, char *valueBuffer, ServiceStatus status)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
diff --git a/interfaces/innerkits/service_watcher/service_watcher.c b/interfaces/innerkits/service_watcher/service_watcher.c
|
||||
index 68cef54..db6f7c0 100644
|
||||
--- a/interfaces/innerkits/service_watcher/service_watcher.c
|
||||
+++ b/interfaces/innerkits/service_watcher/service_watcher.c
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "service_watcher.h"
|
||||
#include "parameter.h"
|
||||
|
||||
-static void ServiceStateChange(const char *key, const char *value, void *context)
|
||||
+__attribute__((unused)) static void ServiceStateChange(const char *key, const char *value, void *context)
|
||||
{
|
||||
return;
|
||||
}
|
||||
diff --git a/services/param/linux/param_request.c b/services/param/linux/param_request.c
|
||||
index 6bcd72d..afd95fe 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(ParamRequestMsg* pmsg, ParamRespMsg* respmsg, int fd)
|
||||
{
|
||||
@@ -48,7 +49,7 @@ static int GetClientSocket()
|
||||
struct sockaddr_un serverAddr;
|
||||
bzero(&serverAddr, sizeof(serverAddr));
|
||||
serverAddr.sun_family = PF_UNIX;
|
||||
- strncpy(serverAddr.sun_path, PIPE_NAME, strlen(PIPE_NAME));
|
||||
+ strncpy(serverAddr.sun_path, PIPE_NAME, strlen(PIPE_NAME) + 1);
|
||||
if (connect(cfd, (struct sockaddr*)&serverAddr, sizeof(serverAddr)) < 0) {
|
||||
close(cfd);
|
||||
perror("Failed to connect");
|
||||
@@ -111,7 +112,7 @@ int SystemSetParameter(const char *name, const char *value)
|
||||
return -1;
|
||||
}
|
||||
|
||||
- strncpy(pmsg->key, name, sizeof(pmsg->key));
|
||||
+ strncpy(pmsg->key, name, sizeof(pmsg->key) - 1);
|
||||
strncpy(pmsg->data, value, pmsg->datasize);
|
||||
int ret;
|
||||
struct ParamRespMsg* respmsg = StartRequest(fd, pmsg);
|
||||
@@ -140,7 +141,7 @@ int SystemReadParam(const char *name, char *value, uint32_t *len)
|
||||
struct ParamRequestMsg* pmsg = GetRequestMsg(GET_PARAMETER, *len);
|
||||
BEGET_ERROR_CHECK(pmsg != NULL, close(fd);return -1, "Invalid pmsg");
|
||||
|
||||
- strncpy(pmsg->key, name, sizeof(pmsg->key));
|
||||
+ strncpy(pmsg->key, name, sizeof(pmsg->key) - 1);
|
||||
int ret;
|
||||
struct ParamRespMsg* respmsg = StartRequest(fd, pmsg);
|
||||
if (respmsg == NULL) {
|
||||
@@ -178,7 +179,7 @@ int SystemWaitParameter(const char *name, const char *value, int32_t timeout)
|
||||
BEGET_ERROR_CHECK(pmsg != NULL, close(fd);return -1, "Invalid pmsg");
|
||||
|
||||
pmsg->timeout = timeout;
|
||||
- strncpy(pmsg->key, name, sizeof(pmsg->key));
|
||||
+ strncpy(pmsg->key, name, sizeof(pmsg->key) - 1);
|
||||
strncpy(pmsg->data, value, sizeof(pmsg->datasize));
|
||||
struct ParamRespMsg* respmsg = StartRequest(fd, pmsg);
|
||||
if (respmsg == NULL) {
|
||||
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 01cd47a..1daa246 100644
|
||||
--- a/services/param_service/src/main.c
|
||||
+++ b/services/param_service/src/main.c
|
||||
@@ -6,6 +6,8 @@
|
||||
#include <sys/prctl.h>
|
||||
#include <string.h>
|
||||
#include "beget_ext.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 2f6b5ed..8b38d0f 100644
|
||||
--- a/services/param_service/src/param_server.c
|
||||
+++ b/services/param_service/src/param_server.c
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "param_utils.h"
|
||||
#include "trie_comm.h"
|
||||
#include "securec.h"
|
||||
+#include "le_utils.h"
|
||||
|
||||
void HandleEvent(struct EventArgs* args)
|
||||
{
|
||||
diff --git a/services/param_service/src/trie_comm.c b/services/param_service/src/trie_comm.c
|
||||
index 1a66d0d..fd8184a 100644
|
||||
--- a/services/param_service/src/trie_comm.c
|
||||
+++ b/services/param_service/src/trie_comm.c
|
||||
@@ -204,7 +204,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;
|
||||
@@ -266,7 +266,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;
|
||||
@@ -477,7 +477,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;
|
||||
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)
|
||||
|
||||
93
0003-feat-for-embedded-fix-sysroot-hilog-path.patch
Normal file
93
0003-feat-for-embedded-fix-sysroot-hilog-path.patch
Normal file
@ -0,0 +1,93 @@
|
||||
From 09afde568a6869e33893cc32f85768611319f430 Mon Sep 17 00:00:00 2001
|
||||
From: s_c_c <shichuchao@huawei.com>
|
||||
Date: Tue, 19 Mar 2024 16:12:51 +0800
|
||||
Subject: [PATCH] feat for embedded fix sysroot hilog path
|
||||
|
||||
---
|
||||
interfaces/innerkits/BUILD.gn | 3 ++-
|
||||
services/param/base/BUILD.gn | 5 +++--
|
||||
services/utils/BUILD.gn | 5 +++--
|
||||
3 files changed, 8 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/interfaces/innerkits/BUILD.gn b/interfaces/innerkits/BUILD.gn
|
||||
index aeba5e6..a68eaee 100644
|
||||
--- a/interfaces/innerkits/BUILD.gn
|
||||
+++ b/interfaces/innerkits/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")
|
||||
|
||||
syspara_sources = [
|
||||
"syspara/param_comm.c",
|
||||
@@ -23,7 +24,7 @@ config("exported_header_files") {
|
||||
"//base/startup/init/interfaces/innerkits/include",
|
||||
"//base/startup/init/interfaces/innerkits/include/syspara",
|
||||
"//base/startup/init/services/include",
|
||||
- "//base/hiviewdfx/hilog/interfaces/native/innerkits/include",
|
||||
+ "${sysroot}/usr/include/hilog",
|
||||
]
|
||||
}
|
||||
|
||||
diff --git a/services/param/base/BUILD.gn b/services/param/base/BUILD.gn
|
||||
index b253055..178ac87 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 = [ ":*" ]
|
||||
@@ -18,7 +19,7 @@ config("exported_header_files") {
|
||||
"//base/startup/init/interfaces/innerkits/include",
|
||||
"//base/startup/init/services/include/param",
|
||||
"//base/startup/init/services/include",
|
||||
- "//base/hiviewdfx/hilog/interfaces/native/innerkits/include",
|
||||
+ "${sysroot}/usr/include/hilog",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -29,7 +30,7 @@ comm_sources = [
|
||||
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/utils/BUILD.gn b/services/utils/BUILD.gn
|
||||
index 11d8bf7..e5f6a96 100644
|
||||
--- a/services/utils/BUILD.gn
|
||||
+++ b/services/utils/BUILD.gn
|
||||
@@ -10,12 +10,13 @@
|
||||
# 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",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -26,7 +27,7 @@ ohos_static_library("libinit_utils") {
|
||||
include_dirs = [
|
||||
"//base/startup/init/interfaces/innerkits/include",
|
||||
"//third_party/bounds_checking_function/include",
|
||||
- "//base/hiviewdfx/hilog/interfaces/native/innerkits/include",
|
||||
+ "${sysroot}/usr/include/hilog",
|
||||
]
|
||||
deps = [
|
||||
"//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog",
|
||||
--
|
||||
2.20.1 (Apple Git-117)
|
||||
|
||||
2143
0004-refactor-using-the-reactor-framework.patch
Normal file
2143
0004-refactor-using-the-reactor-framework.patch
Normal file
File diff suppressed because it is too large
Load Diff
226
0005-feat-for-embedded-fix-compile-errors-after-refactor.patch
Normal file
226
0005-feat-for-embedded-fix-compile-errors-after-refactor.patch
Normal file
@ -0,0 +1,226 @@
|
||||
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)
|
||||
|
||||
127
distributed-beget.spec
Normal file
127
distributed-beget.spec
Normal file
@ -0,0 +1,127 @@
|
||||
%define debug_package %{nil}
|
||||
%global build_opt /opt/distributed-middleware-build
|
||||
%global init_path %{build_opt}/openeuler/compiler_gn/base/startup/init
|
||||
%global openHarmony_source_release OpenHarmony-v3.2-Release
|
||||
|
||||
Name: distributed-beget
|
||||
Version: 1.0.0
|
||||
Release: 6
|
||||
Summary: openEuler embedded softbus capability support
|
||||
License: Apache License 2.0
|
||||
URL: https://gitee.com/openeuler/distributed-beget.git
|
||||
Source1: distributed-beget.tar.gz
|
||||
Source2: startup.bundle.json
|
||||
Source3: startup.BUILD.gn
|
||||
Patch1: 0001-fixbug_fd_leak_for_init.patch
|
||||
Patch2: 0002-feat-for-embedded-fix-compile-errors.patch
|
||||
Patch3: 0003-feat-for-embedded-fix-sysroot-hilog-path.patch
|
||||
Patch4: 0004-refactor-using-the-reactor-framework.patch
|
||||
Patch5: 0005-feat-for-embedded-fix-compile-errors-after-refactor.patch
|
||||
|
||||
BuildRequires: distributed-build, hilog, commonlibrary_c_utils
|
||||
|
||||
Requires: commonlibrary_c_utils
|
||||
Requires: hilog
|
||||
# Requires: libatomic
|
||||
|
||||
%description
|
||||
OpenEuler supports param service for distributed softbus capability
|
||||
|
||||
%prep
|
||||
# Create directory structure
|
||||
rm -rf %{_builddir}/*
|
||||
|
||||
cp -rf %{build_opt} %{_builddir}/build
|
||||
[ ! -L "%{_builddir}/build.sh" ] && ln -s %{_builddir}/build/build_scripts/build.sh %{_builddir}/build.sh
|
||||
[ ! -L "%{_builddir}/.gn" ] && ln -s %{_builddir}/build/core/gn/dotfile.gn %{_builddir}/.gn
|
||||
[ ! -L "%{_builddir}/build.py" ] && ln -s %{_builddir}/build/lite/build.py %{_builddir}/build.py
|
||||
cp -rf %{_builddir}/build/openeuler/vendor %{_builddir}/
|
||||
cp -rf %{_builddir}/build/openeuler/compiler_gn/* %{_builddir}
|
||||
|
||||
# mkdir -p %{_builddir}/base/startup
|
||||
%setup -q -D -T -a 1 -c -n %{_builddir}/base/startup
|
||||
%patch -P1 -p1 -d %{_builddir}/base/startup/init
|
||||
%patch -P2 -p1 -d %{_builddir}/base/startup/init
|
||||
%patch -P3 -p1 -d %{_builddir}/base/startup/init
|
||||
%patch -P4 -p1 -d %{_builddir}/base/startup/init
|
||||
%patch -P5 -p1 -d %{_builddir}/base/startup/init
|
||||
# exit 0
|
||||
|
||||
%build
|
||||
%ifarch x86_64
|
||||
bash %{_builddir}/build.sh --product-name openeuler --target-cpu x86_64
|
||||
%endif
|
||||
|
||||
%ifarch aarch64
|
||||
bash %{_builddir}/build.sh --product-name openeuler --target-cpu arm64
|
||||
%endif
|
||||
|
||||
%install
|
||||
install -d -m 0755 %{buildroot}/%{_includedir}/init/syspara
|
||||
install -d -m 0755 %{buildroot}/%{_includedir}/init/param
|
||||
install -d -m 0755 %{buildroot}/%{_libdir}
|
||||
install -d -m 0755 %{buildroot}/system/lib64/
|
||||
install -d -m 0755 %{buildroot}/%{_bindir}
|
||||
install -d -m 0755 %{buildroot}%{build_opt}/openeuler/compiler_gn/base/startup/init/interfaces/innerkits
|
||||
|
||||
%ifarch aarch64
|
||||
%define module_out_path out/openeuler/linux_clang_arm64
|
||||
%define so_out_path out/openeuler/linux_clang_arm64/startup/init/
|
||||
%endif
|
||||
%ifarch x86_64
|
||||
%define module_out_path out/openeuler/linux_clang_x86_64
|
||||
%define so_out_path out/openeuler/linux_clang_x86_64/startup/init/
|
||||
%endif
|
||||
|
||||
# bin
|
||||
install -m 0755 %{_builddir}/out/openeuler/packages/phone/system/bin/param_service %{buildroot}/%{_bindir}
|
||||
# shared library
|
||||
install -m 0755 %{_builddir}/%{so_out_path}/libbeget_proxy.z.so %{buildroot}/%{_libdir}
|
||||
install -m 0755 %{_builddir}/%{so_out_path}/libbegetutil.z.so %{buildroot}/%{_libdir}
|
||||
install -m 0755 %{_builddir}/%{so_out_path}/libbeget_proxy.z.so %{buildroot}/system/lib64/
|
||||
install -m 0755 %{_builddir}/%{so_out_path}/libbegetutil.z.so %{buildroot}/system/lib64/
|
||||
# header files
|
||||
%define interface_path base/startup/init/interfaces/innerkits/include
|
||||
%define service_path base/startup/init/services/include
|
||||
install -m 0755 %{_builddir}/%{interface_path}/{beget_ext.h,service_watcher.h,service_control.h} %{buildroot}/%{_includedir}/init
|
||||
install -m 0755 %{_builddir}/%{interface_path}/syspara/* %{buildroot}/%{_includedir}/init/syspara
|
||||
install -m 0755 %{_builddir}/%{interface_path}/syspara/* %{buildroot}/%{_includedir}/init
|
||||
install -m 0755 %{_builddir}/%{service_path}/init_utils.h %{buildroot}/%{_includedir}/init
|
||||
install -m 0755 %{_builddir}/%{service_path}/param/* %{buildroot}/%{_includedir}/init/param
|
||||
install -m 0755 %{_builddir}/%{service_path}/param/* %{buildroot}/%{_includedir}/init
|
||||
|
||||
# cp bundle.json
|
||||
mkdir -p %{buildroot}%{init_path}
|
||||
mkdir -p %{buildroot}%{init_path}/interfaces/innerkits/
|
||||
install -m 0755 %{SOURCE2} %{buildroot}%{init_path}/bundle.json
|
||||
# cp BUILD.gn
|
||||
install -m 0755 %{SOURCE3} %{buildroot}%{init_path}/interfaces/innerkits/BUILD.gn
|
||||
# create soft link
|
||||
ln -s /usr/include/init %{buildroot}%{build_opt}/openeuler/compiler_gn/%{interface_path}
|
||||
|
||||
%files
|
||||
%{_bindir}/*
|
||||
%{_libdir}/*
|
||||
%{_includedir}/init/*
|
||||
/system/lib64/*
|
||||
%{build_opt}/*
|
||||
|
||||
%changelog
|
||||
* Wed Apr 24 2024 s_c_c <shichuchao@huawei.com> - 1.0.0-6
|
||||
- Apply the 5th patch
|
||||
|
||||
* Mon Apr 8 2024 s_c_c <shichuchao@huawei.com> - 1.0.0-5
|
||||
- Fix compile errors and BUILD.gn for embedded after refactor
|
||||
|
||||
* Wed Mar 27 2024 peng_langyuan <peng_langyuan@hoperun.com> - 1.0.0-4
|
||||
- Refactor param service using the reactor framework
|
||||
|
||||
* Mon Mar 18 2024 s_c_c <shichuchao@huawei.com> - 1.0.0-3
|
||||
- Fix compile errors and sysroot hilog path for embedded
|
||||
|
||||
* Thu Mar 14 2024 s_c_c <shichuchao@huawei.com> - 1.0.0-2
|
||||
- Remove unused tar.gz
|
||||
|
||||
* Fri Nov 24 2023 muyuying <muyuying1@huawei.com> - 1.0.0-1
|
||||
- Init and Adapt to Openeule
|
||||
|
||||
BIN
distributed-beget.tar.gz
Normal file
BIN
distributed-beget.tar.gz
Normal file
Binary file not shown.
40
startup.BUILD.gn
Normal file
40
startup.BUILD.gn
Normal file
@ -0,0 +1,40 @@
|
||||
# Copyright (c) 2021-2022 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.
|
||||
import("//build/ohos.gni")
|
||||
import("//build/config/sysroot.gni")
|
||||
|
||||
config("libbegetutil_config") {
|
||||
include_dirs = [
|
||||
"${sysroot}/usr/include/init",
|
||||
"${sysroot}/usr/include/hilog",
|
||||
]
|
||||
libs = [ "begetutil.z" ]
|
||||
}
|
||||
|
||||
config("libbeget_proxy_config") {
|
||||
include_dirs = [
|
||||
"${sysroot}/usr/include/init",
|
||||
"${sysroot}/usr/include/hilog",
|
||||
]
|
||||
libs = [ "beget_proxy.z" ]
|
||||
}
|
||||
|
||||
group("libbegetutil") {
|
||||
public_configs = [ ":libbegetutil_config" ]
|
||||
}
|
||||
|
||||
# watcher lib must separate compilation avoid interdependence.
|
||||
group("libbeget_proxy") {
|
||||
public_configs = [ ":libbeget_proxy_config" ]
|
||||
}
|
||||
|
||||
77
startup.bundle.json
Normal file
77
startup.bundle.json
Normal file
@ -0,0 +1,77 @@
|
||||
{
|
||||
"name": "@ohos/startup_init_lite",
|
||||
"description": "ohos init process",
|
||||
"homePage": "https://gitee.com/openharmony",
|
||||
"version": "3.1",
|
||||
"license": "Apache License 2.0",
|
||||
"repository": "https://gitee.com/openharmony/startup_init_lite",
|
||||
"publishAs": "code-segment",
|
||||
"segment": {
|
||||
"destPath": "base/startup/init"
|
||||
},
|
||||
"dirs": {},
|
||||
"scripts": {},
|
||||
"component": {
|
||||
"name": "init",
|
||||
"subsystem": "startup",
|
||||
"syscap": [
|
||||
"SystemCapability.Startup.SystemInfo"
|
||||
],
|
||||
"adapted_system_type": [
|
||||
"standard"
|
||||
],
|
||||
"rom": "",
|
||||
"ram": "",
|
||||
"deps": {
|
||||
"components": [
|
||||
"startup",
|
||||
"c_utils"
|
||||
],
|
||||
"third_party": [
|
||||
"cJSON",
|
||||
"bounds_checking_function"
|
||||
]
|
||||
},
|
||||
"build": {
|
||||
"group_type": {
|
||||
"base_group": [
|
||||
],
|
||||
"fwk_group": [
|
||||
],
|
||||
"service_group": [
|
||||
]
|
||||
},
|
||||
"sub_component": [
|
||||
],
|
||||
"inner_kits": [
|
||||
{
|
||||
"header": {
|
||||
"header_base": "//base/startup/init/interfaces/innerkits/include/",
|
||||
"header_files": [
|
||||
"service_control.h",
|
||||
"beget_ext.h",
|
||||
"syspara/parameter.h",
|
||||
"syspara/parameters.h",
|
||||
"syspara/param_wrapper.h",
|
||||
"syspara/sysparam_errno.h"
|
||||
]
|
||||
},
|
||||
"name": "//base/startup/init/interfaces/innerkits:libbegetutil"
|
||||
},
|
||||
{
|
||||
"header": {
|
||||
"header_base": "//base/startup/init/interfaces/innerkits/include/",
|
||||
"header_files": [
|
||||
"service_watcher.h",
|
||||
"syspara/parameter.h",
|
||||
"syspara/sysparam_errno.h"
|
||||
]
|
||||
},
|
||||
"name": "//base/startup/init/interfaces/innerkits:libbeget_proxy"
|
||||
}
|
||||
],
|
||||
"test": [
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user