]> git.ipfire.org Git - thirdparty/systemd.git/blame - manager.h
add missing header files
[thirdparty/systemd.git] / manager.h
CommitLineData
60918275
LP
1/*-*- Mode: C; c-basic-offset: 8 -*-*/
2
3#ifndef foomanagerhfoo
4#define foomanagerhfoo
5
6#include <stdbool.h>
7#include <inttypes.h>
a66d02c3 8#include <stdio.h>
60918275
LP
9
10typedef struct Manager Manager;
acbb0225
LP
11typedef enum WatchType WatchType;
12typedef struct Watch Watch;
13
14enum WatchType {
15 WATCH_INVALID,
ef734fd6 16 WATCH_SIGNAL,
acbb0225 17 WATCH_FD,
ef734fd6 18 WATCH_TIMER,
f94ea366
LP
19 WATCH_MOUNT,
20 WATCH_UDEV
acbb0225
LP
21};
22
23struct Watch {
24 int fd;
25 WatchType type;
26 union Unit *unit;
27};
60918275 28
87f0e418 29#include "unit.h"
60918275
LP
30#include "job.h"
31#include "hashmap.h"
32#include "list.h"
33#include "set.h"
34
f50e0a01
LP
35#define SPECIAL_DEFAULT_TARGET "default.target"
36#define SPECIAL_SYSLOG_SERVICE "syslog.service"
37#define SPECIAL_DBUS_SERVICE "messagebus.service"
38#define SPECIAL_LOGGER_SOCKET "systemd-logger.socket"
39#define SPECIAL_KBREQUEST_TARGET "kbrequest.target"
40#define SPECIAL_CTRL_ALT_DEL_TARGET "ctrl-alt-del.target"
ce578209 41
60918275
LP
42struct Manager {
43 uint32_t current_job_id;
44
87f0e418 45 /* Note that the set of units we know of is allowed to be
87d1515d
LP
46 * incosistent. However the subset of it that is loaded may
47 * not, and the list of jobs may neither. */
48
87f0e418
LP
49 /* Active jobs and units */
50 Hashmap *units; /* name string => Unit object n:1 */
60918275
LP
51 Hashmap *jobs; /* job id => Job object 1:1 */
52
ef734fd6
LP
53 /* To make it easy to iterate through the units of a specific
54 * type we maintain a per type linked list */
55 LIST_HEAD(Meta, units_per_type[_UNIT_TYPE_MAX]);
56
87f0e418 57 /* Units that need to be loaded */
60918275
LP
58 LIST_HEAD(Meta, load_queue); /* this is actually more a stack than a queue, but uh. */
59
034c6ed7
LP
60 /* Jobs that need to be run */
61 LIST_HEAD(Job, run_queue); /* more a stack than a queue, too */
62
e5b5ae50 63 /* Jobs to be added */
87f0e418 64 Hashmap *transaction_jobs; /* Unit object => Job object list 1:1 */
e5b5ae50 65 JobDependency *transaction_anchor;
223dabab
LP
66
67 bool dispatching_load_queue:1;
034c6ed7 68 bool dispatching_run_queue:1;
5cb5a6ff 69
87f0e418 70 Hashmap *watch_pids; /* pid => Unit object n:1 */
9152c765
LP
71
72 int epoll_fd;
acbb0225
LP
73
74 Watch signal_watch;
ce578209 75
ef734fd6 76 /* Data specific to the device subsystem */
25ac040b 77 struct udev* udev;
f94ea366
LP
78 struct udev_monitor* udev_monitor;
79 Watch udev_watch;
ef734fd6
LP
80
81 /* Data specific to the mount subsystem */
82 FILE *proc_self_mountinfo;
83 Watch mount_watch;
60918275
LP
84};
85
86Manager* manager_new(void);
87void manager_free(Manager *m);
88
f50e0a01
LP
89int manager_coldplug(Manager *m);
90
60918275 91Job *manager_get_job(Manager *m, uint32_t id);
87f0e418 92Unit *manager_get_unit(Manager *m, const char *name);
60918275 93
0301abf4 94int manager_load_unit(Manager *m, const char *path_or_name, Unit **_ret);
87f0e418 95int manager_add_job(Manager *m, JobType type, Unit *unit, JobMode mode, bool force, Job **_ret);
60918275 96
87f0e418 97void manager_dump_units(Manager *s, FILE *f, const char *prefix);
cea8e32e 98void manager_dump_jobs(Manager *s, FILE *f, const char *prefix);
a66d02c3 99
302d0040 100void manager_transaction_unlink_job(Manager *m, Job *j);
e5b5ae50 101
7fad411c
LP
102void manager_clear_jobs(Manager *m);
103
f50e0a01 104void manager_dispatch_load_queue(Manager *m);
034c6ed7 105void manager_dispatch_run_queue(Manager *m);
f50e0a01 106
9152c765 107int manager_loop(Manager *m);
83c60c9f 108
60918275 109#endif