提交 b4f2f42c 编写于 作者: Y yanmengzhao

add param init for init_cmds.

Signed-off-by: Nyanmengzhao <yanmengzhao1@huawei.com>
上级 b7c2b4aa
......@@ -14,6 +14,7 @@
*/
#include "init_cmds.h"
#include <dlfcn.h>
#include <errno.h>
#include <fcntl.h>
#include <net/if.h>
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册