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 IAT error event logging.
21 ///////////////////////////////////////////////////////////////////////////////
22 #include <system_service/ss_system_manager_notifications.h>
23 #include <native_service/frameworkunified_framework_if.h>
24 #include <native_service/frameworkunified_multithreading.h>
25 #include <system_service/ss_services.h>
26 #include <system_service/ss_client_names.h>
27 #include <system_service/ss_power_service_if.h>
28 #include <processlauncher/ProcessLauncher_if.h>
29 #include <processlauncher/ss_sm_process_launcher_protocol.h>
30 #include <processlauncher/ss_sm_process_launcher.h>
31 #include <heartbeat/ss_hb_if.h>
32 #include <system_service/ss_heartbeat_service_protocol.h>
34 #include <system_service/ss_power_service_notifications.h>
35 #include <system_service/ss_power_service_protocol.h>
36 #include <stub/ss_diag.h>
37 #include <system_service/ss_test_clients.h>
38 #include <native_service/ns_np_service_protocol.h>
39 #include <native_service/frameworkunified_application.h>
40 #include <system_service/ss_sm_thread_names.h>
41 #include <system_service/ss_templates.h>
42 #include <native_service/ns_plogger_if.h>
43 #include <native_service/frameworkunified_thread_priority.h>
44 #include <native_service/ns_np_service_nor_persistence.h>
45 #include <native_service/cl_process.h>
51 #include <sys/procfs.h>
55 #include <sys/timeb.h>
57 #include "ss_system_manager.h"
58 #include "ss_sm_systemmanagerlog.h"
59 #include "ss_sm_signals.h"
60 #include "ss_sm_default_paths.h"
61 #include "ss_sm_version.h"
63 ///////////////////////////////////////////////////////////////////////////////
64 /// \ingroup OnHeartBeatErrorDetected
65 /// This function gets called when a heartbeat failure is detected.
67 /// \param [in] f_hApp
68 /// HANDLE - Handle of the Client Application
71 /// EFrameworkunifiedStatus - success or error
72 ///////////////////////////////////////////////////////////////////////////////
73 EFrameworkunifiedStatus CSystemManager::OnHeartBeatErrorDetected(HANDLE f_hApp) {
74 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
75 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
77 EErrorEventResetType l_resetType;
78 SMLoggingInfo l_loggingInfo;
79 std::string l_moduleBinaryName;
81 THbReportData l_HBReport;
83 INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
85 if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < THbReportData > (f_hApp, l_HBReport))) {
86 LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
88 FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Report contains : %d entries.", l_HBReport.nNumOfModules);
90 for (l_ix = 0; l_ix < l_HBReport.nNumOfModules; l_ix++) {
91 if (HB_STATUS_TIMEOUT == l_HBReport.tModuleList[l_ix].ProcHBState) {
92 std::string l_moduleQueueName = l_HBReport.tModuleList[l_ix].ProcQueueName; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
94 m_HBReport.eEntireState = l_HBReport.eEntireState;
95 m_HBReport.nNumOfModules = l_HBReport.nNumOfModules;
96 memcpy(&m_HBReport.tModuleList[l_ix], &l_HBReport.tModuleList[l_ix], sizeof(TSmModuleInfo));
98 TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
99 " ERROR EVENT: Heartbeat error detected from: %s.", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
100 l_moduleQueueName.c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
102 l_eStatus = GetBinaryNameOfProcess(l_moduleQueueName, l_moduleBinaryName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
104 if (eFrameworkunifiedStatusOK != l_eStatus) {
105 FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
106 " Warning. Unable to identify binary name for SM child process with queue name: %s."
107 " The process name will be missing from the .csv and the core file will not be archived.",
108 l_moduleQueueName.c_str());
110 strncpy(l_loggingInfo.binaryFileName,
111 l_moduleBinaryName.c_str(),
112 sizeof(l_loggingInfo.binaryFileName) - 1);
115 if (eFrameworkunifiedStatusOK != (l_eStatus = ActOnModuleFailure(f_hApp, l_moduleQueueName, l_resetRequired))) {
116 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
117 " Error. ActOnModuleFailure(%s,%d) errored: %d/'%s'",
118 l_moduleQueueName.c_str(), l_resetRequired,
119 l_eStatus, GetStr(l_eStatus).c_str());
123 (FALSE == l_resetRequired) ?
124 eErrorEventResetTypeNone :
125 eErrorEventResetTypeHard;
127 if (eErrorEventResetTypeNone != l_resetType) {
128 l_loggingInfo.resetReason =
129 e_SS_SM_CPU_RESET_REASON_GENERIC_ERR;
132 l_eStatus = ErrorEventEnqueue(f_hApp,
133 eErrorEventTypeHeartBeatFailure, l_moduleQueueName,
134 l_resetType, l_loggingInfo);
136 LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
137 "ErrorEventEnqueue(eErrorEventTypeHeartBeatFailure)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
142 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
146 ///////////////////////////////////////////////////////////////////////////////
147 /// \ingroup OnProcessTermDetected
151 /// \param Handle to AGL application.
153 /// \return EFrameworkunifiedStatus
154 /// Success ==> eFrameworkunifiedStatusOK
155 /// Failure ==> Other values
156 ///////////////////////////////////////////////////////////////////////////////
157 EFrameworkunifiedStatus CSystemManager::OnProcessTermDetected(HANDLE f_hApp) {
158 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
159 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
163 // When multiple child processes terminate, CL_ProcessCleanup() returns 1. If 1 is returned, it repeats.
165 CL_ProcessCleanupInfo_t l_procInfo;
169 l_clRet = CL_ProcessCleanup(m_ClProcessSigFd, &l_procInfo);
170 if (l_clRet != 0 && l_clRet != 1) {
171 FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
172 " Warning: CL_ProcessCleanup(%d):%s", l_clRet,
174 l_eStatus = eFrameworkunifiedStatusFail;
178 FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "PID:%d code:%d status:%d",
179 l_procInfo.pid, l_procInfo.code, l_procInfo.status);
181 // Terminate a process group to reclaim descendants of an anomaly terminated process
182 SS_ASERT_ERRNO(0 == CL_ProcessAbortGroup(l_procInfo.pid)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
184 BOOL bIsExited = (CLD_EXITED == l_procInfo.code) ? TRUE : FALSE; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
185 SMProcessExitInfo l_procExitInfo;
186 memset(&l_procExitInfo, 0, sizeof(l_procExitInfo));
187 l_procExitInfo.pid = l_procInfo.pid;
188 // Process exit value when si_code == CLD_EXITED, else delivered signal number.
189 l_procExitInfo.exitValue = l_procInfo.status;
190 l_procExitInfo.signalNumber = SS_SM_ABORT_SIGNAL;
192 // If GroupRelaunch is required, kill the remaining services
193 SS_String l_moduleQueueName("");
194 if (eFrameworkunifiedStatusOK == FindNameOfTerminatedProcess(l_procExitInfo.pid, l_moduleQueueName)) {
195 for (GroupRelaunchModuleListIter l_itr =
196 m_GroupRelaunchModuleList.begin();
197 m_GroupRelaunchModuleList.end() != l_itr; l_itr++) {
198 if (l_itr->name == l_moduleQueueName) {
199 if (l_itr->bIsKilled) { // LCOV_EXCL_BR_LINE 200: relaunch module bIsKilled is always false
200 // LCOV_EXCL_START 200: relaunch module bIsKilled is always false
201 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
202 // Normal during forced Relaunch
203 l_procExitInfo.exitValue = SS_SM_EXIT_RELAUNCH;
205 l_itr->bIsKilled = FALSE;
208 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "GroupRelaunch(%d/%d)",
209 m_GroupRelaunchCount, m_GroupRelaunchLimit);
211 if (m_GroupRelaunchCount < m_GroupRelaunchLimit) {
212 SS_ASERT( // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
213 FrameworkunifiedNPPublishNotification(f_hApp, // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
214 NTFY_SSNeedAplRestart, NULL, 0)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
217 SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
218 SS_String l_moduleBinaryName(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
220 l_loggingInfo.pid = l_procExitInfo.pid;
221 l_loggingInfo.exitValue = l_procExitInfo.exitValue;
222 l_loggingInfo.signalNumber = SS_SM_ABORT_SIGNAL;
223 if (eFrameworkunifiedStatusOK != GetBinaryNameOfProcess(l_moduleQueueName, l_moduleBinaryName)) { // LCOV_EXCL_BR_LINE 200: cannot be error
224 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
225 SS_ASERT(0); // LCOV_EXCL_LINE 200: cannot be error
227 snprintf(l_loggingInfo.binaryFileName,
228 sizeof(l_loggingInfo.binaryFileName),
229 "%s", l_moduleBinaryName.c_str());
232 l_eStatus = ErrorEventEnqueue(f_hApp,
233 eErrorEventTypeGroupRelaunch, l_itr->name,
234 eErrorEventResetTypeNone, l_loggingInfo);
235 LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
236 "ErrorEventEnqueue()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
238 // Relaunch normally and do not leave anomaly LOGs
239 l_procExitInfo.exitValue = SS_SM_EXIT_RELAUNCH;
242 for (GroupRelaunchModuleListIter l_itr =
243 m_GroupRelaunchModuleList.begin();
244 m_GroupRelaunchModuleList.end() != l_itr;
246 if (l_itr->name != l_moduleQueueName) { // LCOV_EXCL_BR_LINE 200: name always be equal because of outer if judge // NOLINT(whitespace/line_length)
247 // LCOV_EXCL_START 200: name always be equal
248 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
249 ModuleLaunchListIter l_ModuleListIter;
250 if (eFrameworkunifiedStatusOK
251 != GetModuleIterator(
254 SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
256 killpg(l_ModuleListIter->pid,
257 SS_SM_TERMINATE_SIGNAL);
258 l_itr->bIsKilled = TRUE;
264 m_GroupRelaunchCount++;
267 ModuleLaunchListIter l_ModuleListIter;
268 if (eFrameworkunifiedStatusOK == GetModuleIterator(l_moduleQueueName.c_str(), l_ModuleListIter)) { // LCOV_EXCL_BR_LINE 200:cannot be error // NOLINT(whitespace/line_length)
269 l_ModuleListIter->relaunch_count = l_ModuleListIter->retry_cnt;
271 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
272 SS_ASERT(0); // LCOV_EXCL_LINE 200: cannot be error
281 if (isPreLaunchedProcess(l_procExitInfo.pid)) { // LCOV_EXCL_BR_LINE 200:prelaunch mode is not valid at UT test //NOLINT (whitespace/line_length)
282 // LCOV_EXCL_START 200 :prelaunch mode is not valid at UT test
283 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
284 l_eStatus = OnPreLaunchedProcessTermDetected(f_hApp, l_procExitInfo, bIsExited); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
285 if (eFrameworkunifiedStatusOK != l_eStatus) {
286 LOG_ERROR("OnPreLaunchedProcessTermDetected()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
287 l_eStatus = eFrameworkunifiedStatusFail;
288 // If an error occurs here, the zombie process may be collected and continued.
291 } else if (bIsExited) {
292 l_eStatus = OnProcessExitDetected(f_hApp, l_procExitInfo); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
293 if (eFrameworkunifiedStatusOK != l_eStatus) {
294 LOG_ERROR("OnProcessExitDetected()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
295 l_eStatus = eFrameworkunifiedStatusFail;
296 // If an error occurs here, the zombie process may be collected and continued.
299 l_eStatus = OnProcessCrashDetected(f_hApp, l_procExitInfo); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
300 if (eFrameworkunifiedStatusOK != l_eStatus) {
301 LOG_ERROR("OnProcessCrashDetected()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
302 l_eStatus = eFrameworkunifiedStatusFail;
303 // If an error occurs here, the zombie process may be collected and continued.
306 } while (l_clRet == 1 && l_count < 50);
308 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
312 BOOL CSystemManager::isPreLaunchedProcess(int f_pid) {
313 BOOL l_bIsExist = FALSE;
315 PreLaunchModuleListIter l_itr;
316 for (l_itr = m_PreLaunchModuleList.begin();
317 m_PreLaunchModuleList.end() != l_itr; l_itr++) {
318 if (l_itr->pid == f_pid) { // LCOV_EXCL_BR_LINE 200:prelaunch mode is not valid at UT test //NOLINT (whitespace/line_length)
319 // LCOV_EXCL_START 200 :prelaunch mode is not valid at UT test
320 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
329 EFrameworkunifiedStatus CSystemManager::OnPreLaunchedProcessTermDetected(HANDLE f_hApp, SMProcessExitInfo &f_procExitInfo, BOOL f_bIsExited) { // LCOV_EXCL_START 200 :prelaunch mode is not valid at UT test // NOLINT(whitespace/line_length)
330 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
331 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
333 PreLaunchModuleListIter l_itr;
334 for (l_itr = m_PreLaunchModuleList.begin();
335 m_PreLaunchModuleList.end() != l_itr; l_itr++) {
336 if (l_itr->pid == static_cast<int>(f_procExitInfo.pid)) {
342 if (m_PreLaunchModuleList.end() == l_itr) {
343 SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
344 throw eFrameworkunifiedStatusFail;
347 BOOL l_bIsNeedRelaunched = FALSE;
349 if ((SS_SM_RELAUNCH_NO_LIMIT == l_itr->relaunchLimit)
350 || (l_itr->relaunchLimit > l_itr->relaunchCount)) {
351 l_itr->relaunchCount++;
352 FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Relaunch %s(%d/%d)",
353 l_itr->name.c_str(), l_itr->relaunchCount,
354 l_itr->relaunchLimit);
355 if (-1 == (l_itr->pid = l_itr->LaunchFunc())) {
356 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Relaunch %s Failed",
357 l_itr->name.c_str());
359 l_bIsNeedRelaunched = TRUE;
363 if (!l_bIsNeedRelaunched) {
364 if (l_itr->critical) {
365 SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
366 EErrorEventType l_ErrorType;
370 l_loggingInfo.pid = f_procExitInfo.pid;
371 l_loggingInfo.exitValue = f_procExitInfo.exitValue;
372 l_loggingInfo.signalNumber = f_procExitInfo.signalNumber;
373 l_loggingInfo.resetReason =
374 e_SS_SM_CPU_RESET_REASON_GENERIC_ERR;
375 snprintf(l_loggingInfo.binaryFileName,
376 sizeof(l_loggingInfo.binaryFileName), "%s",
377 l_itr->binaryFileName.c_str());
380 FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s exited",
381 l_itr->name.c_str());
382 l_ErrorType = eErrorEventTypeProcessExit;
384 FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s crashed",
385 l_itr->name.c_str());
386 l_ErrorType = eErrorEventTypeProcessCrash;
389 l_eStatus = ErrorEventEnqueue(f_hApp, l_ErrorType, l_itr->name,
390 eErrorEventResetTypeHard, l_loggingInfo);
391 LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "ErrorEventEnqueue()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
393 FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s removed",
394 l_itr->name.c_str());
398 } catch (EFrameworkunifiedStatus e) {
406 ///////////////////////////////////////////////////////////////////////////////
407 /// \ingroup OnProcessCrashDetected
408 /// Initiate logging and recovery for an abnormal process termination.
409 /// The terminated process may or may not be a child of system manager.
410 /// If the process is a child of SM, then a validation check must ensue
411 /// to ensure that the process crash is not the result of a failed heartbeat
412 /// and subsequent termination signal sent from System Manager. This function
413 /// is NOT called for processes that exit normally.
415 /// See OnProcessCrashDetected.
417 /// \param Handle to AGL application.
419 /// \return EFrameworkunifiedStatus
420 /// Success ==> eFrameworkunifiedStatusOK
421 /// Failure ==> Other values
422 ///////////////////////////////////////////////////////////////////////////////
423 EFrameworkunifiedStatus CSystemManager::OnProcessCrashDetected(HANDLE f_hApp,
424 SMProcessExitInfo &f_procExitInfo) {
425 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
426 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
427 BOOL l_resetRequired = TRUE;
428 SS_String l_moduleQueueName("");
429 SS_String l_moduleBinaryName(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
430 EErrorEventResetType l_resetType;
432 INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
434 TEXT(__FUNCTION__, " PROCESS CRASH: Process PID: %d", f_procExitInfo.pid); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
436 if (eFrameworkunifiedStatusOK
437 != (l_eStatus = FindNameOfTerminatedProcess(f_procExitInfo.pid, l_moduleQueueName))) {
438 // Normally, logging COULD continue, but stopping logging also solves a PosixBasedOS001 errata
439 // where a process crashes and is removed from the SM process launch map and is ALSO
440 // detected by the exit detector as a 'normal' exit. The FindNameOfTerminatedProcess()
441 // will continue properly IF a crash and removal from the map has not occurred
442 // for the same process.
443 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
444 " Error. FindNameOfTerminatedProcess() returned error: %d/'%s' for PID: %d."
445 " No recovery possible. Logging has been suspended for this event.",
446 l_eStatus, GetStr(l_eStatus).c_str(), f_procExitInfo.pid);
448 l_eStatus = GetBinaryNameOfProcess(l_moduleQueueName, l_moduleBinaryName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
449 if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200: cannot be error
450 // LCOV_EXCL_START 200: cannot be error
451 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
452 FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
453 " Warning. Unable to identify binary for SM child process PID: %d, Queue Name: %s."
454 " The process binary name will be missing from the .csv file.",
455 f_procExitInfo.pid, l_moduleQueueName.c_str());
458 strncpy(f_procExitInfo.binaryFileName, l_moduleBinaryName.c_str(),
459 sizeof(f_procExitInfo.binaryFileName) - 1);
461 f_procExitInfo.binaryFileName[sizeof(f_procExitInfo.binaryFileName) - 1] = '\0';
464 if (eFrameworkunifiedStatusOK
465 != (l_eStatus = ActOnModuleFailure(f_hApp, l_moduleQueueName,
467 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
468 " Error. ActOnModuleFailure(%s,%d) errored: %d/'%s'",
469 l_moduleQueueName.c_str(), l_resetRequired, l_eStatus,
470 GetStr(l_eStatus).c_str());
472 FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__,
473 "Info. ActOnModuleFailure() returned reset status: %d/'%s'.",
474 l_resetRequired, GetStr(l_resetRequired).c_str());
478 (FALSE == l_resetRequired) ?
479 eErrorEventResetTypeNone : eErrorEventResetTypeHard;
481 SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
483 l_loggingInfo.pid = f_procExitInfo.pid;
484 l_loggingInfo.exitValue = f_procExitInfo.exitValue;
485 l_loggingInfo.signalNumber = f_procExitInfo.signalNumber;
486 snprintf(l_loggingInfo.binaryFileName,
487 sizeof(l_loggingInfo.binaryFileName), "%s",
488 f_procExitInfo.binaryFileName);
489 if (eErrorEventResetTypeNone != l_resetType) {
490 l_loggingInfo.resetReason = e_SS_SM_CPU_RESET_REASON_GENERIC_ERR;
493 l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeProcessCrash,
494 l_moduleQueueName, l_resetType, l_loggingInfo);
496 LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
497 "ErrorEventEnqueue(eErrorEventTypeProcessCrash)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
500 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
504 ///////////////////////////////////////////////////////////////////////////////
505 /// \ingroup OnProcessExitDetected
506 /// Initiate logging and recovery for System Manager child processes that
507 /// exit normally via the last brace of main(), exit(), or have their last
508 /// thread exit. This function is NOT called for processes that terminate
511 /// See OnProcessExitDetected.
513 /// \param Handle to AGL application.
515 /// \return EFrameworkunifiedStatus
516 /// Success ==> eFrameworkunifiedStatusOK
517 /// Failure ==> Other values
518 ///////////////////////////////////////////////////////////////////////////////
519 EFrameworkunifiedStatus CSystemManager::OnProcessExitDetected(HANDLE f_hApp,
520 SMProcessExitInfo &f_procExitInfo) {
521 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
522 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail;
523 SS_String l_moduleQueueName("");
525 INTERFACEUNIFIEDLOG_RECEIVED_FROM(f_hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
527 TEXT(__FUNCTION__, "PROCESS EXIT: PID:%d exitValue:%d", f_procExitInfo.pid, // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
528 f_procExitInfo.exitValue); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
530 if (eFrameworkunifiedStatusOK
531 != (l_eStatus = FindNameOfTerminatedProcess(f_procExitInfo.pid,
532 l_moduleQueueName))) {
533 // This happens when SMs to EXEC debugging commands, etc.
534 // Since this is not an error, set LOGs to WARN levels and set the return codes to OK.
535 FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "%s: pid:%d is unknown service",
536 GetStr(l_eStatus).c_str(), f_procExitInfo.pid);
537 l_eStatus = eFrameworkunifiedStatusOK;
539 if (0 == f_procExitInfo.exitValue) {
540 ModuleLaunchListIter l_moduleListIter;
542 if (eFrameworkunifiedStatusOK != (l_eStatus = RemoveModuleEntryFromHB(f_hApp, l_moduleQueueName.c_str()))) { // LCOV_EXCL_BR_LINE 4: NSFW // NOLINT(whitespace/line_length)
543 // LCOV_EXCL_START 4: NSFW
544 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
545 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
546 " Error: RemoveModuleEntryFromHB(%s) errored: %d/'%s'",
547 l_moduleQueueName.c_str(), l_eStatus,
548 GetStr(l_eStatus).c_str());
552 l_eStatus = GetModuleIterator(l_moduleQueueName.c_str(),
554 if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200:cannot be error
555 // LCOV_EXCL_START 200:cannot be error
556 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
557 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
558 " Error: Module %s not found in Group Launch Map",
559 l_moduleQueueName.c_str());
562 l_eStatus = SendRequestToLauncher(f_hApp, l_moduleListIter, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
563 ePLThrdCmd_TERMINATE_MODULE_REQST, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
564 "ePLThrdCmd_TERMINATE_MODULE_REQST"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
566 LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
567 "SendRequestToLauncher()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
569 // Do not add relaunch_count for normal termination.
570 l_moduleListIter->relaunch_status = RelaunchSafe;
572 } else if (SS_SM_EXIT_RELAUNCH == f_procExitInfo.exitValue) {
573 ModuleLaunchListIter l_moduleListIter;
575 if (eFrameworkunifiedStatusOK != (l_eStatus = RemoveModuleEntryFromHB(f_hApp, l_moduleQueueName.c_str()))) { // LCOV_EXCL_BR_LINE 4: nsfw error // NOLINT(whitespace/line_length)
576 // LCOV_EXCL_START 4: nsfw error
577 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
578 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
579 " Error: RemoveModuleEntryFromHB(%s) errored: %d/'%s'",
580 l_moduleQueueName.c_str(), l_eStatus,
581 GetStr(l_eStatus).c_str());
585 l_eStatus = GetModuleIterator(l_moduleQueueName.c_str(),
587 if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200:cannot be error
588 // LCOV_EXCL_START 200:cannot be error
589 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
590 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
591 " Error: Module %s not found in Group Launch Map",
592 l_moduleQueueName.c_str());
595 l_eStatus = SendRequestToLauncher(f_hApp, l_moduleListIter, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
596 ePLThrdCmd_RELAUNCH_MODULE_REQST, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
597 "ePLThrdCmd_RELAUNCH_MODULE_REQST"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
599 LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
600 "SendRequestToLauncher()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
602 // Do not add relaunch_count for normal Relaunch
603 l_moduleListIter->relaunch_status = RelaunchSafe;
606 SS_String l_moduleBinaryName(""); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
607 BOOL l_resetRequired = TRUE;
608 EErrorEventResetType l_resetType;
610 l_eStatus = GetBinaryNameOfProcess(l_moduleQueueName, l_moduleBinaryName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
611 if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200: cannot be error
612 // LCOV_EXCL_START 200: cannot be error
613 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
614 FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__,
615 " Warning. Unable to identify binary for SM child process PID: %d, Queue Name: %s."
616 " The process binary name will be missing from the .csv file.",
617 f_procExitInfo.pid, l_moduleQueueName.c_str());
620 strncpy(f_procExitInfo.binaryFileName,
621 l_moduleBinaryName.c_str(),
622 sizeof(f_procExitInfo.binaryFileName) - 1);
624 f_procExitInfo.binaryFileName[sizeof(f_procExitInfo.binaryFileName)
628 if (eFrameworkunifiedStatusOK
629 != (l_eStatus = ActOnModuleFailure(f_hApp,
630 l_moduleQueueName, l_resetRequired))) {
631 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
632 " Error. ActOnModuleFailure(%s,%d) errored: %d/'%s'",
633 l_moduleQueueName.c_str(), l_resetRequired, l_eStatus,
634 GetStr(l_eStatus).c_str());
638 (FALSE == l_resetRequired) ?
639 eErrorEventResetTypeNone : eErrorEventResetTypeHard;
641 SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
643 l_loggingInfo.pid = f_procExitInfo.pid;
644 l_loggingInfo.exitValue = f_procExitInfo.exitValue;
645 l_loggingInfo.signalNumber = f_procExitInfo.signalNumber;
646 snprintf(l_loggingInfo.binaryFileName,
647 sizeof(l_loggingInfo.binaryFileName), "%s",
648 f_procExitInfo.binaryFileName);
649 if (eErrorEventResetTypeNone != l_resetType) {
650 l_loggingInfo.resetReason = e_SS_SM_CPU_RESET_REASON_GENERIC_ERR;
653 l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeProcessExit,
654 l_moduleQueueName, l_resetType, l_loggingInfo);
655 LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
656 "ErrorEventEnqueue(eErrorEventTypeProcessExit)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
660 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
664 ///////////////////////////////////////////////////////////////////////////////
665 /// \ingroup OnBootMicroResetNotification
666 /// Called from the logging shadow when the boot micro notifies the shadow of
667 /// an unexpected boot micro reset during the last power cycle.
669 /// \param [in] hApp - Application handle.
671 /// \return EFrameworkunifiedStatus
672 /// Success ==> eFrameworkunifiedStatusOK
673 /// Failure ==> Other values
674 ///////////////////////////////////////////////////////////////////////////////
675 EFrameworkunifiedStatus CSystemManager::OnBootMicroResetNotification(HANDLE hApp) {
676 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
677 std::string l_moduleName;
678 EFrameworkunifiedStatus l_eStatus;
680 INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
682 if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < eSMBootMicroResetReason > (hApp, m_BootMicroResetReason))) {
683 LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
685 l_moduleName = FrameworkunifiedGetMsgSrc(hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
687 TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
688 " ERROR EVENT: A boot micro reset has occurred. Reset reason: %d/'%s'.", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
689 m_BootMicroResetReason, GetStr(m_BootMicroResetReason).c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
691 l_eStatus = ErrorEventEnqueue(hApp, eErrorEventTypeBootMicroReset, l_moduleName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
693 LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
694 "ErrorEventEnqueue(eErrorEventTypeBootMicroReset)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
697 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
701 ///////////////////////////////////////////////////////////////////////////////
702 /// \ingroup RequestBootMicroLog
703 /// Request boot micro log from the logging shadow.
705 /// \param [in] hApp - Application handle.
707 /// \return EFrameworkunifiedStatus
708 /// Success ==> eFrameworkunifiedStatusOK
709 /// Failure ==> Other values
710 ///////////////////////////////////////////////////////////////////////////////
711 EFrameworkunifiedStatus CSystemManager::RequestBootMicroLog(HANDLE hApp) {
712 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
713 EFrameworkunifiedStatus l_eStatus;
715 l_eStatus = FrameworkunifiedPublishEvent(hApp, // Event received by PS Logging Shadow
716 SS_SM_BOOT_MICRO_LOG_REQ,
720 LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
721 "FrameworkunifiedPublishEvent(SS_SM_BOOT_MICRO_LOG_REQ)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
724 m_errorEventTimers[eSM_ERROR_EVENT_TIMER_BOOT_MICRO_LOG_RSPN].Start(
725 SS_ERROR_EVENT_BOOT_MICRO_LOG_RESPONSE_TO_SEC, 0, 0, 0);
726 if (FALSE == result) {
727 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
728 " Error. Failed to start timer eSM_TIMER_BOOT_MICRO_LOG_RESPONSE.");
731 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
735 ///////////////////////////////////////////////////////////////////////////////
736 /// \ingroup OnLowSystemMemory
737 /// Called when a low memory error has been detected.
739 /// \param [in] hApp - Application handle.
741 /// \return EFrameworkunifiedStatus
742 /// Success ==> eFrameworkunifiedStatusOK
743 /// Failure ==> Other values
744 ///////////////////////////////////////////////////////////////////////////////
745 EFrameworkunifiedStatus CSystemManager::OnLowSystemMemory(HANDLE hApp) {
746 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
748 std::string l_moduleName;
749 EFrameworkunifiedStatus l_eStatus;
750 SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
752 if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < SysMem > (hApp, l_SysMem))) {
753 LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
755 m_FreeMemAvailable = l_SysMem.FreeMemoryBytes;
757 TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
758 " ERROR EVENT: System Low Memory detected. Remaining memory: %d.", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
759 m_FreeMemAvailable); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
761 l_moduleName = FrameworkunifiedGetMsgSrc(hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
762 l_loggingInfo.resetReason = e_SS_SM_CPU_RESET_REASON_GENERIC_ERR;
763 l_eStatus = ErrorEventEnqueue(hApp, eErrorEventTypeSystemLowMemory,
764 l_moduleName, eErrorEventResetTypeHard, l_loggingInfo);
766 LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
767 "ErrorEventEnqueue(eErrorEventTypeSystemLowMemory)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
770 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
772 } // End of EFrameworkunifiedStatus CSystemManager::OnLowSystemMemory( HANDLE hApp )
774 EFrameworkunifiedStatus CSystemManager::OnPropagateSystemError(HANDLE hApp) {
775 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
776 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
778 INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
780 SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
782 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
786 ///////////////////////////////////////////////////////////////////////////////
787 /// \ingroup OnUserInvokedLoggingRequest
788 /// Called when the end user invokes a error event logging request by means
789 /// of hard key or other direct input method.
791 /// \param [in] hApp - Application handle.
793 /// \return EFrameworkunifiedStatus
794 /// Success ==> eFrameworkunifiedStatusOK
795 /// Failure ==> Other values
796 ///////////////////////////////////////////////////////////////////////////////
797 EFrameworkunifiedStatus CSystemManager::OnUserInvokedLoggingRequest(HANDLE f_hApp) {
798 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
799 TSystemManagerLoggingRequestInfo l_logInfo;
800 EErrorEventType l_errorEventType;
801 std::string l_moduleName;
802 EFrameworkunifiedStatus l_eStatus;
803 SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
805 if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < TSystemManagerLoggingRequestInfo > (f_hApp, l_logInfo))) { // LCOV_EXCL_BR_LINE 4: NSFW error case // NOLINT(whitespace/line_length)
806 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
807 LOG_ERROR("ReadMsg()"); // LCOV_EXCL_LINE 4: NSFW error case
809 l_moduleName = FrameworkunifiedGetMsgSrc(f_hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
810 l_loggingInfo.messageStr = l_logInfo.messageStr;
811 l_loggingInfo.suffixStr = l_logInfo.suffixStr;
813 switch (l_logInfo.logType) {
814 case e_SS_SM_CAPTURE_ALL_LOGS:
815 l_errorEventType = eErrorEventTypeUserInvokedCollectAllLogs;
818 case e_SS_SM_SCREEN_CAPTURE:
819 l_errorEventType = eErrorEventTypeUserInvokedCollectScreenShot;
822 case e_SS_SM_CAPTURE_INTERFACEUNIFIED_LOGS:
823 l_errorEventType = eErrorEventTypeUserInvokedCollectInterfaceunifiedLogs;
826 case e_SS_SM_CAPTURE_DEV_LOGS:
827 l_errorEventType = eErrorEventTypeUserInvokedCollectDevLogs;
830 case e_SS_SM_CAPTURE_MODULE_LOGS:
831 l_errorEventType = eErrorEventTypeModuleInvokedCollectDebugLogs;
834 case e_SS_SM_CAPTURE_DTC_LOGS:
835 l_errorEventType = eErrorEventTypeDtcEvent;
838 case e_SS_SM_CAPTURE_NAVI_LOGS:
839 l_errorEventType = eErrorEventTypeUserInvokedCollectNaviLog;
842 case e_SS_SM_CAPTURE_GROUP_RELAUNCH:
843 l_errorEventType = eErrorEventTypeGroupRelaunch;
847 l_errorEventType = eErrorEventTypeMaxValue;
848 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
849 " Error. Received unknown user invoked log type: %d. Dropping request.",
854 if (eErrorEventTypeMaxValue != l_errorEventType) { // LCOV_EXCL_BR_LINE 200: will not be the else case
855 TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
856 " ERROR EVENT: User invoked logging request %d/'%s' received. " // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
857 "Adding the request to the event queue.", // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
858 l_logInfo.logType, GetStr(l_logInfo.logType).c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
860 l_eStatus = ErrorEventEnqueue(f_hApp, l_errorEventType,
861 l_moduleName, eErrorEventResetTypeNone, l_loggingInfo);
863 LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
864 "ErrorEventEnqueue(UserInvoked)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
868 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
872 ///////////////////////////////////////////////////////////////////////////////
873 /// \ingroup OnEelExportRequest
874 /// Called when a removable device is inserted and contains the EEL_Export
877 /// \param [in] hApp - Application handle.
879 /// \return EFrameworkunifiedStatus
880 /// Success ==> eFrameworkunifiedStatusOK
881 /// Failure ==> Other values
882 ///////////////////////////////////////////////////////////////////////////////
883 EFrameworkunifiedStatus CSystemManager::OnEelExportRequest(HANDLE f_hApp) {
884 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
885 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
886 UI_32 l_strlen = FrameworkunifiedGetMsgLength(f_hApp);
887 CHAR l_path[l_strlen]; // NOLINT
889 if (l_strlen == 0) { // LCOV_EXCL_BR_LINE 200: restricted by iterface_unified
890 // LCOV_EXCL_START 200: restricted by iterface_unified
891 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
892 SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
893 return eFrameworkunifiedStatusFail;
897 if (sizeof(l_path) != FrameworkunifiedGetMsgLength(f_hApp)) { // LCOV_EXCL_BR_LINE 6: must be equal
898 // LCOV_EXCL_START 6: must be equal
899 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
900 LOG_ERROR("DataSize mismatch"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
902 } else if (eFrameworkunifiedStatusOK // LCOV_EXCL_BR_LINE 4: NSFW error case
903 != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &l_path[0],
904 static_cast<UI_32>(sizeof(l_path)), eSMRRelease))) {
905 // LCOV_EXCL_START 4: NSFW error case
906 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
907 LOG_ERROR("FrameworkunifiedGetMsgDataOfSize()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
911 " ERROR EVENT: EelExport request received. Adding the request to the event queue."); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
912 std::string l_moduleName = FrameworkunifiedGetMsgSrc(f_hApp);
913 SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
915 l_path[l_strlen - 1] = '\0';
916 l_loggingInfo.path = l_path;
918 l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeEelExport,
919 l_moduleName, eErrorEventResetTypeNone, l_loggingInfo);
921 LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
922 "ErrorEventEnqueue(eErrorEventTypeEelExport)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
925 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
929 ///////////////////////////////////////////////////////////////////////////////
930 /// \ingroup OnSystemmanagerEmmcLogsRequest
931 /// Called when a removable device is inserted and contains the LOGGERSERVICE_EMMC_LOGS
934 /// \param [in] hApp - Application handle.
936 /// \return EFrameworkunifiedStatus
937 /// Success ==> eFrameworkunifiedStatusOK
938 /// Failure ==> Other values
939 ///////////////////////////////////////////////////////////////////////////////
940 EFrameworkunifiedStatus CSystemManager::OnSystemmanagerEmmcLogsRequest(HANDLE f_hApp) {
941 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
942 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
943 UI_32 l_strlen = FrameworkunifiedGetMsgLength(f_hApp);
944 CHAR l_path[l_strlen]; // NOLINT
946 if (l_strlen == 0) { // LCOV_EXCL_BR_LINE 4:NSFW
947 // LCOV_EXCL_START 4:NSFW
948 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
950 return eFrameworkunifiedStatusFail;
954 if (sizeof(l_path) != FrameworkunifiedGetMsgLength(f_hApp)) { // LCOV_EXCL_BR_LINE 8: CHAR l_path[l_strlen]
955 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
956 LOG_ERROR("DataSize mismatch"); // LCOV_EXCL_LINE 8: CHAR l_path[l_strlen]
957 } else if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &l_path[0], static_cast<UI_32>(sizeof(l_path)), eSMRRelease))) { // LCOV_EXCL_BR_LINE 4:NSFW error case // NOLINT(whitespace/line_length)
958 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
959 LOG_ERROR("FrameworkunifiedGetMsgDataOfSize()"); // LCOV_EXCL_LINE 4:NSFW error case
961 TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
962 " ERROR EVENT: LOGGERSERVICE_EMMC_LOGS request received. Adding the request to the event queue."); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
963 std::string l_moduleName = FrameworkunifiedGetMsgSrc(f_hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
964 SMLoggingInfo l_loggingInfo;
966 l_path[l_strlen - 1u] = '\0';
967 l_loggingInfo.path = l_path;
969 l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeInterfaceunifiedEmmcLogs,
970 l_moduleName, eErrorEventResetTypeNone, l_loggingInfo);
972 LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
973 "ErrorEventEnqueue(eErrorEventTypeInterfaceunifiedEmmcLogs)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
976 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
980 ///////////////////////////////////////////////////////////////////////////////
981 /// \ingroup OnSystemmanagerClearLogsRequest
982 /// Called when a clear LOGGERSERVICE_EMMC_LOGS requested
985 /// \param [in] hApp - Application handle.
987 /// \return EFrameworkunifiedStatus
988 /// Success ==> eFrameworkunifiedStatusOK
989 /// Failure ==> Other values
990 ///////////////////////////////////////////////////////////////////////////////
991 EFrameworkunifiedStatus CSystemManager::OnSystemmanagerClearLogsRequest(HANDLE f_hApp) {
992 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
993 EFrameworkunifiedStatus l_eStatus;
994 std::string l_moduleName = FrameworkunifiedGetMsgSrc(f_hApp);
996 l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeUserInvokedClearLogs, // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
997 l_moduleName, eErrorEventResetTypeNone); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
999 LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
1000 "ErrorEventEnqueue(eErrorEventTypeUserInvokedClearLogs)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
1002 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1006 ///////////////////////////////////////////////////////////////////////////////
1007 /// \ingroup OnDiagLoggingRequest
1008 /// Called by logger to initiate log artifact collection and storage on behalf
1009 /// of diagnostic services.
1011 /// \param [in] hApp - Application handle.
1013 /// \return EFrameworkunifiedStatus
1014 /// Success ==> eFrameworkunifiedStatusOK
1015 /// Failure ==> Other values
1016 ///////////////////////////////////////////////////////////////////////////////
1017 EFrameworkunifiedStatus CSystemManager::OnDiagLoggingRequest(HANDLE f_hApp) {
1018 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
1019 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
1020 UI_32 l_strlen = FrameworkunifiedGetMsgLength(f_hApp);
1021 CHAR l_path[l_strlen]; // NOLINT
1023 if (l_strlen == 0) { // LCOV_EXCL_BR_LINE 200: restricted by iterface_unified
1024 // LCOV_EXCL_START 200: restricted by iterface_unified
1025 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert
1026 SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
1027 return eFrameworkunifiedStatusFail;
1031 if (sizeof(l_path) != FrameworkunifiedGetMsgLength(f_hApp)) { // LCOV_EXCL_BR_LINE 6: must be equal
1032 // LCOV_EXCL_START 6: must be equal
1033 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1034 LOG_ERROR("DataSize mismatch"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
1036 } else if (eFrameworkunifiedStatusOK // LCOV_EXCL_BR_LINE 4: NSFW error case
1037 != (l_eStatus = FrameworkunifiedGetMsgDataOfSize(f_hApp, &l_path[0],
1038 static_cast<UI_32>(sizeof(l_path)), eSMRRelease))) { // NOLINT
1039 // LCOV_EXCL_START 4: NSFW error case
1040 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
1041 LOG_ERROR("FrameworkunifiedGetMsgDataOfSize()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
1044 TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
1045 " ERROR EVENT: SS_SM_ERROR_EVENT_DIAG_LOG_REQ request received. Adding the request to the event queue."); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
1046 std::string l_moduleName = FrameworkunifiedGetMsgSrc(f_hApp);
1047 SMLoggingInfo l_loggingInfo; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
1049 l_path[l_strlen - 1u] = '\0';
1050 l_loggingInfo.path = l_path;
1052 l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeDiagEvent,
1053 l_moduleName, eErrorEventResetTypeNone, l_loggingInfo);
1055 LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
1056 "ErrorEventEnqueue(eErrorEventTypeDiagEvent)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
1059 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
1063 ///////////////////////////////////////////////////////////////////////////////
1064 /// \ingroup OnCanLoggingRequest
1065 /// This function is called by logger to initiate log artifact collection
1066 /// and storage when signaled via CAN.
1068 /// \param [in] hApp - Application handle.
1070 /// \return EFrameworkunifiedStatus
1071 /// Success ==> eFrameworkunifiedStatusOK
1072 /// Failure ==> Other values
1073 ///////////////////////////////////////////////////////////////////////////////
1074 EFrameworkunifiedStatus CSystemManager::OnCANLoggingRequest(HANDLE f_hApp) {
1075 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
1076 EFrameworkunifiedStatus l_eStatus;
1077 std::string l_moduleName;
1079 l_moduleName = FrameworkunifiedGetMsgSrc(f_hApp); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
1081 TEXT(__FUNCTION__, // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
1082 " ERROR EVENT: SS_SM_ERROR_EVENT_CAN_LOG_REQ received from %s.", // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
1083 l_moduleName.c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length)
1085 l_eStatus = ErrorEventEnqueue(f_hApp, eErrorEventTypeCanEvent, l_moduleName); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
1087 LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
1088 "ErrorEventEnqueue(eErrorEventTypeCanEvent)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length)
1090 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");