[systemd-commits] 7 commits - man/systemd.conf.xml man/systemd.exec.xml man/systemd.xml src/99-systemd.rules src/dbus-manager.c src/execute.c src/execute.h src/logger.c src/main.c src/manager.h src/mount.c src/service.c src/socket.c src/swap.c src/system.conf src/unit.c TODO units/fsck-root.service.in units/fsck at .service.in units/systemd-logger.service.in
Lennart Poettering
lennart at kemper.freedesktop.org
Tue Feb 15 04:09:08 PST 2011
TODO | 42 +++++++-------------
man/systemd.conf.xml | 2
man/systemd.exec.xml | 14 ++++--
man/systemd.xml | 35 +++++++++++++++++
src/99-systemd.rules | 2
src/dbus-manager.c | 8 ++-
src/execute.c | 15 ++++++-
src/execute.h | 2
src/logger.c | 25 ++++++++++--
src/main.c | 82 ++++++++++++++++++++++++++++++++--------
src/manager.h | 2
src/mount.c | 4 +
src/service.c | 4 +
src/socket.c | 2
src/swap.c | 3 +
src/system.conf | 4 +
src/unit.c | 6 ++
units/fsck-root.service.in | 2
units/fsck at .service.in | 2
units/systemd-logger.service.in | 1
20 files changed, 198 insertions(+), 59 deletions(-)
New commits:
commit f959c5e63a9080cbff42ac4160154f8a6b508e7a
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Feb 15 13:09:00 2011 +0100
cleanup TODO
diff --git a/TODO b/TODO
index 572816b..1c0811e 100644
--- a/TODO
+++ b/TODO
@@ -9,6 +9,9 @@ Bugs:
* mkswap/mke2fs aus cryptsetup unit muss vor dem mounten ausgeführt werden.
+* exclude java hsp files by default
+ https://bugzilla.redhat.com/show_bug.cgi?id=527425
+
Features:
* look up crypto partition mount points via fstab to show to the user when prompting for a password
@@ -17,17 +20,8 @@ Features:
* perhaps add "systemctl reenable" as combination of "systemctl disable" and "systemctl enable"
-* need a way to apply mount options of api vfs from systemd unit files instead of fstab
-
-* udisks should not use udisks-part-id, instead use blkid. also not probe /dev/loopxxx
-
-* snd-seq should go, https://bugzilla.redhat.com/show_bug.cgi?id=676095
-
-* mount.tmpfs should be optimized, https://bugzilla.redhat.com/show_bug.cgi?id=676100
-
-* mdmon is irre
-
-* gnome-shell python script/glxinfo/is-accelerated wech
+* need a way to apply mount options of api vfs from systemd unit files
+ (or some other modern source?) instead of fstab
* maybe introduce ExecRestartPre=
@@ -44,9 +38,6 @@ Features:
* support caching password questions in plymouth and on the console
https://bugzilla.redhat.com/show_bug.cgi?id=655538
-* exclude java hsp files by default
- https://bugzilla.redhat.com/show_bug.cgi?id=527425
-
* load EnvironmentFile= when starting services, not when reloading configuration
https://bugzilla.redhat.com/show_bug.cgi?id=661282
@@ -54,14 +45,11 @@ Features:
lots of wakeups due to /dev changing when we watch a subdir of /dev.
* Support ProcessNeededForShutdown=true to allow stuff like mdmon
- to be killed very late after the rootfs is read only
+ to be killed very late after the rootfs is read only (?)
* Integrate "mdadm --wait-clean". Maybe just let SIGTERM to mdmon trigger the
needed action
-* oneshot services which do not remain: 'exited' instead of 'dead'?
- it should be visible in 'systemctl' that they have been run?
-
* dot output for --test showing the 'initial transaction'
* calendar time support in timer, iCalendar semantics for the timer stuff (RFC2445)
@@ -116,8 +104,6 @@ Features:
* readahead: btrfs/LVM SSD detection
-* when processes remain in a service even though the start command failed enter active
-
* add seperate man page for [Install] settings
* only add quotacheck deps to .mount units which mention grpquota/usrquota in the mount flags
@@ -134,6 +120,14 @@ Fedora:
External:
+* udisks should not use udisks-part-id, instead use blkid. also not probe /dev/loopxxx
+
+* snd-seq should go, https://bugzilla.redhat.com/show_bug.cgi?id=676095
+
+* mount.tmpfs should be optimized, https://bugzilla.redhat.com/show_bug.cgi?id=676100
+
+* gnome-shell python script/glxinfo/is-accelerated wech
+
* make cryptsetup lower --iter-time
* patch kernel for xattr support in /dev, /proc/, /sys and /sys/fs/cgroup.
commit 27abbe8251a2614aab549a7a83f752e92d971a6a
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Feb 15 12:28:26 2011 +0100
mount,swap: properly add dependencies to logger if needed
diff --git a/src/mount.c b/src/mount.c
index 1f311ce..102d88b 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -466,6 +466,9 @@ static int mount_load(Unit *u) {
/* This is a new unit? Then let's add in some extras */
if (u->meta.load_state == UNIT_LOADED) {
+ if ((r = unit_add_exec_dependencies(u, &m->exec_context)) < 0)
+ return r;
+
if (m->meta.fragment_path)
m->from_fragment = true;
diff --git a/src/swap.c b/src/swap.c
index 4124f75..db0614b 100644
--- a/src/swap.c
+++ b/src/swap.c
@@ -264,6 +264,8 @@ static int swap_load(Unit *u) {
return r;
if (u->meta.load_state == UNIT_LOADED) {
+ if ((r = unit_add_exec_dependencies(u, &s->exec_context)) < 0)
+ return r;
if (s->meta.fragment_path)
s->from_fragment = true;
commit 934da0359966a77ff4f1505a4663e34aa434f4d3
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Feb 15 12:27:29 2011 +0100
service: change default std output to inherit
diff --git a/man/systemd.xml b/man/systemd.xml
index eff093a..2c42a02 100644
--- a/man/systemd.xml
+++ b/man/systemd.xml
@@ -271,8 +271,7 @@
<option>kmsg</option>,
<option>kmsg-console</option>. If the
argument is omitted it defaults to
- <option>null</option>
- resp. <option>inherit</option>.</para></listitem>
+ <option>inherit</option>.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
diff --git a/src/main.c b/src/main.c
index 8512e0b..96a282a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -73,7 +73,7 @@ static bool arg_sysv_console = true;
static bool arg_mount_auto = true;
static bool arg_swap_auto = true;
static char **arg_default_controllers = NULL;
-static ExecOutput arg_default_std_output = EXEC_OUTPUT_NULL;
+static ExecOutput arg_default_std_output = EXEC_OUTPUT_INHERIT;
static ExecOutput arg_default_std_error = EXEC_OUTPUT_INHERIT;
static FILE* serialization = NULL;
diff --git a/src/manager.c b/src/manager.c
index a7c8885..7d0b351 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -214,8 +214,6 @@ int manager_new(ManagerRunningAs running_as, Manager **_m) {
m->exit_code = _MANAGER_EXIT_CODE_INVALID;
m->pin_cgroupfs_fd = -1;
- m->default_std_output = EXEC_OUTPUT_NULL;
-
#ifdef HAVE_AUDIT
m->audit_fd = -1;
#endif
diff --git a/src/system.conf b/src/system.conf
index bd5a1a7..4e06319 100644
--- a/src/system.conf
+++ b/src/system.conf
@@ -21,5 +21,5 @@
#MountAuto=yes
#SwapAuto=yes
#DefaultControllers=cpu
-#DefaultStandardOutput=null
+#DefaultStandardOutput=inherit
#DefaultStandardError=inherit
commit 0a494f1ff323ef36b7acc637c198fdfa240c2bb2
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Feb 15 11:52:29 2011 +0100
exec: introduce global defaults for the standard output of services
diff --git a/TODO b/TODO
index 5d60bdb..572816b 100644
--- a/TODO
+++ b/TODO
@@ -7,6 +7,8 @@ Bugs:
* systemctl default is started when we type "reboot" at rescue mode prompt
+* mkswap/mke2fs aus cryptsetup unit muss vor dem mounten ausgeführt werden.
+
Features:
* look up crypto partition mount points via fstab to show to the user when prompting for a password
@@ -124,8 +126,6 @@ Features:
* allow runtime changing of log level and target
-* global defaults for StandardOuput=xxx
-
Fedora:
* chkconfig â systemd enable/daemon-reload glue
diff --git a/man/systemd.conf.xml b/man/systemd.conf.xml
index 54a8398..8faedda 100644
--- a/man/systemd.conf.xml
+++ b/man/systemd.conf.xml
@@ -81,6 +81,8 @@
<term><varname>ShowStatus=yes</varname></term>
<term><varname>SysVConsole=yes</varname></term>
<term><varname>CrashChVT=1</varname></term>
+ <term><varname>DefaultStandardOutput=null</varname></term>
+ <term><varname>DefaultStandardError=inherit</varname></term>
<listitem><para>Configures various
parameters of basic manager
diff --git a/man/systemd.xml b/man/systemd.xml
index 88904b7..eff093a 100644
--- a/man/systemd.xml
+++ b/man/systemd.xml
@@ -250,6 +250,30 @@
it defaults to
<option>true</option>.</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--default-standard-output=</option></term>
+ <term><option>--default-standard-error=</option></term>
+
+ <listitem><para>Sets the default
+ output resp. error output for all
+ services and sockets, i.e. controls
+ the default for
+ <option>StandardOutput=</option>
+ resp. <option>StandardExecute=</option>
+ (see
+ <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ for details). Takes one of
+ <option>inherit</option>,
+ <option>null</option>,
+ <option>tty</option>,
+ <option>syslog</option>,
+ <option>syslog+console</option>,
+ <option>kmsg</option>,
+ <option>kmsg-console</option>. If the
+ argument is omitted it defaults to
+ <option>null</option>
+ resp. <option>inherit</option>.</para></listitem>
+ </varlistentry>
</variablelist>
</refsect1>
@@ -981,6 +1005,18 @@
environment variables described above.</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>systemd.default_standard_output=</varname></term>
+ <term><varname>systemd.default_standard_error=</varname></term>
+ <listitem><para>Controls default
+ standard output/error output for
+ services, with the same effect as the
+ <option>--default-standard-output=</option>
+ resp. <option>--default-standard-error=</option>
+ command line arguments described
+ above.</para></listitem>
+ </varlistentry>
+
</variablelist>
</refsect1>
diff --git a/src/dbus-manager.c b/src/dbus-manager.c
index d160e7b..6f98aa7 100644
--- a/src/dbus-manager.c
+++ b/src/dbus-manager.c
@@ -168,8 +168,9 @@
" <property name=\"ControlGroupHierarchy\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"MountAuto\" type=\"b\" access=\"read\"/>\n" \
" <property name=\"SwapAuto\" type=\"b\" access=\"read\"/>\n" \
- " <property name=\"DefaultControllers\" type=\"as\" access=\"read\"/>\n"
- \
+ " <property name=\"DefaultControllers\" type=\"as\" access=\"read\"/>\n" \
+ " <property name=\"DefaultStandardOutput\" type=\"s\" access=\"read\"/>\n" \
+ " <property name=\"DefaultStandardError\" type=\"s\" access=\"read\"/>\n"
#ifdef HAVE_SYSV_COMPAT
#define BUS_MANAGER_INTERFACE_PROPERTIES_SYSV \
@@ -205,6 +206,7 @@
const char bus_manager_interface[] _introspect_("Manager") = BUS_MANAGER_INTERFACE;
static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_manager_append_running_as, manager_running_as, ManagerRunningAs);
+static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_manager_append_exec_output, exec_output, ExecOutput);
static int bus_manager_append_log_target(Manager *m, DBusMessageIter *i, const char *property, void *data) {
const char *t;
@@ -323,6 +325,8 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
{ "org.freedesktop.systemd1.Manager", "MountAuto", bus_property_append_bool, "b", &m->mount_auto },
{ "org.freedesktop.systemd1.Manager", "SwapAuto", bus_property_append_bool, "b", &m->swap_auto },
{ "org.freedesktop.systemd1.Manager", "DefaultControllers", bus_property_append_strv, "as", m->default_controllers },
+ { "org.freedesktop.systemd1.Manager", "DefaultStandardOutput", bus_manager_append_exec_output, "s", &m->default_std_output },
+ { "org.freedesktop.systemd1.Manager", "DefaultStandardError", bus_manager_append_exec_output, "s", &m->default_std_error },
#ifdef HAVE_SYSV_COMPAT
{ "org.freedesktop.systemd1.Manager", "SysVConsole", bus_property_append_bool, "b", &m->sysv_console },
{ "org.freedesktop.systemd1.Manager", "SysVInitPath", bus_property_append_strv, "as", m->lookup_paths.sysvinit_path },
diff --git a/src/main.c b/src/main.c
index d9dd0ac..8512e0b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -73,6 +73,8 @@ static bool arg_sysv_console = true;
static bool arg_mount_auto = true;
static bool arg_swap_auto = true;
static char **arg_default_controllers = NULL;
+static ExecOutput arg_default_std_output = EXEC_OUTPUT_NULL;
+static ExecOutput arg_default_std_error = EXEC_OUTPUT_INHERIT;
static FILE* serialization = NULL;
@@ -298,6 +300,20 @@ static int parse_proc_cmdline_word(const char *word) {
log_warning("Failed to parse show status switch %s, Ignoring.", word + 20);
else
arg_show_status = r;
+ } else if (startswith(word, "systemd.default_standard_output=")) {
+ int r;
+
+ if ((r = exec_output_from_string(word + 32)) < 0)
+ log_warning("Failed to parse default standard output switch %s, Ignoring.", word + 32);
+ else
+ arg_default_std_output = r;
+ } else if (startswith(word, "systemd.default_standard_error=")) {
+ int r;
+
+ if ((r = exec_output_from_string(word + 31)) < 0)
+ log_warning("Failed to parse default standard error switch %s, Ignoring.", word + 31);
+ else
+ arg_default_std_error = r;
#ifdef HAVE_SYSV_COMPAT
} else if (startswith(word, "systemd.sysv_console=")) {
int r;
@@ -326,7 +342,11 @@ static int parse_proc_cmdline_word(const char *word) {
" Log target\n"
"systemd.log_level=LEVEL Log level\n"
"systemd.log_color=0|1 Highlight important log messages\n"
- "systemd.log_location=0|1 Include code location in log messages\n");
+ "systemd.log_location=0|1 Include code location in log messages\n"
+ "systemd.default_standard_output=null|tty|syslog|syslog+console|kmsg|kmsg+console\n"
+ " Set default log output for services\n"
+ "systemd.default_standard_error=null|tty|syslog|syslog+console|kmsg|kmsg+console\n"
+ " Set default log error output for services\n");
} else if (streq(word, "quiet")) {
arg_show_status = false;
@@ -466,24 +486,28 @@ static int config_parse_cpu_affinity(
return 0;
}
+static DEFINE_CONFIG_PARSE_ENUM(config_parse_output, exec_output, ExecOutput, "Failed to parse output specifier");
+
static int parse_config_file(void) {
const ConfigItem items[] = {
- { "LogLevel", config_parse_level, NULL, "Manager" },
- { "LogTarget", config_parse_target, NULL, "Manager" },
- { "LogColor", config_parse_color, NULL, "Manager" },
- { "LogLocation", config_parse_location, NULL, "Manager" },
- { "DumpCore", config_parse_bool, &arg_dump_core, "Manager" },
- { "CrashShell", config_parse_bool, &arg_crash_shell, "Manager" },
- { "ShowStatus", config_parse_bool, &arg_show_status, "Manager" },
+ { "LogLevel", config_parse_level, NULL, "Manager" },
+ { "LogTarget", config_parse_target, NULL, "Manager" },
+ { "LogColor", config_parse_color, NULL, "Manager" },
+ { "LogLocation", config_parse_location, NULL, "Manager" },
+ { "DumpCore", config_parse_bool, &arg_dump_core, "Manager" },
+ { "CrashShell", config_parse_bool, &arg_crash_shell, "Manager" },
+ { "ShowStatus", config_parse_bool, &arg_show_status, "Manager" },
#ifdef HAVE_SYSV_COMPAT
- { "SysVConsole", config_parse_bool, &arg_sysv_console, "Manager" },
+ { "SysVConsole", config_parse_bool, &arg_sysv_console, "Manager" },
#endif
- { "CrashChVT", config_parse_int, &arg_crash_chvt, "Manager" },
- { "CPUAffinity", config_parse_cpu_affinity, NULL, "Manager" },
- { "MountAuto", config_parse_bool, &arg_mount_auto, "Manager" },
- { "SwapAuto", config_parse_bool, &arg_swap_auto, "Manager" },
- { "DefaultControllers", config_parse_strv, &arg_default_controllers, "Manager" },
+ { "CrashChVT", config_parse_int, &arg_crash_chvt, "Manager" },
+ { "CPUAffinity", config_parse_cpu_affinity, NULL, "Manager" },
+ { "MountAuto", config_parse_bool, &arg_mount_auto, "Manager" },
+ { "SwapAuto", config_parse_bool, &arg_swap_auto, "Manager" },
+ { "DefaultControllers", config_parse_strv, &arg_default_controllers, "Manager" },
+ { "DefaultStandardOutput", config_parse_output, &arg_default_std_output, "Manager" },
+ { "DefaultStandardError", config_parse_output, &arg_default_std_error, "Manager" },
{ NULL, NULL, NULL, NULL }
};
@@ -564,7 +588,9 @@ static int parse_argv(int argc, char *argv[]) {
ARG_SHOW_STATUS,
ARG_SYSV_CONSOLE,
ARG_DESERIALIZE,
- ARG_INTROSPECT
+ ARG_INTROSPECT,
+ ARG_DEFAULT_STD_OUTPUT,
+ ARG_DEFAULT_STD_ERROR
};
static const struct option options[] = {
@@ -587,6 +613,8 @@ static int parse_argv(int argc, char *argv[]) {
#endif
{ "deserialize", required_argument, NULL, ARG_DESERIALIZE },
{ "introspect", optional_argument, NULL, ARG_INTROSPECT },
+ { "default-standard-output", required_argument, NULL, ARG_DEFAULT_STD_OUTPUT, },
+ { "default-standard-error", required_argument, NULL, ARG_DEFAULT_STD_ERROR, },
{ NULL, 0, NULL, 0 }
};
@@ -640,6 +668,24 @@ static int parse_argv(int argc, char *argv[]) {
break;
+ case ARG_DEFAULT_STD_OUTPUT:
+
+ if ((r = exec_output_from_string(optarg)) < 0) {
+ log_error("Failed to parse default standard output setting %s.", optarg);
+ return r;
+ } else
+ arg_default_std_output = r;
+ break;
+
+ case ARG_DEFAULT_STD_ERROR:
+
+ if ((r = exec_output_from_string(optarg)) < 0) {
+ log_error("Failed to parse default standard error output setting %s.", optarg);
+ return r;
+ } else
+ arg_default_std_error = r;
+ break;
+
case ARG_UNIT:
if ((r = set_default_unit(optarg)) < 0) {
@@ -794,7 +840,9 @@ static int help(void) {
" --log-target=TARGET Set log target (console, syslog, kmsg, syslog-or-kmsg, null)\n"
" --log-level=LEVEL Set log level (debug, info, notice, warning, err, crit, alert, emerg)\n"
" --log-color[=0|1] Highlight important log messages\n"
- " --log-location[=0|1] Include code location in log messages\n",
+ " --log-location[=0|1] Include code location in log messages\n"
+ " --default-standard-output= Set default standard output for services\n"
+ " --default-standard-error= Set default standard error output for services\n",
program_invocation_short_name);
return 0;
@@ -1069,6 +1117,8 @@ int main(int argc, char *argv[]) {
#endif
m->mount_auto = arg_mount_auto;
m->swap_auto = arg_swap_auto;
+ m->default_std_output = arg_default_std_output;
+ m->default_std_error = arg_default_std_error;
if (dual_timestamp_is_set(&initrd_timestamp))
m->initrd_timestamp = initrd_timestamp;
diff --git a/src/manager.c b/src/manager.c
index 7d0b351..a7c8885 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -214,6 +214,8 @@ int manager_new(ManagerRunningAs running_as, Manager **_m) {
m->exit_code = _MANAGER_EXIT_CODE_INVALID;
m->pin_cgroupfs_fd = -1;
+ m->default_std_output = EXEC_OUTPUT_NULL;
+
#ifdef HAVE_AUDIT
m->audit_fd = -1;
#endif
diff --git a/src/manager.h b/src/manager.h
index a329ee9..1967968 100644
--- a/src/manager.h
+++ b/src/manager.h
@@ -219,6 +219,8 @@ struct Manager {
bool mount_auto;
bool swap_auto;
+ ExecOutput default_std_output, default_std_error;
+
int n_deserializing;
unsigned n_installed_jobs;
diff --git a/src/mount.c b/src/mount.c
index d9f3da6..1f311ce 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -64,6 +64,7 @@ static void mount_init(Unit *u) {
m->directory_mode = 0755;
exec_context_init(&m->exec_context);
+ m->exec_context.std_output = EXEC_OUTPUT_KMSG;
/* We need to make sure that /bin/mount is always called in
* the same process group as us, so that the autofs kernel
diff --git a/src/service.c b/src/service.c
index 243e553..e928d1a 100644
--- a/src/service.c
+++ b/src/service.c
@@ -121,6 +121,8 @@ static void service_init(Unit *u) {
s->guess_main_pid = true;
exec_context_init(&s->exec_context);
+ s->exec_context.std_output = u->meta.manager->default_std_output;
+ s->exec_context.std_error = u->meta.manager->default_std_error;
RATELIMIT_INIT(s->ratelimit, 10*USEC_PER_SEC, 5);
@@ -817,7 +819,7 @@ static int service_load_sysv_path(Service *s, const char *path) {
s->restart = SERVICE_RESTART_NO;
s->exec_context.std_output =
(s->meta.manager->sysv_console || s->exec_context.std_input == EXEC_INPUT_TTY)
- ? EXEC_OUTPUT_TTY : EXEC_OUTPUT_NULL;
+ ? EXEC_OUTPUT_TTY : s->meta.manager->default_std_output;
s->exec_context.kill_mode = KILL_PROCESS_GROUP;
/* We use the long description only if
diff --git a/src/socket.c b/src/socket.c
index 3f57e35..c41130c 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -77,6 +77,8 @@ static void socket_init(Unit *u) {
s->mark = -1;
exec_context_init(&s->exec_context);
+ s->exec_context.std_output = u->meta.manager->default_std_output;
+ s->exec_context.std_error = u->meta.manager->default_std_error;
s->control_command_id = _SOCKET_EXEC_COMMAND_INVALID;
}
diff --git a/src/swap.c b/src/swap.c
index 9a253be..4124f75 100644
--- a/src/swap.c
+++ b/src/swap.c
@@ -82,6 +82,7 @@ static void swap_unset_proc_swaps(Swap *s) {
s->timeout_usec = DEFAULT_TIMEOUT_USEC;
exec_context_init(&s->exec_context);
+ s->exec_context.std_output = EXEC_OUTPUT_KMSG;
s->parameters_etc_fstab.priority = s->parameters_proc_swaps.priority = s->parameters_fragment.priority = -1;
diff --git a/src/system.conf b/src/system.conf
index c94cf36..bd5a1a7 100644
--- a/src/system.conf
+++ b/src/system.conf
@@ -5,7 +5,7 @@
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
-# See systemd(1) for details
+# See systemd.conf(5) for details
[Manager]
#LogLevel=info
@@ -21,3 +21,5 @@
#MountAuto=yes
#SwapAuto=yes
#DefaultControllers=cpu
+#DefaultStandardOutput=null
+#DefaultStandardError=inherit
diff --git a/units/systemd-logger.service.in b/units/systemd-logger.service.in
index d970872..ff7a131 100644
--- a/units/systemd-logger.service.in
+++ b/units/systemd-logger.service.in
@@ -15,3 +15,4 @@ After=syslog.socket
[Service]
ExecStart=@rootlibexecdir@/systemd-logger
NotifyAccess=all
+StandardOutput=null
commit b7cf1b68a79833411851fa547ac9b4906207c224
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Feb 15 10:59:46 2011 +0100
udev: use SYSTEMD_READY to mask uninitialized DM devices
diff --git a/src/99-systemd.rules b/src/99-systemd.rules
index 8c54b38..5cdb9e0 100644
--- a/src/99-systemd.rules
+++ b/src/99-systemd.rules
@@ -7,7 +7,7 @@
ACTION!="add|change", GOTO="systemd_end"
-ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="systemd_end"
+ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", ENV{SYSTEMD_READY}="0"
KERNEL=="tty[0-9]|tty1[0-2]", TAG+="systemd"
KERNEL=="ttyS*", TAG+="systemd"
commit 48774cf60f604aba51c77dc67ac43b41760f7918
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Feb 15 01:28:31 2011 +0100
fsck: output to /dev/console by default in addition to syslog
diff --git a/units/fsck-root.service.in b/units/fsck-root.service.in
index cb65426..3df2cd3 100644
--- a/units/fsck-root.service.in
+++ b/units/fsck-root.service.in
@@ -18,5 +18,5 @@ ConditionPathExists=!/dev/.initramfs/fsck
Type=oneshot
RemainAfterExit=no
ExecStart=@rootlibexecdir@/systemd-fsck
-StandardOutput=syslog
+StandardOutput=syslog+console
FsckPassNo=1
diff --git a/units/fsck at .service.in b/units/fsck at .service.in
index 3881541..4751974 100644
--- a/units/fsck at .service.in
+++ b/units/fsck at .service.in
@@ -16,4 +16,4 @@ Before=local-fs.target shutdown.target
Type=oneshot
RemainAfterExit=no
ExecStart=@rootlibexecdir@/systemd-fsck %f
-StandardOutput=syslog
+StandardOutput=syslog+console
commit 28dbc1e80b0db09313f11e44f218138aefd646c8
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Feb 15 01:27:53 2011 +0100
execute: optionally forward program output to /dev/console in addition to syslog/kmsg
diff --git a/TODO b/TODO
index 8f9f76e..5d60bdb 100644
--- a/TODO
+++ b/TODO
@@ -11,8 +11,6 @@ Features:
* look up crypto partition mount points via fstab to show to the user when prompting for a password
-* prohibit socket activation of sysv services
-
* Maybe store in unit files whether a service should be enabled by default on package installation
* perhaps add "systemctl reenable" as combination of "systemctl disable" and "systemctl enable"
@@ -33,8 +31,6 @@ Features:
* figure out what happened to bluez patch
-* introduce StandardOutput=syslog+console and StandardOutput=kmsg+console to support fsck output at boot
-
* Patch systemd-fsck to use -C and pass console fd to it
* support remote/ssh systemctl/systemadm, and local privileged access
diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
index 835ee81..e9576e1 100644
--- a/man/systemd.exec.xml
+++ b/man/systemd.exec.xml
@@ -350,7 +350,9 @@
<option>null</option>,
<option>tty</option>,
<option>syslog</option>,
- <option>kmsg</option> or
+ <option>kmsg</option>,
+ <option>kmsg+console</option>,
+ <option>syslog+console</option> or
<option>socket</option>. If set to
<option>inherit</option> the file
descriptor of standard input is
@@ -374,9 +376,13 @@
system logger. <option>kmsg</option>
connects it with the kernel log buffer
which is accessible via
- <citerefentry><refentrytitle>dmesg</refentrytitle><manvolnum>1</manvolnum></citerefentry>. <option>socket</option>
- connects standard output to a socket
- from socket activation, semantics are
+ <citerefentry><refentrytitle>dmesg</refentrytitle><manvolnum>1</manvolnum></citerefentry>. <option>syslog+console</option>
+ and <option>kmsg+console</option> work
+ similarly but copy the output to the
+ system console as
+ well. <option>socket</option> connects
+ standard output to a socket from
+ socket activation, semantics are
similar to the respective option of
<varname>StandardInput=</varname>.
This setting defaults to
diff --git a/src/execute.c b/src/execute.c
index 10ce951..e01cbde 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -198,7 +198,10 @@ static int connect_logger_as(const ExecContext *context, ExecOutput output, cons
"%i\n"
"%s\n"
"%i\n",
- output == EXEC_OUTPUT_KMSG ? "kmsg" : "syslog",
+ output == EXEC_OUTPUT_KMSG ? "kmsg" :
+ output == EXEC_OUTPUT_KMSG_AND_CONSOLE ? "kmsg+console" :
+ output == EXEC_OUTPUT_SYSLOG ? "syslog" :
+ "syslog+console",
context->syslog_priority,
context->syslog_identifier ? context->syslog_identifier : ident,
context->syslog_level_prefix);
@@ -338,7 +341,9 @@ static int setup_output(const ExecContext *context, int socket_fd, const char *i
return open_terminal_as(tty_path(context), O_WRONLY, STDOUT_FILENO);
case EXEC_OUTPUT_SYSLOG:
+ case EXEC_OUTPUT_SYSLOG_AND_CONSOLE:
case EXEC_OUTPUT_KMSG:
+ case EXEC_OUTPUT_KMSG_AND_CONSOLE:
return connect_logger_as(context, o, ident, STDOUT_FILENO);
case EXEC_OUTPUT_SOCKET:
@@ -389,7 +394,9 @@ static int setup_error(const ExecContext *context, int socket_fd, const char *id
return open_terminal_as(tty_path(context), O_WRONLY, STDERR_FILENO);
case EXEC_OUTPUT_SYSLOG:
+ case EXEC_OUTPUT_SYSLOG_AND_CONSOLE:
case EXEC_OUTPUT_KMSG:
+ case EXEC_OUTPUT_KMSG_AND_CONSOLE:
return connect_logger_as(context, e, ident, STDERR_FILENO);
case EXEC_OUTPUT_SOCKET:
@@ -1543,7 +1550,9 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
prefix, c->tty_path);
if (c->std_output == EXEC_OUTPUT_SYSLOG || c->std_output == EXEC_OUTPUT_KMSG ||
- c->std_error == EXEC_OUTPUT_SYSLOG || c->std_error == EXEC_OUTPUT_KMSG)
+ c->std_output == EXEC_OUTPUT_SYSLOG_AND_CONSOLE || c->std_output == EXEC_OUTPUT_KMSG_AND_CONSOLE ||
+ c->std_error == EXEC_OUTPUT_SYSLOG || c->std_error == EXEC_OUTPUT_KMSG ||
+ c->std_error == EXEC_OUTPUT_SYSLOG_AND_CONSOLE || c->std_error == EXEC_OUTPUT_KMSG_AND_CONSOLE)
fprintf(f,
"%sSyslogFacility: %s\n"
"%sSyslogLevel: %s\n",
@@ -1820,7 +1829,9 @@ static const char* const exec_output_table[_EXEC_OUTPUT_MAX] = {
[EXEC_OUTPUT_NULL] = "null",
[EXEC_OUTPUT_TTY] = "tty",
[EXEC_OUTPUT_SYSLOG] = "syslog",
+ [EXEC_OUTPUT_SYSLOG_AND_CONSOLE] = "syslog+console",
[EXEC_OUTPUT_KMSG] = "kmsg",
+ [EXEC_OUTPUT_KMSG_AND_CONSOLE] = "kmsg+console",
[EXEC_OUTPUT_SOCKET] = "socket"
};
diff --git a/src/execute.h b/src/execute.h
index a6766f9..3cdd2ad 100644
--- a/src/execute.h
+++ b/src/execute.h
@@ -78,7 +78,9 @@ typedef enum ExecOutput {
EXEC_OUTPUT_NULL,
EXEC_OUTPUT_TTY,
EXEC_OUTPUT_SYSLOG,
+ EXEC_OUTPUT_SYSLOG_AND_CONSOLE,
EXEC_OUTPUT_KMSG,
+ EXEC_OUTPUT_KMSG_AND_CONSOLE,
EXEC_OUTPUT_SOCKET,
_EXEC_OUTPUT_MAX,
_EXEC_OUTPUT_INVALID = -1
diff --git a/src/logger.c b/src/logger.c
index 482ec41..342c307 100644
--- a/src/logger.c
+++ b/src/logger.c
@@ -84,7 +84,8 @@ struct Stream {
uid_t uid;
gid_t gid;
- bool prefix;
+ bool prefix:1;
+ bool tee_console:1;
char buffer[LINE_MAX];
size_t length;
@@ -228,6 +229,20 @@ static int stream_log(Stream *s, char *p, usec_t ts) {
} else
assert_not_reached("Unknown log target");
+ if (s->tee_console) {
+ int console;
+
+ if ((console = open_terminal("/dev/console", O_WRONLY|O_NOCTTY|O_CLOEXEC)) >= 0) {
+ IOVEC_SET_STRING(iovec[0], s->process);
+ IOVEC_SET_STRING(iovec[1], header_pid);
+ IOVEC_SET_STRING(iovec[2], p);
+ IOVEC_SET_STRING(iovec[3], (char*) "\n");
+
+ writev(console, iovec, 4);
+ }
+
+ }
+
return 0;
}
@@ -242,9 +257,9 @@ static int stream_line(Stream *s, char *p, usec_t ts) {
switch (s->state) {
case STREAM_TARGET:
- if (streq(p, "syslog"))
+ if (streq(p, "syslog") || streq(p, "syslog+console"))
s->target = STREAM_SYSLOG;
- else if (streq(p, "kmsg")) {
+ else if (streq(p, "kmsg") || streq(p, "kmsg+console")) {
if (s->server->kmsg_fd >= 0 && s->uid == 0)
s->target = STREAM_KMSG;
@@ -256,6 +271,10 @@ static int stream_line(Stream *s, char *p, usec_t ts) {
log_warning("Failed to parse log target line.");
return -EBADMSG;
}
+
+ if (endswith(p, "+console"))
+ s->tee_console = true;
+
s->state = STREAM_PRIORITY;
return 0;
diff --git a/src/unit.c b/src/unit.c
index a7e6714..0d53123 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -556,8 +556,12 @@ int unit_add_exec_dependencies(Unit *u, ExecContext *c) {
if (c->std_output != EXEC_OUTPUT_KMSG &&
c->std_output != EXEC_OUTPUT_SYSLOG &&
+ c->std_output != EXEC_OUTPUT_KMSG_AND_CONSOLE &&
+ c->std_output != EXEC_OUTPUT_SYSLOG_AND_CONSOLE &&
c->std_error != EXEC_OUTPUT_KMSG &&
- c->std_error != EXEC_OUTPUT_SYSLOG)
+ c->std_error != EXEC_OUTPUT_SYSLOG_AND_CONSOLE &&
+ c->std_error != EXEC_OUTPUT_KMSG &&
+ c->std_error != EXEC_OUTPUT_SYSLOG_AND_CONSOLE)
return 0;
/* If syslog or kernel logging is requested, make sure our own
More information about the systemd-commits
mailing list