[systemd-commits] 2 commits - man/systemd.exec.xml src/getty-generator
Zbigniew JÄdrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Thu Sep 12 06:30:08 PDT 2013
man/systemd.exec.xml | 21 +++++++++++++++++++
src/getty-generator/getty-generator.c | 37 +++++++++++++++++++++-------------
2 files changed, 44 insertions(+), 14 deletions(-)
New commits:
commit f4ae69117ba47e75ff89c7d847e180af9af7436a
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Thu Sep 12 09:29:01 2013 -0400
man: Add a note about what environment variables are available by default
diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
index 2c673a2..ff8b812 100644
--- a/man/systemd.exec.xml
+++ b/man/systemd.exec.xml
@@ -76,6 +76,27 @@
configuration options are configured in the [Service],
[Socket], [Mount], or [Swap] sections, depending on the unit
type.</para>
+
+ <para>Processes started by the system systemd instance
+ are executed in a clean environment in which only the
+ <varname>$PATH</varname> and <varname>$LANG</varname>
+ variables are set by default. In order to add
+ additional variables, see the
+ <varname>Environment=</varname> and
+ <varname>EnvironmentFile=</varname> options below. To
+ specify variables globally, see
+ <varname>DefaultEnvironment=</varname> in
+ <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ or the kernel option
+ <varname>systemd.setenv=</varname> in
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>. Processes
+ started by the user systemd instances inherit all
+ environment variables from the user systemd instance,
+ and have <varname>$HOME</varname>,
+ <varname>$USER</varname>,
+ <varname>$XDG_RUNTIME_DIR</varname> defined, among
+ others. In addition, <varname>$MANAGERPID</varname>
+ contains the PID of the user systemd instance.</para>
</refsect1>
<refsect1>
commit 39f0570d6ea01476dd82bbcae60f51f97f614cec
Author: Michael Marineau <michael.marineau at coreos.com>
Date: Fri Aug 16 20:28:24 2013 -0400
getty-generator: Enable getty on all active serial consoles.
This enables a getty on active kernel consoles even when they are not
the last one specified on the kernel command line and mapped to
/dev/console. Now the order "console=ttyS0 console=tty0" works in
addition to "console=tty0 console=ttyS0".
diff --git a/src/getty-generator/getty-generator.c b/src/getty-generator/getty-generator.c
index 4b7a60a..6c93806 100644
--- a/src/getty-generator/getty-generator.c
+++ b/src/getty-generator/getty-generator.c
@@ -122,33 +122,42 @@ int main(int argc, char *argv[]) {
}
if (read_one_line_file("/sys/class/tty/console/active", &active) >= 0) {
- const char *tty;
-
- tty = strrchr(active, ' ');
- if (tty)
- tty ++;
- else
- tty = active;
-
- /* Automatically add in a serial getty on the kernel
- * console */
- if (isempty(tty) || tty_is_vc(tty))
- free(active);
- else {
+ char *w, *state;
+ size_t l;
+
+ /* Automatically add in a serial getty on all active
+ * kernel consoles */
+ FOREACH_WORD(w, l, active, state) {
+ char *tty;
int k;
+ tty = strndup(w, l);
+ if (!tty) {
+ log_oom();
+ free(active);
+ r = EXIT_FAILURE;
+ goto finish;
+ }
+
+ if (isempty(tty) || tty_is_vc(tty)) {
+ free(tty);
+ continue;
+ }
+
/* We assume that gettys on virtual terminals are
* started via manual configuration and do this magic
* only for non-VC terminals. */
k = add_serial_getty(tty);
- free(active);
if (k < 0) {
+ free(tty);
+ free(active);
r = EXIT_FAILURE;
goto finish;
}
}
+ free(active);
}
/* Automatically add in a serial getty on the first
More information about the systemd-commits
mailing list