summaryrefslogtreecommitdiff
path: root/src/journal/journald-server.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-11 23:31:07 +0100
committerLennart Poettering <lennart@poettering.net>2013-12-11 23:31:07 +0100
commite9174f29c7e3ee45137537b126458718913a3ec5 (patch)
treedd8b7afb775a0121031607b2e5b2358b8c0fbece /src/journal/journald-server.c
parent897395791f53064d8c9a18cf6b6567404fbedf15 (diff)
journald: cache cgroup root path, instead of querying it on every incoming log message
Diffstat (limited to 'src/journal/journald-server.c')
-rw-r--r--src/journal/journald-server.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index a4fa394bc7..0f67fb8d57 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -622,7 +622,7 @@ static void dispatch_message_real(
}
#endif
- r = cg_pid_get_path_shifted(ucred->pid, NULL, &c);
+ r = cg_pid_get_path_shifted(ucred->pid, s->cgroup_root, &c);
if (r >= 0) {
char *session = NULL;
@@ -743,7 +743,7 @@ static void dispatch_message_real(
}
#endif
- r = cg_pid_get_path_shifted(object_pid, NULL, &c);
+ r = cg_pid_get_path_shifted(object_pid, s->cgroup_root, &c);
if (r >= 0) {
x = strappenda("OBJECT_SYSTEMD_CGROUP=", c);
IOVEC_SET_STRING(iovec[n++], x);
@@ -878,7 +878,7 @@ void server_dispatch_message(
if (!ucred)
goto finish;
- r = cg_pid_get_path_shifted(ucred->pid, NULL, &path);
+ r = cg_pid_get_path_shifted(ucred->pid, s->cgroup_root, &path);
if (r < 0)
goto finish;
@@ -1563,6 +1563,10 @@ int server_init(Server *s) {
if (!s->rate_limit)
return -ENOMEM;
+ r = cg_get_root_path(&s->cgroup_root);
+ if (r < 0)
+ return r;
+
server_cache_hostname(s);
server_cache_boot_id(s);
server_cache_machine_id(s);
@@ -1643,6 +1647,7 @@ void server_done(Server *s) {
free(s->buffer);
free(s->tty_path);
+ free(s->cgroup_root);
if (s->mmap)
mmap_cache_unref(s->mmap);