]>
git.ipfire.org Git - thirdparty/systemd.git/blob - manager.h
1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
10 typedef struct Manager Manager
;
11 typedef enum WatchType WatchType
;
12 typedef struct Watch Watch
;
34 #define SPECIAL_DEFAULT_TARGET "default.target"
35 #define SPECIAL_SYSLOG_SERVICE "syslog.service"
36 #define SPECIAL_DBUS_SERVICE "messagebus.service"
37 #define SPECIAL_LOGGER_SOCKET "systemd-logger.socket"
38 #define SPECIAL_KBREQUEST_TARGET "kbrequest.target"
39 #define SPECIAL_CTRL_ALT_DEL_TARGET "ctrl-alt-del.target"
42 uint32_t current_job_id
;
44 /* Note that the set of units we know of is allowed to be
45 * incosistent. However the subset of it that is loaded may
46 * not, and the list of jobs may neither. */
48 /* Active jobs and units */
49 Hashmap
*units
; /* name string => Unit object n:1 */
50 Hashmap
*jobs
; /* job id => Job object 1:1 */
52 /* To make it easy to iterate through the units of a specific
53 * type we maintain a per type linked list */
54 LIST_HEAD(Meta
, units_per_type
[_UNIT_TYPE_MAX
]);
56 /* Units that need to be loaded */
57 LIST_HEAD(Meta
, load_queue
); /* this is actually more a stack than a queue, but uh. */
59 /* Jobs that need to be run */
60 LIST_HEAD(Job
, run_queue
); /* more a stack than a queue, too */
62 /* Jobs to be added */
63 Hashmap
*transaction_jobs
; /* Unit object => Job object list 1:1 */
64 JobDependency
*transaction_anchor
;
66 bool dispatching_load_queue
:1;
67 bool dispatching_run_queue
:1;
69 Hashmap
*watch_pids
; /* pid => Unit object n:1 */
75 /* Data specific to the device subsystem */
78 /* Data specific to the mount subsystem */
79 FILE *proc_self_mountinfo
;
83 Manager
* manager_new(void);
84 void manager_free(Manager
*m
);
86 int manager_coldplug(Manager
*m
);
88 Job
*manager_get_job(Manager
*m
, uint32_t id
);
89 Unit
*manager_get_unit(Manager
*m
, const char *name
);
91 int manager_load_unit(Manager
*m
, const char *path_or_name
, Unit
**_ret
);
92 int manager_add_job(Manager
*m
, JobType type
, Unit
*unit
, JobMode mode
, bool force
, Job
**_ret
);
94 void manager_dump_units(Manager
*s
, FILE *f
, const char *prefix
);
95 void manager_dump_jobs(Manager
*s
, FILE *f
, const char *prefix
);
97 void manager_transaction_unlink_job(Manager
*m
, Job
*j
);
99 void manager_clear_jobs(Manager
*m
);
101 void manager_dispatch_load_queue(Manager
*m
);
102 void manager_dispatch_run_queue(Manager
*m
);
104 int manager_loop(Manager
*m
);