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 process launching and termination.
21 ///////////////////////////////////////////////////////////////////////////////
23 #ifndef SS_SM_PROCESS_LAUNCHER_H_ // NOLINT
24 #define SS_SM_PROCESS_LAUNCHER_H_
26 #include <native_service/frameworkunified_types.h>
27 #include <system_service/ss_system_manager_protocol.h>
28 #include <system_service/ss_system_manager_protocol_local.h>
30 #include "ss_sm_config.h"
32 ///////////////////////////////////////////////////////////////////////////////
33 /// System manager launches the modules using the process launcher.
34 /// The system manager launches the modules by sending the data about the process to be launched by
35 /// the message ePLThrdCmd_LAUNCH_MODULE_REQST.
37 ///////////////////////////////////////////////////////////////////////////////
39 CHAR name[SS_SM_MAX_MODULE_NAME_LENGTH];
40 CHAR path[SS_SM_MAX_MODULE_PATH_LENGTH];
41 CHAR args[SS_SM_MAX_MODULE_ARGS_LENGTH];
43 CHAR logging_mask[SS_SM_MAX_MODULE_LOG_MASK_LENGTH];
44 GroupLaunchMapIter groupIterator;
45 ModuleLaunchListIter moduleIterator;
47 } T_ProcessLauncherLaunchReq;
49 ///////////////////////////////////////////////////////////////////////////////
50 /// After successfully launching an module, the process launcher sends the
51 /// pid of the launched process along with the process name and arguments
52 /// by the message ePLThrdCmd_LAUNCH_MODULE_RESP.
53 /// System manager will verify the process name and the arguments and update
54 /// the pid in its process table.
56 /// This message will be sent for every module that is launched by process launcher.
57 /// Launch success returns a number > 0 for ProcessID, which is the PID of the
58 /// newly created process.
59 /// Launch failure returns -1 for ProcessID.
61 ///////////////////////////////////////////////////////////////////////////////
62 /// The response of the module relaunch message from process launcher to system
63 /// manager ePLThrdCmd_RELAUNCH_MODULE_RESP is defined by the below structure
64 /// A process ID value of > 0 indicates the success of the operation.
65 /// The process name and args are used to ensure correct mapping of requests
68 ///////////////////////////////////////////////////////////////////////////////
71 CHAR name[SS_SM_MAX_MODULE_NAME_LENGTH];
72 CHAR path[SS_SM_MAX_MODULE_PATH_LENGTH];
73 CHAR args[SS_SM_MAX_MODULE_ARGS_LENGTH];
75 GroupLaunchMapIter groupIterator;
76 ModuleLaunchListIter moduleIterator;
77 } T_ProcessLaunchResp;
79 ///////////////////////////////////////////////////////////////////////////////
80 /// System manager terminates the process when it detects there is something
81 /// wrong with the process. The system manager send the message
82 /// ePLThrdCmd_TERMINATE_MODULE_REQST to process launcher as required.
83 /// The request data is defined as below
85 ///////////////////////////////////////////////////////////////////////////////
86 typedef T_ProcessLauncherLaunchReq T_ProcessLauncherTerminationReq;
88 ///////////////////////////////////////////////////////////////////////////////
89 /// The response of the module termination response message from process
90 /// launcher to system manager
91 /// ePLThrdCmd_TERMINATE_MODULE_RESP is defined by the below structure
92 /// A ProcessID value of 0 indicates the success of the operation.
93 /// The process name and args are used to ensure correct mapping of requests
96 ///////////////////////////////////////////////////////////////////////////////
97 typedef T_ProcessLaunchResp T_ProcessLauncherTerminationResp;
99 ///////////////////////////////////////////////////////////////////////////////
100 /// The system manager requests a module relaunch by the message
101 /// ePLThrdCmd_RELAUNCH_MODULE_REQST.
102 /// The message data is described by the below structure
103 /// The old process ID is passed sent in the request and a new process ID is
104 /// expected in the response.
105 /// The process launcher launches the module and does internal retries for this
106 /// kind of request in case of failure.
108 ///////////////////////////////////////////////////////////////////////////////
109 typedef T_ProcessLauncherLaunchReq T_ProcessLauncherRelaunchReq;
111 #endif // SS_SM_PROCESS_LAUNCHER_H_ // NOLINT