1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 Copyright 2010 Lennart Poettering
12 typedef enum UnitType {
25 _UNIT_TYPE_INVALID = -1
28 typedef enum UnitLoadState {
31 UNIT_NOT_FOUND, /* error condition #1: unit file not found */
32 UNIT_BAD_SETTING, /* error condition #2: we couldn't parse some essential unit file setting */
33 UNIT_ERROR, /* error condition #3: other "system" error, catchall for the rest */
37 _UNIT_LOAD_STATE_INVALID = -1
40 typedef enum UnitActiveState {
47 _UNIT_ACTIVE_STATE_MAX,
48 _UNIT_ACTIVE_STATE_INVALID = -1
51 typedef enum AutomountState {
57 _AUTOMOUNT_STATE_INVALID = -1
60 /* We simply watch devices, we cannot plug/unplug them. That
61 * simplifies the state engine greatly */
62 typedef enum DeviceState {
64 DEVICE_TENTATIVE, /* mounted or swapped, but not (yet) announced by udev */
65 DEVICE_PLUGGED, /* announced by udev */
67 _DEVICE_STATE_INVALID = -1
70 typedef enum MountState {
72 MOUNT_MOUNTING, /* /usr/bin/mount is running, but the mount is not done yet. */
73 MOUNT_MOUNTING_DONE, /* /usr/bin/mount is running, and the mount is done. */
77 MOUNT_REMOUNTING_SIGTERM,
78 MOUNT_REMOUNTING_SIGKILL,
79 MOUNT_UNMOUNTING_SIGTERM,
80 MOUNT_UNMOUNTING_SIGKILL,
83 _MOUNT_STATE_INVALID = -1
86 typedef enum PathState {
92 _PATH_STATE_INVALID = -1
95 typedef enum ScopeState {
103 _SCOPE_STATE_INVALID = -1
106 typedef enum ServiceState {
112 SERVICE_EXITED, /* Nothing is running anymore, but RemainAfterExit is true hence this is OK */
114 SERVICE_STOP, /* No STOP_PRE state, instead just register multiple STOP executables */
115 SERVICE_STOP_SIGABRT, /* Watchdog timeout */
116 SERVICE_STOP_SIGTERM,
117 SERVICE_STOP_SIGKILL,
119 SERVICE_FINAL_SIGTERM, /* In case the STOP_POST executable hangs, we shoot that down, too */
120 SERVICE_FINAL_SIGKILL,
122 SERVICE_AUTO_RESTART,
124 _SERVICE_STATE_INVALID = -1
127 typedef enum SliceState {
131 _SLICE_STATE_INVALID = -1
134 typedef enum SocketState {
142 SOCKET_STOP_PRE_SIGTERM,
143 SOCKET_STOP_PRE_SIGKILL,
145 SOCKET_FINAL_SIGTERM,
146 SOCKET_FINAL_SIGKILL,
149 _SOCKET_STATE_INVALID = -1
152 typedef enum SwapState {
154 SWAP_ACTIVATING, /* /sbin/swapon is running, but the swap not yet enabled. */
155 SWAP_ACTIVATING_DONE, /* /sbin/swapon is running, and the swap is done. */
158 SWAP_DEACTIVATING_SIGTERM,
159 SWAP_DEACTIVATING_SIGKILL,
162 _SWAP_STATE_INVALID = -1
165 typedef enum TargetState {
169 _TARGET_STATE_INVALID = -1
172 typedef enum TimerState {
179 _TIMER_STATE_INVALID = -1
182 typedef enum UnitDependency {
183 /* Positive dependencies */
190 /* Inverse of the above */
191 UNIT_REQUIRED_BY, /* inverse of 'requires' is 'required_by' */
192 UNIT_REQUISITE_OF, /* inverse of 'requisite' is 'requisite_of' */
193 UNIT_WANTED_BY, /* inverse of 'wants' */
194 UNIT_BOUND_BY, /* inverse of 'binds_to' */
195 UNIT_CONSISTS_OF, /* inverse of 'part_of' */
197 /* Negative dependencies */
198 UNIT_CONFLICTS, /* inverse of 'conflicts' is 'conflicted_by' */
202 UNIT_BEFORE, /* inverse of 'before' is 'after' and vice versa */
208 /* Triggers (i.e. a socket triggers a service) */
212 /* Propagate reloads */
213 UNIT_PROPAGATES_RELOAD_TO,
214 UNIT_RELOAD_PROPAGATED_FROM,
216 /* Joins namespace of */
217 UNIT_JOINS_NAMESPACE_OF,
219 /* Reference information for GC logic */
220 UNIT_REFERENCES, /* Inverse of 'references' is 'referenced_by' */
223 _UNIT_DEPENDENCY_MAX,
224 _UNIT_DEPENDENCY_INVALID = -1
227 typedef enum NotifyAccess {
233 _NOTIFY_ACCESS_INVALID = -1
236 char *unit_dbus_path_from_name(const char *name);
237 int unit_name_from_dbus_path(const char *path, char **name);
239 const char* unit_dbus_interface_from_type(UnitType t);
240 const char *unit_dbus_interface_from_name(const char *name);
242 const char *unit_type_to_string(UnitType i) _const_;
243 UnitType unit_type_from_string(const char *s) _pure_;
245 const char *unit_load_state_to_string(UnitLoadState i) _const_;
246 UnitLoadState unit_load_state_from_string(const char *s) _pure_;
248 const char *unit_active_state_to_string(UnitActiveState i) _const_;
249 UnitActiveState unit_active_state_from_string(const char *s) _pure_;
251 const char* automount_state_to_string(AutomountState i) _const_;
252 AutomountState automount_state_from_string(const char *s) _pure_;
254 const char* device_state_to_string(DeviceState i) _const_;
255 DeviceState device_state_from_string(const char *s) _pure_;
257 const char* mount_state_to_string(MountState i) _const_;
258 MountState mount_state_from_string(const char *s) _pure_;
260 const char* path_state_to_string(PathState i) _const_;
261 PathState path_state_from_string(const char *s) _pure_;
263 const char* scope_state_to_string(ScopeState i) _const_;
264 ScopeState scope_state_from_string(const char *s) _pure_;
266 const char* service_state_to_string(ServiceState i) _const_;
267 ServiceState service_state_from_string(const char *s) _pure_;
269 const char* slice_state_to_string(SliceState i) _const_;
270 SliceState slice_state_from_string(const char *s) _pure_;
272 const char* socket_state_to_string(SocketState i) _const_;
273 SocketState socket_state_from_string(const char *s) _pure_;
275 const char* swap_state_to_string(SwapState i) _const_;
276 SwapState swap_state_from_string(const char *s) _pure_;
278 const char* target_state_to_string(TargetState i) _const_;
279 TargetState target_state_from_string(const char *s) _pure_;
281 const char *timer_state_to_string(TimerState i) _const_;
282 TimerState timer_state_from_string(const char *s) _pure_;
284 const char *unit_dependency_to_string(UnitDependency i) _const_;
285 UnitDependency unit_dependency_from_string(const char *s) _pure_;
287 const char* notify_access_to_string(NotifyAccess i) _const_;
288 NotifyAccess notify_access_from_string(const char *s) _pure_;