]> git.ipfire.org Git - people/ms/systemd.git/blame - manager.h
implement drop-in directories
[people/ms/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;
034c6ed7 11typedef enum ManagerEventType ManagerEventType;
60918275 12
87f0e418 13#include "unit.h"
60918275
LP
14#include "job.h"
15#include "hashmap.h"
16#include "list.h"
17#include "set.h"
18
034c6ed7
LP
19enum ManagerEventType {
20 MANAGER_SIGNAL,
21 MANAGER_FD,
22 MANAGER_TIMER
23};
24
60918275
LP
25struct Manager {
26 uint32_t current_job_id;
27
87f0e418 28 /* Note that the set of units we know of is allowed to be
87d1515d
LP
29 * incosistent. However the subset of it that is loaded may
30 * not, and the list of jobs may neither. */
31
87f0e418
LP
32 /* Active jobs and units */
33 Hashmap *units; /* name string => Unit object n:1 */
60918275
LP
34 Hashmap *jobs; /* job id => Job object 1:1 */
35
87f0e418 36 /* Units that need to be loaded */
60918275
LP
37 LIST_HEAD(Meta, load_queue); /* this is actually more a stack than a queue, but uh. */
38
034c6ed7
LP
39 /* Jobs that need to be run */
40 LIST_HEAD(Job, run_queue); /* more a stack than a queue, too */
41
e5b5ae50 42 /* Jobs to be added */
87f0e418 43 Hashmap *transaction_jobs; /* Unit object => Job object list 1:1 */
e5b5ae50 44 JobDependency *transaction_anchor;
223dabab
LP
45
46 bool dispatching_load_queue:1;
034c6ed7 47 bool dispatching_run_queue:1;
5cb5a6ff 48
87f0e418 49 Hashmap *watch_pids; /* pid => Unit object n:1 */
9152c765
LP
50
51 int epoll_fd;
52 int signal_fd;
60918275
LP
53};
54
55Manager* manager_new(void);
56void manager_free(Manager *m);
57
58Job *manager_get_job(Manager *m, uint32_t id);
87f0e418 59Unit *manager_get_unit(Manager *m, const char *name);
60918275 60
0301abf4 61int manager_load_unit(Manager *m, const char *path_or_name, Unit **_ret);
87f0e418 62int manager_add_job(Manager *m, JobType type, Unit *unit, JobMode mode, bool force, Job **_ret);
60918275 63
87f0e418 64void manager_dump_units(Manager *s, FILE *f, const char *prefix);
cea8e32e 65void manager_dump_jobs(Manager *s, FILE *f, const char *prefix);
a66d02c3 66
302d0040 67void manager_transaction_unlink_job(Manager *m, Job *j);
e5b5ae50 68
7fad411c
LP
69void manager_clear_jobs(Manager *m);
70
034c6ed7 71void manager_dispatch_run_queue(Manager *m);
9152c765 72int manager_loop(Manager *m);
83c60c9f 73
60918275 74#endif