提交 2469ed59 编写于 作者: Y yanmengzhao

import libhidebug with dlopen func.

Signed-off-by: Nyanmengzhao <yanmengzhao1@huawei.com>
上级 8dd0fb87
......@@ -151,8 +151,6 @@ if (defined(ohos_lite)) {
"//third_party/cJSON:cjson_static",
]
external_deps = [ "profiler:libhidebug" ]
cflags = []
if (use_musl) {
......
......@@ -14,12 +14,12 @@
*/
#include "init_service.h"
#include <dlfcn.h>
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
#include <sys/resource.h>
#include "hidebug_base.h"
#include "init_group_manager.h"
#include "init.h"
#include "init_log.h"
......@@ -86,7 +86,18 @@ int ServiceExec(const Service *service)
}
}
INIT_CHECK_ONLY_ELOG(unsetenv("UV_THREADPOOL_SIZE") == 0, "set UV_THREADPOOL_SIZE error : %d.", errno);
InitEnvironmentParam(service->name);
void* handle = dlopen("/system/lib/libhidebug.so", RTLD_LAZY);
if (handle == NULL) {
INIT_LOGE("Failed to dlopen libhidebug.so, %s\n", dlerror());
return SERVICE_FAILURE;
}
bool (* initParam)();
initParam = (bool (*)())dlsym(handle, "InitEnvironmentParam");
if (initParam == NULL) {
INIT_LOGE("Failed to dlsym InitEnvironmentParam, %s\n", dlerror());
return SERVICE_FAILURE;
}
(*initParam)(service->name);
// L2 Can not be reset env
if (service->extraArgs.argv != NULL && service->extraArgs.count > 0) {
INIT_CHECK_ONLY_ELOG(execv(service->extraArgs.argv[0], service->extraArgs.argv) == 0,
......
......@@ -190,10 +190,7 @@ ohos_unittest("init_ut") {
]
defines += [ "_GNU_SOURCE" ]
external_deps = [
"hiviewdfx_hilog_native:libhilog",
"profiler:libhidebug",
]
external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
if (param_feature_watcher) {
external_deps += [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册