chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora: make sure the gettys are run before X starts up
[elogind.git]
/
src
/
manager.c
diff --git
a/src/manager.c
b/src/manager.c
index d26541d3ea361f6d7447b22271b80e7a46ce9616..8a9b9dd44edf9f98e070d4adca09af1a334499b2 100644
(file)
--- a/
src/manager.c
+++ b/
src/manager.c
@@
-89,7
+89,7
@@
static int manager_setup_notify(Manager *m) {
else
strncpy(sa.un.sun_path+1, NOTIFY_SOCKET, sizeof(sa.un.sun_path)-1);
else
strncpy(sa.un.sun_path+1, NOTIFY_SOCKET, sizeof(sa.un.sun_path)-1);
- if (bind(m->notify_watch.fd, &sa.sa, sizeof(sa)) < 0) {
+ if (bind(m->notify_watch.fd, &sa.sa, sizeof(sa
_family_t) + 1 + strlen(sa.un.sun_path+1
)) < 0) {
log_error("bind() failed: %m");
return -errno;
}
log_error("bind() failed: %m");
return -errno;
}
@@
-544,6
+544,12
@@
int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
manager_build_unit_path_cache(m);
manager_build_unit_path_cache(m);
+ /* If we will deserialize make sure that during enumeration
+ * this is already known, so we increase the counter here
+ * already */
+ if (serialization)
+ m->n_deserializing ++;
+
/* First, enumerate what we can from all config files */
r = manager_enumerate(m);
/* First, enumerate what we can from all config files */
r = manager_enumerate(m);
@@
-556,6
+562,11
@@
int manager_startup(Manager *m, FILE *serialization, FDSet *fds) {
if ((q = manager_coldplug(m)) < 0)
r = q;
if ((q = manager_coldplug(m)) < 0)
r = q;
+ if (serialization) {
+ assert(m->n_deserializing > 0);
+ m->n_deserializing --;
+ }
+
/* Now that the initial devices are available, let's see if we
* can write the utmp file */
manager_write_utmp_reboot(m);
/* Now that the initial devices are available, let's see if we
* can write the utmp file */
manager_write_utmp_reboot(m);
@@
-1113,6
+1124,7
@@
static int transaction_apply(Manager *m) {
job_add_to_run_queue(j);
job_add_to_dbus_queue(j);
job_add_to_run_queue(j);
job_add_to_dbus_queue(j);
+ job_start_timer(j);
}
/* As last step, kill all remaining job dependencies. */
}
/* As last step, kill all remaining job dependencies. */
@@
-1317,7
+1329,8
@@
static int transaction_add_job_and_dependencies(
assert(type < _JOB_TYPE_MAX);
assert(unit);
assert(type < _JOB_TYPE_MAX);
assert(unit);
- if (unit->meta.load_state != UNIT_LOADED) {
+ if (type != JOB_STOP &&
+ unit->meta.load_state != UNIT_LOADED) {
dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s failed to load. See logs for details.", unit->meta.id);
return -EINVAL;
}
dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s failed to load. See logs for details.", unit->meta.id);
return -EINVAL;
}
@@
-1947,7
+1960,7
@@
static int manager_process_signal_fd(Manager *m) {
static const char * const table[] = {
[0] = SPECIAL_DEFAULT_TARGET,
[1] = SPECIAL_RESCUE_TARGET,
static const char * const table[] = {
[0] = SPECIAL_DEFAULT_TARGET,
[1] = SPECIAL_RESCUE_TARGET,
- [2] = SPECIAL_EMERGENCY_
SERVICE
,
+ [2] = SPECIAL_EMERGENCY_
TARGET
,
[3] = SPECIAL_HALT_TARGET,
[4] = SPECIAL_POWEROFF_TARGET,
[5] = SPECIAL_REBOOT_TARGET
[3] = SPECIAL_HALT_TARGET,
[4] = SPECIAL_POWEROFF_TARGET,
[5] = SPECIAL_REBOOT_TARGET
@@
-2010,7
+2023,8
@@
static int process_event(Manager *m, struct epoll_event *ev) {
UNIT_VTABLE(w->data.unit)->fd_event(w->data.unit, w->fd, ev->events, w);
break;
UNIT_VTABLE(w->data.unit)->fd_event(w->data.unit, w->fd, ev->events, w);
break;
- case WATCH_TIMER: {
+ case WATCH_UNIT_TIMER:
+ case WATCH_JOB_TIMER: {
uint64_t v;
ssize_t k;
uint64_t v;
ssize_t k;
@@
-2023,7
+2037,10
@@
static int process_event(Manager *m, struct epoll_event *ev) {
return k < 0 ? -errno : -EIO;
}
return k < 0 ? -errno : -EIO;
}
- UNIT_VTABLE(w->data.unit)->timer_event(w->data.unit, v, w);
+ if (w->type == WATCH_UNIT_TIMER)
+ UNIT_VTABLE(w->data.unit)->timer_event(w->data.unit, v, w);
+ else
+ job_timer_event(w->data.job, v, w);
break;
}
break;
}
@@
-2334,7
+2351,7
@@
int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
log_debug("Deserializing state...");
log_debug("Deserializing state...");
- m->
deserializing = true
;
+ m->
n_deserializing ++
;
for (;;) {
Unit *u;
for (;;) {
Unit *u;
@@
-2366,7
+2383,8
@@
int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
r = 0;
finish:
r = 0;
finish:
- m->deserializing = false;
+ assert(m->n_deserializing > 0);
+ m->n_deserializing --;
return r;
}
return r;
}
@@
-2402,6
+2420,8
@@
int manager_reload(Manager *m) {
if ((q = lookup_paths_init(&m->lookup_paths, m->running_as)) < 0)
r = q;
if ((q = lookup_paths_init(&m->lookup_paths, m->running_as)) < 0)
r = q;
+ m->n_deserializing ++;
+
/* First, enumerate what we can from all config files */
if ((q = manager_enumerate(m)) < 0)
r = q;
/* First, enumerate what we can from all config files */
if ((q = manager_enumerate(m)) < 0)
r = q;
@@
-2417,6
+2437,9
@@
int manager_reload(Manager *m) {
if ((q = manager_coldplug(m)) < 0)
r = q;
if ((q = manager_coldplug(m)) < 0)
r = q;
+ assert(m->n_deserializing > 0);
+ m->n_deserializing ++;
+
finish:
if (f)
fclose(f);
finish:
if (f)
fclose(f);
@@
-2443,6
+2466,16
@@
bool manager_is_booting_or_shutting_down(Manager *m) {
return false;
}
return false;
}
+void manager_reset_maintenance(Manager *m) {
+ Unit *u;
+ Iterator i;
+
+ assert(m);
+
+ HASHMAP_FOREACH(u, m->units, i)
+ unit_reset_maintenance(u);
+}
+
static const char* const manager_running_as_table[_MANAGER_RUNNING_AS_MAX] = {
[MANAGER_SYSTEM] = "system",
[MANAGER_SESSION] = "session"
static const char* const manager_running_as_table[_MANAGER_RUNNING_AS_MAX] = {
[MANAGER_SYSTEM] = "system",
[MANAGER_SESSION] = "session"