]>
git.ipfire.org Git - people/ms/systemd.git/blob - manager.h
1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
10 #include <dbus/dbus.h>
12 typedef struct Manager Manager
;
13 typedef enum WatchType WatchType
;
14 typedef struct Watch Watch
;
34 DBusTimeout
*bus_timeout
;
45 #define SPECIAL_DEFAULT_TARGET "default.target"
46 #define SPECIAL_SYSLOG_SERVICE "syslog.service"
47 #define SPECIAL_DBUS_SERVICE "messagebus.service"
48 #define SPECIAL_LOGGER_SOCKET "systemd-logger.socket"
49 #define SPECIAL_KBREQUEST_TARGET "kbrequest.target"
50 #define SPECIAL_CTRL_ALT_DEL_TARGET "ctrl-alt-del.target"
53 uint32_t current_job_id
;
55 /* Note that the set of units we know of is allowed to be
56 * incosistent. However the subset of it that is loaded may
57 * not, and the list of jobs may neither. */
59 /* Active jobs and units */
60 Hashmap
*units
; /* name string => Unit object n:1 */
61 Hashmap
*jobs
; /* job id => Job object 1:1 */
63 /* To make it easy to iterate through the units of a specific
64 * type we maintain a per type linked list */
65 LIST_HEAD(Meta
, units_per_type
[_UNIT_TYPE_MAX
]);
67 /* Units that need to be loaded */
68 LIST_HEAD(Meta
, load_queue
); /* this is actually more a stack than a queue, but uh. */
70 /* Jobs that need to be run */
71 LIST_HEAD(Job
, run_queue
); /* more a stack than a queue, too */
73 /* Jobs to be added */
74 Hashmap
*transaction_jobs
; /* Unit object => Job object list 1:1 */
75 JobDependency
*transaction_anchor
;
77 bool dispatching_load_queue
:1;
78 bool dispatching_run_queue
:1;
82 bool request_bus_dispatch
:1;
84 Hashmap
*watch_pids
; /* pid => Unit object n:1 */
90 /* Data specific to the device subsystem */
92 struct udev_monitor
* udev_monitor
;
95 /* Data specific to the mount subsystem */
96 FILE *proc_self_mountinfo
;
99 /* Data specific to the D-Bus subsystem */
103 Manager
* manager_new(void);
104 void manager_free(Manager
*m
);
106 int manager_coldplug(Manager
*m
);
108 Job
*manager_get_job(Manager
*m
, uint32_t id
);
109 Unit
*manager_get_unit(Manager
*m
, const char *name
);
111 int manager_get_unit_from_dbus_path(Manager
*m
, const char *s
, Unit
**_u
);
113 int manager_load_unit(Manager
*m
, const char *path_or_name
, Unit
**_ret
);
114 int manager_add_job(Manager
*m
, JobType type
, Unit
*unit
, JobMode mode
, bool force
, Job
**_ret
);
116 void manager_dump_units(Manager
*s
, FILE *f
, const char *prefix
);
117 void manager_dump_jobs(Manager
*s
, FILE *f
, const char *prefix
);
119 void manager_transaction_unlink_job(Manager
*m
, Job
*j
);
121 void manager_clear_jobs(Manager
*m
);
123 void manager_dispatch_load_queue(Manager
*m
);
124 void manager_dispatch_run_queue(Manager
*m
);
126 int manager_loop(Manager
*m
);