unit.h revision 0a9f8ed00c8f323d5bf24a9a11149a9342c0e1aa
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen This file is part of systemd.
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen Copyright 2010 Lennart Poettering
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen systemd is free software; you can redistribute it and/or modify it
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen under the terms of the GNU Lesser General Public License as published by
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen the Free Software Foundation; either version 2.1 of the License, or
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen (at your option) any later version.
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen systemd is distributed in the hope that it will be useful, but
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen WITHOUT ANY WARRANTY; without even the implied warranty of
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen Lesser General Public License for more details.
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen You should have received a copy of the GNU Lesser General Public License
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen along with systemd; If not, see <http://www.gnu.org/licenses/>.
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poetteringtypedef struct UnitStatusMessageFormats UnitStatusMessageFormats;
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poetteringstatic inline bool UNIT_IS_ACTIVE_OR_RELOADING(UnitActiveState t) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return t == UNIT_ACTIVE || t == UNIT_RELOADING;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstatic inline bool UNIT_IS_ACTIVE_OR_ACTIVATING(UnitActiveState t) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return t == UNIT_ACTIVE || t == UNIT_ACTIVATING || t == UNIT_RELOADING;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstatic inline bool UNIT_IS_INACTIVE_OR_DEACTIVATING(UnitActiveState t) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering return t == UNIT_INACTIVE || t == UNIT_FAILED || t == UNIT_DEACTIVATING;
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poetteringstatic inline bool UNIT_IS_INACTIVE_OR_FAILED(UnitActiveState t) {
a2a416f768e2aa7db5b975cd50eb19237cac9cceLennart Poettering return t == UNIT_INACTIVE || t == UNIT_FAILED;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Positive dependencies */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Inverse of the above */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering UNIT_REQUIRED_BY, /* inverse of 'requires' and 'requisite' is 'required_by' */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering UNIT_REQUIRED_BY_OVERRIDABLE, /* inverse of 'requires_overridable' and 'requisite_overridable' is 'soft_required_by' */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering UNIT_BOUND_BY, /* inverse of 'bind_to' */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Negative dependencies */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering UNIT_CONFLICTS, /* inverse of 'conflicts' is 'conflicted_by' */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering UNIT_BEFORE, /* inverse of 'before' is 'after' and vice versa */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* On Failure */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Triggers (i.e. a socket triggers a service) */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Propagate reloads */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Reference information for GC logic */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering UNIT_REFERENCES, /* Inverse of 'references' is 'referenced_by' */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering char *id; /* One name is special because we use it for identification. Points to an entry in the names set */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering char *fragment_path; /* if loaded from a config file this is the primary path to it */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering char *source_path; /* if converted, the source file */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* If there is something to do with this unit, then this is the installed job for it */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* JOB_NOP jobs are special and can be installed without disturbing the real job. */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* References to this */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Conditions to check */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Counterparts in the cgroup filesystem */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Per type list */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* All units which have requires_mounts_for set */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering LIST_FIELDS(Unit, has_requires_mounts_for);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Load queue */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* D-Bus queue */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Cleanup queue */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* GC queue */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Used during GC sweeps */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* When deserializing, temporarily store the job type for this
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * unit here, if there was a job scheduled.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * Only for deserializing from a legacy version. New style uses full
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * serialized jobs. */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering int deserialized_job; /* This is actually of type JobType */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Error code when we didn't manage to load the unit (negative) */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Cached unit file state */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Garbage collect us we nobody wants or requires us anymore */
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen /* Create default dependencies */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Refuse manual starting, allow starting only indirectly via dependency. */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Don't allow the user to stop this unit manually, allow stopping only indirectly via dependency. */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Allow isolation requests */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Isolate OnFailure unit */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Ignore this unit when isolating */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Ignore this unit when snapshotting */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Did the last condition check suceed? */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Keeps tracks of references to a unit. This is useful so
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * that we can merge two units if necessary and correct all
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * references to them */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering const char *finished_start_job[_JOB_RESULT_MAX];
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering const char *finished_stop_job[_JOB_RESULT_MAX];
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* How much memory does an object of this unit type need */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Config file sections this unit type understands, separated
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * by NUL chars */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* This should reset all type-specific variables. This should
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * not allocate memory, and is called with zero-initialized
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * data. It should hence only initialize variables that need
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * to be set != 0. */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* This should free all type-specific variables. It should be
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * idempotent. */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Actually load data from disk. This may fail, and should set
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * load_state to UNIT_LOADED, UNIT_MERGED or leave it at
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * UNIT_STUB if no configuration could be found. */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* If a a lot of units got created via enumerate(), this is
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * where to actually set the state and call unit_notify(). */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering void (*dump)(Unit *u, FILE *f, const char *prefix);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering int (*kill)(Unit *u, KillWho w, KillMode m, int signo, DBusError *error);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering /* Write all data that cannot be restored from other sources
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering * away using unit_serialize_item() */
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering int (*serialize)(Unit *u, FILE *f, FDSet *fds);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering /* Restore one item from the serialization */
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering int (*deserialize_item)(Unit *u, const char *key, const char *data, FDSet *fds);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering /* Boils down the more complex internal state of this unit to
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering * a simpler one that the engine can understand */
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering UnitActiveState (*active_state)(Unit *u);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering /* Returns the substate specific to this unit type as
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering * string. This is purely information so that we can give the
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering * user a more fine grained explanation in which actual state a
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering * unit is in. */
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering const char* (*sub_state_to_string)(Unit *u);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering /* Return true when there is reason to keep this entry around
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering * even nothing references it and it isn't active in any
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering /* Return true when this unit is suitable for snapshotting */
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering void (*fd_event)(Unit *u, int fd, uint32_t events, Watch *w);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering void (*sigchld_event)(Unit *u, pid_t pid, int code, int status);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering void (*timer_event)(Unit *u, uint64_t n_elapsed, Watch *w);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering /* Reset failed state if we are in failed state */
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering /* Called whenever any of the cgroups this unit watches for
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering * ran empty */
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering /* Called whenever a process of this unit sends us a message */
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering void (*notify_message)(Unit *u, pid_t pid, char **tags);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering /* Called whenever a name thus Unit registered for comes or
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering * goes away. */
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering void (*bus_name_owner_change)(Unit *u, const char *name, const char *old_owner, const char *new_owner);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering /* Called whenever a bus PID lookup finishes */
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering void (*bus_query_pid_done)(Unit *u, const char *name, pid_t pid);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering /* Called for each message received on the bus */
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering DBusHandlerResult (*bus_message_handler)(Unit *u, DBusConnection *c, DBusMessage *message);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering /* Return the unit this unit is following */
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering /* Return the set of units that are following each other */
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering /* This is called for each unit type and should be used to
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering * enumerate existing devices and load them. However,
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering * everything that is loaded here should still stay in
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering * inactive state. It is the job of the coldplug() call above
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering * to put the units into the initial state. */
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering /* Type specific cleanups. */
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering /* When sending out PropertiesChanged signal, which properties
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering * shall be invalidated? This is a NUL separated list of
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering * strings, to minimize relocations a little. */
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering /* The interface name */
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering UnitStatusMessageFormats status_message_formats;
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering /* Can units of this type have multiple names? */
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poettering /* Instances make no sense for this type */
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen /* Exclude from automatic gc */
c92e531c82a9815ec349aa1bf31236b86b2d5311Lennart Poetteringextern const UnitVTable * const unit_vtable[_UNIT_TYPE_MAX];
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersen/* For casting a unit into the various unit types */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering static inline MixedCase* UPPERCASE(Unit *u) { \
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering if (_unlikely_(!u || u->type != UNIT_##UPPERCASE)) \
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering/* For casting the various unit types into a unit */
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poetteringint unit_add_name(Unit *u, const char *name);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint unit_add_dependency(Unit *u, UnitDependency d, Unit *other, bool add_reference);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint unit_add_two_dependencies(Unit *u, UnitDependency d, UnitDependency e, Unit *other, bool add_reference);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint unit_add_dependency_by_name(Unit *u, UnitDependency d, const char *name, const char *filename, bool add_reference);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint unit_add_two_dependencies_by_name(Unit *u, UnitDependency d, UnitDependency e, const char *name, const char *path, bool add_reference);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint unit_add_dependency_by_name_inverse(Unit *u, UnitDependency d, const char *name, const char *filename, bool add_reference);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint unit_add_two_dependencies_by_name_inverse(Unit *u, UnitDependency d, UnitDependency e, const char *name, const char *path, bool add_reference);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint unit_add_exec_dependencies(Unit *u, ExecContext *c);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint unit_add_cgroup(Unit *u, CGroupBonding *b);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint unit_add_cgroup_from_text(Unit *u, const char *name);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart PoetteringCGroupBonding* unit_get_default_cgroup(Unit *u);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poetteringint unit_add_cgroup_attribute(Unit *u, const char *controller, const char *name, const char *value, CGroupAttributeMapCallback map_callback);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poetteringint unit_choose_id(Unit *u, const char *name);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poetteringint unit_set_description(Unit *u, const char *description);
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersenint unit_merge_by_name(Unit *u, const char *other);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint unit_load_fragment_and_dropin_optional(Unit *u);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringbool unit_has_name(Unit *u, const char *name);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart PoetteringUnitActiveState unit_active_state(Unit *u);
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poetteringconst char* unit_sub_state_to_string(Unit *u);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringvoid unit_dump(Unit *u, FILE *f, const char *prefix);
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersenint unit_kill(Unit *u, KillWho w, KillMode m, int signo, DBusError *error);
096b6773886bd7a0c8c97aa684b0b67dfae58355Lennart Poetteringvoid unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_success);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint unit_watch_fd(Unit *u, int fd, uint32_t events, Watch *w);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringvoid unit_unwatch_pid(Unit *u, pid_t pid);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poetteringint unit_watch_timer(Unit *u, usec_t delay, Watch *w);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poetteringvoid unit_unwatch_timer(Unit *u, Watch *w);
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poetteringint unit_watch_bus_name(Unit *u, const char *name);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poetteringvoid unit_unwatch_bus_name(Unit *u, const char *name);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poetteringbool unit_job_is_applicable(Unit *u, JobType j);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poetteringint set_unit_path(const char *p);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint unit_load_related_unit(Unit *u, const char *type, Unit **_found);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poetteringint unit_get_related_unit(Unit *u, const char *type, Unit **_found);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poetteringchar *unit_name_printf(Unit *u, const char* text);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poetteringchar *unit_full_printf(Unit *u, const char *text);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poetteringchar **unit_full_printf_strv(Unit *u, char **l);
eb60f9cd4e93ff5016dc1b5486fd1b7e1565fd92Lennart Poetteringint unit_serialize(Unit *u, FILE *f, FDSet *fds);
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersenvoid unit_serialize_item_format(Unit *u, FILE *f, const char *key, const char *value, ...) _printf_attr_(4,5);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringvoid unit_serialize_item(Unit *u, FILE *f, const char *key, const char *value);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint unit_deserialize(Unit *u, FILE *f, FDSet *fds);
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersenint unit_add_node_link(Unit *u, const char *what, bool wants);
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersenvoid unit_status_printf(Unit *u, const char *status, const char *format, ...);
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersenint unit_add_default_target_dependency(Unit *u, Unit *target);
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersenbool unit_name_is_valid(const char *n, bool template_ok);
091a364c802e34a58f3260c9cb5db9b75c62215cTom GundersenUnitFileState unit_get_unit_file_state(Unit *u);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart PoetteringUnit* unit_ref_set(UnitRef *ref, Unit *u);
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersenint unit_add_one_mount_link(Unit *u, Mount *m);
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersenconst char *unit_load_state_to_string(UnitLoadState i);
091a364c802e34a58f3260c9cb5db9b75c62215cTom GundersenUnitLoadState unit_load_state_from_string(const char *s);
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersenconst char *unit_active_state_to_string(UnitActiveState i);
091a364c802e34a58f3260c9cb5db9b75c62215cTom GundersenUnitActiveState unit_active_state_from_string(const char *s);
091a364c802e34a58f3260c9cb5db9b75c62215cTom Gundersenconst char *unit_dependency_to_string(UnitDependency i);