summaryrefslogtreecommitdiff
path: root/src/core/socket.c
diff options
context:
space:
mode:
authorMichal Sekletar <msekleta@redhat.com>2013-03-14 18:12:27 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-15 22:56:40 -0400
commitc17ec25e4d9bd6c8e8617416f813e25b2ebbafc5 (patch)
tree6a414a30460e6a362180a059bc93e88cea946916 /src/core/socket.c
parent3b953d68c628c6ae70adba871719ac0f16083b51 (diff)
core: reuse the same /tmp, /var/tmp and inaccessible dir
All Execs within the service, will get mounted the same /tmp and /var/tmp directories, if service is configured with PrivateTmp=yes. Temporary directories are cleaned up by service itself in addition to systemd-tmpfiles. Directory which is mounted as inaccessible is created at runtime in /run/systemd.
Diffstat (limited to 'src/core/socket.c')
-rw-r--r--src/core/socket.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/core/socket.c b/src/core/socket.c
index ee9de4e14c..a3e3631dac 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -127,7 +127,7 @@ static void socket_done(Unit *u) {
socket_free_ports(s);
- exec_context_done(&s->exec_context);
+ exec_context_done(&s->exec_context, manager_is_reloading_or_reexecuting(u->manager));
exec_command_free_array(s->exec_command, _SOCKET_EXEC_COMMAND_MAX);
s->control_command = NULL;
@@ -1253,6 +1253,7 @@ static void socket_enter_dead(Socket *s, SocketResult f) {
if (f != SOCKET_SUCCESS)
s->result = f;
+ exec_context_tmp_dirs_done(&s->exec_context);
socket_set_state(s, s->result != SOCKET_SUCCESS ? SOCKET_FAILED : SOCKET_DEAD);
}
@@ -1742,6 +1743,8 @@ static int socket_serialize(Unit *u, FILE *f, FDSet *fds) {
}
}
+ exec_context_serialize(&s->exec_context, UNIT(s), f);
+
return 0;
}
@@ -1901,7 +1904,22 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value,
p->fd = fdset_remove(fds, fd);
}
}
+ } else if (streq(key, "tmp-dir")) {
+ char *t;
+
+ t = strdup(value);
+ if (!t)
+ return log_oom();
+
+ s->exec_context.tmp_dir = t;
+ } else if (streq(key, "var-tmp-dir")) {
+ char *t;
+
+ t = strdup(value);
+ if (!t)
+ return log_oom();
+ s->exec_context.var_tmp_dir = t;
} else
log_debug_unit(UNIT(s)->id,
"Unknown serialization key '%s'", key);