1 /* SPDX-License-Identifier: LGPL-2.1+ */
8 typedef enum UnitType {
21 _UNIT_TYPE_INVALID = -1
24 typedef enum UnitLoadState {
27 UNIT_NOT_FOUND, /* error condition #1: unit file not found */
28 UNIT_BAD_SETTING, /* error condition #2: we couldn't parse some essential unit file setting */
29 UNIT_ERROR, /* error condition #3: other "system" error, catchall for the rest */
33 _UNIT_LOAD_STATE_INVALID = -1
36 typedef enum UnitActiveState {
43 _UNIT_ACTIVE_STATE_MAX,
44 _UNIT_ACTIVE_STATE_INVALID = -1
47 typedef enum AutomountState {
53 _AUTOMOUNT_STATE_INVALID = -1
56 /* We simply watch devices, we cannot plug/unplug them. That
57 * simplifies the state engine greatly */
58 typedef enum DeviceState {
60 DEVICE_TENTATIVE, /* mounted or swapped, but not (yet) announced by udev */
61 DEVICE_PLUGGED, /* announced by udev */
63 _DEVICE_STATE_INVALID = -1
66 typedef enum MountState {
68 MOUNT_MOUNTING, /* /usr/bin/mount is running, but the mount is not done yet. */
69 MOUNT_MOUNTING_DONE, /* /usr/bin/mount is running, and the mount is done. */
73 MOUNT_REMOUNTING_SIGTERM,
74 MOUNT_REMOUNTING_SIGKILL,
75 MOUNT_UNMOUNTING_SIGTERM,
76 MOUNT_UNMOUNTING_SIGKILL,
79 _MOUNT_STATE_INVALID = -1
82 typedef enum PathState {
88 _PATH_STATE_INVALID = -1
91 typedef enum ScopeState {
99 _SCOPE_STATE_INVALID = -1
102 typedef enum ServiceState {
108 SERVICE_EXITED, /* Nothing is running anymore, but RemainAfterExit is true hence this is OK */
110 SERVICE_STOP, /* No STOP_PRE state, instead just register multiple STOP executables */
111 SERVICE_STOP_SIGABRT, /* Watchdog timeout */
112 SERVICE_STOP_SIGTERM,
113 SERVICE_STOP_SIGKILL,
115 SERVICE_FINAL_SIGTERM, /* In case the STOP_POST executable hangs, we shoot that down, too */
116 SERVICE_FINAL_SIGKILL,
118 SERVICE_AUTO_RESTART,
120 _SERVICE_STATE_INVALID = -1
123 typedef enum SliceState {
127 _SLICE_STATE_INVALID = -1
130 typedef enum SocketState {
138 SOCKET_STOP_PRE_SIGTERM,
139 SOCKET_STOP_PRE_SIGKILL,
141 SOCKET_FINAL_SIGTERM,
142 SOCKET_FINAL_SIGKILL,
145 _SOCKET_STATE_INVALID = -1
148 typedef enum SwapState {
150 SWAP_ACTIVATING, /* /sbin/swapon is running, but the swap not yet enabled. */
151 SWAP_ACTIVATING_DONE, /* /sbin/swapon is running, and the swap is done. */
154 SWAP_DEACTIVATING_SIGTERM,
155 SWAP_DEACTIVATING_SIGKILL,
158 _SWAP_STATE_INVALID = -1
161 typedef enum TargetState {
165 _TARGET_STATE_INVALID = -1
168 typedef enum TimerState {
175 _TIMER_STATE_INVALID = -1
178 typedef enum UnitDependency {
179 /* Positive dependencies */
186 /* Inverse of the above */
187 UNIT_REQUIRED_BY, /* inverse of 'requires' is 'required_by' */
188 UNIT_REQUISITE_OF, /* inverse of 'requisite' is 'requisite_of' */
189 UNIT_WANTED_BY, /* inverse of 'wants' */
190 UNIT_BOUND_BY, /* inverse of 'binds_to' */
191 UNIT_CONSISTS_OF, /* inverse of 'part_of' */
193 /* Negative dependencies */
194 UNIT_CONFLICTS, /* inverse of 'conflicts' is 'conflicted_by' */
198 UNIT_BEFORE, /* inverse of 'before' is 'after' and vice versa */
204 /* Triggers (i.e. a socket triggers a service) */
208 /* Propagate reloads */
209 UNIT_PROPAGATES_RELOAD_TO,
210 UNIT_RELOAD_PROPAGATED_FROM,
212 /* Joins namespace of */
213 UNIT_JOINS_NAMESPACE_OF,
215 /* Reference information for GC logic */
216 UNIT_REFERENCES, /* Inverse of 'references' is 'referenced_by' */
219 _UNIT_DEPENDENCY_MAX,
220 _UNIT_DEPENDENCY_INVALID = -1
223 typedef enum NotifyAccess {
229 _NOTIFY_ACCESS_INVALID = -1
232 char *unit_dbus_path_from_name(const char *name);
233 int unit_name_from_dbus_path(const char *path, char **name);
235 const char* unit_dbus_interface_from_type(UnitType t);
236 const char *unit_dbus_interface_from_name(const char *name);
238 const char *unit_type_to_string(UnitType i) _const_;
239 UnitType unit_type_from_string(const char *s) _pure_;
241 const char *unit_load_state_to_string(UnitLoadState i) _const_;
242 UnitLoadState unit_load_state_from_string(const char *s) _pure_;
244 const char *unit_active_state_to_string(UnitActiveState i) _const_;
245 UnitActiveState unit_active_state_from_string(const char *s) _pure_;
247 const char* automount_state_to_string(AutomountState i) _const_;
248 AutomountState automount_state_from_string(const char *s) _pure_;
250 const char* device_state_to_string(DeviceState i) _const_;
251 DeviceState device_state_from_string(const char *s) _pure_;
253 const char* mount_state_to_string(MountState i) _const_;
254 MountState mount_state_from_string(const char *s) _pure_;
256 const char* path_state_to_string(PathState i) _const_;
257 PathState path_state_from_string(const char *s) _pure_;
259 const char* scope_state_to_string(ScopeState i) _const_;
260 ScopeState scope_state_from_string(const char *s) _pure_;
262 const char* service_state_to_string(ServiceState i) _const_;
263 ServiceState service_state_from_string(const char *s) _pure_;
265 const char* slice_state_to_string(SliceState i) _const_;
266 SliceState slice_state_from_string(const char *s) _pure_;
268 const char* socket_state_to_string(SocketState i) _const_;
269 SocketState socket_state_from_string(const char *s) _pure_;
271 const char* swap_state_to_string(SwapState i) _const_;
272 SwapState swap_state_from_string(const char *s) _pure_;
274 const char* target_state_to_string(TargetState i) _const_;
275 TargetState target_state_from_string(const char *s) _pure_;
277 const char *timer_state_to_string(TimerState i) _const_;
278 TimerState timer_state_from_string(const char *s) _pure_;
280 const char *unit_dependency_to_string(UnitDependency i) _const_;
281 UnitDependency unit_dependency_from_string(const char *s) _pure_;
283 const char* notify_access_to_string(NotifyAccess i) _const_;
284 NotifyAccess notify_access_from_string(const char *s) _pure_;