manager.h revision 02a3bcc6b4372ca50c0a62b193f9a75b988ffa69
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering This file is part of systemd.
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering Copyright 2010 Lennart Poettering
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering systemd is free software; you can redistribute it and/or modify it
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering under the terms of the GNU Lesser General Public License as published by
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering (at your option) any later version.
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering systemd is distributed in the hope that it will be useful, but
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering Lesser General Public License for more details.
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering You should have received a copy of the GNU Lesser General Public License
0c8570287400ba57d3705a2f62dd26039121ea6fLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering/* Enforce upper limit how many names we allow */
0c8570287400ba57d3705a2f62dd26039121ea6fLennart Poettering#define MANAGER_MAX_NAMES 131072 /* 128K */
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering /* Note that the set of units we know of is allowed to be
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering * inconsistent. However the subset of it that is loaded may
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering * not, and the list of jobs may neither. */
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering /* Active jobs and units */
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering Hashmap *units; /* name string => Unit object n:1 */
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering Hashmap *jobs; /* job id => Job object 1:1 */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* To make it easy to iterate through the units of a specific
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering * type we maintain a per type linked list */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering LIST_HEAD(Unit, units_by_type[_UNIT_TYPE_MAX]);
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* Units that need to be loaded */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering LIST_HEAD(Unit, load_queue); /* this is actually more a stack than a queue, but uh. */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* Jobs that need to be run */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering LIST_HEAD(Job, run_queue); /* more a stack than a queue, too */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* Units and jobs that have not yet been announced via
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering * D-Bus. When something about a job changes it is added here
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering * if it is not in there yet. This allows easy coalescing of
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering * D-Bus change signals. */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* Units to remove */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* Units to check when doing GC */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* Jobs to be added */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering Hashmap *transaction_jobs; /* Unit object => Job object list 1:1 */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering Hashmap *watch_pids; /* pid => Unit object n:1 */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* Data specific to the device subsystem */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* Data specific to the mount subsystem */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* Data specific to the swap filesystem */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* Data specific to the D-Bus subsystem */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering Set *bus_connections, *bus_connections_for_dispatch;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering DBusMessage *queued_message; /* This is used during reloading:
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering * before the reload we queue the
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering * reply message here, and
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering * afterwards we send it */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering DBusConnection *queued_message_connection; /* The connection to send the queued message on */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering Hashmap *watch_bus; /* D-Bus names => Unit object n:1 */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* Data specific to the Automount subsystem */
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering /* Data specific to the cgroup subsystem */
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering Hashmap *cgroup_bondings; /* path string => CGroupBonding object 1:n */
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering /* Make sure the user cannot accidentally unmount our cgroup
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering * file system */
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering /* Audit fd */
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering ExecOutput default_std_output, default_std_error;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering /* non-zero if we are reloading or reexecuting, */
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_new(ManagerRunningAs running_as, Manager **m);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_startup(Manager *m, FILE *serialization, FDSet *fds);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart PoetteringJob *manager_get_job(Manager *m, uint32_t id);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart PoetteringUnit *manager_get_unit(Manager *m, const char *name);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_get_unit_from_dbus_path(Manager *m, const char *s, Unit **_u);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_get_job_from_dbus_path(Manager *m, const char *s, Job **_j);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_load_unit_prepare(Manager *m, const char *name, const char *path, DBusError *e, Unit **_ret);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_load_unit(Manager *m, const char *name, const char *path, DBusError *e, Unit **_ret);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_add_job(Manager *m, JobType type, Unit *unit, JobMode mode, bool force, DBusError *e, Job **_ret);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_add_job_by_name(Manager *m, JobType type, const char *name, JobMode mode, bool force, DBusError *e, Job **_ret);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringvoid manager_dump_units(Manager *s, FILE *f, const char *prefix);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringvoid manager_dump_jobs(Manager *s, FILE *f, const char *prefix);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringunsigned manager_dispatch_load_queue(Manager *m);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringunsigned manager_dispatch_run_queue(Manager *m);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringunsigned manager_dispatch_dbus_queue(Manager *m);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_set_default_controllers(Manager *m, char **controllers);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringvoid manager_dispatch_bus_name_owner_changed(Manager *m, const char *name, const char* old_owner, const char *new_owner);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringvoid manager_dispatch_bus_query_pid_done(Manager *m, const char *name, pid_t pid);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_open_serialization(Manager *m, FILE **_f);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_serialize(Manager *m, FILE *f, FDSet *fds);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_deserialize(Manager *m, FILE *f, FDSet *fds);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringbool manager_is_booting_or_shutting_down(Manager *m);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringvoid manager_send_unit_audit(Manager *m, Unit *u, int type, bool success);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringvoid manager_send_unit_plymouth(Manager *m, Unit *u);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringbool manager_unit_pending_inactive(Manager *m, const char *name);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringvoid manager_set_show_status(Manager *m, bool b);
2a0d751be498be89e18f130ca02b2197f83b6baaLennart Poetteringconst char *manager_running_as_to_string(ManagerRunningAs i);