diff --git a/default_config/mini/config.gni b/default_config/mini/config.gni index 4df9b5ab904650b1060e235918094df00085ed30..e8ce0b504e2c572ae2757091eb1e05609941a7a6 100644 --- a/default_config/mini/config.gni +++ b/default_config/mini/config.gni @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (C) 2021-2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -33,4 +33,5 @@ declare_args() { enable_key_agree_pake_ec_prime_x25519 = true max_auth_session_count = 10 + deviceauth_hichain_thread_stack_size = 8192 } diff --git a/default_config/small/config.gni b/default_config/small/config.gni index bcb0fead8526028a203898c3a12a9c4eee151490..2a89b7959e38f63a00f03d0a448b4f4af4cf8e11 100644 --- a/default_config/small/config.gni +++ b/default_config/small/config.gni @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (C) 2021-2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -32,4 +32,5 @@ declare_args() { enable_key_agree_pake_ec_prime_x25519 = true max_auth_session_count = 10 + deviceauth_hichain_thread_stack_size = 8192 } diff --git a/default_config/standard/config.gni b/default_config/standard/config.gni index 04a6df3de6fef3181455de6bea83cb79dee8e79c..db7643b98e6d8c690e0f20e4104446dcdcb2c2e0 100644 --- a/default_config/standard/config.gni +++ b/default_config/standard/config.gni @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (C) 2021-2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -32,4 +32,5 @@ declare_args() { enable_key_agree_pake_ec_prime_x25519 = true max_auth_session_count = 10 + deviceauth_hichain_thread_stack_size = 20480 } diff --git a/deps_adapter/os_adapter/impl/src/linux/hc_thread.c b/deps_adapter/os_adapter/impl/src/linux/hc_thread.c index 711b725021bf4b4863cd14cdb50f618977604171..c1d6261673a979423b224d78fd9d92d921e5d65d 100644 --- a/deps_adapter/os_adapter/impl/src/linux/hc_thread.c +++ b/deps_adapter/os_adapter/impl/src/linux/hc_thread.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -33,6 +33,9 @@ void *StaticThreadFunc(void *args) int res = pthread_setname_np(pthread_self(), StringGet(&thread->name)); if (res != 0) { LOGW("[OS]: pthread_setname_np fail. [Res]: %d", res); + } else { + LOGI("[OS]: pthread_setname_np success. [StackSize]: %zu, [Name]: %s", + thread->stackSize, StringGet(&thread->name)); } if (thread->threadFunc) { diff --git a/services/BUILD.gn b/services/BUILD.gn index 99429ce006029f5167395a9cd894ca013a03e4ac..edf76140dd1c31cad1c0e326eaef293dcc16f855 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -65,9 +65,9 @@ if (os_level == "mini" || os_level == "small") { cflags = build_flags } cflags += [ - "-DHICHAIN_THREAD_STACK_SIZE=${deviceauth_hichain_thread_stack_size}", + "-DDEV_AUTH_WORK_THREAD_STACK_SIZE=${deviceauth_hichain_thread_stack_size}", + "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}", ] - cflags += [ "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}" ] if (ohos_kernel_type == "linux" || ohos_kernel_type == "liteos_a") { include_dirs += [ "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog" ] @@ -183,7 +183,10 @@ if (os_level == "mini" || os_level == "small") { defines += [ "HILOG_ENABLE" ] defines += [ "DEV_AUTH_HIVIEW_ENABLE" ] cflags = build_flags - cflags += [ "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}" ] + cflags += [ + "-DDEV_AUTH_WORK_THREAD_STACK_SIZE=${deviceauth_hichain_thread_stack_size}", + "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}", + ] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } diff --git a/services/deviceauth.gni b/services/deviceauth.gni index e39a8aaca93bf49c9ecd07198c87b687b371c0b7..638a6033af19e3266e95b39610a1b31645fe4acf 100644 --- a/services/deviceauth.gni +++ b/services/deviceauth.gni @@ -26,9 +26,6 @@ creds_manager_path = "${services_path}/creds_manager" mk_agree_path = "${services_path}/mk_agree" enable_broadcast = true -declare_args() { - deviceauth_hichain_thread_stack_size = 8192 -} deviceauth_defines = [] inc_path = [ diff --git a/services/frameworks/src/task_manager/task_manager.c b/services/frameworks/src/task_manager/task_manager.c index 36caad86d7130cebbd635e005c69601fe9787883..1d24282be2117ba90eeb960ddec20dce46e9382b 100644 --- a/services/frameworks/src/task_manager/task_manager.c +++ b/services/frameworks/src/task_manager/task_manager.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -18,10 +18,6 @@ #include "device_auth_defines.h" #include "hc_log.h" -#ifndef HICHAIN_THREAD_STACK_SIZE -#define HICHAIN_THREAD_STACK_SIZE 16384 -#endif - static HcTaskThread *g_taskThread = NULL; int32_t PushTask(HcTaskBase *baseTask) @@ -44,7 +40,7 @@ int32_t InitTaskManager(void) if (g_taskThread == NULL) { return HC_ERR_ALLOC_MEMORY; } - int32_t res = InitHcTaskThread(g_taskThread, HICHAIN_THREAD_STACK_SIZE, "DevAuthWork"); + int32_t res = InitHcTaskThread(g_taskThread, DEV_AUTH_WORK_THREAD_STACK_SIZE, "DevAuthWork"); if (res != HC_SUCCESS) { LOGE("Failed to init task thread! res: %d", res); HcFree(g_taskThread); diff --git a/test/unittest/deviceauth/BUILD.gn b/test/unittest/deviceauth/BUILD.gn index 0b101e18f9044f6e7dfb5e07e8ea665e8f3fe9dc..4a28bb52635cd69af81ab8bd85a89aedc8b16028 100644 --- a/test/unittest/deviceauth/BUILD.gn +++ b/test/unittest/deviceauth/BUILD.gn @@ -116,7 +116,10 @@ ohos_unittest("deviceauth_llt") { ] cflags = [ "-DHILOG_ENABLE" ] - cflags += [ "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}" ] + cflags += [ + "-DDEV_AUTH_WORK_THREAD_STACK_SIZE=${deviceauth_hichain_thread_stack_size}", + "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}", + ] cflags += [ "-DDEVICE_AUTH_TEST_HKS_DATA_PATH=\"${huks_key_store_standard_path}\"" ] @@ -243,7 +246,10 @@ ohos_unittest("device_auth_func_test") { ] cflags = [ "-DHILOG_ENABLE" ] - cflags += [ "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}" ] + cflags += [ + "-DDEV_AUTH_WORK_THREAD_STACK_SIZE=${deviceauth_hichain_thread_stack_size}", + "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}", + ] cflags += [ "-DDEVICE_AUTH_TEST_HKS_DATA_PATH=\"${huks_key_store_standard_path}\"" ] @@ -367,7 +373,10 @@ ohos_unittest("deviceauth_unit_test") { ] cflags = [ "-DHILOG_ENABLE" ] - cflags += [ "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}" ] + cflags += [ + "-DDEV_AUTH_WORK_THREAD_STACK_SIZE=${deviceauth_hichain_thread_stack_size}", + "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}", + ] deps = [ "//third_party/cJSON:cjson", diff --git a/test/unittest/tdd_framework/unit_test/services/creds_manager/BUILD.gn b/test/unittest/tdd_framework/unit_test/services/creds_manager/BUILD.gn index 5312646397e1b4f4f66e87f20241357fd27ca9be..9e05a7d1ff9696c97eda288c52e3df921934fe2d 100644 --- a/test/unittest/tdd_framework/unit_test/services/creds_manager/BUILD.gn +++ b/test/unittest/tdd_framework/unit_test/services/creds_manager/BUILD.gn @@ -64,7 +64,10 @@ ohos_unittest("creds_manager_test") { defines -= [ "ENABLE_PSEUDONYM" ] cflags = [ "-DHILOG_ENABLE" ] - cflags += [ "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}" ] + cflags += [ + "-DDEV_AUTH_WORK_THREAD_STACK_SIZE=${deviceauth_hichain_thread_stack_size}", + "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}", + ] cflags += [ "-DDEVICE_AUTH_TEST_HKS_DATA_PATH=\"${huks_key_store_standard_path}\"" ] diff --git a/test/unittest/tdd_framework/unit_test/services/frameworks/os_account_adapter/BUILD.gn b/test/unittest/tdd_framework/unit_test/services/frameworks/os_account_adapter/BUILD.gn index 887f6a89fc08a3d1af3d47822fb18e73180bd90e..a4cb7f9f3ca31011e77fa3d7cf4f9b44d85cf93f 100644 --- a/test/unittest/tdd_framework/unit_test/services/frameworks/os_account_adapter/BUILD.gn +++ b/test/unittest/tdd_framework/unit_test/services/frameworks/os_account_adapter/BUILD.gn @@ -57,7 +57,10 @@ if (support_os_account) { sources += sa_subscriber_files cflags = [ "-DHILOG_ENABLE" ] - cflags += [ "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}" ] + cflags += [ + "-DDEV_AUTH_WORK_THREAD_STACK_SIZE=${deviceauth_hichain_thread_stack_size}", + "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}", + ] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] }