17 #ifndef IOX_POSH_ROUDI_PROCESS_MANAGER_HPP
18 #define IOX_POSH_ROUDI_PROCESS_MANAGER_HPP
20 #include "iceoryx_posh/internal/mepoo/segment_manager.hpp"
21 #include "iceoryx_posh/internal/roudi/introspection/process_introspection.hpp"
22 #include "iceoryx_posh/internal/roudi/port_manager.hpp"
23 #include "iceoryx_posh/internal/roudi/process.hpp"
24 #include "iceoryx_posh/internal/runtime/ipc_interface_user.hpp"
25 #include "iceoryx_posh/mepoo/chunk_header.hpp"
26 #include "iceoryx_posh/version/compatibility_check_level.hpp"
27 #include "iceoryx_posh/version/version_info.hpp"
28 #include "iceoryx_utils/cxx/list.hpp"
29 #include "iceoryx_utils/error_handling/error_handling.hpp"
30 #include "iceoryx_utils/posix_wrapper/posix_access_rights.hpp"
42 virtual void sendServiceRegistryChangeCounterToProcess(
const RuntimeName_t& process_name) noexcept = 0;
43 virtual void discoveryUpdate() noexcept = 0;
51 using ProcessList_t = cxx::list<Process, MAX_PROCESS_NUMBER>;
54 enum class TerminationFeedback
57 DO_NOT_SEND_ACK_TO_PROCESS
62 const version::CompatibilityCheckLevel compatibilityCheckLevel) noexcept;
79 const posix::PosixUser user,
80 const bool isMonitored,
81 const int64_t transmissionTimestamp,
82 const uint64_t sessionId,
83 const version::VersionInfo& versionInfo) noexcept;
108 void updateLivelinessOfProcess(const RuntimeName_t& name) noexcept;
110 void findServiceForProcess(const RuntimeName_t& name, const capro::ServiceDescription& service) noexcept;
113 addInterfaceForProcess(const RuntimeName_t& name, capro::Interfaces interface, const NodeName_t& node) noexcept;
115 void addApplicationForProcess(const RuntimeName_t& name) noexcept;
117 void addNodeForProcess(const RuntimeName_t& process, const NodeName_t& node) noexcept;
119 void addSubscriberForProcess(const RuntimeName_t& name,
120 const capro::ServiceDescription& service,
121 const popo::SubscriberOptions& subscriberOptions,
124 void addPublisherForProcess(const RuntimeName_t& name,
125 const capro::ServiceDescription& service,
126 const popo::PublisherOptions& publisherOptions,
129 void addConditionVariableForProcess(const RuntimeName_t& runtimeName) noexcept;
135 popo::
PublisherPortData* addIntrospectionPublisherPort(const capro::ServiceDescription& service,
136 const RuntimeName_t& process_name) noexcept;
141 void sendServiceRegistryChangeCounterToProcess(const RuntimeName_t& process_name) noexcept override;
144 bool searchForProcessAndThen(const RuntimeName_t& name,
145 cxx::function_ref<
void(
Process&)> AndThenCallable,
146 cxx::function_ref<
void()> OrElseCallable) noexcept;
148 void monitorProcesses() noexcept;
149 void discoveryUpdate() noexcept override;
159 bool addProcess(const RuntimeName_t& name,
161 const posix::PosixUser& user,
162 const
bool isMonitored,
163 const int64_t transmissionTimestamp,
164 const uint64_t sessionId,
165 const version::VersionInfo& versionInfo) noexcept;
171 bool searchForProcessAndRemoveIt(const RuntimeName_t& name, const TerminationFeedback feedback) noexcept;
178 bool removeProcessAndDeleteRespectiveSharedMemoryObjects(ProcessList_t::iterator& processIter,
179 const TerminationFeedback feedback) noexcept;
181 enum class ShutdownPolicy
192 bool requestShutdownOfProcess(
Process& process, ShutdownPolicy shutdownPolicy) noexcept;
197 bool isProcessAlive(
const Process& process) noexcept;
205 void evaluateKillError(
const Process& process,
206 const int32_t& errnum,
207 const char* errorString,
208 ShutdownPolicy shutdownPolicy) noexcept;
214 rp::BaseRelativePointer::id_t m_mgmtSegmentId{rp::BaseRelativePointer::NULL_POINTER_ID};
215 ProcessList_t m_processList;
217 version::CompatibilityCheckLevel m_compatibilityCheckLevel;
Definition: memory_manager.hpp:45
Definition: segment_manager.hpp:43
Definition: port_manager.hpp:55
Definition: process_manager.hpp:40
Definition: process_manager.hpp:49
bool unregisterProcess(const RuntimeName_t &name) noexcept
Unregisters a process at the ProcessManager.
bool isAnyRegisteredProcessStillRunning() noexcept
Is one or more of the registered processes running?
void handleProcessShutdownPreparationRequest(const RuntimeName_t &name) noexcept
A process is about to shut down and needs to be unblock by a potentially block publisher.
void sendMessageNotSupportedToRuntime(const RuntimeName_t &name) noexcept
Notify the application that it sent an unsupported message.
void printWarningForRegisteredProcessesAndClearProcessList() noexcept
Informs the user about the processes which are registered and then clears the process list.
void requestShutdownOfAllProcesses() noexcept
Tries to gracefully terminate all registered processes.
bool registerProcess(const RuntimeName_t &name, const uint32_t pid, const posix::PosixUser user, const bool isMonitored, const int64_t transmissionTimestamp, const uint64_t sessionId, const version::VersionInfo &versionInfo) noexcept
Registers a process at the ProcessManager.
void killAllProcesses() noexcept
Kills all registered processes. If RouDi doesn't have sufficient rights to kill the process,...
Definition: process.hpp:39
Definition: roudi_memory_interface.hpp:36
ProcessIntrospection< PublisherPortUserType > ProcessIntrospectionType
typedef for the templated process introspection class that is used by RouDi for the actual process in...
Definition: process_introspection.hpp:110
Definition: service_description.hpp:29
container for publisher port introspection data.
Definition: introspection_types.hpp:80
Stores information necessary to create the right type of port on RouDi side. Different types of ports...
Definition: port_config_info.hpp:32