2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 ///////////////////////////////////////////////////////////////////////////////
18 /// \ingroup tag_SystemManager
19 /// \brief This file provides support for System Manager configuration.
21 ///////////////////////////////////////////////////////////////////////////////
23 #include <boost/algorithm/string.hpp>
26 #include <other_service/PosixBasedOS001ClockCycleApi.h>
27 #include <other_service/ultoa.h>
28 #include <native_service/frameworkunified_framework_if.h>
29 #include <system_service/ss_string_maps.h>
30 #include <system_service/ss_templates.h>
31 #include <native_service/ns_config_parser_if.h>
34 #include <sys/resource.h>
47 #include "ss_sm_config.h"
48 #include "ss_sm_systemmanagerlog.h"
49 #include "ss_sm_launch_configuration.h"
50 #include "system_launcher_cfg_format.h"
51 #include "ss_sm_default_paths.h"
53 using namespace std; // NOLINT
55 // Constants for Heart Beat configuration data
56 const UI_32 HBApplicationHeartBeatIntervalInitial = 40u; // Units of seconds. 0 = HB Disabled.
57 const UI_32 HBApplicationHeartBeatIntervalRepeat = 5u; // Units of seconds. 0 = HB Disabled.
58 const UI_32 HBMaxHeartBeatRetryCount = 3u;
60 // Constants for Crash Detector configuration data
61 const BOOL CDEnabled = TRUE;
63 // Constants for system low memory configuration data
65 const UI_32 SLMTimerValue = 5000; // msec
66 const UI_32 SLMThresholdValue = (1024 * 512); // bytes
67 const UI_32 SLMRetryCount = 6;
68 const UI_32 SLMSystemmanagerLogIntervalMs = 30000;
70 // Constants for Module connect time and Stat Resp Time
72 const UI_32 ModuleConnectionNumTimesToCheck = 5;
73 const UI_32 ModuleConnectionTimeOutSec = 5; // sec
74 const UI_32 ModuleStartRespTimeOutSec = 120; // sec
76 // Constants for Critical Apps Max wait timeout
78 const UI_32 CriticalAppsMaxShutdownTimeFastSleepSec = 2; // sec
79 const UI_32 CriticalAppsMaxShutdownTimeNormalResetSec = 15; // sec
81 // Constants for User Mode data structure type
82 const BOOL isBoolean = TRUE;
84 const CHAR SMConfigDataHeader[] = "SystemManager";
85 const CHAR HBConfigDataHeader[] = "HeartBeat";
86 const CHAR CDConfigDataHeader[] = "CrashDetector";
87 const CHAR SLMConfigDataHeader[] = "SysLowMemory";
88 const CHAR UserModeConfigDataHeader[] = "UserMode";
90 struct CfgLaunchParams {
94 group_wait_for_trigger(0),
100 shutdown_wait_time(0),
101 fast_shutdown_wait_time(0),
104 disable_agl_resethistory(FALSE),
105 disable_nonagl_resethistory(FALSE) {
106 std::memset(&group_name[0], 0, sizeof(group_name));
107 std::memset(&name[0], 0, sizeof(name));
108 std::memset(&binary_name[0], 0, sizeof(binary_name));
109 std::memset(&arguments[0], 0, sizeof(arguments));
110 std::memset(&logging_msk_str[0], 0, sizeof(logging_msk_str));
111 std::memset(&restart[0], 0, sizeof(restart));
112 std::memset(&unix_user_name[0], 0, sizeof(unix_user_name));
113 std::memset(&env_value_condition[0], 0, sizeof(env_value_condition));
116 CHAR group_name[100];
118 UI_32 group_launch_wait;
119 BOOL group_wait_for_trigger;
121 CHAR binary_name[MAX_PATH_LENGTH];
126 CHAR logging_msk_str[50];
128 BOOL is_start_required;
129 BOOL shutdown_critical;
130 UI_32 shutdown_wait_time;
131 UI_32 fast_shutdown_wait_time;
132 TUserNameBuffer unix_user_name; // TODO(username): Stuff.: Does Posix define a useful
133 // constant representing max length of user id?
134 CHAR env_value_condition[256];
138 BOOL IsAGLUnit(void) const { return is_agl_unit; }
139 BOOL IsAGLResetHistoryDisable(void) const { return disable_agl_resethistory; }
140 BOOL IsNonAGLResetHistoryDisable(void) const { return disable_nonagl_resethistory; }
141 void SetAGLUnit(BOOL f_is_agl_unit) { is_agl_unit = f_is_agl_unit; }
142 void SetAGLResetHistoryDisable(BOOL f_disable_agl_resethistory) {
143 disable_agl_resethistory = f_disable_agl_resethistory;
145 void SetNonAGLResetHisoryDisable(BOOL f_disable_nonagl_resethistory) {
146 disable_nonagl_resethistory = f_disable_nonagl_resethistory;
151 BOOL disable_agl_resethistory;
152 BOOL disable_nonagl_resethistory;
155 namespace ss_sm_cfg {
158 enum { // typedef enum _tokens
162 group_wait_for_trigger,
174 fast_shutdown_wait_time,
177 disable_agl_resethistory,
178 disable_nonagl_resethistory,
184 }; // namespace ss_sm_cfg
186 static void set_grp_member_info(const LaunchInfo& launch_info, ModuleLaunchList& module_lst); // NOLINT
187 static void load_parameters_order_cfg(
188 GroupLaunchMap& groups_map, LaunchOrderedVector& f_OrderList, SS_String& f_launchOrderName, SS_String& f_launchCfgFn); // NOLINT
190 /*******************************************************************************
193 * Set Initial time, reset Final and Delta to zero, return time *
195 UI_64 CTimeSpan::Begin() {
196 initial = GetTimeMilliseconds();
200 } // End of UI_64 CTimeSpan::Begin()
203 * Set Final time, calculate Delta time, return time
205 UI_64 CTimeSpan::End() {
206 final = GetTimeMilliseconds();
207 delta = (final > initial) ? (final - initial) : 0; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
209 } // End of UI_64 CTimeSpan::End()
211 UI_64 CTimeSpan::GetInitial(void) {
215 UI_64 CTimeSpan::GetFinal() {
219 UI_64 CTimeSpan::GetDelta() {
223 UI_64 CTimeSpan::GetTimeMilliseconds() {
224 UI_64 l_totalmsec = 0;
225 struct timespec timeSpec;
227 if (0 != clock_gettime(CLOCK_MONOTONIC, &timeSpec)) {
228 SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
230 l_totalmsec = (timeSpec.tv_sec * 1000ULL)
231 + (timeSpec.tv_nsec / 1000000);
238 * End of CTimeSpan class *
239 ******************************************************************************/
241 ModuleLaunchParams::ModuleLaunchParams():
246 , configuration_priority(0)
248 , previous_priority(0)
249 , current_priority(0)
252 , logging_msk_str("")
253 , is_start_required(FALSE)
254 , shutdown_critical(FALSE)
255 , shutdown_wait_time(0)
256 , fast_shutdown_wait_time(0)
260 , relaunch_status(NotRelaunched)
262 , m_serviceAvailability(FALSE)
265 , m_ModuleDebugDumpState(MODULE_DEBUG_DUMP_STATE_NOT_REQUESTED)
267 , disable_agl_resethistory(FALSE)
268 , disable_nonagl_resethistory(FALSE) { // LCOV_EXCL_BR_START 11:Gcov constraints (because exception-handling routes are automatically generated)
269 SetModuleState(MODULE_STATE_INVALID, FALSE);
271 // Module State strings
272 m_ModuleStateStrMap[MODULE_STATE_INVALID] = "INVALID";
273 m_ModuleStateStrMap[MODULE_STATE_SKIPPED] = "SKIPPED";
274 m_ModuleStateStrMap[MODULE_STATE_LAUNCHING] = "LAUNCHING";
275 m_ModuleStateStrMap[MODULE_STATE_LAUNCHED] = "LAUNCHED";
276 m_ModuleStateStrMap[MODULE_STATE_LAUNCH_FAILED] = "LAUNCH_FAIL";
277 m_ModuleStateStrMap[MODULE_STATE_CONNECTED] = "CONNECTED";
278 m_ModuleStateStrMap[MODULE_STATE_START_SENT] = "START_SENT";
279 m_ModuleStateStrMap[MODULE_STATE_START_FAILED] = "START_FAIL";
280 m_ModuleStateStrMap[MODULE_STATE_STARTED] = "STARTED";
281 m_ModuleStateStrMap[MODULE_STATE_STOP_FAILED] = "STOP_FAIL";
282 m_ModuleStateStrMap[MODULE_STATE_STOP_SENT] = "STOP_SENT";
283 m_ModuleStateStrMap[MODULE_STATE_STOPPED] = "STOPPED";
284 m_ModuleStateStrMap[MODULE_STATE_START_PRE_SENT] = "PRE_START_SENT";
285 m_ModuleStateStrMap[MODULE_STATE_START_PRE_FAILED] = "PRE_START_FAIL";
286 m_ModuleStateStrMap[MODULE_STATE_STARTED_PRE] = "PRE_STARTED";
287 m_ModuleStateStrMap[MODULE_STATE_STOP_PRE_SENT] = "PRE_STOP_SENT";
288 m_ModuleStateStrMap[MODULE_STATE_STOP_PRE_FAILED] = "PRE_STOP_FAIL";
289 m_ModuleStateStrMap[MODULE_STATE_STOPPED_PRE] = "PRE_STOPPED";
290 m_ModuleStateStrMap[MODULE_STATE_START_BACKGROUND_SENT] = "BACKGROUND_START_SENT";
291 m_ModuleStateStrMap[MODULE_STATE_START_BACKGROUND_FAILED] = "BACKGROUND_START_FAIL";
292 m_ModuleStateStrMap[MODULE_STATE_STARTED_BACKGROUND] = "BACKGROUND_STARTED";
293 m_ModuleStateStrMap[MODULE_STATE_STOP_BACKGROUND_SENT] = "BACKGROUND_STOP_SENT";
294 m_ModuleStateStrMap[MODULE_STATE_STOP_BACKGROUND_FAILED] = "BACKGROUND_STOP_FAIL";
295 m_ModuleStateStrMap[MODULE_STATE_STOPPED_BACKGROUND] = "BACKGROUND_STOPPED";
298 m_startReason.SetReason(NotStarted);
299 m_stopReason.SetReason(NotStopped);
301 MAP_ENTRY(m_ModuleDebugDumpStateStrMap, MODULE_DEBUG_DUMP_STATE_NOT_REQUESTED); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
302 MAP_ENTRY(m_ModuleDebugDumpStateStrMap, MODULE_DEBUG_DUMP_STATE_REQUEST_SENT); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
303 MAP_ENTRY(m_ModuleDebugDumpStateStrMap, MODULE_DEBUG_DUMP_STATE_RESPONSE_RECEIVED); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
305 std::memset(&unix_user_name[0], 0, sizeof(unix_user_name));
306 } // End of ModuleLaunchParams::ModuleLaunchParams() :
308 ModuleLaunchParams::~ModuleLaunchParams() {
309 } // End of ModuleLaunchParams::~ModuleLaunchParams() :
311 SMModuleState ModuleLaunchParams::GetModuleState(void) {
312 return m_moduleState;
313 } // End of SMModuleState ModuleLaunchParams::GetModuleState(void)
315 BOOL ModuleLaunchParams::IsModuleState(SMModuleState f_moduleState) {
316 return m_moduleState == f_moduleState;
317 } // End of BOOL ModuleLaunchParams::IsModuleState(SMModuleState f_moduleState )
320 // Determine if a module is in a state capable of receiving messages from System Manager.
321 BOOL ModuleLaunchParams::IsModuleConnected() const {
322 BOOL l_isModuleConnected = FALSE;
324 switch (m_moduleState) {
325 case MODULE_STATE_CONNECTED:
326 case MODULE_STATE_START_SENT:
327 case MODULE_STATE_START_FAILED:
328 case MODULE_STATE_STARTED:
329 case MODULE_STATE_STOP_SENT:
330 case MODULE_STATE_STOP_FAILED:
331 case MODULE_STATE_STOPPED:
332 case MODULE_STATE_START_PRE_SENT:
333 case MODULE_STATE_START_PRE_FAILED:
334 case MODULE_STATE_STARTED_PRE:
335 case MODULE_STATE_STOP_PRE_SENT:
336 case MODULE_STATE_STOP_PRE_FAILED:
337 case MODULE_STATE_STOPPED_PRE:
338 case MODULE_STATE_START_BACKGROUND_SENT:
339 case MODULE_STATE_START_BACKGROUND_FAILED:
340 case MODULE_STATE_STARTED_BACKGROUND:
341 case MODULE_STATE_STOP_BACKGROUND_SENT:
342 case MODULE_STATE_STOP_BACKGROUND_FAILED:
343 case MODULE_STATE_STOPPED_BACKGROUND:
344 l_isModuleConnected = TRUE;
348 l_isModuleConnected = FALSE;
352 return (l_isModuleConnected);
353 } // End of BOOL ModuleLaunchParams::IsModuleConnected(void)
355 VOID ModuleLaunchParams::SetModuleState(SMModuleState f_moduleState, BOOL f_bLog) {
356 m_moduleState = f_moduleState;
358 switch (m_moduleState) { // Because the module status cannot be changed from the external API
359 case MODULE_STATE_INVALID:
360 case MODULE_STATE_SKIPPED:
361 case MODULE_STATE_LAUNCH_FAILED:
362 case MODULE_STATE_LAUNCHING:
363 case MODULE_STATE_LAUNCHED:
364 case MODULE_STATE_CONNECTED:
366 case MODULE_STATE_START_SENT:
367 m_startReason.Begin();
369 case MODULE_STATE_START_FAILED:
371 m_startReason.SetReason(StartedByModuleStartFail);
373 case MODULE_STATE_STARTED:
375 m_startReason.SetReason(StartedByModuleStartComplete);
378 case MODULE_STATE_STOP_SENT:
379 m_stopReason.Begin();
382 case MODULE_STATE_STOP_FAILED:
384 m_stopReason.SetReason(StoppedByModuleStopFail);
386 case MODULE_STATE_STOPPED:
388 m_stopReason.SetReason(StoppedByModuleStopComplete);
391 case MODULE_STATE_START_PRE_SENT:
392 m_startReason.Begin();
394 case MODULE_STATE_START_PRE_FAILED:
396 m_startReason.SetReason(StartedByModulePreStartFail);
398 case MODULE_STATE_STARTED_PRE:
400 m_startReason.SetReason(StartedByModulePreStartComplete);
402 case MODULE_STATE_STOP_PRE_SENT:
403 m_stopReason.Begin();
405 case MODULE_STATE_STOP_PRE_FAILED:
407 m_stopReason.SetReason(StoppedByModulePreStopFail);
409 case MODULE_STATE_STOPPED_PRE:
411 m_stopReason.SetReason(StoppedByModulePreStopComplete);
414 case MODULE_STATE_START_BACKGROUND_SENT:
415 m_startReason.Begin();
417 case MODULE_STATE_START_BACKGROUND_FAILED:
419 m_startReason.SetReason(StartedByModuleBackgroundStartFail);
421 case MODULE_STATE_STARTED_BACKGROUND:
423 m_startReason.SetReason(StartedByModuleBackgroundStartComplete);
425 case MODULE_STATE_STOP_BACKGROUND_SENT:
426 m_stopReason.Begin();
428 case MODULE_STATE_STOP_BACKGROUND_FAILED:
430 m_stopReason.SetReason(StoppedByModuleBackgroundStopFail);
432 case MODULE_STATE_STOPPED_BACKGROUND:
434 m_stopReason.SetReason(StoppedByModuleBackgroundStopComplete);
437 // default: Don't code a 'default' here - let the compiler
438 // issue a warning ( set via -Wall or -Wswitch ) when the set of
439 // enumerations changes - then the maintainer will
440 // automagically know to update this switch statement.
446 strcpy(p, m_ModuleStateStrMap[m_moduleState].c_str()); // NOLINT
447 p += m_ModuleStateStrMap[m_moduleState].size();
448 strcpy(p, ":"); // NOLINT
449 p += sizeof(":") - 1;
450 strcpy(p, name.c_str()); // NOLINT
451 FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, buf);
453 } // End of VOID ModuleLaunchParams::SetModuleState(SMModuleState f_moduleState )
455 std::string ModuleLaunchParams::ModuleStateStr(void) {
456 return m_ModuleStateStrMap[m_moduleState];
457 } // End of std::string ModuleLaunchParams::ModuleStateStr(SMModuleState f_moduleState )
459 SMModuleDebugDumpState ModuleLaunchParams::GetModuleDebugDumpState(void) { // LCOV_EXCL_START 6: Because the condition cannot be set // NOLINT(whitespace/line_length)
460 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
461 return m_ModuleDebugDumpState;
462 } // End of SMModuleDebugDumpState ModuleLaunchParams::GetModuleDebugDumpState(void)
465 std::string ModuleLaunchParams::GetModuleDebugDumpStateStr(void) {
466 return m_ModuleDebugDumpStateStrMap[m_ModuleDebugDumpState];
467 } // End of std::string ModuleLaunchParams::GetModuleDebugDumpStateStr()
469 VOID ModuleLaunchParams::SetModuleDebugDumpState(
470 SMModuleDebugDumpState f_moduleDebugDumpState, BOOL f_bLog) {
471 m_ModuleDebugDumpState = f_moduleDebugDumpState;
473 if (f_bLog) { // LCOV_EXCL_BR_LINE 200:f_bLog must be TRUE
474 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s set for %s",
475 GetModuleDebugDumpStateStr().c_str(), name.c_str());
477 } // End of VOID ModuleLaunchParams::SetModuleDebugDumpState(SMModuleDebugDumpState f_moduleDebugDumpState )
479 EFrameworkunifiedStatus ModuleLaunchParams::SendMsgAndUpdateState(
480 const UI_32 f_iCmd, const T_SS_SM_START_DataStructType* const f_startData) {
481 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
482 char l_cBuf[500] = " Error: char l_cBuf[] not built";
483 T_SS_SM_START_DataStructType l_startData;
484 SMModuleState l_SendSuccess = MODULE_STATE_START_SENT;
485 SMModuleState l_SendFailed = MODULE_STATE_START_FAILED;
487 memcpy(&l_startData, f_startData, sizeof(T_SS_SM_START_DataStructType));
489 switch (relaunch_status) { // LCOV_EXCL_BR_LINE 6: Because all conditions cannot be satisfied from the external API
491 // Setting startup information at the first startup
493 case RelaunchSafe: // LCOV_EXCL_START 6: Because all conditions cannot be satisfied from the external API
494 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
495 l_startData.resetStatus = e_SS_SM_RESET_STATUS_NONE;
498 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
499 l_startData.resetStatus = e_SS_SM_RESET_STATUS_NG;
502 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
509 case SS_SM_PRE_START:
510 l_SendSuccess = MODULE_STATE_START_PRE_SENT;
511 l_SendFailed = MODULE_STATE_START_PRE_FAILED;
514 l_SendSuccess = MODULE_STATE_STOP_PRE_SENT;
515 l_SendFailed = MODULE_STATE_STOP_PRE_FAILED;
517 case SS_SM_BACKGROUND_START:
518 l_SendSuccess = MODULE_STATE_START_BACKGROUND_SENT;
519 l_SendFailed = MODULE_STATE_START_BACKGROUND_FAILED;
521 case SS_SM_BACKGROUND_STOP:
522 l_SendSuccess = MODULE_STATE_STOP_BACKGROUND_SENT;
523 l_SendFailed = MODULE_STATE_STOP_BACKGROUND_FAILED;
527 l_SendSuccess = MODULE_STATE_START_SENT;
528 l_SendFailed = MODULE_STATE_START_FAILED;
532 const EFrameworkunifiedStatus l_eStatus = FrameworkunifiedSendMsg(hsession, f_iCmd,
533 sizeof(T_SS_SM_START_DataStructType),
534 static_cast<PCVOID>(&l_startData));
536 // LCOV_EXCL_START 6: As no TRUE is returned
537 if (IS_ZONE_SET(ZONE_ERR) || IS_ZONE_SET(ZONE_INFO)) {
539 snprintf(l_cBuf, sizeof(l_cBuf), "FrameworkunifiedSendMsg(%s, system_manager protocol message, %d/%s)",
540 name.c_str(), l_startData.startupReason,
541 GetStr(l_startData.startupReason).c_str());
543 // LCOV_EXCL_STOP 6:As no TRUE is returned
544 if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4:NSFW's error
545 // LCOV_EXCL_START 4:NSFW's error
546 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
547 LOG_ERROR(l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
548 SetModuleState(l_SendFailed);
551 LOG_SUCCESS(l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
552 SetModuleState(l_SendSuccess);
554 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
557 // End of EFrameworkunifiedStatus ModuleLaunchParams::SendMsgAndUpdateState(T_SS_SM_START_DataStructType const * f_startData)
559 EFrameworkunifiedStatus ModuleLaunchParams::SendMsgAndUpdateState(
560 T_SS_SM_STOP_DataStructType const* f_stopData) {
561 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
562 char l_cBuf[500] = " Error: char l_cBuf[] not built";
563 EFrameworkunifiedStatus l_eStatus = FrameworkunifiedSendMsg(hsession, SS_SM_STOP,
564 sizeof(T_SS_SM_STOP_DataStructType),
565 static_cast<PCVOID>(f_stopData));
567 if (IS_ZONE_SET(ZONE_ERR) || IS_ZONE_SET(ZONE_INFO)) { // LCOV_EXCL_BR_LINE 200:alwasy true
568 snprintf(l_cBuf, sizeof(l_cBuf), "FrameworkunifiedSendMsg(%s, SS_SM_STOP, %d/%s, "
569 "Last User Mode: %s)", name.c_str(),
570 f_stopData->shutdownTrigger,
571 GetStr(f_stopData->shutdownTrigger).c_str(),
572 GetStr(f_stopData->lastUserMode).c_str());
574 if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4:NSFW's error
575 // LCOV_EXCL_START 4:NSFW's error
576 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
577 LOG_ERROR(l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
578 SetModuleState(MODULE_STATE_STOP_FAILED);
581 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s successful", l_cBuf);
582 SetModuleState(MODULE_STATE_STOP_SENT);
584 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
587 // End of EFrameworkunifiedStatus ModuleLaunchParams::SendMsgAndUpdateState(T_SS_SM_STOP_DataStructType const * f_stopData)
589 EFrameworkunifiedStatus ModuleLaunchParams::GetPriority(UI_32& f_Priority) {
590 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
591 EFrameworkunifiedStatus l_eStatus;
593 struct sched_param cur_sch_params;
597 if (0 == pid) { // LCOV_EXCL_BR_LINE 200: pid can not be 0
598 // LCOV_EXCL_START 200: pid can not be 0
599 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
600 l_eStatus = eFrameworkunifiedStatusInvldParam;
601 LOG_ERROR("0 == pid"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
603 } else if (-1 >= sched_getparam(pid, &cur_sch_params)) { // LCOV_EXCL_BR_LINE 5: system function failed
604 // LCOV_EXCL_START 5: system function failed
605 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
606 l_eStatus = eFrameworkunifiedStatusFault;
607 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
608 " Error: 'sched_getparam( pid %d, &cur_sch_params )' returned -1, "
609 "strerr() is '%s'", pid, strerror(errno));
612 l_eStatus = eFrameworkunifiedStatusOK;
613 f_Priority = cur_sch_params.sched_priority;
615 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
617 } // End of EFrameworkunifiedStatus ModuleLaunchParams::GetPriority (UI_32 & f_Priority )
619 EFrameworkunifiedStatus ModuleLaunchParams::SetPriority(UI_32 f_Priority) {
620 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
621 EFrameworkunifiedStatus l_eStatus;
625 if (99 < f_Priority) { // LCOV_EXCL_BR_LINE 200: priority can not greater than 99
626 // LCOV_EXCL_START 200: priority can not greater than 99
627 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
628 l_eStatus = eFrameworkunifiedStatusInvldParam;
629 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: Invalid 'f_Priority' %d/0x%X",
630 f_Priority, f_Priority);
632 } else if (0 == pid) { // LCOV_EXCL_BR_LINE 200: pid can not be 0
633 // LCOV_EXCL_START 200: pid can not be 0
634 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
635 l_eStatus = eFrameworkunifiedStatusInvldParam;
636 LOG_ERROR("0 == pid"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
640 struct sched_param l_schedParam = { };
641 l_schedParam.sched_priority = f_Priority;
643 if (f_Priority == 0) { // LCOV_EXCL_BR_LINE 200: f_Priority can not be 0
644 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
645 rc = sched_setscheduler(pid, SCHED_OTHER, &l_schedParam); // LCOV_EXCL_LINE 200: f_Priority can not be 0
647 rc = sched_setscheduler(pid, SCHED_FIFO, &l_schedParam);
649 SS_ASERT_ERRNO(0 == rc); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
651 previous_priority = current_priority;
652 current_priority = f_Priority;
653 l_eStatus = eFrameworkunifiedStatusOK;
654 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
655 " setprio( %s, pid %d, 'previous_priority' %d -> %d ) successful",
656 name.c_str(), pid, previous_priority, f_Priority);
657 } else if (rc == -1) { // LCOV_EXCL_BR_LINE 5: system function failed
658 // LCOV_EXCL_START 5: system function failed
659 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
660 l_eStatus = eFrameworkunifiedStatusFault;
661 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
662 " setprio( %s, pid %d, 'current_priority' %d -> %d ) returned '-1', strerr() is '%s'",
663 name.c_str(), pid, current_priority, f_Priority,
666 } else { // LCOV_EXCL_BR_LINE 5: can not be other value
667 // LCOV_EXCL_START 5: can not be other value
668 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
669 l_eStatus = eFrameworkunifiedStatusFault;
670 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
671 " setprio( %s, pid %d, 'current_priority' %d -> %d ) returned '%d'; "
672 "'rc' is neither original priority nor '-1': 'errno' is '%d', strerr() is '%s'",
673 name.c_str(), pid, current_priority, f_Priority, rc,
674 errno, strerror(errno));
679 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
681 } // End of EFrameworkunifiedStatus ModuleLaunchParams::SetPriority( UI_32 f_Priority )
683 SysMgrConfiguration::SysMgrConfiguration():
687 SysMgrConfiguration::~SysMgrConfiguration() {
690 static BOOL is_satisfy_env_launch_cond(CHAR *env_cond) { // LCOV_EXCL_START 6: Because the condition cannot be set
691 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
692 BOOL l_isSatisfy = FALSE;
693 BOOL l_isReverse = FALSE;
694 CHAR *l_pString = NULL;
696 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "env_cond [%s]", env_cond);
698 if (NULL != (l_pString = strstr(env_cond, "!="))) {
700 } else if (NULL == (l_pString = strstr(env_cond, "=="))) {
704 if (NULL != l_pString) {
705 CHAR *l_pEnv = env_cond;
706 CHAR *l_pValue = l_pString + 2;
709 CHAR *l_pEnvVariable = NULL;
711 if (NULL != (l_pEnvVariable = std::getenv(l_pEnv))) {
712 l_isSatisfy = (0 == strcmp(l_pValue, l_pEnvVariable)) ? TRUE : FALSE;
714 l_isSatisfy = !l_isSatisfy;
722 static void set_grp_member_info(const LaunchInfo& launch_info, ModuleLaunchList& module_lst) { // NOLINT
723 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
725 ModuleLaunchParams grp_member_info;
726 grp_member_info.name = launch_info.name;
727 grp_member_info.path = launch_info.binary_name;
728 grp_member_info.arguments = launch_info.arguments;
729 grp_member_info.restart = launch_info.restart;
730 grp_member_info.configuration_priority = launch_info.priority;
731 grp_member_info.retry_cnt = launch_info.retry_cnt;
732 grp_member_info.logging_msk_str = launch_info.logging_msk_str;
733 grp_member_info.critical = launch_info.critical;
734 grp_member_info.shutdown_critical = launch_info.shutdown_critical;
735 grp_member_info.shutdown_wait_time = launch_info.shutdown_wait_time;
736 grp_member_info.group_id = launch_info.group_id;
737 grp_member_info.is_start_required = launch_info.is_start_required;
738 grp_member_info.fast_shutdown_wait_time = launch_info.fast_shutdown_wait_time;
739 grp_member_info.SetAGLUnit(launch_info.IsAGLUnit());
740 grp_member_info.SetAGLResetHistoryDisable(launch_info.IsAGLResetHistoryDisable());
741 grp_member_info.SetNonAGLResetHisoryDisable(launch_info.IsNonAGLResetHistoryDisable());
743 module_lst.push_back(grp_member_info);
747 static ModuleLaunchListIter set_cfg_grp_member_info(
748 const CfgLaunchParams& launch_info, ModuleLaunchList& module_lst) { // NOLINT
749 ModuleLaunchParams grp_member_info;
750 ModuleLaunchListIter moduleLaunchListIter;
752 grp_member_info.name = launch_info.name;
753 grp_member_info.path = launch_info.binary_name;
754 grp_member_info.arguments = ( // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
755 std::strcmp(launch_info.arguments, "NULL") == 0 ? "" : launch_info.arguments);
756 grp_member_info.restart = ( // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
757 std::strcmp(launch_info.restart, "NULL") == 0 ? "" : launch_info.restart);
758 grp_member_info.configuration_priority = launch_info.priority;
759 grp_member_info.cpu_assign = launch_info.cpu_assign;
760 grp_member_info.retry_cnt = launch_info.retry_cnt;
761 grp_member_info.logging_msk_str = ( // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
762 std::strcmp(launch_info.logging_msk_str, "NULL") == 0 ? "" : launch_info.logging_msk_str);
764 grp_member_info.critical = launch_info.critical;
765 grp_member_info.shutdown_critical = launch_info.shutdown_critical;
766 grp_member_info.shutdown_wait_time = launch_info.shutdown_wait_time;
767 grp_member_info.group_id = launch_info.group_id;
768 grp_member_info.is_start_required = launch_info.is_start_required;
769 grp_member_info.fast_shutdown_wait_time = launch_info.fast_shutdown_wait_time;
770 grp_member_info.SetAGLUnit(launch_info.IsAGLUnit());
771 grp_member_info.SetAGLResetHistoryDisable(launch_info.IsAGLResetHistoryDisable());
772 grp_member_info.SetNonAGLResetHisoryDisable(launch_info.IsNonAGLResetHistoryDisable());
774 strncpy(&grp_member_info.unix_user_name[0], &launch_info.unix_user_name[0],
775 sizeof(TUserNameBuffer));
777 moduleLaunchListIter = module_lst.insert(module_lst.end(), grp_member_info);
778 return (moduleLaunchListIter);
781 static void load_parameters_order_cfg(GroupLaunchMap& groups_map, // NOLINT
782 LaunchOrderedVector& f_OrderList, SS_String& f_launchOrderName, // NOLINT
783 SS_String& f_launchCfgFn) { // NOLINT
784 SS_String l_OrderCfgFn = f_launchCfgFn;
785 string::size_type pos = l_OrderCfgFn.find(".cfg");
787 if (pos == string::npos) { // LCOV_EXCL_BR_LINE 5:C error
788 // LCOV_EXCL_START 5:C error
789 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
790 FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "invalid file name:%s",
791 f_launchCfgFn.c_str());
796 l_OrderCfgFn.replace(pos, strlen(".order.cfg"), ".order.cfg");
797 CNSConfigReader *l_pReaderOrderCfg = new CNSConfigReader(l_OrderCfgFn);
799 if (l_pReaderOrderCfg != NULL) { // LCOV_EXCL_BR_LINE 5:new error
801 std::sprintf(key, "%s.order", f_launchOrderName.c_str()); // NOLINT
802 SS_String value = l_pReaderOrderCfg->GetString(key);
803 std::vector<std::string> strList;
804 if (value.empty()) { // LCOV_EXCL_BR_LINE 200:cannot be empty
807 // LCOV_EXCL_START 6: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied
808 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
809 boost::split(strList, value, boost::is_any_of("|"));
810 for (UI_32 i = 0; i < strList.size(); i++) {
812 f_OrderList.push_back(
813 static_cast<UI_32>(strtoul(strList[i].c_str(), &endptr, 10)));
814 if (*endptr != '\0') {
815 // Discard boot order if invalid string is detected
820 std::sprintf(key, "%s.owlist", f_launchOrderName.c_str()); // NOLINT
821 SS_String ow_list_value = l_pReaderOrderCfg->GetString(key);
822 std::vector<std::string> owList;
824 if (!ow_list_value.empty()) {
825 boost::split(owList, ow_list_value, boost::is_any_of("|"));
826 for (UI_32 i = 0; i < owList.size(); i++) {
827 std::sprintf(key, "%s.%s", f_launchOrderName.c_str(), // NOLINT
829 SS_String grop_ow_time = l_pReaderOrderCfg->GetString(key);
830 if (owList[i].compare(0, 4, "oww_") == 0) {
832 SS_String group_name = owList[i].substr(strlen("oww_"));
833 UI_32 group_launch_wait = static_cast<UI_32>(strtoul(
834 grop_ow_time.c_str(), &endptr, 10));
835 if (*endptr != '\0') {
838 GroupLaunchMapIter grp_iter = groups_map.begin();
839 while (grp_iter != groups_map.end()) {
840 if (group_name == grp_iter->second.name) {
841 grp_iter->second.grp_launch_wait = group_launch_wait;
842 FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__,
843 "grp_launch_wait %s=%d", group_name.c_str(),
853 FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "ConfigReader(%s) is NULL",
854 l_OrderCfgFn.c_str());
857 ERROR: if (l_pReaderOrderCfg != NULL) { // LCOV_EXCL_BR_LINE 200:cannot be null
858 delete l_pReaderOrderCfg; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
863 // Given a string, splits it up on the seperator character
864 // SubStringIterator( "a|b|| c |", '|' )
865 // -> On each subsequent invocation of next() would return "a", "b", "", " c ", ""
866 class SubStringIterator {
867 typedef std::string::const_iterator SCIter;
870 SubStringIterator(const std::string& s, char c) :
871 m_position(s.begin()), m_end(s.end()), m_seperator(c), m_done(false) {
875 SCIter begin = m_position;
876 while (m_position != m_end &&
877 *m_position != m_seperator) {
881 const std::string ret(begin, m_position);
882 if (m_position == m_end) {
897 const char m_seperator;
903 Iter skipPrecedingWS(Iter begin, Iter end) { // LCOV_EXCL_START 6: Because the condition cannot be set
904 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
905 return std::find_if(begin, end,
906 std::not1(std::ptr_fun((int (*)(int))std::isspace)));
909 // remove only preceding and trailing whitespace, but leave intermediate whitespace characters alone
910 std::string strip(const std::string& str) {
911 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
912 std::string::const_iterator skipTo = skipPrecedingWS(str.begin(), str.end());
913 if (skipTo == str.end()) { // if string consists of ONLY whitespace
914 return std::string("");
916 return std::string(skipTo, skipPrecedingWS(str.rbegin(), str.rend()).base());
921 BOOL SysMgrConfiguration::LoadParametersCfg(GroupLaunchMap& groups_map,
922 ProcessNameMap& f_processNameMap, LaunchOrderedVector& f_OrderList,
923 SS_String& f_launchOrderName, SS_String& f_launchCfgFn) {
924 BOOL rtn_code = TRUE;
925 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
927 l_pReaderCfg = new (std::nothrow) CNSConfigReader(f_launchCfgFn); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
929 if (NULL != l_pReaderCfg) { // LCOV_EXCL_BR_LINE 5:new error
930 UI_32 launch_idx = 1;
932 std::sprintf(key, "ModulesLaunchConfig.Launch%d", launch_idx); // NOLINT
933 SS_String value = l_pReaderCfg->GetString(key);
935 if (value.empty()) { // LCOV_EXCL_BR_LINE 200:cannot be empty
936 // LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup
937 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
938 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
939 " Error: l_pReaderCfg->GetString(%s) returned empty-string; "
940 "is launch configuration file mis-configured ?",
945 const char* nfsenv = getenv("AGL_NFS");
946 bool isNfs = (nfsenv && strcmp(nfsenv, "y") == 0) ? true : false; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
948 std::list<std::string> capFiles;
950 // LCOV_EXCL_START 6: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied
951 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
952 const std::string capPath("/usr/debug/share/target/cap.lst");
953 std::ifstream fin(capPath.c_str());
955 while (fin && std::getline(fin, line)) {
956 std::list<std::string> strList;
957 boost::split(strList, line, boost::is_any_of("|"));
958 if (!strList.empty()) {
959 if (strList.front()[0] == '/') { // Only character strings beginning with '/' are considered PATH
960 capFiles.push_back(strList.front().c_str());
966 while (!value.empty()) {
967 CHAR critical[10] = { };
968 CHAR is_start_required[10] = { };
969 CHAR shutdown_critical[10] = { };
970 CHAR group_wait_for_trigger[10] = { };
971 CHAR is_agl_unit[10] = { };
972 CHAR disable_agl_resethistory[10] = { };
973 CHAR disable_nonagl_resethistory[10] = { };
974 CfgLaunchParams cfg_data;
976 int at = static_cast<int>(ss_sm_cfg::cfg_args::group_name);
978 SubStringIterator iter(value, '|');
979 while (!iter.done() && ss_sm_cfg::cfg_args::END != at) {
980 const std::string data_ = iter.next();
981 if (!data_.empty()) {
982 const char* data = data_.c_str();
984 case ss_sm_cfg::cfg_args::group_name:
985 snprintf(cfg_data.group_name,
986 sizeof(cfg_data.group_name), "%s", data);
988 case ss_sm_cfg::cfg_args::group_id:
989 cfg_data.group_id = static_cast<UI_32>(strtoul(data, NULL, 10));
991 case ss_sm_cfg::cfg_args::group_launch_wait:
992 cfg_data.group_launch_wait =
993 static_cast<UI_32>(strtoul(data, NULL, 10));
995 case ss_sm_cfg::cfg_args::group_wait_for_trigger:
996 snprintf(group_wait_for_trigger,
997 sizeof(group_wait_for_trigger), "%s", data);
999 case ss_sm_cfg::cfg_args::name:
1000 snprintf(cfg_data.name, sizeof(cfg_data.name), "%s", data);
1002 case ss_sm_cfg::cfg_args::binary_name:
1003 snprintf(cfg_data.binary_name,
1004 sizeof(cfg_data.binary_name), "%s", data);
1006 case ss_sm_cfg::cfg_args::priority:
1007 cfg_data.priority = static_cast<UI_32>(strtoul(data, NULL, 10));
1009 case ss_sm_cfg::cfg_args::critical:
1010 snprintf(critical, sizeof(critical), "%s", data);
1012 case ss_sm_cfg::cfg_args::retry_cnt:
1013 cfg_data.retry_cnt = static_cast<UI_32>(strtoul(data, NULL, 10));
1015 case ss_sm_cfg::cfg_args::arguments:
1016 strncpy(cfg_data.arguments, data,
1017 sizeof(cfg_data.arguments) - 1);
1019 case ss_sm_cfg::cfg_args::logging_msk:
1020 snprintf(cfg_data.logging_msk_str,
1021 sizeof(cfg_data.logging_msk_str), "%s", data);
1023 case ss_sm_cfg::cfg_args::restart:
1024 snprintf(cfg_data.restart, sizeof(cfg_data.restart), "%s", data);
1026 case ss_sm_cfg::cfg_args::is_start_required:
1027 snprintf(is_start_required,
1028 sizeof(is_start_required), "%s", data);
1030 case ss_sm_cfg::cfg_args::shutdown_critical:
1031 snprintf(shutdown_critical,
1032 sizeof(shutdown_critical), "%s", data);
1034 case ss_sm_cfg::cfg_args::shutdown_wait_time:
1035 cfg_data.shutdown_wait_time =
1036 static_cast<UI_32>(strtoul(data, NULL, 10));
1038 case ss_sm_cfg::cfg_args::fast_shutdown_wait_time:
1039 cfg_data.fast_shutdown_wait_time =
1040 static_cast<UI_32>(strtoul(data, NULL, 10));
1042 case ss_sm_cfg::cfg_args::unix_user_name:
1043 strncpy(&cfg_data.unix_user_name[0],
1044 strip(data_).c_str(),
1045 sizeof(cfg_data.unix_user_name) - 1);
1047 case ss_sm_cfg::cfg_args::is_agl_unit:
1048 strncpy(is_agl_unit, data, sizeof(is_agl_unit));
1050 case ss_sm_cfg::cfg_args::disable_agl_resethistory:
1051 strncpy(disable_agl_resethistory, data, sizeof(disable_agl_resethistory));
1053 case ss_sm_cfg::cfg_args::disable_nonagl_resethistory:
1054 strncpy(disable_nonagl_resethistory, data, sizeof(disable_nonagl_resethistory));
1056 case ss_sm_cfg::cfg_args::env_value_condition: // LCOV_EXCL_START 6: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied // NOLINT(whitespace/line_length)
1057 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1058 snprintf(cfg_data.env_value_condition,
1059 sizeof(cfg_data.env_value_condition), "%s", data);
1061 case ss_sm_cfg::cfg_args::cpu_assign:
1062 cfg_data.cpu_assign =
1063 static_cast<int>(strtoul(data, NULL, 16));
1066 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1067 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
1068 " Error: unknown ss_sm_cfg::cfg_args::xxx/'at' "
1069 "enum value '%d'", at);
1076 ////////////////////////////////////////////////////////////////////////////////
1077 // LCOV_EXCL_BR_START 6: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied
1078 if (0 != std::strlen(cfg_data.env_value_condition)
1080 == is_satisfy_env_launch_cond(
1081 // LCOV_EXCL_BR_STOP
1082 cfg_data.env_value_condition)) { // LCOV_EXCL_LINE 6: For setting the initialization conditions at SystemManager startup
1083 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1084 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
1085 "exclude %s from wakeup service", cfg_data.name);
1087 if (isNfs) { // LCOV_EXCL_BR_LINE 6: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied
1088 // Since the NFS environment is used by copying the executable file containing the CAP to /tmp, it is read out.
1089 // LCOV_EXCL_START 6: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied
1090 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1091 std::string binPath(cfg_data.binary_name);
1092 for (std::list<std::string>::iterator ite =
1093 capFiles.begin(); ite != capFiles.end(); ite++) {
1094 if (binPath == *ite) {
1095 std::list<std::string> nodes;
1096 boost::split(nodes, binPath, boost::is_any_of("/"));
1097 std::string newPath("/tmp/");
1098 newPath += nodes.back();
1099 FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "EXCHG %s", newPath.c_str());
1100 snprintf(cfg_data.binary_name,
1101 sizeof(cfg_data.binary_name), "%s", newPath.c_str());
1107 // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "is_start_required: %s", is_start_required);
1108 cfg_data.is_start_required = (std::strcmp("True",
1109 is_start_required) == 0);
1111 if (std::strcmp("True", group_wait_for_trigger) == 0) {
1112 cfg_data.group_wait_for_trigger = TRUE;
1114 cfg_data.group_wait_for_trigger = FALSE;
1117 // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "critical: %s", critical);
1118 cfg_data.critical = (std::strcmp("True", critical) == 0);
1120 // FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "shutdown_critical: %s", shutdown_critical);
1121 cfg_data.shutdown_critical = (std::strcmp("True",
1122 shutdown_critical) == 0);
1124 cfg_data.SetAGLUnit(ParseBoolParameter(is_agl_unit, TRUE));
1125 cfg_data.SetAGLResetHistoryDisable(ParseBoolParameter(disable_agl_resethistory));
1126 cfg_data.SetNonAGLResetHisoryDisable(ParseBoolParameter(disable_nonagl_resethistory));
1128 GroupLaunchInfo grp_info;
1129 grp_info.start_complete = FALSE;
1130 grp_info.stop_complete = FALSE;
1131 grp_info.launch_complete = FALSE;
1132 grp_info.name = cfg_data.group_name;
1133 grp_info.id = cfg_data.group_id;
1134 grp_info.grp_launch_wait = cfg_data.group_launch_wait;
1135 grp_info.grp_wait_for_trigger =
1136 cfg_data.group_wait_for_trigger;
1137 ModuleLaunchListIter l_moduleLaunchListIter;
1139 GroupLaunchMapIter grp_iter = groups_map.find(grp_info.id);
1140 if (grp_iter != groups_map.end()) {
1141 l_moduleLaunchListIter = set_cfg_grp_member_info(
1142 cfg_data, grp_iter->second.modules);
1144 l_moduleLaunchListIter = set_cfg_grp_member_info(
1145 cfg_data, grp_info.modules);
1147 // add this grp info object to the list of grps
1148 groups_map.insert(make_pair(grp_info.id, grp_info));
1151 std::string l_binaryNameStr = cfg_data.binary_name;
1152 size_t l_binaryNamePos = l_binaryNameStr.find_last_of("/");
1153 if (std::string::npos != l_binaryNamePos) {
1154 l_binaryNameStr = l_binaryNameStr.substr(l_binaryNamePos + 1);
1155 f_processNameMap.insert(
1156 make_pair(l_binaryNameStr, l_moduleLaunchListIter));
1160 std::sprintf(key, "ModulesLaunchConfig.Launch%d", ++launch_idx); // NOLINT
1161 value = l_pReaderCfg->GetString(key);
1164 } else { // LCOV_EXCL_START 6: Because new doesn't pass the failure case
1165 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1166 // defaults use from the header file ... this is much faster then reading from an xml file.
1167 FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
1168 " Warning: \"new CNSConfigReader(%s)\" returned NULL; using "
1169 "constants.", f_launchCfgFn.c_str());
1170 UI_32 num_of_items = static_cast<UI_32>(_countof(g_arrLaunchTableCfg));
1171 for (UI_32 arr_idx = 0; arr_idx < num_of_items; arr_idx++) {
1172 GroupLaunchInfo grp_info;
1173 grp_info.launch_complete = FALSE;
1174 grp_info.name = g_arrLaunchTableCfg[arr_idx].group_name;
1175 grp_info.id = g_arrLaunchTableCfg[arr_idx].group_id;
1176 grp_info.grp_launch_wait =
1177 g_arrLaunchTableCfg[arr_idx].group_launch_wait;
1179 GroupLaunchMapIter grp_iter = groups_map.find(grp_info.id);
1181 if (grp_iter != groups_map.end()) {
1182 set_grp_member_info(g_arrLaunchTableCfg[arr_idx],
1183 grp_iter->second.modules);
1185 set_grp_member_info(g_arrLaunchTableCfg[arr_idx],
1187 // add this grp info object to the list of grps
1188 groups_map.insert(make_pair(grp_info.id, grp_info));
1193 if (rtn_code == TRUE) {
1194 load_parameters_order_cfg(groups_map, f_OrderList, f_launchOrderName, f_launchCfgFn);
1197 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1201 VOID SysMgrConfiguration::PrintGroupInfo(GroupLaunchInfo& refGrpInfo) {
1202 std::stringstream l_logMsg;
1204 l_logMsg << endl << "Group: " << refGrpInfo.name.data() << endl
1205 << " id: " << refGrpInfo.id << endl << " wait-time: "
1206 << refGrpInfo.grp_launch_wait << endl << " launch complete: "
1207 << (refGrpInfo.launch_complete == TRUE ? "YES" : "NO"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
1209 std::string l_logStr = l_logMsg.str();
1210 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", l_logStr.c_str());
1213 VOID SysMgrConfiguration::PrintModuleInfo(ModuleLaunchParams& refMbrInfo) {
1214 std::stringstream l_logMsg;
1216 // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length)
1217 l_logMsg << endl << "Module: " << refMbrInfo.name.data() << endl
1218 << " path: " << refMbrInfo.path.data() << endl << " args: "
1219 << refMbrInfo.arguments.data() << endl << " restart: "
1220 << refMbrInfo.restart.data() << endl
1221 << " configuration_priority: "
1222 << refMbrInfo.configuration_priority << endl
1224 << refMbrInfo.cpu_assign << endl
1225 << " current_priority: " << refMbrInfo.current_priority << endl
1226 << " previous_priority: " << refMbrInfo.previous_priority << endl
1227 << " critical: " << (refMbrInfo.critical == TRUE ? "YES" : "NO")
1229 << " retry count: " << refMbrInfo.retry_cnt << endl
1230 << " logging mask: " << refMbrInfo.logging_msk_str << endl
1231 << " is_start_required: "
1232 << (refMbrInfo.is_start_required == TRUE ? "YES" : "NO")
1234 << " shutdown_critical: "
1235 << (refMbrInfo.shutdown_critical == TRUE ? "YES" : "NO") << endl
1236 << " shutdown_wait_time: " << refMbrInfo.shutdown_wait_time
1237 << endl << " fast_shutdown_wait_time: "
1238 << refMbrInfo.fast_shutdown_wait_time << endl << " is_agl_unit: "
1239 << refMbrInfo.IsAGLUnit() << endl << " disable_agl_resethistory: "
1240 << refMbrInfo.IsAGLResetHistoryDisable() << endl << " disable_nonagl_resethistory: "
1241 << refMbrInfo.IsNonAGLResetHistoryDisable() << endl << " state: "
1242 << refMbrInfo.ModuleStateStr() << endl << " group ID: "
1243 << refMbrInfo.group_id << endl << " debug dump state: "
1244 << refMbrInfo.GetModuleDebugDumpStateStr();
1245 // LCOV_EXCL_BR_STOP
1246 std::string l_logStr = l_logMsg.str();
1247 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", l_logStr.c_str());
1250 VOID SysMgrConfiguration::PrintAllInfo(GroupLaunchMap& refGrpMap) {
1251 // get first client from the map...
1252 GroupLaunchMapIter grp_iter = refGrpMap.begin();
1254 for (; grp_iter != refGrpMap.end(); grp_iter++) {
1255 PrintGroupInfo(grp_iter->second);
1256 ModuleLaunchListIter mbr_iter = grp_iter->second.modules.begin();
1257 for (; mbr_iter != grp_iter->second.modules.end(); mbr_iter++) {
1258 PrintModuleInfo(*mbr_iter);
1263 BOOL SysMgrConfiguration::ParseBoolParameter(PCSTR f_value, BOOL f_default) const {
1264 if (FALSE == f_default) {
1265 const char TRUE_VALUE[] = "True";
1266 if (0 == strcmp(TRUE_VALUE, f_value)) {
1270 const char FALSE_VALUE[] = "False";
1271 if (0 == strcmp(FALSE_VALUE, f_value)) {
1279 * SM Configuration data constructor
1281 SMConfigParams::SMConfigParams() {
1285 * SM Configuration data destructor
1287 SMConfigParams::~SMConfigParams() {
1290 ////////////////////////////////////////////////////////////////////////////////////////////
1292 /// \brief Print the configuration data stored in config structure
1294 /// \param [in] configata
1295 /// ConfigurationData & - Ref to structure that get populated.
1298 ////////////////////////////////////////////////////////////////////////////////////////////
1299 VOID SMConfigParams::PrintConfigInfo(ConfigurationData const & f_ConfigParams) {
1300 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "AppHeartBeatInterval_Initial Info: %d",
1301 f_ConfigParams.HBConfig.ApplicationHeartBeatIntervalInitial);
1302 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "AppHeartBeatInterval_Repeat Info: %d",
1303 f_ConfigParams.HBConfig.ApplicationHeartBeatIntervalRepeat);
1304 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "HBMaxHeartBeatRetryCount Info: %d",
1305 f_ConfigParams.HBConfig.MaxHeartBeatRetryCount);
1306 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "CDEnabled: %d",
1307 f_ConfigParams.CDConfig.CrashDetectorEnabled);
1308 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SLMTimerValue: %d",
1309 f_ConfigParams.SLMConfig.SLMTimerValue);
1310 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SLMMaxRetryCount: %d",
1311 f_ConfigParams.SLMConfig.SLMMaxRetryCount);
1312 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SLMThresholdValue: %d",
1313 f_ConfigParams.SLMConfig.SLMThresholdValue);
1314 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "SLMSystemmanagerLogIntervalMs: %d",
1315 f_ConfigParams.SLMConfig.SLMSystemmanagerLogIntervalMs);
1316 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "UserModeStructIsBoolean: %s",
1317 GetStr(f_ConfigParams.UMConfig.IsUserModeNotificationABOOL).c_str());
1318 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "ModuleConnectionNumTimesToCheck: %d",
1319 f_ConfigParams.MCConfig.ModuleConnectionNumTimesToCheck);
1320 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "ModuleConnectionTimeOutSec: %d",
1321 f_ConfigParams.MCConfig.ModuleConnectionTimeOutSec);
1322 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "ModuleStartRespTimeOutSec: %d",
1323 f_ConfigParams.MCConfig.ModuleStartRespTimeOutSec);
1324 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "CriticalAppsMaxShutdownTimeFastSleep: %d",
1325 f_ConfigParams.CAMSTConfig.CriticalAppsMaxShutdownTimeFastSleep);
1326 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__,
1327 "CriticalAppsMaxShutdownTimeNormalReset: %d",
1328 f_ConfigParams.CAMSTConfig.CriticalAppsMaxShutdownTimeNormalReset);
1332 ////////////////////////////////////////////////////////////////////////////////////////////
1333 /// GetSMConfigInformation
1334 /// \brief Read config data from cfg file and populate the configuration data structure
1336 /// \param [in] f_ConfigParams & - Ref to ConfigurationData that get populated.
1337 /// \param [in] f_FileName - Configuration file name.
1340 /// BOOL - TRUE or FALSE
1341 ////////////////////////////////////////////////////////////////////////////////////////////
1342 BOOL SMConfigParams::GetSMConfigInformation(ConfigurationData& f_ConfigParams, SS_String f_FileName) {
1343 EFrameworkunifiedStatus l_eStatus;
1344 BOOL l_rtnCode = FALSE; // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
1346 CNSConfigReader *l_pReaderCfg = new (std::nothrow) CNSConfigReader(); // LCOV_EXCL_BR_LINE 10: As new does not fail
1347 // LCOV_EXCL_BR_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
1348 if (NULL == l_pReaderCfg) {
1349 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1350 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
1351 " Error. new CNSConfigReader() returned NULL pointer.");
1353 if (eFrameworkunifiedStatusOK != (l_eStatus = l_pReaderCfg->Parse(f_FileName))) {
1354 // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
1355 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1356 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
1357 " Error. l_pReaderCfg->Open(%s) returned NULL pointer.",
1358 f_FileName.c_str());
1360 } else if (eFrameworkunifiedStatusOK
1361 != (l_eStatus = l_pReaderCfg->GetInt(
1362 "Heartbeat.MaxHeartBeatRetryCount",
1363 f_ConfigParams.HBConfig.MaxHeartBeatRetryCount))) {
1364 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1365 LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
1366 "l_pReaderCfg->GetInt('Heartbeat.MaxHeartBeatRetryCount')");
1367 } else if (eFrameworkunifiedStatusOK
1368 != (l_eStatus = l_pReaderCfg->GetInt(
1369 "Heartbeat.AppHeartBeatIntervalInitial",
1370 f_ConfigParams.HBConfig.ApplicationHeartBeatIntervalInitial))) {
1371 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1372 LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
1373 "l_pReaderCfg->GetInt('Heartbeat.AppHeartBeatIntervalInitial')");
1374 } else if (eFrameworkunifiedStatusOK
1375 != (l_eStatus = l_pReaderCfg->GetInt(
1376 "Heartbeat.AppHeartBeatIntervalRepeat",
1377 f_ConfigParams.HBConfig.ApplicationHeartBeatIntervalRepeat))) {
1378 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1379 LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
1380 "l_pReaderCfg->GetInt('Heartbeat.AppHeartBeatIntervalRepeat')");
1381 } else if (eFrameworkunifiedStatusOK
1382 != (l_eStatus = l_pReaderCfg->GetBool("CrashDetector.Enabled",
1383 f_ConfigParams.CDConfig.CrashDetectorEnabled))) {
1384 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1385 LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
1386 "l_pReaderCfg->GetBool('CrashDetector.Enabled')");
1387 } else if (eFrameworkunifiedStatusOK
1388 != (l_eStatus = l_pReaderCfg->GetInt("SysLowMemory.TimerValue",
1389 f_ConfigParams.SLMConfig.SLMTimerValue))) {
1390 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1391 LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
1392 "l_pReaderCfg->GetInt('SysLowMemory.TimerValue')");
1393 } else if (eFrameworkunifiedStatusOK
1394 != (l_eStatus = l_pReaderCfg->GetInt(
1395 "SysLowMemory.MaxRetryCount",
1396 f_ConfigParams.SLMConfig.SLMMaxRetryCount))) {
1397 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1398 LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
1399 "l_pReaderCfg->GetInt('SysLowMemory.MaxRetryCount')");
1400 } else if (eFrameworkunifiedStatusOK
1401 != (l_eStatus = l_pReaderCfg->GetInt(
1402 "SysLowMemory.ThresholdValue",
1403 f_ConfigParams.SLMConfig.SLMThresholdValue))) {
1404 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1405 LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
1406 "l_pReaderCfg->GetInt('SysLowMemory.ThresholdValue')");
1407 } else if (eFrameworkunifiedStatusOK
1408 != (l_eStatus = l_pReaderCfg->GetInt(
1409 "SysLowMemory.InterfaceunifiedLogIntervalMs",
1410 f_ConfigParams.SLMConfig.SLMSystemmanagerLogIntervalMs))) {
1411 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1412 LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
1413 "l_pReaderCfg->GetInt('SysLowMemory.InterfaceunifiedLogIntervalMs')");
1414 } else if (eFrameworkunifiedStatusOK
1415 != (l_eStatus = l_pReaderCfg->GetBool(
1416 "UserModeNotification.IsBoolean",
1417 f_ConfigParams.UMConfig.IsUserModeNotificationABOOL))) {
1418 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1419 LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
1420 "l_pReaderCfg->GetBool('UserModeNotification.IsBoolean')");
1421 f_ConfigParams.UMConfig.IsUserModeNotificationABOOL = TRUE;
1422 } else if (eFrameworkunifiedStatusOK
1423 != (l_eStatus = l_pReaderCfg->GetInt(
1424 "Module.ModuleConnectionNumTimesToCheck",
1425 f_ConfigParams.MCConfig.ModuleConnectionNumTimesToCheck))) {
1426 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1427 LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
1428 "l_pReaderCfg->GetInt('Module.ModuleConnectionNumTimesToCheck')");
1429 } else if (eFrameworkunifiedStatusOK
1430 != (l_eStatus = l_pReaderCfg->GetInt(
1431 "Module.ModuleConnectionTimeOutSec",
1432 f_ConfigParams.MCConfig.ModuleConnectionTimeOutSec))) {
1433 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1434 LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
1435 "l_pReaderCfg->GetInt('Module.ModuleConnectionTimeOutSec')");
1436 } else if (eFrameworkunifiedStatusOK
1437 != (l_eStatus = l_pReaderCfg->GetInt(
1438 "Module.ModuleStartRespTimeOutSec",
1439 f_ConfigParams.MCConfig.ModuleStartRespTimeOutSec))) {
1440 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1441 LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
1442 "l_pReaderCfg->GetInt('Module.ModuleStartRespTimeOutSec')");
1443 } else if (eFrameworkunifiedStatusOK
1444 != (l_eStatus = l_pReaderCfg->GetInt(
1445 "CriticalApps.CriticalAppsMaxShutdownTimeFastSleep",
1446 f_ConfigParams.CAMSTConfig.CriticalAppsMaxShutdownTimeFastSleep))) {
1447 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1448 LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
1449 "l_pReaderCfg->GetInt('CriticalApps.CriticalAppsMaxShutdownTimeFastSleep')");
1450 } else if (eFrameworkunifiedStatusOK
1451 != (l_eStatus = l_pReaderCfg->GetInt(
1452 "CriticalApps.CriticalAppsMaxShutdownTimeNormalReset",
1453 f_ConfigParams.CAMSTConfig.CriticalAppsMaxShutdownTimeNormalReset))) {
1454 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1455 LOG_STATUS_IF_ERRORED(l_eStatus, // LCOV_EXCL_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
1456 "l_pReaderCfg->GetInt('CriticalApps.CriticalAppsMaxShutdownTimeNormalReset')");
1461 delete l_pReaderCfg; // LCOV_EXCL_BR_LINE 10: As the delete does not fail
1463 // LCOV_EXCL_BR_STOP
1468 ////////////////////////////////////////////////////////////////////////////////////////////
1469 /// LoadSMConfigParameters
1470 /// \brief Read System Manager configuration parameters from cfg file or
1471 /// use defaults values in case cfg file is not available
1473 /// \param [in] f_ConfigParams & - Ref to ConfigurationData that get populated.
1474 /// \param [in] f_FileName - Configuration file name.
1477 /// BOOL - TRUE or FALSE
1478 ////////////////////////////////////////////////////////////////////////////////////////////
1479 BOOL SMConfigParams::LoadSMConfigParameters(ConfigurationData& f_ConfigParams, SS_String f_FileName) {
1480 BOOL rtn_code = TRUE;
1482 rtn_code = GetSMConfigInformation(f_ConfigParams, f_FileName);
1484 // cfg config file not found, use constants
1485 if (FALSE == rtn_code) {
1486 // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value)
1487 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1488 FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
1489 " Warning: cfg config file not open, using constants");
1491 // Heart Beat constants
1492 f_ConfigParams.HBConfig.ApplicationHeartBeatIntervalInitial =
1493 HBApplicationHeartBeatIntervalInitial;
1494 f_ConfigParams.HBConfig.ApplicationHeartBeatIntervalRepeat =
1495 HBApplicationHeartBeatIntervalRepeat;
1496 f_ConfigParams.HBConfig.MaxHeartBeatRetryCount = HBMaxHeartBeatRetryCount;
1498 // Crash Detector constants
1499 f_ConfigParams.CDConfig.CrashDetectorEnabled = CDEnabled;
1501 // System Low Memory
1502 f_ConfigParams.SLMConfig.SLMTimerValue = SLMTimerValue;
1503 f_ConfigParams.SLMConfig.SLMMaxRetryCount = SLMRetryCount;
1504 f_ConfigParams.SLMConfig.SLMThresholdValue = SLMThresholdValue;
1505 f_ConfigParams.SLMConfig.SLMSystemmanagerLogIntervalMs = SLMSystemmanagerLogIntervalMs;
1507 // Module connect and start resp
1508 f_ConfigParams.MCConfig.ModuleConnectionNumTimesToCheck =
1509 ModuleConnectionNumTimesToCheck;
1510 f_ConfigParams.MCConfig.ModuleConnectionTimeOutSec =
1511 ModuleConnectionTimeOutSec;
1512 f_ConfigParams.MCConfig.ModuleStartRespTimeOutSec = ModuleStartRespTimeOutSec;
1514 // Critical Apps shutdown time
1515 f_ConfigParams.CAMSTConfig.CriticalAppsMaxShutdownTimeFastSleep =
1516 CriticalAppsMaxShutdownTimeFastSleepSec;
1517 f_ConfigParams.CAMSTConfig.CriticalAppsMaxShutdownTimeNormalReset =
1518 CriticalAppsMaxShutdownTimeNormalResetSec;
1520 // USer Mode Data Structure Type
1521 f_ConfigParams.UMConfig.IsUserModeNotificationABOOL = TRUE;
1524 PrintConfigInfo(f_ConfigParams);
1527 } // LCOV_EXCL_BR_LINE 10: Final line