1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 This file is part of systemd.
7 Copyright 2010 Lennart Poettering
9 systemd is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or
12 (at your option) any later version.
14 systemd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public License
20 along with systemd; If not, see <http://www.gnu.org/licenses/>.
27 typedef enum UnitType {
40 _UNIT_TYPE_INVALID = -1
43 typedef enum UnitLoadState {
51 _UNIT_LOAD_STATE_INVALID = -1
54 typedef enum UnitActiveState {
61 _UNIT_ACTIVE_STATE_MAX,
62 _UNIT_ACTIVE_STATE_INVALID = -1
65 typedef enum AutomountState {
71 _AUTOMOUNT_STATE_INVALID = -1
74 /* We simply watch devices, we cannot plug/unplug them. That
75 * simplifies the state engine greatly */
76 typedef enum DeviceState {
78 DEVICE_TENTATIVE, /* mounted or swapped, but not (yet) announced by udev */
79 DEVICE_PLUGGED, /* announced by udev */
81 _DEVICE_STATE_INVALID = -1
84 typedef enum MountState {
86 MOUNT_MOUNTING, /* /usr/bin/mount is running, but the mount is not done yet. */
87 MOUNT_MOUNTING_DONE, /* /usr/bin/mount is running, and the mount is done. */
91 MOUNT_REMOUNTING_SIGTERM,
92 MOUNT_REMOUNTING_SIGKILL,
93 MOUNT_UNMOUNTING_SIGTERM,
94 MOUNT_UNMOUNTING_SIGKILL,
97 _MOUNT_STATE_INVALID = -1
100 typedef enum PathState {
106 _PATH_STATE_INVALID = -1
109 typedef enum ScopeState {
117 _SCOPE_STATE_INVALID = -1
120 typedef enum ServiceState {
126 SERVICE_EXITED, /* Nothing is running anymore, but RemainAfterExit is true hence this is OK */
128 SERVICE_STOP, /* No STOP_PRE state, instead just register multiple STOP executables */
129 SERVICE_STOP_SIGABRT, /* Watchdog timeout */
130 SERVICE_STOP_SIGTERM,
131 SERVICE_STOP_SIGKILL,
133 SERVICE_FINAL_SIGTERM, /* In case the STOP_POST executable hangs, we shoot that down, too */
134 SERVICE_FINAL_SIGKILL,
136 SERVICE_AUTO_RESTART,
138 _SERVICE_STATE_INVALID = -1
141 typedef enum SliceState {
145 _SLICE_STATE_INVALID = -1
148 typedef enum SocketState {
156 SOCKET_STOP_PRE_SIGTERM,
157 SOCKET_STOP_PRE_SIGKILL,
159 SOCKET_FINAL_SIGTERM,
160 SOCKET_FINAL_SIGKILL,
163 _SOCKET_STATE_INVALID = -1
166 typedef enum SwapState {
168 SWAP_ACTIVATING, /* /sbin/swapon is running, but the swap not yet enabled. */
169 SWAP_ACTIVATING_DONE, /* /sbin/swapon is running, and the swap is done. */
172 SWAP_DEACTIVATING_SIGTERM,
173 SWAP_DEACTIVATING_SIGKILL,
176 _SWAP_STATE_INVALID = -1
179 typedef enum TargetState {
183 _TARGET_STATE_INVALID = -1
186 typedef enum TimerState {
193 _TIMER_STATE_INVALID = -1
196 typedef enum UnitDependency {
197 /* Positive dependencies */
204 /* Inverse of the above */
205 UNIT_REQUIRED_BY, /* inverse of 'requires' is 'required_by' */
206 UNIT_REQUISITE_OF, /* inverse of 'requisite' is 'requisite_of' */
207 UNIT_WANTED_BY, /* inverse of 'wants' */
208 UNIT_BOUND_BY, /* inverse of 'binds_to' */
209 UNIT_CONSISTS_OF, /* inverse of 'part_of' */
211 /* Negative dependencies */
212 UNIT_CONFLICTS, /* inverse of 'conflicts' is 'conflicted_by' */
216 UNIT_BEFORE, /* inverse of 'before' is 'after' and vice versa */
222 /* Triggers (i.e. a socket triggers a service) */
226 /* Propagate reloads */
227 UNIT_PROPAGATES_RELOAD_TO,
228 UNIT_RELOAD_PROPAGATED_FROM,
230 /* Joins namespace of */
231 UNIT_JOINS_NAMESPACE_OF,
233 /* Reference information for GC logic */
234 UNIT_REFERENCES, /* Inverse of 'references' is 'referenced_by' */
237 _UNIT_DEPENDENCY_MAX,
238 _UNIT_DEPENDENCY_INVALID = -1
241 typedef enum NotifyAccess {
247 _NOTIFY_ACCESS_INVALID = -1
250 char *unit_dbus_path_from_name(const char *name);
251 int unit_name_from_dbus_path(const char *path, char **name);
253 const char* unit_dbus_interface_from_type(UnitType t);
254 const char *unit_dbus_interface_from_name(const char *name);
256 const char *unit_type_to_string(UnitType i) _const_;
257 UnitType unit_type_from_string(const char *s) _pure_;
259 const char *unit_load_state_to_string(UnitLoadState i) _const_;
260 UnitLoadState unit_load_state_from_string(const char *s) _pure_;
262 const char *unit_active_state_to_string(UnitActiveState i) _const_;
263 UnitActiveState unit_active_state_from_string(const char *s) _pure_;
265 const char* automount_state_to_string(AutomountState i) _const_;
266 AutomountState automount_state_from_string(const char *s) _pure_;
268 const char* device_state_to_string(DeviceState i) _const_;
269 DeviceState device_state_from_string(const char *s) _pure_;
271 const char* mount_state_to_string(MountState i) _const_;
272 MountState mount_state_from_string(const char *s) _pure_;
274 const char* path_state_to_string(PathState i) _const_;
275 PathState path_state_from_string(const char *s) _pure_;
277 const char* scope_state_to_string(ScopeState i) _const_;
278 ScopeState scope_state_from_string(const char *s) _pure_;
280 const char* service_state_to_string(ServiceState i) _const_;
281 ServiceState service_state_from_string(const char *s) _pure_;
283 const char* slice_state_to_string(SliceState i) _const_;
284 SliceState slice_state_from_string(const char *s) _pure_;
286 const char* socket_state_to_string(SocketState i) _const_;
287 SocketState socket_state_from_string(const char *s) _pure_;
289 const char* swap_state_to_string(SwapState i) _const_;
290 SwapState swap_state_from_string(const char *s) _pure_;
292 const char* target_state_to_string(TargetState i) _const_;
293 TargetState target_state_from_string(const char *s) _pure_;
295 const char *timer_state_to_string(TimerState i) _const_;
296 TimerState timer_state_from_string(const char *s) _pure_;
298 const char *unit_dependency_to_string(UnitDependency i) _const_;
299 UnitDependency unit_dependency_from_string(const char *s) _pure_;
301 const char* notify_access_to_string(NotifyAccess i) _const_;
302 NotifyAccess notify_access_from_string(const char *s) _pure_;