typedef enum UnitLoadState UnitLoadState;
typedef enum UnitActiveState UnitActiveState;
typedef enum UnitDependency UnitDependency;
+typedef struct UnitRef UnitRef;
#include "set.h"
#include "util.h"
/* On Failure */
UNIT_ON_FAILURE,
+ /* Triggers (i.e. a socket triggers a service) */
+ UNIT_TRIGGERS,
+ UNIT_TRIGGERED_BY,
+
+ /* Propagate reloads */
+ UNIT_PROPAGATE_RELOAD_TO,
+ UNIT_PROPAGATE_RELOAD_FROM,
+
/* Reference information for GC logic */
UNIT_REFERENCES, /* Inverse of 'references' is 'referenced_by' */
UNIT_REFERENCED_BY,
#include "manager.h"
#include "job.h"
#include "cgroup.h"
+#include "cgroup-attr.h"
struct Meta {
Manager *manager;
usec_t job_timeout;
+ /* References to this */
+ LIST_HEAD(UnitRef, refs);
+
/* Conditions to check */
LIST_HEAD(Condition, conditions);
/* Counterparts in the cgroup filesystem */
CGroupBonding *cgroup_bondings;
+ CGroupAttribute *cgroup_attributes;
/* Per type list */
LIST_FIELDS(Meta, units_by_type);
bool in_audit:1;
};
+struct UnitRef {
+ /* Keeps tracks of references to a unit. This is useful so
+ * that we can merge two units if necessary and correct all
+ * references to them */
+
+ Unit* unit;
+ LIST_FIELDS(UnitRef, refs);
+};
+
#include "service.h"
#include "timer.h"
#include "socket.h"
int unit_add_cgroup_from_text(Unit *u, const char *name);
int unit_add_default_cgroups(Unit *u);
CGroupBonding* unit_get_default_cgroup(Unit *u);
+int unit_add_cgroup_attribute(Unit *u, const char *controller, const char *name, const char *value, CGroupAttributeMapCallback map_callback);
int unit_choose_id(Unit *u, const char *name);
int unit_set_description(Unit *u, const char *description);
int unit_coldplug(Unit *u);
-void unit_status_printf(Unit *u, const char *format, ...);
+void unit_status_printf(Unit *u, const char *status, const char *format, ...);
bool unit_need_daemon_reload(Unit *u);
UnitFileState unit_get_unit_file_state(Unit *u);
+Unit* unit_ref_set(UnitRef *ref, Unit *u);
+void unit_ref_unset(UnitRef *ref);
+
+#define UNIT_DEREF(ref) ((ref).unit)
+
const char *unit_load_state_to_string(UnitLoadState i);
UnitLoadState unit_load_state_from_string(const char *s);