From b4f2f42cd2ace5d43d20e009805c55d799c03754 Mon Sep 17 00:00:00 2001 From: yanmengzhao Date: Mon, 28 Feb 2022 10:50:30 +0800 Subject: [PATCH] add param init for init_cmds. Signed-off-by: yanmengzhao --- services/init/standard/init_cmds.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/services/init/standard/init_cmds.c b/services/init/standard/init_cmds.c index e2abaa65..eda20e21 100755 --- a/services/init/standard/init_cmds.c +++ b/services/init/standard/init_cmds.c @@ -14,6 +14,7 @@ */ #include "init_cmds.h" +#include #include #include #include @@ -180,6 +181,20 @@ static void DoExec(const struct CmdArgs *ctx) if (pid == 0) { INIT_ERROR_CHECK(ctx != NULL && ctx->argv[0] != NULL, _exit(0x7f), "DoExec: invalid arguments to exec \"%s\"", ctx->argv[0]); +#ifdef SUPPORT_PROFILER_HIDEBUG + void* handle = dlopen("/system/lib/libhidebug.so", RTLD_LAZY); + if (handle == NULL) { + INIT_LOGE("Failed to dlopen libhidebug.so, %s\n", dlerror()); + return; + } + bool (* initParam)(); + initParam = (bool (*)())dlsym(handle, "InitEnvironmentParam"); + if (initParam == NULL) { + INIT_LOGE("Failed to dlsym InitEnvironmentParam, %s\n", dlerror()); + return; + } + (*initParam)(ctx->argv[0]); +#endif int ret = execv(ctx->argv[0], ctx->argv); if (ret == -1) { INIT_LOGE("DoExec: execute \"%s\" failed: %d.", ctx->argv[0], errno); -- GitLab