[systemd-commits] TODO src/core
Lennart Poettering
lennart at kemper.freedesktop.org
Tue Jul 17 16:47:41 PDT 2012
TODO | 2 ++
src/core/main.c | 21 +++++++++++++--------
src/core/manager.c | 6 +++---
src/core/manager.h | 2 +-
src/core/unit.c | 19 +++++++++++--------
src/core/unit.h | 2 +-
6 files changed, 31 insertions(+), 21 deletions(-)
New commits:
commit 6b78f9b4354010f8af2fe48c783ffd52b2db8f57
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Jul 18 01:46:52 2012 +0200
unit: don't serialize job state, only unit state across switch-root
diff --git a/TODO b/TODO
index d1fbed5..86a2463 100644
--- a/TODO
+++ b/TODO
@@ -34,6 +34,8 @@ Bugfixes:
Features:
+* syscall filter: add knowledge about compat syscalls
+
* flush jobs when switching root
* autorestart of journald after switch-root is broken
diff --git a/src/core/main.c b/src/core/main.c
index 022d05a..c7a7a87 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1058,7 +1058,7 @@ static int version(void) {
return 0;
}
-static int prepare_reexecute(Manager *m, FILE **_f, FDSet **_fds) {
+static int prepare_reexecute(Manager *m, FILE **_f, FDSet **_fds, bool serialize_jobs) {
FILE *f = NULL;
FDSet *fds = NULL;
int r;
@@ -1070,18 +1070,21 @@ static int prepare_reexecute(Manager *m, FILE **_f, FDSet **_fds) {
/* Make sure nothing is really destructed when we shut down */
m->n_reloading ++;
- if ((r = manager_open_serialization(m, &f)) < 0) {
+ r = manager_open_serialization(m, &f);
+ if (r < 0) {
log_error("Failed to create serialization file: %s", strerror(-r));
goto fail;
}
- if (!(fds = fdset_new())) {
+ fds = fdset_new();
+ if (!fds) {
r = -ENOMEM;
log_error("Failed to allocate fd set: %s", strerror(-r));
goto fail;
}
- if ((r = manager_serialize(m, f, fds)) < 0) {
+ r = manager_serialize(m, f, fds, serialize_jobs);
+ if (r < 0) {
log_error("Failed to serialize state: %s", strerror(-r));
goto fail;
}
@@ -1091,12 +1094,14 @@ static int prepare_reexecute(Manager *m, FILE **_f, FDSet **_fds) {
goto fail;
}
- if ((r = fd_cloexec(fileno(f), false)) < 0) {
+ r = fd_cloexec(fileno(f), false);
+ if (r < 0) {
log_error("Failed to disable O_CLOEXEC for serialization: %s", strerror(-r));
goto fail;
}
- if ((r = fdset_cloexec(fds, false)) < 0) {
+ r = fdset_cloexec(fds, false);
+ if (r < 0) {
log_error("Failed to disable O_CLOEXEC for serialization fds: %s", strerror(-r));
goto fail;
}
@@ -1624,7 +1629,7 @@ int main(int argc, char *argv[]) {
case MANAGER_REEXECUTE:
- if (prepare_reexecute(m, &serialization, &fds) < 0)
+ if (prepare_reexecute(m, &serialization, &fds, true) < 0)
goto finish;
reexecute = true;
@@ -1638,7 +1643,7 @@ int main(int argc, char *argv[]) {
m->switch_root = m->switch_root_init = NULL;
if (!switch_root_init)
- if (prepare_reexecute(m, &serialization, &fds) < 0)
+ if (prepare_reexecute(m, &serialization, &fds, false) < 0)
goto finish;
reexecute = true;
diff --git a/src/core/manager.c b/src/core/manager.c
index 8f26350..27dc9f3 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -1722,7 +1722,7 @@ int manager_open_serialization(Manager *m, FILE **_f) {
return 0;
}
-int manager_serialize(Manager *m, FILE *f, FDSet *fds) {
+int manager_serialize(Manager *m, FILE *f, FDSet *fds, bool serialize_jobs) {
Iterator i;
Unit *u;
const char *t;
@@ -1759,7 +1759,7 @@ int manager_serialize(Manager *m, FILE *f, FDSet *fds) {
fputs(u->id, f);
fputc('\n', f);
- if ((r = unit_serialize(u, f, fds)) < 0) {
+ if ((r = unit_serialize(u, f, fds, serialize_jobs)) < 0) {
m->n_reloading --;
return r;
}
@@ -1899,7 +1899,7 @@ int manager_reload(Manager *m) {
goto finish;
}
- r = manager_serialize(m, f, fds);
+ r = manager_serialize(m, f, fds, true);
if (r < 0) {
m->n_reloading --;
goto finish;
diff --git a/src/core/manager.h b/src/core/manager.h
index be2780b..6c81f92 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -278,7 +278,7 @@ void manager_dispatch_bus_query_pid_done(Manager *m, const char *name, pid_t pid
int manager_open_serialization(Manager *m, FILE **_f);
-int manager_serialize(Manager *m, FILE *f, FDSet *fds);
+int manager_serialize(Manager *m, FILE *f, FDSet *fds, bool serialize_jobs);
int manager_deserialize(Manager *m, FILE *f, FDSet *fds);
int manager_reload(Manager *m);
diff --git a/src/core/unit.c b/src/core/unit.c
index 7994f70..ae6f691 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2401,7 +2401,7 @@ bool unit_can_serialize(Unit *u) {
return UNIT_VTABLE(u)->serialize && UNIT_VTABLE(u)->deserialize_item;
}
-int unit_serialize(Unit *u, FILE *f, FDSet *fds) {
+int unit_serialize(Unit *u, FILE *f, FDSet *fds, bool serialize_jobs) {
int r;
assert(u);
@@ -2414,14 +2414,17 @@ int unit_serialize(Unit *u, FILE *f, FDSet *fds) {
if ((r = UNIT_VTABLE(u)->serialize(u, f, fds)) < 0)
return r;
- if (u->job) {
- fprintf(f, "job\n");
- job_serialize(u->job, f, fds);
- }
- if (u->nop_job) {
- fprintf(f, "job\n");
- job_serialize(u->nop_job, f, fds);
+ if (serialize_jobs) {
+ if (u->job) {
+ fprintf(f, "job\n");
+ job_serialize(u->job, f, fds);
+ }
+
+ if (u->nop_job) {
+ fprintf(f, "job\n");
+ job_serialize(u->nop_job, f, fds);
+ }
}
dual_timestamp_serialize(f, "inactive-exit-timestamp", &u->inactive_exit_timestamp);
diff --git a/src/core/unit.h b/src/core/unit.h
index 2483e4e..d0a5d64 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -499,7 +499,7 @@ char *unit_full_printf(Unit *u, const char *text);
char **unit_full_printf_strv(Unit *u, char **l);
bool unit_can_serialize(Unit *u);
-int unit_serialize(Unit *u, FILE *f, FDSet *fds);
+int unit_serialize(Unit *u, FILE *f, FDSet *fds, bool serialize_jobs);
void unit_serialize_item_format(Unit *u, FILE *f, const char *key, const char *value, ...) _printf_attr_(4,5);
void unit_serialize_item(Unit *u, FILE *f, const char *key, const char *value);
int unit_deserialize(Unit *u, FILE *f, FDSet *fds);
More information about the systemd-commits
mailing list