]> err.no Git - systemd/commitdiff
journal: support changing the console tty to forward to
authorLennart Poettering <lennart@poettering.net>
Thu, 31 May 2012 23:06:10 +0000 (01:06 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 1 Jun 2012 15:27:16 +0000 (17:27 +0200)
TODO
man/journald.conf.xml
src/journal/journald-gperf.gperf
src/journal/journald.c
src/journal/journald.conf
src/journal/journald.h

diff --git a/TODO b/TODO
index 7eaff7a1d5fe3e88ad780a1643e00ad2016aea37..1d308697b33822710944fbfc578cadde813c9e3f 100644 (file)
--- a/TODO
+++ b/TODO
@@ -31,8 +31,6 @@ Features:
 
 * nspawn: make use of device cgroup contrller by default
 
-* parse kernel cmdline option for capability bset
-
 * journalctl /dev/sda, journalctl --device=b12:8 (--device=n12, --device=+usb:1-1)
 
 * make use of /sys/power/wake_lock in inhibitors
@@ -41,8 +39,6 @@ Features:
 
 * make sure show-logs checks for utf8 validity, not ascii validity
 
-* add TimerSlackNS to system.conf to set system-wide caps bounds
-
 * when breaking cycles drop sysv services first, then services from /run, then from /etc, then from /usr
 
 * readahead: when bumping /sys readahead variable save mtime and compare later to detect changes
@@ -104,8 +100,6 @@ Features:
 
 * Auke: merge Auke's bootchart
 
-* journald: allow forwarding of log data to specific TTY instead of console
-
 * udev: move to LGPL
 
 * udev systemd unify:
index 5ad0f02b30115c059e5491c666ef1ca01e869d23..28ad2edacff99761f75056aac4e917dd2f432c83 100644 (file)
                                 </para></listitem>
                         </varlistentry>
 
+                        <varlistentry>
+                                <term><varname>TTYPath=</varname></term>
+
+                                <listitem><para>Change the console TTY
+                                to use if
+                                <varname>ForwardToConsole=yes</varname>
+                                is used. Defaults to
+                                <filename>/dev/console</filename>.</para></listitem>
+                        </varlistentry>
+
                         <varlistentry>
                                 <term><varname>ImportKernel=</varname></term>
 
index a56f6d966e201a06e9e4fb8155f347fe8fa35540..9c778fcff063eb393101c333870e664e9a2a25ea 100644 (file)
@@ -29,3 +29,4 @@ Journal.ForwardToSyslog,    config_parse_bool,      0, offsetof(Server, forward_
 Journal.ForwardToKMsg,      config_parse_bool,      0, offsetof(Server, forward_to_kmsg)
 Journal.ForwardToConsole,   config_parse_bool,      0, offsetof(Server, forward_to_console)
 Journal.ImportKernel,       config_parse_bool,      0, offsetof(Server, import_proc_kmsg)
+Journal.TTYPath,            config_parse_path,      0, offsetof(Server, tty_path)
index e0e7cce1227d4aea19cc2934939efd56ae6445ee..0e27582df3335324d7964cf611532edfaa55ad50 100644 (file)
@@ -965,6 +965,7 @@ static void forward_console(Server *s, const char *identifier, const char *messa
         char header_pid[16];
         int n = 0, fd;
         char *ident_buf = NULL;
+        const char *tty;
 
         assert(s);
         assert(message);
@@ -992,14 +993,16 @@ static void forward_console(Server *s, const char *identifier, const char *messa
         IOVEC_SET_STRING(iovec[n++], message);
         IOVEC_SET_STRING(iovec[n++], "\n");
 
-        fd = open_terminal("/dev/console", O_WRONLY|O_NOCTTY|O_CLOEXEC);
+        tty = s->tty_path ? s->tty_path : "/dev/console";
+
+        fd = open_terminal(tty, O_WRONLY|O_NOCTTY|O_CLOEXEC);
         if (fd < 0) {
-                log_debug("Failed to open /dev/console for logging: %s", strerror(errno));
+                log_debug("Failed to open %s for logging: %s", tty, strerror(errno));
                 goto finish;
         }
 
         if (writev(fd, iovec, n) < 0)
-                log_debug("Failed to write to /dev/console for logging: %s", strerror(errno));
+                log_debug("Failed to write to %s for logging: %s", tty, strerror(errno));
 
         close_nointr_nofail(fd);
 
@@ -2782,6 +2785,7 @@ static void server_done(Server *s) {
                 journal_rate_limit_free(s->rate_limit);
 
         free(s->buffer);
+        free(s->tty_path);
 }
 
 int main(int argc, char *argv[]) {
index 95534dc2a9ebee4b772b479718bd2106c59601bb..433181134414a1e0da90154f0a020ce2b1a62791 100644 (file)
@@ -23,3 +23,4 @@
 #ForwardToKMsg=no
 #ForwardToConsole=no
 #ImportKernel=yes
+#TTYPath=/dev/console
index 3c69f7ec248f50fc07cf9bce23672db3f42999f4..04ebf30017c92a417ddc320da3bf1bb2b9f867fc 100644 (file)
@@ -79,6 +79,8 @@ typedef struct Server {
 
         LIST_HEAD(StdoutStream, stdout_streams);
         unsigned n_stdout_streams;
+
+        char *tty_path;
 } Server;
 
 /* gperf lookup function */