diff --git a/interfaces/innerkits/BUILD.gn b/interfaces/innerkits/BUILD.gn index e4c8d9c2bdd1b4037e37e533aaced11f0ea47e1d..2291ba8e16ea37c0efb05561a5038abb475855f0 100755 --- a/interfaces/innerkits/BUILD.gn +++ b/interfaces/innerkits/BUILD.gn @@ -254,7 +254,7 @@ if (defined(ohos_lite)) { external_deps = [ "c_utils:utils", "hilog_native:libhilog_base", - "ipc:ipc_core", + "ipc:ipc_single", "samgr:samgr_proxy", ] public_configs = [ ":exported_header_files" ] diff --git a/services/init/init_service_manager.c b/services/init/init_service_manager.c index 690a0eacb549ecd3779046e39730d6795074a55a..8a7779f3246b842c699c144a8d4dfb7240179f5c 100755 --- a/services/init/init_service_manager.c +++ b/services/init/init_service_manager.c @@ -1036,6 +1036,10 @@ void ParseAllServices(const cJSON *fileRoot) static Service *GetServiceByExtServName(const char *fullServName) { INIT_ERROR_CHECK(fullServName != NULL, return NULL, "Failed get parameters"); + Service *service = GetServiceByName(fullServName); + if (service != NULL) { // none parameter in fullServName + return service; + } char *tmpServName = strdup(fullServName); char *dstPtr[MAX_PATH_ARGS_CNT] = {NULL}; int returnCount = SplitString(tmpServName, "|", dstPtr, MAX_PATH_ARGS_CNT); @@ -1043,7 +1047,7 @@ static Service *GetServiceByExtServName(const char *fullServName) free(tmpServName); return NULL; } - Service *service = GetServiceByName(dstPtr[0]); + service = GetServiceByName(dstPtr[0]); if (service == NULL) { free(tmpServName); return NULL; @@ -1060,9 +1064,6 @@ static Service *GetServiceByExtServName(const char *fullServName) for (extArgc = 0; extArgc < (returnCount - 1); extArgc++) { service->extraArgs.argv[extArgc + argc] = strdup(dstPtr[extArgc + 1]); } - for (int i = 0; i < service->extraArgs.count - 1; i++) { - INIT_LOGI("service->extraArgs.argv[%d] is %s", i, service->extraArgs.argv[i]); - } service->extraArgs.argv[service->extraArgs.count] = NULL; free(tmpServName); return service; @@ -1102,7 +1103,7 @@ void StopAllServices(int flags, const char **exclude, int size, int (*filter)(const Service *service, const char **exclude, int size)) { Service *service = GetServiceByName("appspawn"); - if (service != NULL && service->pid != -1) { // notify appspawn stop + if (service != NULL && service->pid > 0) { // notify appspawn stop #ifndef STARTUP_INIT_TEST kill(service->pid, SIGTERM); waitpid(service->pid, 0, 0); diff --git a/services/init/standard/init_cmds.c b/services/init/standard/init_cmds.c index bea9bbeec9195cfc4e4ae50428c2817409e7432e..e14e834b8bf34e11b437368ba99958f28d7ffed1 100755 --- a/services/init/standard/init_cmds.c +++ b/services/init/standard/init_cmds.c @@ -89,11 +89,12 @@ int GetParamValue(const char *symValue, unsigned int symLen, char *paramValue, u return 0; } -static int SyncExecCommand(int argc, char * const *argv) +static void SyncExecCommand(int argc, char * const *argv) { - INIT_CHECK(!(argc == 0 || argv == NULL || argv[0] == NULL), return -1); + INIT_CHECK(!(argc == 0 || argv == NULL || argv[0] == NULL), return); + INIT_LOGI("sync exec: %s", argv[0]); pid_t pid = fork(); - INIT_ERROR_CHECK(!(pid < 0), return -1, "Fork new process to format failed: %d", errno); + INIT_ERROR_CHECK(!(pid < 0), return, "Fork new process to format failed: %d", errno); if (pid == 0) { INIT_CHECK_ONLY_ELOG(execv(argv[0], argv) == 0, "execv %s failed! err %d.", argv[0], errno); exit(-1); @@ -102,11 +103,10 @@ static int SyncExecCommand(int argc, char * const *argv) pid_t ret = waitpid(pid, &status, 0); if (ret != pid) { INIT_LOGE("Failed to wait pid %d, errno %d", pid, errno); - return ret; + return; } - INIT_CHECK_ONLY_ELOG(!(!WIFEXITED(status) || WEXITSTATUS(status) != 0), - "Command %s failed with status %d", argv[0], WEXITSTATUS(status)); - return 0; + INIT_LOGI("sync exec: %s result %d %d", argv[0], WEXITSTATUS(status), WIFEXITED(status)); + return; } static void DoIfup(const struct CmdArgs *ctx) @@ -198,8 +198,7 @@ static void DoSyncExec(const struct CmdArgs *ctx) // format: syncexec /xxx/xxx/xxx xxx INIT_ERROR_CHECK(ctx != NULL && ctx->argv[0] != NULL, return, "DoSyncExec: invalid arguments to exec \"%s\"", ctx->argv[0]); - int ret = SyncExecCommand(ctx->argc, ctx->argv); - INIT_LOGI("DoSyncExec end with ret %d", ret); + SyncExecCommand(ctx->argc, ctx->argv); return; } @@ -288,7 +287,8 @@ static void DoMakeDevice(const struct CmdArgs *ctx) static void DoMountFstabFile(const struct CmdArgs *ctx) { INIT_LOGI("Mount partitions from fstab file \" %s \"", ctx->argv[0]); - (void)MountAllWithFstabFile(ctx->argv[0], 0); + int ret = MountAllWithFstabFile(ctx->argv[0], 0); + INIT_LOGI("Mount partitions from fstab file \" %s \" finish ret %d", ctx->argv[0], ret); } static void DoUmountFstabFile(const struct CmdArgs *ctx) @@ -420,7 +420,6 @@ static bool InitFscryptPolicy(void) static void DoInitGlobalKey(const struct CmdArgs *ctx) { - INIT_LOGI("DoInitGlobalKey: start"); if (ctx == NULL || ctx->argc != 1) { INIT_LOGE("DoInitGlobalKey: para invalid"); return; @@ -442,13 +441,11 @@ static void DoInitGlobalKey(const struct CmdArgs *ctx) NULL }; int argc = ARRAY_LENGTH(argv); - int ret = SyncExecCommand(argc, argv); - INIT_LOGI("DoInitGlobalKey: end, ret = %d", ret); + SyncExecCommand(argc, argv); } static void DoInitMainUser(const struct CmdArgs *ctx) { - INIT_LOGI("DoInitMainUser: start"); if (ctx == NULL) { INIT_LOGE("DoInitMainUser: para invalid"); return; @@ -461,13 +458,11 @@ static void DoInitMainUser(const struct CmdArgs *ctx) NULL }; int argc = ARRAY_LENGTH(argv); - int ret = SyncExecCommand(argc, argv); - INIT_LOGI("DoInitMainUser: end, ret = %d", ret); + SyncExecCommand(argc, argv); } static void DoMkswap(const struct CmdArgs *ctx) { - INIT_LOGI("DoMkswap: start"); if (ctx == NULL) { INIT_LOGE("DoMkswap: para invalid"); return; @@ -478,13 +473,11 @@ static void DoMkswap(const struct CmdArgs *ctx) NULL }; int argc = ARRAY_LENGTH(argv); - int ret = SyncExecCommand(argc, argv); - INIT_LOGI("DoMkswap: end, ret = %d", ret); + SyncExecCommand(argc, argv); } static void DoSwapon(const struct CmdArgs *ctx) { - INIT_LOGI("DoSwapon: start"); if (ctx == NULL) { INIT_LOGE("DoSwapon: para invalid"); return; @@ -495,8 +488,7 @@ static void DoSwapon(const struct CmdArgs *ctx) NULL }; int argc = ARRAY_LENGTH(argv); - int ret = SyncExecCommand(argc, argv); - INIT_LOGI("DoSwapon: end, ret = %d", ret); + SyncExecCommand(argc, argv); } static void DoMkSandbox(const struct CmdArgs *ctx) diff --git a/services/init/standard/switch_root.c b/services/init/standard/switch_root.c index 8375a9188e8a5375721e60b69e7a7241031ca03c..b91c3cf35e03a977b51e243d345202f8770e1d48 100644 --- a/services/init/standard/switch_root.c +++ b/services/init/standard/switch_root.c @@ -199,5 +199,6 @@ int SwitchRoot(const char *newRoot) return -1; } FreeRootDir(oldRoot, oldRootStat.st_dev); + INIT_LOGI("SwitchRoot to %s finish", newRoot); return 0; } diff --git a/services/modules/bootchart/BUILD.gn b/services/modules/bootchart/BUILD.gn index 5abae303d6e585d42248c8fe919ad82675d89298..83427c840bff60542b3afca1cbd9e37deaf55c2e 100755 --- a/services/modules/bootchart/BUILD.gn +++ b/services/modules/bootchart/BUILD.gn @@ -23,7 +23,6 @@ ohos_shared_library("bootchart") { ] deps = [ - "//base/startup/init/interfaces/innerkits:libbegetutil", "//third_party/bounds_checking_function:libsec_shared", "//third_party/cJSON:cjson_static", ] diff --git a/ueventd/BUILD.gn b/ueventd/BUILD.gn index ba4f68c867d026a916de61b2551e61453a3bda79..b53f056912f2c07401616f5f8647516169b4cd5b 100644 --- a/ueventd/BUILD.gn +++ b/ueventd/BUILD.gn @@ -89,11 +89,6 @@ if (defined(ohos_lite)) { deps = service_ueventd_deps defines = [ "__RAMDISK__" ] cflags = [] - if (use_musl == false) { - deps += [ "//base/startup/init/services/param/base:parameterbase" ] - } else { - deps += [ "//base/startup/init/services/param/base:parameterbase_ext" ] - } if (build_selinux) { external_deps = [ "selinux:librestorecon" ] cflags += [ "-DWITH_SELINUX" ] diff --git a/watchdog/BUILD.gn b/watchdog/BUILD.gn index 3a5921636064a53c4429c60ba65a189bc06bd6d1..10ea17cf72ff269d0487f06e59d3bf498464e9a2 100644 --- a/watchdog/BUILD.gn +++ b/watchdog/BUILD.gn @@ -32,16 +32,14 @@ if (defined(ohos_lite)) { } else { import("//build/ohos.gni") ohos_executable("watchdog_service") { - sources = [ "init_watchdog.c" ] + sources = [ + "//base/startup/init/services/log/init_commlog.c", + "init_watchdog.c", + ] deps = [ "//base/startup/init/services/log:init_log", "//third_party/bounds_checking_function:libsec_shared", ] - if (use_musl == false) { - deps += [ "//base/startup/init/services/param/base:parameterbase" ] - } else { - deps += [ "//base/startup/init/services/param/base:parameterbase_ext" ] - } defines = [ "LINUX_WATCHDOG" ] defines += [ "_GNU_SOURCE" ] install_enable = true