manager.h revision 4d7213b2747ddd87002f970ccc60b1a9ab637136
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering This file is part of systemd.
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering Copyright 2010 Lennart Poettering
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering systemd is free software; you can redistribute it and/or modify it
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering under the terms of the GNU Lesser General Public License as published by
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering (at your option) any later version.
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering systemd is distributed in the hope that it will be useful, but
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering Lesser General Public License for more details.
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering You should have received a copy of the GNU Lesser General Public License
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering/* Enforce upper limit how many names we allow */
6ad623a3f77e087e308f334525fd4046811f2a9aLennart Poettering#define MANAGER_MAX_NAMES 131072 /* 128K */
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering /* Note that the set of units we know of is allowed to be
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering * inconsistent. However the subset of it that is loaded may
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering * not, and the list of jobs may neither. */
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering /* Active jobs and units */
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering Hashmap *units; /* name string => Unit object n:1 */
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering Hashmap *jobs; /* job id => Job object 1:1 */
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering /* To make it easy to iterate through the units of a specific
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering * type we maintain a per type linked list */
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering LIST_HEAD(Unit, units_by_type[_UNIT_TYPE_MAX]);
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering /* Units that need to be loaded */
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering LIST_HEAD(Unit, load_queue); /* this is actually more a stack than a queue, but uh. */
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering /* Jobs that need to be run */
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering LIST_HEAD(Job, run_queue); /* more a stack than a queue, too */
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering /* Units and jobs that have not yet been announced via
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering * D-Bus. When something about a job changes it is added here
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering * if it is not in there yet. This allows easy coalescing of
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering * D-Bus change signals. */
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering /* Units to remove */
6bedfcbb2970e06a4d3280c8fb62083d252ede73Lennart Poettering /* Units to check when doing GC */
char *notify_socket;
int notify_fd;
int signal_fd;
int time_change_fd;
unsigned n_snapshots;
char **environment;
char *generator_unit_path;
char *generator_unit_path_early;
char *generator_unit_path_late;
int private_listen_fd;
char **deserialized_subscribed;
bool send_reloading_done;
int dev_autofs_fd;
char *cgroup_root;
int gc_marker;
unsigned n_in_gc_queue;
int pin_cgroupfs_fd;
bool confirm_spawn;
bool no_console_output;
unsigned default_start_limit_burst;
bool default_cpu_accounting;
int n_reloading;
unsigned n_installed_jobs;
unsigned n_failed_jobs;
unsigned n_running_jobs;
unsigned n_on_console;
unsigned jobs_in_progress_iteration;
char *switch_root;
char *switch_root_init;
int kdbus_fd;
int manager_load_unit_prepare(Manager *m, const char *name, const char *path, sd_bus_error *e, Unit **_ret);
int manager_load_unit(Manager *m, const char *name, const char *path, sd_bus_error *e, Unit **_ret);
int manager_add_job(Manager *m, JobType type, Unit *unit, JobMode mode, bool force, sd_bus_error *e, Job **_ret);
int manager_add_job_by_name(Manager *m, JobType type, const char *name, JobMode mode, bool force, sd_bus_error *e, Job **_ret);
void manager_dispatch_bus_name_owner_changed(Manager *m, const char *name, const char* old_owner, const char *new_owner);