1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 This file is part of systemd.
7 Copyright 2010 Lennart Poettering
14 typedef enum UnitType {
27 _UNIT_TYPE_INVALID = -1
30 typedef enum UnitLoadState {
33 UNIT_NOT_FOUND, /* error condition #1: unit file not found */
34 UNIT_BAD_SETTING, /* error condition #2: we couldn't parse some essential unit file setting */
35 UNIT_ERROR, /* error condition #3: other "system" error, catchall for the rest */
39 _UNIT_LOAD_STATE_INVALID = -1
42 typedef enum UnitActiveState {
49 _UNIT_ACTIVE_STATE_MAX,
50 _UNIT_ACTIVE_STATE_INVALID = -1
53 typedef enum AutomountState {
59 _AUTOMOUNT_STATE_INVALID = -1
62 /* We simply watch devices, we cannot plug/unplug them. That
63 * simplifies the state engine greatly */
64 typedef enum DeviceState {
66 DEVICE_TENTATIVE, /* mounted or swapped, but not (yet) announced by udev */
67 DEVICE_PLUGGED, /* announced by udev */
69 _DEVICE_STATE_INVALID = -1
72 typedef enum MountState {
74 MOUNT_MOUNTING, /* /usr/bin/mount is running, but the mount is not done yet. */
75 MOUNT_MOUNTING_DONE, /* /usr/bin/mount is running, and the mount is done. */
79 MOUNT_REMOUNTING_SIGTERM,
80 MOUNT_REMOUNTING_SIGKILL,
81 MOUNT_UNMOUNTING_SIGTERM,
82 MOUNT_UNMOUNTING_SIGKILL,
85 _MOUNT_STATE_INVALID = -1
88 typedef enum PathState {
94 _PATH_STATE_INVALID = -1
97 typedef enum ScopeState {
105 _SCOPE_STATE_INVALID = -1
108 typedef enum ServiceState {
114 SERVICE_EXITED, /* Nothing is running anymore, but RemainAfterExit is true hence this is OK */
116 SERVICE_STOP, /* No STOP_PRE state, instead just register multiple STOP executables */
117 SERVICE_STOP_SIGABRT, /* Watchdog timeout */
118 SERVICE_STOP_SIGTERM,
119 SERVICE_STOP_SIGKILL,
121 SERVICE_FINAL_SIGTERM, /* In case the STOP_POST executable hangs, we shoot that down, too */
122 SERVICE_FINAL_SIGKILL,
124 SERVICE_AUTO_RESTART,
126 _SERVICE_STATE_INVALID = -1
129 typedef enum SliceState {
133 _SLICE_STATE_INVALID = -1
136 typedef enum SocketState {
144 SOCKET_STOP_PRE_SIGTERM,
145 SOCKET_STOP_PRE_SIGKILL,
147 SOCKET_FINAL_SIGTERM,
148 SOCKET_FINAL_SIGKILL,
151 _SOCKET_STATE_INVALID = -1
154 typedef enum SwapState {
156 SWAP_ACTIVATING, /* /sbin/swapon is running, but the swap not yet enabled. */
157 SWAP_ACTIVATING_DONE, /* /sbin/swapon is running, and the swap is done. */
160 SWAP_DEACTIVATING_SIGTERM,
161 SWAP_DEACTIVATING_SIGKILL,
164 _SWAP_STATE_INVALID = -1
167 typedef enum TargetState {
171 _TARGET_STATE_INVALID = -1
174 typedef enum TimerState {
181 _TIMER_STATE_INVALID = -1
184 typedef enum UnitDependency {
185 /* Positive dependencies */
192 /* Inverse of the above */
193 UNIT_REQUIRED_BY, /* inverse of 'requires' is 'required_by' */
194 UNIT_REQUISITE_OF, /* inverse of 'requisite' is 'requisite_of' */
195 UNIT_WANTED_BY, /* inverse of 'wants' */
196 UNIT_BOUND_BY, /* inverse of 'binds_to' */
197 UNIT_CONSISTS_OF, /* inverse of 'part_of' */
199 /* Negative dependencies */
200 UNIT_CONFLICTS, /* inverse of 'conflicts' is 'conflicted_by' */
204 UNIT_BEFORE, /* inverse of 'before' is 'after' and vice versa */
210 /* Triggers (i.e. a socket triggers a service) */
214 /* Propagate reloads */
215 UNIT_PROPAGATES_RELOAD_TO,
216 UNIT_RELOAD_PROPAGATED_FROM,
218 /* Joins namespace of */
219 UNIT_JOINS_NAMESPACE_OF,
221 /* Reference information for GC logic */
222 UNIT_REFERENCES, /* Inverse of 'references' is 'referenced_by' */
225 _UNIT_DEPENDENCY_MAX,
226 _UNIT_DEPENDENCY_INVALID = -1
229 typedef enum NotifyAccess {
235 _NOTIFY_ACCESS_INVALID = -1
238 char *unit_dbus_path_from_name(const char *name);
239 int unit_name_from_dbus_path(const char *path, char **name);
241 const char* unit_dbus_interface_from_type(UnitType t);
242 const char *unit_dbus_interface_from_name(const char *name);
244 const char *unit_type_to_string(UnitType i) _const_;
245 UnitType unit_type_from_string(const char *s) _pure_;
247 const char *unit_load_state_to_string(UnitLoadState i) _const_;
248 UnitLoadState unit_load_state_from_string(const char *s) _pure_;
250 const char *unit_active_state_to_string(UnitActiveState i) _const_;
251 UnitActiveState unit_active_state_from_string(const char *s) _pure_;
253 const char* automount_state_to_string(AutomountState i) _const_;
254 AutomountState automount_state_from_string(const char *s) _pure_;
256 const char* device_state_to_string(DeviceState i) _const_;
257 DeviceState device_state_from_string(const char *s) _pure_;
259 const char* mount_state_to_string(MountState i) _const_;
260 MountState mount_state_from_string(const char *s) _pure_;
262 const char* path_state_to_string(PathState i) _const_;
263 PathState path_state_from_string(const char *s) _pure_;
265 const char* scope_state_to_string(ScopeState i) _const_;
266 ScopeState scope_state_from_string(const char *s) _pure_;
268 const char* service_state_to_string(ServiceState i) _const_;
269 ServiceState service_state_from_string(const char *s) _pure_;
271 const char* slice_state_to_string(SliceState i) _const_;
272 SliceState slice_state_from_string(const char *s) _pure_;
274 const char* socket_state_to_string(SocketState i) _const_;
275 SocketState socket_state_from_string(const char *s) _pure_;
277 const char* swap_state_to_string(SwapState i) _const_;
278 SwapState swap_state_from_string(const char *s) _pure_;
280 const char* target_state_to_string(TargetState i) _const_;
281 TargetState target_state_from_string(const char *s) _pure_;
283 const char *timer_state_to_string(TimerState i) _const_;
284 TimerState timer_state_from_string(const char *s) _pure_;
286 const char *unit_dependency_to_string(UnitDependency i) _const_;
287 UnitDependency unit_dependency_from_string(const char *s) _pure_;
289 const char* notify_access_to_string(NotifyAccess i) _const_;
290 NotifyAccess notify_access_from_string(const char *s) _pure_;