summaryrefslogtreecommitdiff
path: root/src/core/socket.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-03-19 20:40:05 +0100
committerLennart Poettering <lennart@poettering.net>2014-03-19 21:06:53 +0100
commit598459cebac7cc93089769a992e7b03287f77e12 (patch)
treeab690b534e7578ce1d9421d5127224a43fd5fded /src/core/socket.c
parentae439c9f9b8a9cbb320d66290e3f9ad0e2f37378 (diff)
core: rework context initialization/destruction logic
Let's automatically initialize the kill, exec and cgroup contexts of the various unit types when the object is constructed, instead of invididually in type-specific code. Also, when PrivateDevices= is set, set DevicePolicy= to closed.
Diffstat (limited to 'src/core/socket.c')
-rw-r--r--src/core/socket.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/core/socket.c b/src/core/socket.c
index b2a3e954cb..3708a86f4d 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -90,13 +90,8 @@ static void socket_init(Unit *u) {
s->ip_ttl = -1;
s->mark = -1;
- exec_context_init(&s->exec_context);
s->exec_context.std_output = u->manager->default_std_output;
s->exec_context.std_error = u->manager->default_std_error;
- kill_context_init(&s->kill_context);
- cgroup_context_init(&s->cgroup_context);
-
- unit_cgroup_context_init_defaults(u, &s->cgroup_context);
s->control_command_id = _SOCKET_EXEC_COMMAND_INVALID;
}
@@ -134,8 +129,6 @@ static void socket_done(Unit *u) {
socket_free_ports(s);
- cgroup_context_done(&s->cgroup_context);
- exec_context_done(&s->exec_context);
s->exec_runtime = exec_runtime_unref(s->exec_runtime);
exec_command_free_array(s->exec_command, _SOCKET_EXEC_COMMAND_MAX);
s->control_command = NULL;
@@ -336,7 +329,7 @@ static int socket_add_extras(Socket *s) {
if (r < 0)
return r;
- r = unit_exec_context_patch_defaults(u, &s->exec_context);
+ r = unit_patch_contexts(u);
if (r < 0)
return r;
@@ -345,7 +338,7 @@ static int socket_add_extras(Socket *s) {
if (r < 0)
return r;
- r = unit_add_default_slice(u);
+ r = unit_add_default_slice(u, &s->cgroup_context);
if (r < 0)
return r;
}