manager.h revision 02a3bcc6b4372ca50c0a62b193f9a75b988ffa69
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering#ifndef foomanagerhfoo
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering#define foomanagerhfoo
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering/***
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering This file is part of systemd.
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering Copyright 2010 Lennart Poettering
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart 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
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
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/>.
0c8570287400ba57d3705a2f62dd26039121ea6fLennart Poettering***/
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering#include <stdbool.h>
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering#include <inttypes.h>
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering#include <stdio.h>
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering#include <dbus/dbus.h>
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering#include "fdset.h"
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering/* Enforce upper limit how many names we allow */
0c8570287400ba57d3705a2f62dd26039121ea6fLennart Poettering#define MANAGER_MAX_NAMES 131072 /* 128K */
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringtypedef struct Manager Manager;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringtypedef enum WatchType WatchType;
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poetteringtypedef struct Watch Watch;
e7d179acb9f50dec4a16c6c222dd147d7e53c6bbLennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringtypedef enum ManagerExitCode {
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering MANAGER_RUNNING,
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering MANAGER_EXIT,
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering MANAGER_RELOAD,
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering MANAGER_REEXECUTE,
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering MANAGER_REBOOT,
86e9cbcaeda647eb4f1db77333f7069d5bf549f1Lennart Poettering MANAGER_POWEROFF,
86e9cbcaeda647eb4f1db77333f7069d5bf549f1Lennart Poettering MANAGER_HALT,
86e9cbcaeda647eb4f1db77333f7069d5bf549f1Lennart Poettering MANAGER_KEXEC,
86e9cbcaeda647eb4f1db77333f7069d5bf549f1Lennart Poettering _MANAGER_EXIT_CODE_MAX,
86e9cbcaeda647eb4f1db77333f7069d5bf549f1Lennart Poettering _MANAGER_EXIT_CODE_INVALID = -1
86e9cbcaeda647eb4f1db77333f7069d5bf549f1Lennart Poettering} ManagerExitCode;
86e9cbcaeda647eb4f1db77333f7069d5bf549f1Lennart Poettering
86e9cbcaeda647eb4f1db77333f7069d5bf549f1Lennart Poetteringtypedef enum ManagerRunningAs {
86e9cbcaeda647eb4f1db77333f7069d5bf549f1Lennart Poettering MANAGER_SYSTEM,
86e9cbcaeda647eb4f1db77333f7069d5bf549f1Lennart Poettering MANAGER_USER,
86e9cbcaeda647eb4f1db77333f7069d5bf549f1Lennart Poettering _MANAGER_RUNNING_AS_MAX,
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering _MANAGER_RUNNING_AS_INVALID = -1
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering} ManagerRunningAs;
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poetteringenum WatchType {
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering WATCH_INVALID,
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering WATCH_SIGNAL,
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering WATCH_NOTIFY,
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering WATCH_FD,
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering WATCH_UNIT_TIMER,
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering WATCH_JOB_TIMER,
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering WATCH_MOUNT,
86e9cbcaeda647eb4f1db77333f7069d5bf549f1Lennart Poettering WATCH_SWAP,
86e9cbcaeda647eb4f1db77333f7069d5bf549f1Lennart Poettering WATCH_UDEV,
86e9cbcaeda647eb4f1db77333f7069d5bf549f1Lennart Poettering WATCH_DBUS_WATCH,
86e9cbcaeda647eb4f1db77333f7069d5bf549f1Lennart Poettering WATCH_DBUS_TIMEOUT
86e9cbcaeda647eb4f1db77333f7069d5bf549f1Lennart Poettering};
d76f90f1711e55d23ee6c8c0957fa3db17927327Lennart Poettering
d76f90f1711e55d23ee6c8c0957fa3db17927327Lennart Poetteringstruct Watch {
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering int fd;
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering WatchType type;
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering union {
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering struct Unit *unit;
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering struct Job *job;
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering DBusWatch *bus_watch;
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering DBusTimeout *bus_timeout;
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering } data;
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering bool fd_is_dupped:1;
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering bool socket_accept:1;
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering};
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering#include "unit.h"
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering#include "job.h"
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering#include "hashmap.h"
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering#include "list.h"
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering#include "set.h"
105e151299dc1208855380be2b22d0db2d66ebc6Lennart Poettering#include "dbus.h"
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering#include "path-lookup.h"
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poettering
0d2cd47617b423f37d7425be7a56ae2fca8ff9f6Lennart Poetteringstruct Manager {
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
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 */
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
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
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
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* Jobs that need to be run */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering LIST_HEAD(Job, run_queue); /* more a stack than a queue, too */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
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 LIST_HEAD(Unit, dbus_unit_queue);
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering LIST_HEAD(Job, dbus_job_queue);
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* Units to remove */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering LIST_HEAD(Unit, cleanup_queue);
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* Units to check when doing GC */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering LIST_HEAD(Unit, gc_queue);
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* Jobs to be added */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering Hashmap *transaction_jobs; /* Unit object => Job object list 1:1 */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering JobDependency *transaction_anchor;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering Hashmap *watch_pids; /* pid => Unit object n:1 */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering char *notify_socket;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering Watch notify_watch;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering Watch signal_watch;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering int epoll_fd;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering unsigned n_snapshots;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering LookupPaths lookup_paths;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering Set *unit_path_cache;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering char **environment;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering char **default_controllers;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering usec_t runtime_watchdog;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering usec_t shutdown_watchdog;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering dual_timestamp initrd_timestamp;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering dual_timestamp startup_timestamp;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering dual_timestamp finish_timestamp;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering char *generator_unit_path;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* Data specific to the device subsystem */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering struct udev* udev;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering struct udev_monitor* udev_monitor;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering Watch udev_watch;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering Hashmap *devices_by_sysfs;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* Data specific to the mount subsystem */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering FILE *proc_self_mountinfo;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering Watch mount_watch;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* Data specific to the swap filesystem */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering FILE *proc_swaps;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering Hashmap *swaps_by_proc_swaps;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering bool request_reload;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering Watch swap_watch;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* Data specific to the D-Bus subsystem */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering DBusConnection *api_bus, *system_bus;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering DBusServer *private_bus;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering Set *bus_connections, *bus_connections_for_dispatch;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
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
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering Hashmap *watch_bus; /* D-Bus names => Unit object n:1 */
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering int32_t name_data_slot;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering int32_t conn_data_slot;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering int32_t subscribed_data_slot;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering uint32_t current_job_id;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering uint32_t default_unit_job_id;
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering
30c778094b90a637c6691c462a66df81eeb865b5Lennart Poettering /* Data specific to the Automount subsystem */
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering int dev_autofs_fd;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering /* Data specific to the cgroup subsystem */
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering Hashmap *cgroup_bondings; /* path string => CGroupBonding object 1:n */
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering char *cgroup_hierarchy;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering usec_t gc_queue_timestamp;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering int gc_marker;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering unsigned n_in_gc_queue;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering /* Make sure the user cannot accidentally unmount our cgroup
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering * file system */
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering int pin_cgroupfs_fd;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering /* Audit fd */
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering#ifdef HAVE_AUDIT
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering int audit_fd;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering#endif
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering /* Flags */
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering ManagerRunningAs running_as;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering ManagerExitCode exit_code:5;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering bool dispatching_load_queue:1;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering bool dispatching_run_queue:1;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering bool dispatching_dbus_queue:1;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering bool taint_usr:1;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering bool show_status;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering bool confirm_spawn;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering#ifdef HAVE_SYSV_COMPAT
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering bool sysv_console;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering#endif
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering bool mount_auto;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering bool swap_auto;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering ExecOutput default_std_output, default_std_error;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering /* non-zero if we are reloading or reexecuting, */
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering int n_reloading;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering unsigned n_installed_jobs;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering unsigned n_failed_jobs;
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering};
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_new(ManagerRunningAs running_as, Manager **m);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringvoid manager_free(Manager *m);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_enumerate(Manager *m);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_coldplug(Manager *m);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_startup(Manager *m, FILE *serialization, FDSet *fds);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart PoetteringJob *manager_get_job(Manager *m, uint32_t id);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart PoetteringUnit *manager_get_unit(Manager *m, const char *name);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
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 Poettering
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 Poettering
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 Poettering
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 Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringvoid manager_clear_jobs(Manager *m);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
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 Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_set_default_controllers(Manager *m, char **controllers);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_loop(Manager *m);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
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 Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_open_serialization(Manager *m, FILE **_f);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_serialize(Manager *m, FILE *f, FDSet *fds);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_deserialize(Manager *m, FILE *f, FDSet *fds);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringint manager_reload(Manager *m);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringbool manager_is_booting_or_shutting_down(Manager *m);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringvoid manager_reset_failed(Manager *m);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
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 Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringbool manager_unit_pending_inactive(Manager *m, const char *name);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringvoid manager_check_finished(Manager *m);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringvoid manager_run_generators(Manager *m);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringvoid manager_undo_generators(Manager *m);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringvoid manager_recheck_journal(Manager *m);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poettering
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringvoid manager_set_show_status(Manager *m, bool b);
8e54f5d90a6b9dd1ff672fb97ea98de66c49e332Lennart Poetteringbool manager_get_show_status(Manager *m);
2a0d751be498be89e18f130ca02b2197f83b6baaLennart Poettering
2a0d751be498be89e18f130ca02b2197f83b6baaLennart Poetteringconst char *manager_running_as_to_string(ManagerRunningAs i);
2a0d751be498be89e18f130ca02b2197f83b6baaLennart PoetteringManagerRunningAs manager_running_as_from_string(const char *s);
2a0d751be498be89e18f130ca02b2197f83b6baaLennart Poettering
2a0d751be498be89e18f130ca02b2197f83b6baaLennart Poettering#endif
2a0d751be498be89e18f130ca02b2197f83b6baaLennart Poettering