manager.h revision 6b78f9b4354010f8af2fe48c783ffd52b2db8f57
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#ifndef foomanagerhfoo
#define foomanagerhfoo
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdbool.h>
#include <inttypes.h>
#include <stdio.h>
#include "fdset.h"
/* Enforce upper limit how many names we allow */
typedef enum ManagerExitCode {
typedef enum ManagerRunningAs {
enum WatchType {
};
struct Watch {
int fd;
union {
} data;
bool fd_is_dupped:1;
bool socket_accept:1;
};
#include "unit.h"
#include "job.h"
#include "hashmap.h"
#include "list.h"
#include "set.h"
#include "dbus.h"
#include "path-lookup.h"
struct Manager {
/* Note that the set of units we know of is allowed to be
* inconsistent. However the subset of it that is loaded may
* not, and the list of jobs may neither. */
/* Active jobs and units */
/* To make it easy to iterate through the units of a specific
* type we maintain a per type linked list */
/* To optimize iteration of units that have requires_mounts_for set */
/* Units that need to be loaded */
/* Jobs that need to be run */
/* Units and jobs that have not yet been announced via
* D-Bus. When something about a job changes it is added here
* if it is not in there yet. This allows easy coalescing of
* D-Bus change signals. */
/* Units to remove */
/* Units to check when doing GC */
char *notify_socket;
int epoll_fd;
unsigned n_snapshots;
char **environment;
char **default_controllers;
char *generator_unit_path;
char *generator_unit_path_early;
char *generator_unit_path_late;
/* Data specific to the device subsystem */
struct udev_monitor* udev_monitor;
/* Data specific to the mount subsystem */
/* Data specific to the swap filesystem */
bool request_reload;
/* Data specific to the D-Bus subsystem */
* before the reload we queue the
* reply message here, and
* afterwards we send it */
/* Data specific to the Automount subsystem */
int dev_autofs_fd;
/* Data specific to the cgroup subsystem */
char *cgroup_hierarchy;
int gc_marker;
unsigned n_in_gc_queue;
/* Make sure the user cannot accidentally unmount our cgroup
* file system */
int pin_cgroupfs_fd;
/* Audit fd */
#ifdef HAVE_AUDIT
int audit_fd;
#endif
/* Flags */
bool dispatching_load_queue:1;
bool dispatching_run_queue:1;
bool dispatching_dbus_queue:1;
bool taint_usr:1;
bool show_status;
bool confirm_spawn;
/* non-zero if we are reloading or reexecuting, */
int n_reloading;
unsigned n_installed_jobs;
unsigned n_failed_jobs;
/* Type=idle pipes */
int idle_pipe[2];
char *switch_root;
char *switch_root_init;
};
void manager_free(Manager *m);
int manager_enumerate(Manager *m);
int manager_coldplug(Manager *m);
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_clear_jobs(Manager *m);
unsigned manager_dispatch_load_queue(Manager *m);
unsigned manager_dispatch_run_queue(Manager *m);
unsigned manager_dispatch_dbus_queue(Manager *m);
int manager_loop(Manager *m);
void manager_dispatch_bus_name_owner_changed(Manager *m, const char *name, const char* old_owner, const char *new_owner);
int manager_reload(Manager *m);
bool manager_is_booting_or_shutting_down(Manager *m);
void manager_reset_failed(Manager *m);
void manager_check_finished(Manager *m);
void manager_run_generators(Manager *m);
void manager_undo_generators(Manager *m);
void manager_recheck_journal(Manager *m);
void manager_set_show_status(Manager *m, bool b);
bool manager_get_show_status(Manager *m);
const char *manager_running_as_to_string(ManagerRunningAs i);
ManagerRunningAs manager_running_as_from_string(const char *s);
#endif