naccyde / rpms / systemd

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