提交 8d34a205 编写于 作者: M Mupceet

support liteos

Signed-off-by: NMupceet <laiguizhong@huawei.com>
上级 54859a3e
...@@ -33,6 +33,18 @@ if (defined(ohos_lite)) { ...@@ -33,6 +33,18 @@ if (defined(ohos_lite)) {
import("//build/lite/config/component/lite_component.gni") import("//build/lite/config/component/lite_component.gni")
import("//build/lite/ndk/ndk.gni") import("//build/lite/ndk/ndk.gni")
include_common = [
"./include",
"//base/hiviewdfx/hilog_lite/interfaces/native/kits",
"//third_party/bounds_checking_function/include",
"//base/startup/init_lite/services/include",
"//base/startup/init_lite/services/include/param",
"//base/startup/init_lite/interfaces/innerkits/fd_holder",
"//base/startup/init_lite/services/param/include",
"//base/startup/init_lite/interfaces/innerkits/include",
"//base/startup/init_lite/interfaces/hals",
]
if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") { if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") {
shared_library("libbegetutil") { shared_library("libbegetutil") {
sources = [ "//base/startup/init_lite/services/log/init_log.c" ] sources = [ "//base/startup/init_lite/services/log/init_log.c" ]
...@@ -42,6 +54,7 @@ if (defined(ohos_lite)) { ...@@ -42,6 +54,7 @@ if (defined(ohos_lite)) {
"OHOS_LITE", "OHOS_LITE",
] ]
deps = [] deps = []
include_dirs = include_common
if (enable_ohos_startup_init_feature_begetctl_liteos) { if (enable_ohos_startup_init_feature_begetctl_liteos) {
sources += syspara_sources sources += syspara_sources
defines += [ "LITEOS_SUPPORT" ] defines += [ "LITEOS_SUPPORT" ]
...@@ -52,16 +65,7 @@ if (defined(ohos_lite)) { ...@@ -52,16 +65,7 @@ if (defined(ohos_lite)) {
public_configs = [ ":exported_header_files" ] public_configs = [ ":exported_header_files" ]
cflags = [ "-fPIC" ] cflags = [ "-fPIC" ]
include_dirs = [
"./include",
"//base/hiviewdfx/hilog_lite/interfaces/native/kits",
"//third_party/bounds_checking_function/include",
"//base/startup/init_lite/services/include",
"//base/startup/init_lite/services/include/param",
"//base/startup/init_lite/interfaces/innerkits/fd_holder",
"//base/startup/init_lite/services/param/include",
"//base/startup/init_lite/interfaces/innerkits/include",
]
deps += [ deps += [
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//base/startup/init_lite/services/utils:libinit_tools", "//base/startup/init_lite/services/utils:libinit_tools",
...@@ -91,16 +95,7 @@ if (defined(ohos_lite)) { ...@@ -91,16 +95,7 @@ if (defined(ohos_lite)) {
"__LITEOS_M__", "__LITEOS_M__",
] ]
include_dirs = [ include_dirs = include_common
"./include",
"//base/hiviewdfx/hilog_lite/interfaces/native/kits",
"//third_party/bounds_checking_function/include",
"//base/startup/init_lite/services/include",
"//base/startup/init_lite/services/include/param",
"//base/startup/init_lite/interfaces/innerkits/fd_holder",
"//base/startup/init_lite/services/param/include",
"//base/startup/init_lite/interfaces/innerkits/include",
]
deps = [ deps = [
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_static", "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_static",
"//base/startup/init_lite/services/utils:libinit_tools", "//base/startup/init_lite/services/utils:libinit_tools",
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <string.h> #include <string.h>
#include "init_param.h" #include "init_param.h"
#include "hal_sys_param.h"
#include "parameter.h" #include "parameter.h"
#include "sysparam_errno.h" #include "sysparam_errno.h"
#ifdef USE_MBEDTLS #ifdef USE_MBEDTLS
...@@ -46,6 +47,9 @@ INIT_LOCAL_API int GetParameter_(const char *key, const char *def, char *value, ...@@ -46,6 +47,9 @@ INIT_LOCAL_API int GetParameter_(const char *key, const char *def, char *value,
} }
uint32_t size = len; uint32_t size = len;
int ret = SystemGetParameter(key, NULL, &size); int ret = SystemGetParameter(key, NULL, &size);
if (ret == PARAM_CODE_INVALID_NAME || ret == DAC_RESULT_FORBIDED || ret == PARAM_CODE_INVALID_PARAM) {
return EC_FAILURE;
}
if ((size > len) || (ret != 0)) { if ((size > len) || (ret != 0)) {
return strcpy_s(value, len, def); return strcpy_s(value, len, def);
} }
......
...@@ -50,6 +50,8 @@ typedef enum { ...@@ -50,6 +50,8 @@ typedef enum {
PARAM_CODE_READ_ONLY, PARAM_CODE_READ_ONLY,
PARAM_CODE_FAIL_CONNECT, PARAM_CODE_FAIL_CONNECT,
PARAM_CODE_NODE_EXIST, // 9 PARAM_CODE_NODE_EXIST, // 9
DAC_RESULT_INVALID_PARAM = 1000,
DAC_RESULT_FORBIDED,
PARAM_CODE_MAX PARAM_CODE_MAX
} PARAM_CODE; } PARAM_CODE;
......
...@@ -47,11 +47,7 @@ extern "C" { ...@@ -47,11 +47,7 @@ extern "C" {
#define SELINUX_CONTENT_LEN 64 #define SELINUX_CONTENT_LEN 64
#define SYS_UID_INDEX 1000 #define SYS_UID_INDEX 1000
typedef enum { #define DAC_RESULT_PERMISSION 0
DAC_RESULT_PERMISSION = 0,
DAC_RESULT_INVALID_PARAM = 1000,
DAC_RESULT_FORBIDED,
} DAC_RESULT;
typedef struct UserCred { typedef struct UserCred {
pid_t pid; pid_t pid;
......
...@@ -192,6 +192,7 @@ ohos_unittest("init_ut") { ...@@ -192,6 +192,7 @@ ohos_unittest("init_ut") {
"//base/security/access_token/interfaces/innerkits/token_setproc/include", "//base/security/access_token/interfaces/innerkits/token_setproc/include",
"//base/security/access_token/interfaces/innerkits/nativetoken/include", "//base/security/access_token/interfaces/innerkits/nativetoken/include",
"//base/startup/init_lite/interfaces/innerkits/sandbox/include", "//base/startup/init_lite/interfaces/innerkits/sandbox/include",
"//base/startup/init_lite/interfaces/innerkits/hals",
] ]
deps = [ deps = [
......
...@@ -95,6 +95,7 @@ if (defined(ohos_lite)) { ...@@ -95,6 +95,7 @@ if (defined(ohos_lite)) {
"//third_party/bounds_checking_function/include", "//third_party/bounds_checking_function/include",
"//base/hiviewdfx/hilog_lite/interfaces/native/kits", "//base/hiviewdfx/hilog_lite/interfaces/native/kits",
"//base/startup/init_lite/interfaces/innerkits/fd_holder", "//base/startup/init_lite/interfaces/innerkits/fd_holder",
"//base/startup/init_lite/interfaces/hals",
] ]
sources = sysparam_source sources = sysparam_source
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册