提交 c056e3a1 编写于 作者: M Mupceet

add: ueventd parse config in vendor

Signed-off-by: NMupceet <laiguizhong@huawei.com>
上级 b0aae888
......@@ -32,6 +32,7 @@ if (defined(ohos_lite)) {
include_dirs = [
"//third_party/bounds_checking_function/include",
"//base/startup/init_lite/services/include/param",
"//base/startup/init_lite/services/log",
"//base/startup/init_lite/interfaces/innerkits/include",
"//base/startup/init_lite/services/include",
......@@ -41,6 +42,8 @@ if (defined(ohos_lite)) {
deps = [
"//base/startup/init_lite/services/log:init_log",
"//base/startup/init_lite/services/param:param_client",
"//base/startup/init_lite/services/utils:libinit_tools",
"//third_party/bounds_checking_function:libsec_static",
]
}
......@@ -120,7 +123,10 @@ if (defined(ohos_lite)) {
"//base/startup/init_lite/interfaces/innerkits/include",
]
deps = service_ueventd_deps
deps += [ "//base/startup/init_lite/interfaces/innerkits:libbegetutil" ]
deps += [
"//base/startup/init_lite/interfaces/innerkits:libbegetutil",
"//base/startup/init_lite/services/param:param_client",
]
cflags = []
if (build_selinux) {
......
......@@ -13,13 +13,16 @@
* limitations under the License.
*/
#include <limits.h>
#include <poll.h>
#include "ueventd.h"
#include "ueventd_read_cfg.h"
#include "ueventd_socket.h"
#define INIT_LOG_TAG "ueventd"
#include "init_log.h"
#include "init_param.h"
#include "init_socket.h"
#include "securec.h"
static void PollUeventdSocketTimeout(int ueventSockFd)
{
......@@ -46,7 +49,24 @@ static void PollUeventdSocketTimeout(int ueventSockFd)
int main(int argc, char **argv)
{
char *ueventdConfigs[] = {"/etc/ueventd.config", NULL};
char *vendorConfig = NULL;
do {
char hardware[CMDLINE_VALUE_LEN_MAX] = {0};
unsigned int buffLen = (unsigned int)CMDLINE_VALUE_LEN_MAX;
int ret = SystemReadParam("ohos.boot.hardware", hardware, &buffLen);
if (ret != 0) {
INIT_LOGE("Failed to get hardware parameter value");
break;
}
char configFile[PATH_MAX] = {0};
ret = snprintf_s(configFile, PATH_MAX, PATH_MAX -1, "/vendor/etc/ueventd.%s.config", hardware);
if (ret < 0) {
INIT_LOGE("Failed to format vendor config file path");
break;
}
vendorConfig = configFile;
} while (0);
char *ueventdConfigs[] = {"/etc/ueventd.config", vendorConfig, NULL};
int i = 0;
while (ueventdConfigs[i] != NULL) {
ParseUeventdConfigFile(ueventdConfigs[i++]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册