unit.h revision bcbe497e5a73d889e8799f8a3680c303afede347
f0528cfc93da36692a5fb7898d7e4a9e95150318nd/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
f0528cfc93da36692a5fb7898d7e4a9e95150318nd This file is part of systemd.
f0528cfc93da36692a5fb7898d7e4a9e95150318nd Copyright 2010 Lennart Poettering
f0528cfc93da36692a5fb7898d7e4a9e95150318nd systemd is free software; you can redistribute it and/or modify it
f0528cfc93da36692a5fb7898d7e4a9e95150318nd under the terms of the GNU Lesser General Public License as published by
f0528cfc93da36692a5fb7898d7e4a9e95150318nd the Free Software Foundation; either version 2.1 of the License, or
f0528cfc93da36692a5fb7898d7e4a9e95150318nd (at your option) any later version.
f0528cfc93da36692a5fb7898d7e4a9e95150318nd systemd is distributed in the hope that it will be useful, but
f0528cfc93da36692a5fb7898d7e4a9e95150318nd WITHOUT ANY WARRANTY; without even the implied warranty of
f0528cfc93da36692a5fb7898d7e4a9e95150318nd MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f0528cfc93da36692a5fb7898d7e4a9e95150318nd Lesser General Public License for more details.
f0528cfc93da36692a5fb7898d7e4a9e95150318nd You should have received a copy of the GNU Lesser General Public License
f0528cfc93da36692a5fb7898d7e4a9e95150318nd along with systemd; If not, see <http://www.gnu.org/licenses/>.
f0528cfc93da36692a5fb7898d7e4a9e95150318ndtypedef struct UnitStatusMessageFormats UnitStatusMessageFormats;
enum UnitActiveState {
enum UnitDependency {
UNIT_REQUIRED_BY_OVERRIDABLE, /* inverse of 'requires_overridable' and 'requisite_overridable' is 'soft_required_by' */
#include "manager.h"
#include "job.h"
#include "cgroup.h"
#include "cgroup-attr.h"
struct Unit {
char *id; /* One name is special because we use it for identification. Points to an entry in the names set */
char *instance;
char **requires_mounts_for;
char *description;
char **documentation;
unsigned gc_marker;
int load_error;
bool stop_when_unneeded;
bool default_dependencies;
bool refuse_manual_start;
/* Don't allow the user to stop this unit manually, allow stopping only indirectly via dependency. */
bool refuse_manual_stop;
bool allow_isolate;
bool on_failure_isolate;
bool ignore_on_isolate;
bool ignore_on_snapshot;
bool condition_result;
struct UnitRef {
struct UnitStatusMessageFormats {
#include "service.h"
#include "timer.h"
#include "socket.h"
#include "target.h"
#include "device.h"
#include "mount.h"
#include "automount.h"
#include "snapshot.h"
#include "swap.h"
#include "path.h"
struct UnitVTable {
const char *sections;
void (*bus_name_owner_change)(Unit *u, const char *name, const char *old_owner, const char *new_owner);
const char *bus_invalidating_properties;
const char *bus_interface;
return NULL; \
return (MixedCase*) u; \
int unit_add_two_dependencies(Unit *u, UnitDependency d, UnitDependency e, Unit *other, bool add_reference);
int unit_add_dependency_by_name(Unit *u, UnitDependency d, const char *name, const char *filename, bool add_reference);
int unit_add_two_dependencies_by_name(Unit *u, UnitDependency d, UnitDependency e, const char *name, const char *path, bool add_reference);
int unit_add_dependency_by_name_inverse(Unit *u, UnitDependency d, const char *name, const char *filename, bool add_reference);
int unit_add_two_dependencies_by_name_inverse(Unit *u, UnitDependency d, UnitDependency e, const char *name, const char *path, bool add_reference);
int unit_add_cgroup_attribute(Unit *u, const char *controller, const char *name, const char *value, CGroupAttributeMapCallback map_callback);
int set_unit_path(const char *p);
void unit_serialize_item_format(Unit *u, FILE *f, const char *key, const char *value, ...) _printf_attr_(4,5);