diff --git a/device_info/BUILD.gn b/device_info/BUILD.gn index cf3f2e244b9b3dd1c22851f03103229ec60a08ec..06125466bdf24046faf16334b570aaccefa921e2 100644 --- a/device_info/BUILD.gn +++ b/device_info/BUILD.gn @@ -40,11 +40,7 @@ ohos_shared_library("deviceinfoservice") { ] deps = [ - "//base/startup/init_lite/services/log:agent_log", - "//base/startup/init_lite/services/loopevent:loopevent", - "//base/startup/init_lite/services/param:param_client", - "//base/startup/init_lite/services/utils:libinit_tools", - "//base/startup/init_lite/services/utils:libinit_utils", + "//base/startup/init_lite/interfaces/innerkits:libbegetutil", "//third_party/bounds_checking_function:libsec_shared", "//third_party/openssl:libcrypto_shared", ] diff --git a/interfaces/innerkits/BUILD.gn b/interfaces/innerkits/BUILD.gn index 887bd3649b9c66e3b243df8443b92786ffc523fc..a0a7cf03de30f3ad9c51044fa6595477a71c5706 100755 --- a/interfaces/innerkits/BUILD.gn +++ b/interfaces/innerkits/BUILD.gn @@ -226,8 +226,10 @@ if (defined(ohos_lite)) { ] deps = [ + ":libbegetutil", "//base/startup/init_lite/services/utils:libinit_utils", "//third_party/bounds_checking_function:libsec_shared", + "//third_party/openssl:libcrypto_shared", ] if (enable_ohos_startup_init_feature_watcher) { @@ -241,12 +243,6 @@ if (defined(ohos_lite)) { "//base/startup/init_lite/services/param/watcher/include", "//base/startup/init_lite/services/log", ] - deps += [ - "//base/startup/init_lite/services/param:param_client", - "//base/startup/init_lite/services/utils:libinit_tools", - "//base/startup/init_lite/services/utils:libinit_utils", - "//third_party/openssl:libcrypto_shared", - ] } else { defines += [ "NO_PARAM_WATCHER" ] } @@ -261,13 +257,6 @@ if (defined(ohos_lite)) { sources += [ "//base/startup/init_lite/interfaces/innerkits/syspara/param_comm.c", ] - deps += [ - "//base/startup/init_lite/services/loopevent:loopevent", - "//base/startup/init_lite/services/param:param_client", - "//base/startup/init_lite/services/utils:libinit_tools", - "//base/startup/init_lite/services/utils:libinit_utils", - "//third_party/openssl:libcrypto_shared", - ] } external_deps = [ diff --git a/services/begetctl/main.c b/services/begetctl/main.c index 5a06fa35679828c1b91435e93cef3e8553196076..e324064df10520bacd8ddc53efb765763db61daa 100644 --- a/services/begetctl/main.c +++ b/services/begetctl/main.c @@ -74,7 +74,7 @@ int main(int argc, char *argv[]) printf("Failed to get shell handle \n"); return 0; } - SetInitLogLevel(0); + BShellParamCmdRegister(handle, 0); #ifdef INIT_TEST BShellCmdRegister(handle, 0); diff --git a/services/begetctl/shell/shell_main.c b/services/begetctl/shell/shell_main.c index 929da598366983a74f249d0df01b7ea118c6ed76..eb25b3334a0ea07768f9f3a7ec8a00201583487f 100644 --- a/services/begetctl/shell/shell_main.c +++ b/services/begetctl/shell/shell_main.c @@ -73,7 +73,6 @@ int main(int argc, char *args[]) tio.c_cc[VMIN] = 1; tcsetattr(0, TCSAFLUSH, &tio); - SetInitLogLevel(0); BSH_LOGV("BShellEnvStart %d", argc); do { BShellHandle handle = GetShellHandle(); diff --git a/services/log/init_log.c b/services/log/init_log.c index bc7bde27ed13cc555df3326767c636aa888e8971..5c1e4d4d919c2318921caac48542270dcde784f3 100644 --- a/services/log/init_log.c +++ b/services/log/init_log.c @@ -32,6 +32,7 @@ #include "hilog_base/log_base.h" #endif +#define DEF_LOG_SIZE 128 #define MAX_LOG_SIZE 1024 #define BASE_YEAR 1900 @@ -105,9 +106,13 @@ void InitLog(InitLogLevel logLevel, unsigned int domain, const char *tag, const } va_list vargs; va_start(vargs, fmt); - char tmpFmt[MAX_LOG_SIZE] = {0}; - if (vsnprintf_s(tmpFmt, MAX_LOG_SIZE, MAX_LOG_SIZE - 1, fmt, vargs) == -1) { + char tmpFmt[DEF_LOG_SIZE] = {0}; + if (vsnprintf_s(tmpFmt, sizeof(tmpFmt), sizeof(tmpFmt) - 1, fmt, vargs) == -1) { va_end(vargs); +#ifdef OHOS_LITE + static LogLevel LOG_LEVEL[] = { LOG_DEBUG, LOG_INFO, LOG_WARN, LOG_ERROR, LOG_FATAL }; + (void)HiLogPrint(INIT_LOG_INIT, LOG_LEVEL[logLevel], domain, tag, "%{public}s", fmt); +#endif return; } va_end(vargs); diff --git a/services/loopevent/loop/le_loop.c b/services/loopevent/loop/le_loop.c index ecdbfd026d0866561e888ce5a4b451cdd448384a..6796ffc8d82c31f142be3fc3677f7375df416c30 100644 --- a/services/loopevent/loop/le_loop.c +++ b/services/loopevent/loop/le_loop.c @@ -92,7 +92,6 @@ LE_STATUS ProcessEvent(const EventLoop *loop, int fd, uint32_t oper) } task->handleEvent((LoopHandle)loop, (TaskHandle)task, oper); } else { - LE_LOGE("ProcessEvent can not find task for %d", fd); loop->delEvent(loop, fd, oper); } return LE_SUCCESS; diff --git a/services/param/linux/param_request.c b/services/param/linux/param_request.c index 88aeebdf135607888e90e5b030e39aaf29f2047c..762230af6b35a8a0031eead7e7ef042b90a77c61 100755 --- a/services/param/linux/param_request.c +++ b/services/param/linux/param_request.c @@ -44,13 +44,13 @@ static int InitParamClient(void) if (PARAM_TEST_FLAG(g_clientSpace.flags, WORKSPACE_FLAGS_INIT)) { return 0; } - PARAM_LOGV("InitParamClient"); + PARAM_LOGI("InitParamClient %p", &g_clientSpace); pthread_mutex_init(&g_clientSpace.mutex, NULL); g_clientSpace.clientFd = INVALID_SOCKET; int ret = InitParamWorkSpace(1); PARAM_CHECK(ret == 0, return -1, "Failed to init param workspace"); PARAM_SET_FLAG(g_clientSpace.flags, WORKSPACE_FLAGS_INIT); - PARAM_LOGI("InitParamClient finish"); + PARAM_LOGI("InitParamClient %p finish", &g_clientSpace); return 0; } @@ -64,6 +64,7 @@ void ClientInit(void) void ClientDeinit(void) { + PARAM_LOGI("ClientDeinit %p", &g_clientSpace); #ifndef STARTUP_INIT_TEST if (PARAM_TEST_FLAG(g_clientSpace.flags, WORKSPACE_FLAGS_INIT)) { CloseParamWorkSpace(); @@ -74,6 +75,7 @@ void ClientDeinit(void) } PARAM_SET_FLAG(g_clientSpace.flags, 0); pthread_mutex_destroy(&g_clientSpace.mutex); + PARAM_LOGI("ClientDeinit %p finish", &g_clientSpace); } static int ProcessRecvMsg(const ParamMessage *recvMsg) @@ -177,7 +179,6 @@ int SystemSetParameter(const char *name, const char *value) request->msgSize = offset + sizeof(ParamMessage); request->id.msgId = atomic_fetch_add(&g_requestId, 1); - PARAM_LOGV("SystemSetParameter name %s", name); int fd = INVALID_SOCKET; pthread_mutex_lock(&g_clientSpace.mutex); if (g_clientSpace.clientFd == INVALID_SOCKET) { @@ -188,6 +189,7 @@ int SystemSetParameter(const char *name, const char *value) PARAM_CHECK(fd > 0, return -1, "Failed to connect server for set %s", name); ret = StartRequest(fd, request, DEFAULT_PARAM_SET_TIMEOUT); free(request); + PARAM_LOGI("SystemSetParameter name %s %d", name, ret); return ret; } diff --git a/services/param/manager/param_manager.c b/services/param/manager/param_manager.c index fbd0521a843bbfe225450bb0cce0d37bc8efe848..c91021a170742d58f12d746f040b823566e5be0f 100644 --- a/services/param/manager/param_manager.c +++ b/services/param/manager/param_manager.c @@ -117,6 +117,7 @@ PARAM_STATIC int RegisterSecurityOps(int onlyRead) int InitParamWorkSpace(int onlyRead) { + PARAM_LOGI("InitParamWorkSpace %p", &g_paramWorkSpace); if (PARAM_TEST_FLAG(g_paramWorkSpace.flags, WORKSPACE_FLAGS_INIT)) { return 0; } @@ -695,7 +696,6 @@ WorkSpace *GetWorkSpace(const char *name) space = HASHMAP_ENTRY(node, WorkSpace, hashNode); } WORKSPACE_RW_UNLOCK(g_paramWorkSpace); - PARAM_LOGV("GetWorkSpace %s space-name %s, space %p", name, tmpName, space); return (space != NULL && space->area != NULL) ? space : NULL; } diff --git a/services/param/manager/param_trie.c b/services/param/manager/param_trie.c index 1ef247908b6a8623ae2647d23055395d6d09b888..3d62ec008b60d300ceddeba62e3ec59eb087936b 100644 --- a/services/param/manager/param_trie.c +++ b/services/param/manager/param_trie.c @@ -112,12 +112,14 @@ int InitWorkSpace(WorkSpace *workSpace, int onlyRead, uint32_t spaceSize) PARAM_CHECK(ret == 0, return ret, "Failed to init workspace %s", workSpace->fileName); PARAMSPACE_AREA_INIT_LOCK(workSpace); PARAM_SET_FLAG(workSpace->flags, WORKSPACE_FLAGS_INIT); + PARAM_LOGI("InitWorkSpace %s", workSpace->fileName); return ret; } void CloseWorkSpace(WorkSpace *workSpace) { PARAM_CHECK(workSpace != NULL, return, "The workspace is null"); + PARAM_LOGI("CloseWorkSpace %s", workSpace->fileName); if (!PARAM_TEST_FLAG(workSpace->flags, WORKSPACE_FLAGS_INIT)) { free(workSpace); return;