提交 10f88cac 编写于 作者: 熊磊 提交者: Gitee

Merge branch 'OpenHarmony-3.1-Release' of gitee.com:openharmony/startup_init_lite into init_3.1

Signed-off-by: Nxionglei <xionglei6@huawei.com>
......@@ -182,18 +182,29 @@ static void DoExec(const struct CmdArgs *ctx)
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]);
do {
if (access("/system/lib/libhidebug.so", F_OK) != 0) {
INIT_LOGE("access failed, errno = %d\n", errno);
break;
}
void* handle = dlopen("/system/lib/libhidebug.so", RTLD_LAZY);
if (handle == NULL) {
INIT_LOGE("Failed to dlopen libhidebug.so, %s\n", dlerror());
break;
}
bool (* initParam)();
initParam = (bool (*)())dlsym(handle, "InitEnvironmentParam");
if (initParam == NULL) {
INIT_LOGE("Failed to dlsym InitEnvironmentParam, %s\n", dlerror());
dlclose(handle);
break;
}
bool ret = (*initParam)(ctx->argv[0]);
if (!ret) {
INIT_LOGE("init parameters failed.\n");
}
dlclose(handle);
} while (0);
#endif
int ret = execv(ctx->argv[0], ctx->argv);
if (ret == -1) {
......
......@@ -19,6 +19,7 @@
#include <string.h>
#include <sys/param.h>
#include <sys/resource.h>
#include <unistd.h>
#include "init_group_manager.h"
#include "init.h"
......@@ -87,18 +88,29 @@ 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
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);
do {
if (access("/system/lib/libhidebug.so", F_OK) != 0) {
INIT_LOGE("access failed, errno = %d\n", errno);
break;
}
void* handle = dlopen("/system/lib/libhidebug.so", RTLD_LAZY);
if (handle == NULL) {
INIT_LOGE("Failed to dlopen libhidebug.so, %s\n", dlerror());
break;
}
bool (* initParam)();
initParam = (bool (*)())dlsym(handle, "InitEnvironmentParam");
if (initParam == NULL) {
INIT_LOGE("Failed to dlsym InitEnvironmentParam, %s\n", dlerror());
dlclose(handle);
break;
}
bool ret = (*initParam)(service->name);
if (!ret) {
INIT_LOGE("init parameters failed.\n");
}
dlclose(handle);
} while (0);
#endif
// L2 Can not be reset env
if (service->extraArgs.argv != NULL && service->extraArgs.count > 0) {
......
......@@ -25,6 +25,7 @@ uint32_t WatcherManagerProxy::AddWatcher(const std::string &keyPrefix, const spt
WATCHER_CHECK(remote != nullptr, return 0, "Can not get remote");
MessageParcel data;
data.WriteInterfaceToken(WatcherManagerProxy::GetDescriptor());
data.WriteString(keyPrefix);
bool ret = data.WriteRemoteObject(watcher->AsObject());
WATCHER_CHECK(ret, return 0, "Can not get remote");
......@@ -42,6 +43,7 @@ int32_t WatcherManagerProxy::DelWatcher(const std::string &keyPrefix, uint32_t w
WATCHER_CHECK(remote != nullptr, return ERR_FLATTEN_OBJECT, "Can not get remote");
MessageParcel data;
data.WriteInterfaceToken(WatcherManagerProxy::GetDescriptor());
data.WriteString(keyPrefix);
data.WriteUint32(watcherId);
MessageParcel reply;
......
......@@ -22,6 +22,10 @@ namespace OHOS {
namespace init_param {
int32_t WatcherStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
{
std::u16string myDescripter = IWatcher::GetDescriptor();
std::u16string remoteDescripter = data.ReadInterfaceToken();
WATCHER_CHECK(myDescripter == remoteDescripter, return -1, "Invalid remoteDescripter");
switch (code) {
case PARAM_CHANGE: {
std::string name = data.ReadString();
......
......@@ -21,6 +21,10 @@ namespace init_param {
int32_t WatcherManagerStub::OnRemoteRequest(uint32_t code,
MessageParcel &data, MessageParcel &reply, MessageOption &option)
{
std::u16string myDescripter = IWatcherManager::GetDescriptor();
std::u16string remoteDescripter = data.ReadInterfaceToken();
WATCHER_CHECK(myDescripter == remoteDescripter, return -1, "Invalid remoteDescripter");
switch (code) {
case ADD_WATCHER: {
std::string key = data.ReadString();
......
......@@ -32,6 +32,7 @@ void WatcherProxy::OnParamerterChange(const std::string &name, const std::string
auto remote = Remote();
WATCHER_CHECK(remote != nullptr, return, "Can not get remote");
data.WriteInterfaceToken(WatcherProxy::GetDescriptor());
data.WriteString(name);
data.WriteString(value);
int ret = remote->SendRequest(PARAM_CHANGE, data, reply, option);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册