manager.h revision c2f1db8f83618e60dcded8303d14656d7d26b436
87d2c1ff6a7375f03476767e6f59454bcc5cd04bLennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
87d2c1ff6a7375f03476767e6f59454bcc5cd04bLennart Poettering This file is part of systemd.
87d2c1ff6a7375f03476767e6f59454bcc5cd04bLennart Poettering Copyright 2010 Lennart Poettering
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering systemd is free software; you can redistribute it and/or modify it
87d2c1ff6a7375f03476767e6f59454bcc5cd04bLennart Poettering under the terms of the GNU Lesser General Public License as published by
87d2c1ff6a7375f03476767e6f59454bcc5cd04bLennart Poettering the Free Software Foundation; either version 2.1 of the License, or
87d2c1ff6a7375f03476767e6f59454bcc5cd04bLennart Poettering (at your option) any later version.
87d2c1ff6a7375f03476767e6f59454bcc5cd04bLennart Poettering systemd is distributed in the hope that it will be useful, but
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
87d2c1ff6a7375f03476767e6f59454bcc5cd04bLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering Lesser General Public License for more details.
87d2c1ff6a7375f03476767e6f59454bcc5cd04bLennart Poettering You should have received a copy of the GNU Lesser General Public License
87d2c1ff6a7375f03476767e6f59454bcc5cd04bLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
6eb7a9a0010d035e5bdbbf70227088ce02b2120eZbigniew Jędrzejewski-Szmek/* Enforce upper limit how many names we allow */
6eb7a9a0010d035e5bdbbf70227088ce02b2120eZbigniew Jędrzejewski-Szmek#define MANAGER_MAX_NAMES 131072 /* 128K */
87d2c1ff6a7375f03476767e6f59454bcc5cd04bLennart Poettering /* Note that the set of units we know of is allowed to be
787784c4c1b24a13207d18b415d60483cfbdeaa3Ronny Chevalier * inconsistent. However the subset of it that is loaded may
87d2c1ff6a7375f03476767e6f59454bcc5cd04bLennart Poettering * not, and the list of jobs may neither. */
787784c4c1b24a13207d18b415d60483cfbdeaa3Ronny Chevalier /* Active jobs and units */
87d2c1ff6a7375f03476767e6f59454bcc5cd04bLennart Poettering Hashmap *units; /* name string => Unit object n:1 */
787784c4c1b24a13207d18b415d60483cfbdeaa3Ronny Chevalier Hashmap *jobs; /* job id => Job object 1:1 */
87d2c1ff6a7375f03476767e6f59454bcc5cd04bLennart Poettering /* To make it easy to iterate through the units of a specific
787784c4c1b24a13207d18b415d60483cfbdeaa3Ronny Chevalier * type we maintain a per type linked list */
787784c4c1b24a13207d18b415d60483cfbdeaa3Ronny Chevalier LIST_HEAD(Unit, units_by_type[_UNIT_TYPE_MAX]);
787784c4c1b24a13207d18b415d60483cfbdeaa3Ronny Chevalier /* To optimize iteration of units that have requires_mounts_for set */
87d2c1ff6a7375f03476767e6f59454bcc5cd04bLennart Poettering LIST_HEAD(Unit, has_requires_mounts_for);
7560fffcd2531786b9c1ca657667a43e90331326Lennart Poettering /* Units that need to be loaded */
0ac38b707212e9aa40e25d65ffbae648cc9116f5Lennart Poettering LIST_HEAD(Unit, load_queue); /* this is actually more a stack than a queue, but uh. */
87d2c1ff6a7375f03476767e6f59454bcc5cd04bLennart Poettering /* Jobs that need to be run */
6eb7a9a0010d035e5bdbbf70227088ce02b2120eZbigniew Jędrzejewski-Szmek LIST_HEAD(Job, run_queue); /* more a stack than a queue, too */
6eb7a9a0010d035e5bdbbf70227088ce02b2120eZbigniew Jędrzejewski-Szmek /* Units and jobs that have not yet been announced via
6eb7a9a0010d035e5bdbbf70227088ce02b2120eZbigniew Jędrzejewski-Szmek * D-Bus. When something about a job changes it is added here
6eb7a9a0010d035e5bdbbf70227088ce02b2120eZbigniew Jędrzejewski-Szmek * if it is not in there yet. This allows easy coalescing of
8580d1f73db36e9383e674e388b4fb55828c0c66Lennart Poettering * D-Bus change signals. */
6eb7a9a0010d035e5bdbbf70227088ce02b2120eZbigniew Jędrzejewski-Szmek LIST_HEAD(Unit, dbus_unit_queue);
6eb7a9a0010d035e5bdbbf70227088ce02b2120eZbigniew Jędrzejewski-Szmek /* Units to remove */
6eb7a9a0010d035e5bdbbf70227088ce02b2120eZbigniew Jędrzejewski-Szmek /* Units to check when doing GC */
6eb7a9a0010d035e5bdbbf70227088ce02b2120eZbigniew Jędrzejewski-Szmek Hashmap *watch_pids; /* pid => Unit object n:1 */
6eb7a9a0010d035e5bdbbf70227088ce02b2120eZbigniew Jędrzejewski-Szmek dual_timestamp initrd_timestamp;
6eb7a9a0010d035e5bdbbf70227088ce02b2120eZbigniew Jędrzejewski-Szmek dual_timestamp startup_timestamp;
6eb7a9a0010d035e5bdbbf70227088ce02b2120eZbigniew Jędrzejewski-Szmek dual_timestamp finish_timestamp;
6eb7a9a0010d035e5bdbbf70227088ce02b2120eZbigniew Jędrzejewski-Szmek char *generator_unit_path_early;
6eb7a9a0010d035e5bdbbf70227088ce02b2120eZbigniew Jędrzejewski-Szmek /* Data specific to the device subsystem */
6eb7a9a0010d035e5bdbbf70227088ce02b2120eZbigniew Jędrzejewski-Szmek struct udev_monitor* udev_monitor;
510b857f7d1e7e8d38912890536342dd5dd647ddLennart Poettering /* Data specific to the mount subsystem */
6eb7a9a0010d035e5bdbbf70227088ce02b2120eZbigniew Jędrzejewski-Szmek /* Data specific to the swap filesystem */
143bfdaf0b890fa7acadf02d1eafacaef1b696bdHolger Hans Peter Freyther /* Data specific to the D-Bus subsystem */
143bfdaf0b890fa7acadf02d1eafacaef1b696bdHolger Hans Peter Freyther DBusConnection *api_bus, *system_bus;
6eb7a9a0010d035e5bdbbf70227088ce02b2120eZbigniew Jędrzejewski-Szmek Set *bus_connections, *bus_connections_for_dispatch;
95ea1b90cc61f464f3b9bc147119dee4ba9620b8Lennart Poettering DBusMessage *queued_message; /* This is used during reloading:
87d2c1ff6a7375f03476767e6f59454bcc5cd04bLennart Poettering * before the reload we queue the
87d2c1ff6a7375f03476767e6f59454bcc5cd04bLennart Poettering * reply message here, and
int dev_autofs_fd;
char *cgroup_hierarchy;
int gc_marker;
unsigned n_in_gc_queue;
int pin_cgroupfs_fd;
#ifdef HAVE_AUDIT
int audit_fd;
bool show_status;
bool confirm_spawn;
int n_reloading;
unsigned n_installed_jobs;
unsigned n_failed_jobs;
char *switch_root;
char *switch_root_init;
int manager_load_unit_prepare(Manager *m, const char *name, const char *path, DBusError *e, Unit **_ret);
int manager_add_job(Manager *m, JobType type, Unit *unit, JobMode mode, bool force, DBusError *e, Job **_ret);
int manager_add_job_by_name(Manager *m, JobType type, const char *name, JobMode mode, bool force, DBusError *e, Job **_ret);
void manager_dispatch_bus_name_owner_changed(Manager *m, const char *name, const char* old_owner, const char *new_owner);