manager.h revision c1165f822cd9f8c3467b5f825ce933ab8374b361
898720b7e9cf3bdf7a93e435cbed5dd6942ecf9bHarald Hoyer/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
898720b7e9cf3bdf7a93e435cbed5dd6942ecf9bHarald Hoyer This file is part of systemd.
0d6e798a784ef0ba6b95512e4453067b2f84a91aHarald Hoyer Copyright 2010 Lennart Poettering
898720b7e9cf3bdf7a93e435cbed5dd6942ecf9bHarald Hoyer systemd is free software; you can redistribute it and/or modify it
3486cb6cfa3d32a95c0daf02c7510fdf372507bfMartin Pitt under the terms of the GNU Lesser General Public License as published by
3486cb6cfa3d32a95c0daf02c7510fdf372507bfMartin Pitt the Free Software Foundation; either version 2.1 of the License, or
3486cb6cfa3d32a95c0daf02c7510fdf372507bfMartin Pitt (at your option) any later version.
3486cb6cfa3d32a95c0daf02c7510fdf372507bfMartin Pitt systemd is distributed in the hope that it will be useful, but
4be4833ece2856e0cacc09f8f8b2c02b320751faMartin Pitt WITHOUT ANY WARRANTY; without even the implied warranty of
c50a4525aa8151b180d5a325e88c5f3812e66c36Martin Pitt MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier Lesser General Public License for more details.
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier You should have received a copy of the GNU Lesser General Public License
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier along with systemd; If not, see <http://www.gnu.org/licenses/>.
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier/* Enforce upper limit how many names we allow */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* Note that the set of units we know of is allowed to be
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier * inconsistent. However the subset of it that is loaded may
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier * not, and the list of jobs may neither. */
3486cb6cfa3d32a95c0daf02c7510fdf372507bfMartin Pitt /* Active jobs and units */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier Hashmap *units; /* name string => Unit object n:1 */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier Hashmap *jobs; /* job id => Job object 1:1 */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* To make it easy to iterate through the units of a specific
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier * type we maintain a per type linked list */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier LIST_HEAD(Unit, units_by_type[_UNIT_TYPE_MAX]);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* To optimize iteration of units that have requires_mounts_for set */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* Units that need to be loaded */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier LIST_HEAD(Unit, load_queue); /* this is actually more a stack than a queue, but uh. */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* Jobs that need to be run */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier LIST_HEAD(Job, run_queue); /* more a stack than a queue, too */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* Units and jobs that have not yet been announced via
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier * D-Bus. When something about a job changes it is added here
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier * if it is not in there yet. This allows easy coalescing of
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier * D-Bus change signals. */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* Units to remove */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* Units to check when doing GC */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier Hashmap *watch_pids; /* pid => Unit object n:1 */
739d81ddd005fae2bb82edce5b8a6173c7c48b34Zbigniew Jędrzejewski-Szmek dual_timestamp userspace_timestamp;
739d81ddd005fae2bb82edce5b8a6173c7c48b34Zbigniew Jędrzejewski-Szmek char *generator_unit_path_early;
1b1eae69ce52ef6c89a1200e8d3758549b291991Daniel Mack /* Data specific to the device subsystem */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* Data specific to the mount subsystem */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* Data specific to the swap filesystem */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* Data specific to the D-Bus subsystem */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier Set *bus_connections, *bus_connections_for_dispatch;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier DBusMessage *queued_message; /* This is used during reloading:
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier * before the reload we queue the
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier * reply message here, and
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier * afterwards we send it */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier DBusConnection *queued_message_connection; /* The connection to send the queued message on */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier Hashmap *watch_bus; /* D-Bus names => Unit object n:1 */
c7eda0133b6bf13a182337cbe8a61bf2faf9b32eEvgeny Vereshchagin /* Data specific to the Automount subsystem */
c7eda0133b6bf13a182337cbe8a61bf2faf9b32eEvgeny Vereshchagin /* Data specific to the cgroup subsystem */
c7eda0133b6bf13a182337cbe8a61bf2faf9b32eEvgeny Vereshchagin Hashmap *cgroup_bondings; /* path string => CGroupBonding object 1:n */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* Make sure the user cannot accidentally unmount our cgroup
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier * file system */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier ExecOutput default_std_output, default_std_error;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* non-zero if we are reloading or reexecuting, */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* Type=idle pipes */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_new(SystemdRunningAs running_as, Manager **m);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_startup(Manager *m, FILE *serialization, FDSet *fds);
889a90422dd47284dffa32b9234a6e58991b000cRonny ChevalierJob *manager_get_job(Manager *m, uint32_t id);
889a90422dd47284dffa32b9234a6e58991b000cRonny ChevalierUnit *manager_get_unit(Manager *m, const char *name);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_get_job_from_dbus_path(Manager *m, const char *s, Job **_j);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_load_unit_prepare(Manager *m, const char *name, const char *path, DBusError *e, Unit **_ret);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_load_unit(Manager *m, const char *name, const char *path, DBusError *e, Unit **_ret);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_load_unit_from_dbus_path(Manager *m, const char *s, DBusError *e, Unit **_u);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_add_job(Manager *m, JobType type, Unit *unit, JobMode mode, bool force, DBusError *e, Job **_ret);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_add_job_by_name(Manager *m, JobType type, const char *name, JobMode mode, bool force, DBusError *e, Job **_ret);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevaliervoid manager_dump_units(Manager *s, FILE *f, const char *prefix);
4be4833ece2856e0cacc09f8f8b2c02b320751faMartin Pittvoid manager_dump_jobs(Manager *s, FILE *f, const char *prefix);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierunsigned manager_dispatch_load_queue(Manager *m);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierunsigned manager_dispatch_run_queue(Manager *m);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierunsigned manager_dispatch_dbus_queue(Manager *m);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_set_default_controllers(Manager *m, char **controllers);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_set_default_rlimits(Manager *m, struct rlimit **default_rlimit);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevaliervoid manager_dispatch_bus_name_owner_changed(Manager *m, const char *name, const char* old_owner, const char *new_owner);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevaliervoid manager_dispatch_bus_query_pid_done(Manager *m, const char *name, pid_t pid);
3486cb6cfa3d32a95c0daf02c7510fdf372507bfMartin Pittint manager_open_serialization(Manager *m, FILE **_f);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_serialize(Manager *m, FILE *f, FDSet *fds, bool serialize_jobs);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_deserialize(Manager *m, FILE *f, FDSet *fds);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierbool manager_is_booting_or_shutting_down(Manager *m);
0fe15dc8ddddeb39a5cad1f4f4afa25fa074a5d1Evgeny Vereshchaginvoid manager_send_unit_audit(Manager *m, Unit *u, int type, bool success);
0fe15dc8ddddeb39a5cad1f4f4afa25fa074a5d1Evgeny Vereshchaginvoid manager_send_unit_plymouth(Manager *m, Unit *u);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierbool manager_unit_pending_inactive(Manager *m, const char *name);
417491f122b346a31cf8dc406c4f9195a5900cecEvgeny Vereshchaginvoid manager_recheck_journal(Manager *m);