未验证 提交 4021ad47 编写于 作者: O openharmony_ci 提交者: Gitee

!323 采用dlopen方式添加对libhidebug的依赖

Merge pull request !323 from hw_mzyan/master
......@@ -151,10 +151,6 @@ if (defined(ohos_lite)) {
"//third_party/cJSON:cjson_static",
]
if (support_jsapi) {
external_deps = [ "profiler:libhidebug" ]
}
cflags = []
if (use_musl) {
......
......@@ -14,15 +14,12 @@
*/
#include "init_service.h"
#include <dlfcn.h>
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
#include <sys/resource.h>
#ifdef SUPPORT_PROFILER_HIDEBUG
#include "hidebug_base.h"
#endif
#include "init_group_manager.h"
#include "init.h"
#include "init_log.h"
......@@ -90,9 +87,19 @@ int ServiceExec(const Service *service)
}
INIT_CHECK_ONLY_ELOG(unsetenv("UV_THREADPOOL_SIZE") == 0, "set UV_THREADPOOL_SIZE error : %d.", errno);
#ifdef SUPPORT_PROFILER_HIDEBUG
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);
#endif
// 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,
......
......@@ -191,9 +191,6 @@ ohos_unittest("init_ut") {
defines += [ "_GNU_SOURCE" ]
external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
if (support_jsapi) {
external_deps += [ "profiler:libhidebug" ]
}
if (param_feature_watcher) {
external_deps += [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册