unit.h revision 7c8fa05c4d5d01748ff2a04edb882afb3119b7d7
a4cce2c98eedecb5d3b47da62104634cae268434Stephen Gallagher/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
a4cce2c98eedecb5d3b47da62104634cae268434Stephen Gallagher This file is part of systemd.
a4cce2c98eedecb5d3b47da62104634cae268434Stephen Gallagher Copyright 2010 Lennart Poettering
a4cce2c98eedecb5d3b47da62104634cae268434Stephen Gallagher systemd is free software; you can redistribute it and/or modify it
a4cce2c98eedecb5d3b47da62104634cae268434Stephen Gallagher under the terms of the GNU Lesser General Public License as published by
a4cce2c98eedecb5d3b47da62104634cae268434Stephen Gallagher the Free Software Foundation; either version 2.1 of the License, or
a4cce2c98eedecb5d3b47da62104634cae268434Stephen Gallagher (at your option) any later version.
a4cce2c98eedecb5d3b47da62104634cae268434Stephen Gallagher systemd is distributed in the hope that it will be useful, but
a4cce2c98eedecb5d3b47da62104634cae268434Stephen Gallagher WITHOUT ANY WARRANTY; without even the implied warranty of
a4cce2c98eedecb5d3b47da62104634cae268434Stephen Gallagher MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
a4cce2c98eedecb5d3b47da62104634cae268434Stephen Gallagher Lesser General Public License for more details.
a4cce2c98eedecb5d3b47da62104634cae268434Stephen Gallagher You should have received a copy of the GNU Lesser General Public License
a4cce2c98eedecb5d3b47da62104634cae268434Stephen Gallagher along with systemd; If not, see <http://www.gnu.org/licenses/>.
a4cce2c98eedecb5d3b47da62104634cae268434Stephen Gallaghertypedef enum UnitActiveState UnitActiveState;
a4cce2c98eedecb5d3b47da62104634cae268434Stephen Gallaghertypedef enum UnitDependency UnitDependency;
#include "set.h"
#include "util.h"
#include "list.h"
#include "socket-util.h"
#include "execute.h"
#include "condition.h"
#include "install.h"
enum UnitType {
UNIT_SERVICE = 0,
enum UnitLoadState {
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;
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 {
#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 *suffix;
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);