teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0520-Revert-Revert-journald-allow-restarting-journald-wit.patch

ecbff1
From e0a3cd2cb02c465c13dcc4e2c092c9e14883ad59 Mon Sep 17 00:00:00 2001
ecbff1
From: Lukas Nykryn <lnykryn@redhat.com>
ecbff1
Date: Wed, 3 Feb 2016 10:37:48 +0100
ecbff1
Subject: [PATCH] Revert "Revert "journald: allow restarting journald without
ecbff1
 losing stream connections""
ecbff1
ecbff1
This reverts commit 91cb89c1b79ef3c475d91319edb0c052cb9f2724.
ecbff1
ecbff1
Resolves: #1359939
ecbff1
---
ecbff1
 src/journal/journald-server.c |  26 ++-
ecbff1
 src/journal/journald-stream.c | 371 ++++++++++++++++++++++++++++++++++++------
ecbff1
 src/journal/journald-stream.h |   3 +-
ecbff1
 3 files changed, 340 insertions(+), 60 deletions(-)
ecbff1
ecbff1
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
ecbff1
index 07426b41e..c1358e1e9 100644
ecbff1
--- a/src/journal/journald-server.c
ecbff1
+++ b/src/journal/journald-server.c
ecbff1
@@ -1477,6 +1477,7 @@ static int server_open_hostname(Server *s) {
ecbff1
 }
ecbff1
 
ecbff1
 int server_init(Server *s) {
ecbff1
+        _cleanup_fdset_free_ FDSet *fds = NULL;
ecbff1
         int n, r, fd;
ecbff1
 
ecbff1
         assert(s);
ecbff1
@@ -1573,26 +1574,33 @@ int server_init(Server *s) {
ecbff1
                         s->audit_fd = fd;
ecbff1
 
ecbff1
                 } else {
ecbff1
-                        log_warning("Unknown socket passed as file descriptor %d, ignoring.", fd);
ecbff1
 
ecbff1
-                        /* Let's close the fd, better be safe than
ecbff1
-                           sorry. The fd might reference some resource
ecbff1
-                           that we really want to release if we don't
ecbff1
-                           make use of it. */
ecbff1
+                        if (!fds) {
ecbff1
+                                fds = fdset_new();
ecbff1
+                                if (!fds)
ecbff1
+                                        return log_oom();
ecbff1
+                        }
ecbff1
 
ecbff1
-                        safe_close(fd);
ecbff1
+                        r = fdset_put(fds, fd);
ecbff1
+                        if (r < 0)
ecbff1
+                                return log_oom();
ecbff1
                 }
ecbff1
         }
ecbff1
 
ecbff1
-        r = server_open_syslog_socket(s);
ecbff1
+        r = server_open_stdout_socket(s, fds);
ecbff1
         if (r < 0)
ecbff1
                 return r;
ecbff1
 
ecbff1
-        r = server_open_native_socket(s);
ecbff1
+        if (fdset_size(fds) > 0) {
ecbff1
+                log_warning("%u unknown file descriptors passed, closing.", fdset_size(fds));
ecbff1
+                fds = fdset_free(fds);
ecbff1
+        }
ecbff1
+
ecbff1
+        r = server_open_syslog_socket(s);
ecbff1
         if (r < 0)
ecbff1
                 return r;
ecbff1
 
ecbff1
-        r = server_open_stdout_socket(s);
ecbff1
+        r = server_open_native_socket(s);
ecbff1
         if (r < 0)
ecbff1
                 return r;
ecbff1
 
ecbff1
diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c
ecbff1
index b8607144b..15c9110c0 100644
ecbff1
--- a/src/journal/journald-stream.c
ecbff1
+++ b/src/journal/journald-stream.c
ecbff1
@@ -28,8 +28,11 @@
ecbff1
 #endif
ecbff1
 
ecbff1
 #include "sd-event.h"
ecbff1
+#include "sd-daemon.h"
ecbff1
 #include "socket-util.h"
ecbff1
 #include "selinux-util.h"
ecbff1
+#include "mkdir.h"
ecbff1
+#include "fileio.h"
ecbff1
 #include "journald-server.h"
ecbff1
 #include "journald-stream.h"
ecbff1
 #include "journald-syslog.h"
ecbff1
@@ -66,14 +69,148 @@ struct StdoutStream {
ecbff1
         bool forward_to_kmsg:1;
ecbff1
         bool forward_to_console:1;
ecbff1
 
ecbff1
+        bool fdstore:1;
ecbff1
+
ecbff1
         char buffer[LINE_MAX+1];
ecbff1
         size_t length;
ecbff1
 
ecbff1
         sd_event_source *event_source;
ecbff1
 
ecbff1
+        char *state_file;
ecbff1
+
ecbff1
         LIST_FIELDS(StdoutStream, stdout_stream);
ecbff1
 };
ecbff1
 
ecbff1
+void stdout_stream_free(StdoutStream *s) {
ecbff1
+        if (!s)
ecbff1
+                return;
ecbff1
+
ecbff1
+        if (s->server) {
ecbff1
+                assert(s->server->n_stdout_streams > 0);
ecbff1
+                s->server->n_stdout_streams --;
ecbff1
+                LIST_REMOVE(stdout_stream, s->server->stdout_streams, s);
ecbff1
+        }
ecbff1
+
ecbff1
+        if (s->event_source) {
ecbff1
+                sd_event_source_set_enabled(s->event_source, SD_EVENT_OFF);
ecbff1
+                s->event_source = sd_event_source_unref(s->event_source);
ecbff1
+        }
ecbff1
+
ecbff1
+        safe_close(s->fd);
ecbff1
+        free(s->label);
ecbff1
+        free(s->identifier);
ecbff1
+        free(s->unit_id);
ecbff1
+        free(s->state_file);
ecbff1
+
ecbff1
+        free(s);
ecbff1
+}
ecbff1
+
ecbff1
+DEFINE_TRIVIAL_CLEANUP_FUNC(StdoutStream*, stdout_stream_free);
ecbff1
+
ecbff1
+static void stdout_stream_destroy(StdoutStream *s) {
ecbff1
+        if (!s)
ecbff1
+                return;
ecbff1
+
ecbff1
+        if (s->state_file)
ecbff1
+                unlink(s->state_file);
ecbff1
+
ecbff1
+        stdout_stream_free(s);
ecbff1
+}
ecbff1
+
ecbff1
+static int stdout_stream_save(StdoutStream *s) {
ecbff1
+        _cleanup_free_ char *temp_path = NULL;
ecbff1
+        _cleanup_fclose_ FILE *f = NULL;
ecbff1
+        int r;
ecbff1
+
ecbff1
+        assert(s);
ecbff1
+
ecbff1
+        if (s->state != STDOUT_STREAM_RUNNING)
ecbff1
+                return 0;
ecbff1
+
ecbff1
+        if (!s->state_file) {
ecbff1
+                struct stat st;
ecbff1
+
ecbff1
+                r = fstat(s->fd, &st);
ecbff1
+                if (r < 0)
ecbff1
+                        return log_warning_errno(errno, "Failed to stat connected stream: %m");
ecbff1
+
ecbff1
+                /* We use device and inode numbers as identifier for the stream */
ecbff1
+                if (asprintf(&s->state_file, "/run/systemd/journal/streams/%lu:%lu", (unsigned long) st.st_dev, (unsigned long) st.st_ino) < 0)
ecbff1
+                        return log_oom();
ecbff1
+        }
ecbff1
+
ecbff1
+        mkdir_p("/run/systemd/journal/streams", 0755);
ecbff1
+
ecbff1
+        r = fopen_temporary(s->state_file, &f, &temp_path);
ecbff1
+        if (r < 0)
ecbff1
+                goto finish;
ecbff1
+
ecbff1
+        fprintf(f,
ecbff1
+                "# This is private data. Do not parse\n"
ecbff1
+                "PRIORITY=%i\n"
ecbff1
+                "LEVEL_PREFIX=%i\n"
ecbff1
+                "FORWARD_TO_SYSLOG=%i\n"
ecbff1
+                "FORWARD_TO_KMSG=%i\n"
ecbff1
+                "FORWARD_TO_CONSOLE=%i\n",
ecbff1
+                s->priority,
ecbff1
+                s->level_prefix,
ecbff1
+                s->forward_to_syslog,
ecbff1
+                s->forward_to_kmsg,
ecbff1
+                s->forward_to_console);
ecbff1
+
ecbff1
+        if (!isempty(s->identifier)) {
ecbff1
+                _cleanup_free_ char *escaped;
ecbff1
+
ecbff1
+                escaped = cescape(s->identifier);
ecbff1
+                if (!escaped) {
ecbff1
+                        r = -ENOMEM;
ecbff1
+                        goto finish;
ecbff1
+                }
ecbff1
+
ecbff1
+                fprintf(f, "IDENTIFIER=%s\n", escaped);
ecbff1
+        }
ecbff1
+
ecbff1
+        if (!isempty(s->unit_id)) {
ecbff1
+                _cleanup_free_ char *escaped;
ecbff1
+
ecbff1
+                escaped = cescape(s->unit_id);
ecbff1
+                if (!escaped) {
ecbff1
+                        r = -ENOMEM;
ecbff1
+                        goto finish;
ecbff1
+                }
ecbff1
+
ecbff1
+                fprintf(f, "UNIT=%s\n", escaped);
ecbff1
+        }
ecbff1
+
ecbff1
+        r = fflush_and_check(f);
ecbff1
+        if (r < 0)
ecbff1
+                goto finish;
ecbff1
+
ecbff1
+        if (rename(temp_path, s->state_file) < 0) {
ecbff1
+                r = -errno;
ecbff1
+                goto finish;
ecbff1
+        }
ecbff1
+
ecbff1
+        free(temp_path);
ecbff1
+        temp_path = NULL;
ecbff1
+
ecbff1
+        /* Store the connection fd in PID 1, so that we get it passed
ecbff1
+         * in again on next start */
ecbff1
+        if (!s->fdstore) {
ecbff1
+                sd_pid_notify_with_fds(0, false, "FDSTORE=1", &s->fd, 1);
ecbff1
+                s->fdstore = true;
ecbff1
+        }
ecbff1
+
ecbff1
+finish:
ecbff1
+        if (temp_path)
ecbff1
+                unlink(temp_path);
ecbff1
+
ecbff1
+        if (r < 0)
ecbff1
+                log_error_errno(r, "Failed to save stream data %s: %m", s->state_file);
ecbff1
+
ecbff1
+        return r;
ecbff1
+}
ecbff1
+
ecbff1
 static int stdout_stream_log(StdoutStream *s, const char *p) {
ecbff1
         struct iovec iovec[N_IOVEC_META_FIELDS + 5];
ecbff1
         int priority;
ecbff1
@@ -219,6 +356,9 @@ static int stdout_stream_line(StdoutStream *s, char *p) {
ecbff1
 
ecbff1
                 s->forward_to_console = !!r;
ecbff1
                 s->state = STDOUT_STREAM_RUNNING;
ecbff1
+
ecbff1
+                /* Try to save the stream, so that journald can be restarted and we can recover */
ecbff1
+                (void) stdout_stream_save(s);
ecbff1
                 return 0;
ecbff1
 
ecbff1
         case STDOUT_STREAM_RUNNING:
ecbff1
@@ -313,36 +453,62 @@ static int stdout_stream_process(sd_event_source *es, int fd, uint32_t revents,
ecbff1
         return 1;
ecbff1
 
ecbff1
 terminate:
ecbff1
-        stdout_stream_free(s);
ecbff1
+        stdout_stream_destroy(s);
ecbff1
         return 0;
ecbff1
 }
ecbff1
 
ecbff1
-void stdout_stream_free(StdoutStream *s) {
ecbff1
+static int stdout_stream_install(Server *s, int fd, StdoutStream **ret) {
ecbff1
+        _cleanup_(stdout_stream_freep) StdoutStream *stream = NULL;
ecbff1
+        int r;
ecbff1
+
ecbff1
         assert(s);
ecbff1
+        assert(fd >= 0);
ecbff1
 
ecbff1
-        if (s->server) {
ecbff1
-                assert(s->server->n_stdout_streams > 0);
ecbff1
-                s->server->n_stdout_streams --;
ecbff1
-                LIST_REMOVE(stdout_stream, s->server->stdout_streams, s);
ecbff1
-        }
ecbff1
+        stream = new0(StdoutStream, 1);
ecbff1
+        if (!stream)
ecbff1
+                return log_oom();
ecbff1
 
ecbff1
-        if (s->event_source) {
ecbff1
-                sd_event_source_set_enabled(s->event_source, SD_EVENT_OFF);
ecbff1
-                s->event_source = sd_event_source_unref(s->event_source);
ecbff1
+        stream->fd = -1;
ecbff1
+        stream->priority = LOG_INFO;
ecbff1
+
ecbff1
+        r = getpeercred(fd, &stream->ucred);
ecbff1
+        if (r < 0)
ecbff1
+                return log_error_errno(r, "Failed to determine peer credentials: %m");
ecbff1
+
ecbff1
+        if (mac_selinux_use()) {
ecbff1
+                r = getpeersec(fd, &stream->label);
ecbff1
+                if (r < 0 && r != -EOPNOTSUPP)
ecbff1
+                        (void) log_warning_errno(r, "Failed to determine peer security context: %m");
ecbff1
         }
ecbff1
 
ecbff1
-        safe_close(s->fd);
ecbff1
+        (void) shutdown(fd, SHUT_WR);
ecbff1
 
ecbff1
-        free(s->label);
ecbff1
-        free(s->identifier);
ecbff1
-        free(s->unit_id);
ecbff1
-        free(s);
ecbff1
+        r = sd_event_add_io(s->event, &stream->event_source, fd, EPOLLIN, stdout_stream_process, stream);
ecbff1
+        if (r < 0)
ecbff1
+                return log_error_errno(r, "Failed to add stream to event loop: %m");
ecbff1
+
ecbff1
+        r = sd_event_source_set_priority(stream->event_source, SD_EVENT_PRIORITY_NORMAL+5);
ecbff1
+        if (r < 0)
ecbff1
+                return log_error_errno(r, "Failed to adjust stdout event source priority: %m");
ecbff1
+
ecbff1
+        stream->fd = fd;
ecbff1
+
ecbff1
+        stream->server = s;
ecbff1
+        LIST_PREPEND(stdout_stream, s->stdout_streams, stream);
ecbff1
+        s->n_stdout_streams ++;
ecbff1
+
ecbff1
+        if (ret)
ecbff1
+                *ret = stream;
ecbff1
+
ecbff1
+        stream = NULL;
ecbff1
+
ecbff1
+        return 0;
ecbff1
 }
ecbff1
 
ecbff1
 static int stdout_stream_new(sd_event_source *es, int listen_fd, uint32_t revents, void *userdata) {
ecbff1
+        _cleanup_close_ int fd = -1;
ecbff1
         Server *s = userdata;
ecbff1
-        StdoutStream *stream;
ecbff1
-        int fd, r;
ecbff1
+        int r;
ecbff1
 
ecbff1
         assert(s);
ecbff1
 
ecbff1
@@ -362,61 +528,163 @@ static int stdout_stream_new(sd_event_source *es, int listen_fd, uint32_t revent
ecbff1
 
ecbff1
         if (s->n_stdout_streams >= STDOUT_STREAMS_MAX) {
ecbff1
                 log_warning("Too many stdout streams, refusing connection.");
ecbff1
-                safe_close(fd);
ecbff1
                 return 0;
ecbff1
         }
ecbff1
 
ecbff1
-        stream = new0(StdoutStream, 1);
ecbff1
-        if (!stream) {
ecbff1
-                safe_close(fd);
ecbff1
-                return log_oom();
ecbff1
+        r = stdout_stream_install(s, fd, NULL);
ecbff1
+        if (r < 0)
ecbff1
+                return r;
ecbff1
+
ecbff1
+        fd = -1;
ecbff1
+        return 0;
ecbff1
+}
ecbff1
+
ecbff1
+static int stdout_stream_load(StdoutStream *stream, const char *fname) {
ecbff1
+        _cleanup_free_ char
ecbff1
+                *priority = NULL,
ecbff1
+                *level_prefix = NULL,
ecbff1
+                *forward_to_syslog = NULL,
ecbff1
+                *forward_to_kmsg = NULL,
ecbff1
+                *forward_to_console = NULL;
ecbff1
+        int r;
ecbff1
+
ecbff1
+        assert(stream);
ecbff1
+        assert(fname);
ecbff1
+
ecbff1
+        if (!stream->state_file) {
ecbff1
+                stream->state_file = strappend("/run/systemd/journal/streams/", fname);
ecbff1
+                if (!stream->state_file)
ecbff1
+                        return log_oom();
ecbff1
         }
ecbff1
 
ecbff1
-        stream->fd = fd;
ecbff1
+        r = parse_env_file(stream->state_file, NEWLINE,
ecbff1
+                           "PRIORITY", &priority,
ecbff1
+                           "LEVEL_PREFIX", &level_prefix,
ecbff1
+                           "FORWARD_TO_SYSLOG", &forward_to_syslog,
ecbff1
+                           "FORWARD_TO_KMSG", &forward_to_kmsg,
ecbff1
+                           "FORWARD_TO_CONSOLE", &forward_to_console,
ecbff1
+                           "IDENTIFIER", &stream->identifier,
ecbff1
+                           "UNIT", &stream->unit_id,
ecbff1
+                           NULL);
ecbff1
+        if (r < 0)
ecbff1
+                return log_error_errno(r, "Failed to read: %s", stream->state_file);
ecbff1
 
ecbff1
-        r = getpeercred(fd, &stream->ucred);
ecbff1
-        if (r < 0) {
ecbff1
-                log_error_errno(errno, "Failed to determine peer credentials: %m");
ecbff1
-                goto fail;
ecbff1
+        if (priority) {
ecbff1
+                int p;
ecbff1
+
ecbff1
+                p = log_level_from_string(priority);
ecbff1
+                if (p >= 0)
ecbff1
+                        stream->priority = p;
ecbff1
         }
ecbff1
 
ecbff1
-#ifdef HAVE_SELINUX
ecbff1
-        if (mac_selinux_use()) {
ecbff1
-                r = getpeersec(fd, &stream->label);
ecbff1
-                if (r < 0 && r != -EOPNOTSUPP)
ecbff1
-                        (void) log_warning_errno(r, "Failed to determine peer security context: %m");
ecbff1
+        if (level_prefix) {
ecbff1
+                r = parse_boolean(level_prefix);
ecbff1
+                if (r >= 0)
ecbff1
+                        stream->level_prefix = r;
ecbff1
         }
ecbff1
-#endif
ecbff1
 
ecbff1
-        if (shutdown(fd, SHUT_WR) < 0) {
ecbff1
-                log_error_errno(errno, "Failed to shutdown writing side of socket: %m");
ecbff1
-                goto fail;
ecbff1
+        if (forward_to_syslog) {
ecbff1
+                r = parse_boolean(forward_to_syslog);
ecbff1
+                if (r >= 0)
ecbff1
+                        stream->forward_to_syslog = r;
ecbff1
         }
ecbff1
 
ecbff1
-        r = sd_event_add_io(s->event, &stream->event_source, fd, EPOLLIN, stdout_stream_process, stream);
ecbff1
-        if (r < 0) {
ecbff1
-                log_error_errno(r, "Failed to add stream to event loop: %m");
ecbff1
-                goto fail;
ecbff1
+        if (forward_to_kmsg) {
ecbff1
+                r = parse_boolean(forward_to_kmsg);
ecbff1
+                if (r >= 0)
ecbff1
+                        stream->forward_to_kmsg = r;
ecbff1
         }
ecbff1
 
ecbff1
-        r = sd_event_source_set_priority(stream->event_source, SD_EVENT_PRIORITY_NORMAL+5);
ecbff1
-        if (r < 0) {
ecbff1
-                log_error_errno(r, "Failed to adjust stdout event source priority: %m");
ecbff1
-                goto fail;
ecbff1
+        if (forward_to_console) {
ecbff1
+                r = parse_boolean(forward_to_console);
ecbff1
+                if (r >= 0)
ecbff1
+                        stream->forward_to_console = r;
ecbff1
         }
ecbff1
 
ecbff1
-        stream->server = s;
ecbff1
-        LIST_PREPEND(stdout_stream, s->stdout_streams, stream);
ecbff1
-        s->n_stdout_streams ++;
ecbff1
+        return 0;
ecbff1
+}
ecbff1
+
ecbff1
+static int stdout_stream_restore(Server *s, const char *fname, int fd) {
ecbff1
+        StdoutStream *stream;
ecbff1
+        int r;
ecbff1
+
ecbff1
+        assert(s);
ecbff1
+        assert(fname);
ecbff1
+        assert(fd >= 0);
ecbff1
+
ecbff1
+        if (s->n_stdout_streams >= STDOUT_STREAMS_MAX) {
ecbff1
+                log_warning("Too many stdout streams, refusing restoring of stream.");
ecbff1
+                return -ENOBUFS;
ecbff1
+        }
ecbff1
+
ecbff1
+        r = stdout_stream_install(s, fd, &stream);
ecbff1
+        if (r < 0)
ecbff1
+                return r;
ecbff1
+
ecbff1
+        stream->state = STDOUT_STREAM_RUNNING;
ecbff1
+        stream->fdstore = true;
ecbff1
+
ecbff1
+        /* Ignore all parsing errors */
ecbff1
+        (void) stdout_stream_load(stream, fname);
ecbff1
 
ecbff1
         return 0;
ecbff1
+}
ecbff1
+
ecbff1
+static int server_restore_streams(Server *s, FDSet *fds) {
ecbff1
+        _cleanup_closedir_ DIR *d = NULL;
ecbff1
+        struct dirent *de;
ecbff1
+        int r;
ecbff1
+
ecbff1
+        d = opendir("/run/systemd/journal/streams");
ecbff1
+        if (!d) {
ecbff1
+                if (errno == ENOENT)
ecbff1
+                        return 0;
ecbff1
+
ecbff1
+                return log_warning_errno(errno, "Failed to enumerate /run/systemd/journal/streams: %m");
ecbff1
+        }
ecbff1
+
ecbff1
+        FOREACH_DIRENT(de, d, goto fail) {
ecbff1
+                unsigned long st_dev, st_ino;
ecbff1
+                bool found = false;
ecbff1
+                Iterator i;
ecbff1
+                int fd;
ecbff1
+
ecbff1
+                if (sscanf(de->d_name, "%lu:%lu", &st_dev, &st_ino) != 2)
ecbff1
+                        continue;
ecbff1
+
ecbff1
+                FDSET_FOREACH(fd, fds, i) {
ecbff1
+                        struct stat st;
ecbff1
+
ecbff1
+                        if (fstat(fd, &st) < 0)
ecbff1
+                                return log_error_errno(errno, "Failed to stat %s: %m", de->d_name);
ecbff1
+
ecbff1
+                        if (S_ISSOCK(st.st_mode) && st.st_dev == st_dev && st.st_ino == st_ino) {
ecbff1
+                                found = true;
ecbff1
+                                break;
ecbff1
+                        }
ecbff1
+                }
ecbff1
+
ecbff1
+                if (!found) {
ecbff1
+                        /* No file descriptor? Then let's delete the state file */
ecbff1
+                        log_debug("Cannot restore stream file %s", de->d_name);
ecbff1
+                        unlinkat(dirfd(d), de->d_name, 0);
ecbff1
+                        continue;
ecbff1
+                }
ecbff1
+
ecbff1
+                fdset_remove(fds, fd);
ecbff1
+
ecbff1
+                r = stdout_stream_restore(s, de->d_name, fd);
ecbff1
+                if (r < 0)
ecbff1
+                        safe_close(fd);
ecbff1
+        }
ecbff1
 
ecbff1
-fail:
ecbff1
-        stdout_stream_free(stream);
ecbff1
         return 0;
ecbff1
+
ecbff1
+fail:
ecbff1
+        return log_error_errno(errno, "Failed to read streams directory: %m");
ecbff1
 }
ecbff1
 
ecbff1
-int server_open_stdout_socket(Server *s) {
ecbff1
+int server_open_stdout_socket(Server *s, FDSet *fds) {
ecbff1
         int r;
ecbff1
 
ecbff1
         assert(s);
ecbff1
@@ -452,5 +720,8 @@ int server_open_stdout_socket(Server *s) {
ecbff1
         if (r < 0)
ecbff1
                 return log_error_errno(r, "Failed to adjust priority of stdout server event source: %m");
ecbff1
 
ecbff1
+        /* Try to restore streams, but don't bother if this fails */
ecbff1
+        (void) server_restore_streams(s, fds);
ecbff1
+
ecbff1
         return 0;
ecbff1
 }
ecbff1
diff --git a/src/journal/journald-stream.h b/src/journal/journald-stream.h
ecbff1
index 8cad01296..94bf955d7 100644
ecbff1
--- a/src/journal/journald-stream.h
ecbff1
+++ b/src/journal/journald-stream.h
ecbff1
@@ -21,8 +21,9 @@
ecbff1
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
ecbff1
 ***/
ecbff1
 
ecbff1
+#include "fdset.h"
ecbff1
 #include "journald-server.h"
ecbff1
 
ecbff1
-int server_open_stdout_socket(Server *s);
ecbff1
+int server_open_stdout_socket(Server *s, FDSet *fds);
ecbff1
 
ecbff1
 void stdout_stream_free(StdoutStream *s);