manager.h revision c1165f822cd9f8c3467b5f825ce933ab8374b361
898720b7e9cf3bdf7a93e435cbed5dd6942ecf9bHarald Hoyer/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
898720b7e9cf3bdf7a93e435cbed5dd6942ecf9bHarald Hoyer
898720b7e9cf3bdf7a93e435cbed5dd6942ecf9bHarald Hoyer#pragma once
898720b7e9cf3bdf7a93e435cbed5dd6942ecf9bHarald Hoyer
898720b7e9cf3bdf7a93e435cbed5dd6942ecf9bHarald Hoyer/***
898720b7e9cf3bdf7a93e435cbed5dd6942ecf9bHarald Hoyer This file is part of systemd.
0fe15dc8ddddeb39a5cad1f4f4afa25fa074a5d1Evgeny Vereshchagin
0d6e798a784ef0ba6b95512e4453067b2f84a91aHarald Hoyer Copyright 2010 Lennart Poettering
0d6e798a784ef0ba6b95512e4453067b2f84a91aHarald Hoyer
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
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
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***/
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier#include <stdbool.h>
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier#include <inttypes.h>
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier#include <stdio.h>
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier#include <dbus/dbus.h>
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier#include "fdset.h"
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier/* Enforce upper limit how many names we allow */
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier#define MANAGER_MAX_NAMES 131072 /* 128K */
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevaliertypedef struct Manager Manager;
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevaliertypedef enum WatchType WatchType;
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevaliertypedef struct Watch Watch;
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevaliertypedef enum ManagerExitCode {
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier MANAGER_RUNNING,
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier MANAGER_EXIT,
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier MANAGER_RELOAD,
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier MANAGER_REEXECUTE,
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier MANAGER_REBOOT,
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier MANAGER_POWEROFF,
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier MANAGER_HALT,
b6f0c419e38a960873fe68bf8f89bbb0268eed02Harald Hoyer MANAGER_KEXEC,
b6f0c419e38a960873fe68bf8f89bbb0268eed02Harald Hoyer MANAGER_SWITCH_ROOT,
b6f0c419e38a960873fe68bf8f89bbb0268eed02Harald Hoyer _MANAGER_EXIT_CODE_MAX,
b6f0c419e38a960873fe68bf8f89bbb0268eed02Harald Hoyer _MANAGER_EXIT_CODE_INVALID = -1
b6f0c419e38a960873fe68bf8f89bbb0268eed02Harald Hoyer} ManagerExitCode;
b6f0c419e38a960873fe68bf8f89bbb0268eed02Harald Hoyer
b6f0c419e38a960873fe68bf8f89bbb0268eed02Harald Hoyerenum WatchType {
b6f0c419e38a960873fe68bf8f89bbb0268eed02Harald Hoyer WATCH_INVALID,
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier WATCH_SIGNAL,
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier WATCH_NOTIFY,
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier WATCH_FD,
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier WATCH_UNIT_TIMER,
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier WATCH_JOB_TIMER,
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier WATCH_MOUNT,
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier WATCH_SWAP,
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier WATCH_UDEV,
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier WATCH_DBUS_WATCH,
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier WATCH_DBUS_TIMEOUT
3486cb6cfa3d32a95c0daf02c7510fdf372507bfMartin Pitt};
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalierstruct Watch {
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier int fd;
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier WatchType type;
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier union {
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier struct Unit *unit;
dbf43a42b8bb66d53c7cbab05f104c28097f811eDaniel Mack struct Job *job;
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier DBusWatch *bus_watch;
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier DBusTimeout *bus_timeout;
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier } data;
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier bool fd_is_dupped:1;
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier bool socket_accept:1;
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier};
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier#include "unit.h"
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier#include "job.h"
c6a77179a4097df355f0f04b8f3260c76b5e515cRonny Chevalier#include "hashmap.h"
dbf43a42b8bb66d53c7cbab05f104c28097f811eDaniel Mack#include "list.h"
dbf43a42b8bb66d53c7cbab05f104c28097f811eDaniel Mack#include "set.h"
dbf43a42b8bb66d53c7cbab05f104c28097f811eDaniel Mack#include "dbus.h"
dbf43a42b8bb66d53c7cbab05f104c28097f811eDaniel Mack#include "path-lookup.h"
8a8332f77e61d41f3bb28b8f929ed41e0ffaf721Zbigniew Jędrzejewski-Szmek
8a8332f77e61d41f3bb28b8f929ed41e0ffaf721Zbigniew Jędrzejewski-Szmekstruct Manager {
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. */
8a8332f77e61d41f3bb28b8f929ed41e0ffaf721Zbigniew Jędrzejewski-Szmek
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
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
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* To optimize iteration of units that have requires_mounts_for set */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier LIST_HEAD(Unit, has_requires_mounts_for);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
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
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* Jobs that need to be run */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier LIST_HEAD(Job, run_queue); /* more a stack than a queue, too */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
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 LIST_HEAD(Unit, dbus_unit_queue);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier LIST_HEAD(Job, dbus_job_queue);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* Units to remove */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier LIST_HEAD(Unit, cleanup_queue);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* Units to check when doing GC */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier LIST_HEAD(Unit, gc_queue);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier Hashmap *watch_pids; /* pid => Unit object n:1 */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier char *notify_socket;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier Watch notify_watch;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier Watch signal_watch;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier int epoll_fd;
8a8332f77e61d41f3bb28b8f929ed41e0ffaf721Zbigniew Jędrzejewski-Szmek
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier unsigned n_snapshots;
2375607039517c88df51ef16ddbb624ec1c10654Kay Sievers
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier LookupPaths lookup_paths;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier Set *unit_path_cache;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier char **environment;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier char **default_controllers;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier usec_t runtime_watchdog;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier usec_t shutdown_watchdog;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier dual_timestamp firmware_timestamp;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier dual_timestamp loader_timestamp;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier dual_timestamp kernel_timestamp;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier dual_timestamp initrd_timestamp;
739d81ddd005fae2bb82edce5b8a6173c7c48b34Zbigniew Jędrzejewski-Szmek dual_timestamp userspace_timestamp;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier dual_timestamp finish_timestamp;
1b1eae69ce52ef6c89a1200e8d3758549b291991Daniel Mack
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier char *generator_unit_path;
739d81ddd005fae2bb82edce5b8a6173c7c48b34Zbigniew Jędrzejewski-Szmek char *generator_unit_path_early;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier char *generator_unit_path_late;
edbced8a151c1b7ded685e2ec644950d2adec5f5Harald Hoyer
1b1eae69ce52ef6c89a1200e8d3758549b291991Daniel Mack /* Data specific to the device subsystem */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier struct udev* udev;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier struct udev_monitor* udev_monitor;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier Watch udev_watch;
739d81ddd005fae2bb82edce5b8a6173c7c48b34Zbigniew Jędrzejewski-Szmek Hashmap *devices_by_sysfs;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* Data specific to the mount subsystem */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier FILE *proc_self_mountinfo;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier Watch mount_watch;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* Data specific to the swap filesystem */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier FILE *proc_swaps;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier Hashmap *swaps_by_proc_swaps;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier bool request_reload;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier Watch swap_watch;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* Data specific to the D-Bus subsystem */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier DBusConnection *api_bus, *system_bus;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier DBusServer *private_bus;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier Set *bus_connections, *bus_connections_for_dispatch;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
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
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier Hashmap *watch_bus; /* D-Bus names => Unit object n:1 */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier int32_t name_data_slot;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier int32_t conn_data_slot;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier int32_t subscribed_data_slot;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier uint32_t current_job_id;
c7eda0133b6bf13a182337cbe8a61bf2faf9b32eEvgeny Vereshchagin uint32_t default_unit_job_id;
c7eda0133b6bf13a182337cbe8a61bf2faf9b32eEvgeny Vereshchagin
c7eda0133b6bf13a182337cbe8a61bf2faf9b32eEvgeny Vereshchagin /* Data specific to the Automount subsystem */
c7eda0133b6bf13a182337cbe8a61bf2faf9b32eEvgeny Vereshchagin int dev_autofs_fd;
c7eda0133b6bf13a182337cbe8a61bf2faf9b32eEvgeny Vereshchagin
c7eda0133b6bf13a182337cbe8a61bf2faf9b32eEvgeny Vereshchagin /* Data specific to the cgroup subsystem */
c7eda0133b6bf13a182337cbe8a61bf2faf9b32eEvgeny Vereshchagin Hashmap *cgroup_bondings; /* path string => CGroupBonding object 1:n */
c7eda0133b6bf13a182337cbe8a61bf2faf9b32eEvgeny Vereshchagin char *cgroup_hierarchy;
c7eda0133b6bf13a182337cbe8a61bf2faf9b32eEvgeny Vereshchagin
c7eda0133b6bf13a182337cbe8a61bf2faf9b32eEvgeny Vereshchagin usec_t gc_queue_timestamp;
c7eda0133b6bf13a182337cbe8a61bf2faf9b32eEvgeny Vereshchagin int gc_marker;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier unsigned n_in_gc_queue;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* Make sure the user cannot accidentally unmount our cgroup
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier * file system */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier int pin_cgroupfs_fd;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* Flags */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier SystemdRunningAs running_as;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier ManagerExitCode exit_code:5;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier bool dispatching_load_queue:1;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier bool dispatching_run_queue:1;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier bool dispatching_dbus_queue:1;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier bool taint_usr:1;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier bool show_status;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier bool confirm_spawn;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier ExecOutput default_std_output, default_std_error;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier struct rlimit *rlimit[RLIMIT_NLIMITS];
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* non-zero if we are reloading or reexecuting, */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier int n_reloading;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier unsigned n_installed_jobs;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier unsigned n_failed_jobs;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier /* Type=idle pipes */
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier int idle_pipe[2];
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier char *switch_root;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier char *switch_root_init;
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier};
bf3a947cb44f31359bba313e0252cbcc0dc95b03Evgeny Vereshchagin
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_new(SystemdRunningAs running_as, Manager **m);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevaliervoid manager_free(Manager *m);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_enumerate(Manager *m);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_coldplug(Manager *m);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_startup(Manager *m, FILE *serialization, FDSet *fds);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny ChevalierJob *manager_get_job(Manager *m, uint32_t id);
889a90422dd47284dffa32b9234a6e58991b000cRonny ChevalierUnit *manager_get_unit(Manager *m, const char *name);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_get_job_from_dbus_path(Manager *m, const char *s, Job **_j);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
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 Chevalier
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 Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevaliervoid manager_dump_units(Manager *s, FILE *f, const char *prefix);
4be4833ece2856e0cacc09f8f8b2c02b320751faMartin Pittvoid manager_dump_jobs(Manager *s, FILE *f, const char *prefix);
7d023341c765c205068e33d23d63a4000ec211dfMartin Pitt
7d023341c765c205068e33d23d63a4000ec211dfMartin Pittvoid manager_clear_jobs(Manager *m);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
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 Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_set_default_controllers(Manager *m, char **controllers);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_set_default_rlimits(Manager *m, struct rlimit **default_rlimit);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
cffae62bcb6912fbaf1b7b282d9d170c9d308897Martin Pittint manager_loop(Manager *m);
99877b7e3782a51b31bf191825f0335500f52fe5Harald Hoyer
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);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
3486cb6cfa3d32a95c0daf02c7510fdf372507bfMartin Pittint manager_open_serialization(Manager *m, FILE **_f);
3486cb6cfa3d32a95c0daf02c7510fdf372507bfMartin Pitt
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_serialize(Manager *m, FILE *f, FDSet *fds, bool serialize_jobs);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_deserialize(Manager *m, FILE *f, FDSet *fds);
e63b61be5350dbe92ea12e1eeb96dde251ed9292Evgeny Vereshchagin
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierint manager_reload(Manager *m);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierbool manager_is_booting_or_shutting_down(Manager *m);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevaliervoid manager_reset_failed(Manager *m);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
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 Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierbool manager_unit_pending_inactive(Manager *m, const char *name);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevaliervoid manager_check_finished(Manager *m);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
0fe15dc8ddddeb39a5cad1f4f4afa25fa074a5d1Evgeny Vereshchaginvoid manager_run_generators(Manager *m);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevaliervoid manager_undo_generators(Manager *m);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier
417491f122b346a31cf8dc406c4f9195a5900cecEvgeny Vereshchaginvoid manager_recheck_journal(Manager *m);
417491f122b346a31cf8dc406c4f9195a5900cecEvgeny Vereshchagin
417491f122b346a31cf8dc406c4f9195a5900cecEvgeny Vereshchaginvoid manager_set_show_status(Manager *m, bool b);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalierbool manager_get_show_status(Manager *m);
889a90422dd47284dffa32b9234a6e58991b000cRonny Chevalier