[systemd-commits] 3 commits - Makefile.am man/sd-daemon.xml man/systemd.automount.xml man/systemd.conf.xml man/systemd.device.xml man/systemd.exec.xml man/systemd.mount.xml man/systemd.path.xml man/systemd.service.xml man/systemd.snapshot.xml man/systemd.socket.xml man/systemd.swap.xml man/systemd.target.xml man/systemd.timer.xml man/systemd.xml src/conf-parser.h src/load-fragment.c src/main.c src/system.conf src/util.c src/util.h
Lennart Poettering
lennart at kemper.freedesktop.org
Tue Jul 6 16:39:05 PDT 2010
Makefile.am | 8 +-
man/sd-daemon.xml | 2
man/systemd.automount.xml | 2
man/systemd.conf.xml | 112 ++++++++++++++++++++++++++++++
man/systemd.device.xml | 2
man/systemd.exec.xml | 2
man/systemd.mount.xml | 2
man/systemd.path.xml | 2
man/systemd.service.xml | 2
man/systemd.snapshot.xml | 2
man/systemd.socket.xml | 2
man/systemd.swap.xml | 2
man/systemd.target.xml | 2
man/systemd.timer.xml | 2
man/systemd.xml | 171 ++++++++++++++++++++++++++++++++++++----------
src/conf-parser.h | 28 +++++++
src/load-fragment.c | 45 ++----------
src/main.c | 170 +++++++++++++++++++++++++++++++++++++++++++++
src/system.conf | 19 +++++
src/util.c | 47 ++++++++++++
src/util.h | 2
21 files changed, 542 insertions(+), 84 deletions(-)
New commits:
commit f3e219a238c716ffa06fab7b0618197c090dfd5a
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Jul 7 01:38:56 2010 +0200
update man pages for recent changes
diff --git a/Makefile.am b/Makefile.am
index cdb5be3..0215f23 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -341,7 +341,8 @@ MANPAGES = \
man/telinit.8 \
man/halt.8 \
man/shutdown.8 \
- man/pam_systemd.8
+ man/pam_systemd.8 \
+ man/systemd.conf.5
MANPAGES_ALIAS = \
man/reboot.8 \
diff --git a/man/sd-daemon.xml b/man/sd-daemon.xml
index d961513..e3ac68e 100644
--- a/man/sd-daemon.xml
+++ b/man/sd-daemon.xml
@@ -61,7 +61,7 @@
<filename>sd-daemon.h</filename> provide a reference
implementation of various APIs for new-style daemons,
as implemented by the
- <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
init system.</para>
<para>See
diff --git a/man/systemd.automount.xml b/man/systemd.automount.xml
index d1e04f6..754d1e3 100644
--- a/man/systemd.automount.xml
+++ b/man/systemd.automount.xml
@@ -155,7 +155,7 @@
<refsect1>
<title>See Also</title>
<para>
- <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
diff --git a/man/systemd.conf.xml b/man/systemd.conf.xml
new file mode 100644
index 0000000..95a2e52
--- /dev/null
+++ b/man/systemd.conf.xml
@@ -0,0 +1,112 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+ This file is part of systemd.
+
+ Copyright 2010 Lennart Poettering
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<refentry id="systemd.conf">
+ <refentryinfo>
+ <title>systemd.conf</title>
+ <productname>systemd</productname>
+
+ <authorgroup>
+ <author>
+ <contrib>Developer</contrib>
+ <firstname>Lennart</firstname>
+ <surname>Poettering</surname>
+ <email>lennart at poettering.net</email>
+ </author>
+ </authorgroup>
+ </refentryinfo>
+
+ <refmeta>
+ <refentrytitle>systemd.conf</refentrytitle>
+ <manvolnum>5</manvolnum>
+ </refmeta>
+
+ <refnamediv>
+ <refname>systemd.conf</refname>
+ <refpurpose>systemd manager configuration file</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <para><filename>system.conf</filename></para>
+ <para><filename>session.conf</filename></para>
+ </refsynopsisdiv>
+
+ <refsect1>
+ <title>Description</title>
+
+ <para>When run as system instance systemd reads the
+ configuration file <filename>system.conf</filename>,
+ otherwise <filename>session.conf</filename>. These
+ configuration files contain a few settings controlling
+ basic manager operations.</para>
+
+ </refsect1>
+
+ <refsect1>
+ <title>Options</title>
+
+ <para>All options are configured in the
+ <literal>[Manager]</literal> section:</para>
+
+ <variablelist>
+
+ <varlistentry>
+ <term><varname>LogLevel=</varname></term>
+ <term><varname>LogTarget=</varname></term>
+ <term><varname>LogColor=</varname></term>
+ <term><varname>LogLocation=</varname></term>
+ <term><varname>DumpCore=yes</varname></term>
+ <term><varname>CrashShell=no</varname></term>
+ <term><varname>ShowStatus=yes</varname></term>
+ <term><varname>CrashChVT=1</varname></term>
+
+ <listitem><para>Configures various
+ parameters of basic manager
+ operation. These options may be
+ overriden by the respective command
+ line arguments. See
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+ for details about these command line
+ arguments.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>CPUAffinity=</varname></term>
+
+ <listitem><para>Configures the initial
+ CPU affinity for the init
+ process. Takes a space-seperated list
+ of CPU indexes.</para></listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
+ <refsect1>
+ <title>See Also</title>
+ <para>
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+ </para>
+ </refsect1>
+
+</refentry>
diff --git a/man/systemd.device.xml b/man/systemd.device.xml
index c530643..ea1416f 100644
--- a/man/systemd.device.xml
+++ b/man/systemd.device.xml
@@ -139,7 +139,7 @@
<refsect1>
<title>See Also</title>
<para>
- <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum></citerefentry>
diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml
index 6502d87..68495dc 100644
--- a/man/systemd.exec.xml
+++ b/man/systemd.exec.xml
@@ -734,7 +734,7 @@
<refsect1>
<title>See Also</title>
<para>
- <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
diff --git a/man/systemd.mount.xml b/man/systemd.mount.xml
index 45173b5..70170bb 100644
--- a/man/systemd.mount.xml
+++ b/man/systemd.mount.xml
@@ -237,7 +237,7 @@
<refsect1>
<title>See Also</title>
<para>
- <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
diff --git a/man/systemd.path.xml b/man/systemd.path.xml
index d910d2c..d5495c7 100644
--- a/man/systemd.path.xml
+++ b/man/systemd.path.xml
@@ -174,7 +174,7 @@
<refsect1>
<title>See Also</title>
<para>
- <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
diff --git a/man/systemd.service.xml b/man/systemd.service.xml
index 008ebd7..bceb5aa 100644
--- a/man/systemd.service.xml
+++ b/man/systemd.service.xml
@@ -538,7 +538,7 @@
<refsect1>
<title>See Also</title>
<para>
- <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
diff --git a/man/systemd.snapshot.xml b/man/systemd.snapshot.xml
index 5287ad2..a3e2322 100644
--- a/man/systemd.snapshot.xml
+++ b/man/systemd.snapshot.xml
@@ -78,7 +78,7 @@
<refsect1>
<title>See Also</title>
<para>
- <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
</para>
diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml
index 6154b30..32102fa 100644
--- a/man/systemd.socket.xml
+++ b/man/systemd.socket.xml
@@ -509,7 +509,7 @@
<refsect1>
<title>See Also</title>
<para>
- <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
diff --git a/man/systemd.swap.xml b/man/systemd.swap.xml
index 18f96d0..38574ab 100644
--- a/man/systemd.swap.xml
+++ b/man/systemd.swap.xml
@@ -134,7 +134,7 @@
<refsect1>
<title>See Also</title>
<para>
- <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
diff --git a/man/systemd.target.xml b/man/systemd.target.xml
index 6f3bc18..5c26427 100644
--- a/man/systemd.target.xml
+++ b/man/systemd.target.xml
@@ -97,7 +97,7 @@
<refsect1>
<title>See Also</title>
<para>
- <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>
diff --git a/man/systemd.timer.xml b/man/systemd.timer.xml
index 557a45e..518ae2a 100644
--- a/man/systemd.timer.xml
+++ b/man/systemd.timer.xml
@@ -182,7 +182,7 @@
<refsect1>
<title>See Also</title>
<para>
- <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
diff --git a/man/systemd.xml b/man/systemd.xml
index b4a7e3e..ba775c5 100644
--- a/man/systemd.xml
+++ b/man/systemd.xml
@@ -73,6 +73,13 @@
are mostly equivalent when invoked from normal login sessions. See
<citerefentry><refentrytitle>telinit</refentrytitle><manvolnum>8</manvolnum></citerefentry>
for more information.</para>
+
+ <para>When run as system instance, systemd interprets
+ the configuration file
+ <filename>system.conf</filename>, otherwise
+ <filename>session.conf</filename>. See
+ <citerefentry><refentrytitle>systemd.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ for more information.</para>
</refsect1>
<refsect1>
@@ -89,6 +96,37 @@
text and exits.</para></listitem>
</varlistentry>
<varlistentry>
+ <term><option>--test</option></term>
+
+ <listitem><para>Determine startup
+ sequence, dump it and exit. This is an
+ option useful for debugging
+ only.</para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>--dump-configuration-items</option></term>
+
+ <listitem><para>Dump understood unit
+ configuration items. This outputs a
+ terse but complete list of
+ configuration items understood in unit
+ definition files.</para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>--introspect=</option></term>
+
+ <listitem><para>Extract D-Bus
+ interface introspection data. This is
+ mostly useful at build at install time
+ to generate data suitable for the
+ D-Bus interfaces
+ repository. Optionally the interface
+ name for the introspection data may be
+ specified. If omitted, the
+ introspection data for all interfaces
+ is dumped.</para></listitem>
+ </varlistentry>
+ <varlistentry>
<term><option>--unit=</option></term>
<listitem><para>Set default unit to
@@ -111,40 +149,35 @@
debugging.</para></listitem>
</varlistentry>
<varlistentry>
- <term><option>--test</option></term>
+ <term><option>--dump-core</option></term>
- <listitem><para>Determine startup
- sequence, dump it and exit. This is an
- option useful for debugging
- only.</para></listitem>
+ <listitem><para>Dump core on crash. This switch has no effect when run as session instance.</para></listitem>
</varlistentry>
<varlistentry>
- <term><option>--dump-configuration-items</option></term>
+ <term><option>--crash-shell</option></term>
- <listitem><para>Dump understood unit
- configuration items. This outputs a
- terse but complete list of
- configuration items understood in unit
- definition files.</para></listitem>
+ <listitem><para>Run shell on crash. This switch has no effect when run as session instance.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--confirm-spawn</option></term>
- <listitem><para>Ask for confirmation when spawning processes.</para></listitem>
+ <listitem><para>Ask for confirmation when spawning processes. This switch has no effect when run as session instance.</para></listitem>
</varlistentry>
<varlistentry>
- <term><option>--introspect=</option></term>
+ <term><option>--show-status</option></term>
- <listitem><para>Extract D-Bus
- interface introspection data. This is
- mostly useful at build at install time
- to generate data suitable for the
- D-Bus interfaces
- repository. Optionally the interface
- name for the introspection data may be
- specified. If omitted, the
- introspection data for all interfaces
- is dumped.</para></listitem>
+ <listitem><para>Show terse service status information while booting. This switch has no effect when run as session instance.</para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>--log-target=</option></term>
+
+ <listitem><para>Set log
+ target. Argument must be one of
+ <option>console</option>,
+ <option>syslog</option>,
+ <option>kmsg</option>,
+ <option>syslog-or-kmsg</option>,
+ <option>null</option>.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--log-level=</option></term>
@@ -163,17 +196,6 @@
<option>debug</option>.</para></listitem>
</varlistentry>
<varlistentry>
- <term><option>--log-target=</option></term>
-
- <listitem><para>Set log
- target. Argument must be one of
- <option>console</option>,
- <option>syslog</option>,
- <option>kmsg</option>,
- <option>syslog-or-kmsg</option>,
- <option>null</option>.</para></listitem>
- </varlistentry>
- <varlistentry>
<term><option>--log-color=</option></term>
<listitem><para>Highlight important
@@ -715,6 +737,87 @@
</refsect1>
<refsect1>
+ <title>Kernel Command Line</title>
+
+ <para>When run as system instance systemd parses a few kernel command line arguments:</para>
+
+ <variablelist>
+ <varlistentry>
+ <term><varname>systemd.unit=</varname></term>
+
+ <listitem><para>Overrides the unit to
+ activate on boot. Defaults to
+ <filename>default.target</filename>. This
+ may be used to temporarily boot into a
+ different boot unit, for example
+ <filename>rescue.target</filename> or
+ <filename>emergency.service</filename>. See
+ <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+ for details about these
+ units.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>systemd.log_target=</varname></term>
+ <term><varname>systemd.log_level=</varname></term>
+ <term><varname>systemd.log_color=</varname></term>
+ <term><varname>systemd.log_location=</varname></term>
+
+ <listitem><para>Controls log output,
+ with the same effect as the
+ <varname>$SYSTEMD_LOG_TARGET</varname>, <varname>$SYSTEMD_LOG_LEVEL</varname>, <varname>$SYSTEMD_LOG_COLOR</varname>, <varname>$SYSTEMD_LOG_LOCATION</varname>
+ environment variables described above.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>systemd.dump_core=</varname></term>
+
+ <listitem><para>Takes a boolean
+ argument. If <option>true</option>
+ systemd dumps core when it
+ crashes. Otherwise no core dump is
+ created. Defaults to
+ <option>true</option>.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>systemd.crash_shell=</varname></term>
+
+ <listitem><para>Takes a boolean
+ argument. If <option>true</option>
+ systemd spawns a shell when it
+ crashes. Otherwise no core dump is
+ created. Defaults to
+ <option>false</option>, for security
+ reasons, as the shell is not protected
+ by any password
+ authentication.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>systemd.crash_chvt=</varname></term>
+
+ <listitem><para>Takes an integer
+ argument. If positive systemd
+ activates the specified virtual
+ terminal when it crashes. Defaults to
+ <literal>-1</literal>.</para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>systemd.show_status=</varname></term>
+
+ <listitem><para>Takes a boolean
+ argument. If <option>true</option>
+ shows terse service status updates on
+ the console during bootup. Defaults to
+ <option>true</option>.</para></listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect1>
+
+ <refsect1>
<title>Sockets and FIFOs</title>
<variablelist>
commit 487393e9f11e4a06d91df03232914bd8c4b3368e
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Jul 7 01:10:27 2010 +0200
main: implement manager configuration file
diff --git a/Makefile.am b/Makefile.am
index fd02db3..cdb5be3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,10 +38,12 @@ systemunitdir=$(rootdir)/lib/systemd/system
AM_CPPFLAGS = \
-include $(top_builddir)/config.h \
+ -DSYSTEM_CONFIG_FILE=\"$(pkgsysconfdir)/system.conf\" \
-DSYSTEM_CONFIG_UNIT_PATH=\"$(pkgsysconfdir)/system\" \
-DSYSTEM_DATA_UNIT_PATH=\"$(systemunitdir)\" \
-DSYSTEM_SYSVINIT_PATH=\"$(SYSTEM_SYSVINIT_PATH)\" \
-DSYSTEM_SYSVRCND_PATH=\"$(SYSTEM_SYSVRCND_PATH)\" \
+ -DSESSION_CONFIG_FILE=\"$(pkgsysconfdir)/session.conf\" \
-DSESSION_CONFIG_UNIT_PATH=\"$(pkgsysconfdir)/session\" \
-DSESSION_DATA_UNIT_PATH=\"$(sessionunitdir)\" \
-DCGROUP_AGENT_PATH=\"$(rootlibexecdir)/systemd-cgroups-agent\" \
@@ -81,6 +83,9 @@ pamlib_LTLIBRARIES = \
pam_systemd.la
endif
+dist_pkgsysconf_DATA = \
+ src/system.conf
+
dist_dbuspolicy_DATA = \
src/org.freedesktop.systemd1.conf
diff --git a/src/conf-parser.h b/src/conf-parser.h
index b3b2915..2797076 100644
--- a/src/conf-parser.h
+++ b/src/conf-parser.h
@@ -53,4 +53,32 @@ int config_parse_path(const char *filename, unsigned line, const char *section,
int config_parse_strv(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata);
int config_parse_path_strv(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata);
+#define DEFINE_CONFIG_PARSE_ENUM(function,name,type,msg) \
+ int function( \
+ const char *filename, \
+ unsigned line, \
+ const char *section, \
+ const char *lvalue, \
+ const char *rvalue, \
+ void *data, \
+ void *userdata) { \
+ \
+ type *i = data, x; \
+ \
+ assert(filename); \
+ assert(lvalue); \
+ assert(rvalue); \
+ assert(data); \
+ \
+ if ((x = name##_from_string(rvalue)) < 0) { \
+ log_error("[%s:%u] " msg ": %s", filename, line, rvalue); \
+ return -EBADMSG; \
+ } \
+ \
+ *i = x; \
+ \
+ return 0; \
+ }
+
+
#endif
diff --git a/src/load-fragment.c b/src/load-fragment.c
index 3c0cccf..591b73d 100644
--- a/src/load-fragment.c
+++ b/src/load-fragment.c
@@ -43,33 +43,6 @@
#define COMMENTS "#;\n"
#define LINE_MAX 4096
-#define DEFINE_CONFIG_PARSE_ENUM(function,name,type,msg) \
- static int function( \
- const char *filename, \
- unsigned line, \
- const char *section, \
- const char *lvalue, \
- const char *rvalue, \
- void *data, \
- void *userdata) { \
- \
- type *i = data, x; \
- \
- assert(filename); \
- assert(lvalue); \
- assert(rvalue); \
- assert(data); \
- \
- if ((x = name##_from_string(rvalue)) < 0) { \
- log_error("[%s:%u] " msg ": %s", filename, line, rvalue); \
- return -EBADMSG; \
- } \
- \
- *i = x; \
- \
- return 0; \
- }
-
static int config_parse_deps(
const char *filename,
unsigned line,
@@ -496,8 +469,8 @@ static int config_parse_usec(
return 0;
}
-DEFINE_CONFIG_PARSE_ENUM(config_parse_service_type, service_type, ServiceType, "Failed to parse service type");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_service_restart, service_restart, ServiceRestart, "Failed to parse service restart specifier");
+static DEFINE_CONFIG_PARSE_ENUM(config_parse_service_type, service_type, ServiceType, "Failed to parse service type");
+static DEFINE_CONFIG_PARSE_ENUM(config_parse_service_restart, service_restart, ServiceRestart, "Failed to parse service restart specifier");
static int config_parse_bindtodevice(
const char *filename,
@@ -528,8 +501,8 @@ static int config_parse_bindtodevice(
return 0;
}
-DEFINE_CONFIG_PARSE_ENUM(config_parse_output, exec_output, ExecOutput, "Failed to parse output specifier");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_input, exec_input, ExecInput, "Failed to parse input specifier");
+static DEFINE_CONFIG_PARSE_ENUM(config_parse_output, exec_output, ExecOutput, "Failed to parse output specifier");
+static DEFINE_CONFIG_PARSE_ENUM(config_parse_input, exec_input, ExecInput, "Failed to parse input specifier");
static int config_parse_facility(
const char *filename,
@@ -725,13 +698,13 @@ static int config_parse_cpu_affinity(
if (!(t = strndup(w, l)))
return -ENOMEM;
+ r = safe_atou(t, &cpu);
+ free(t);
+
if (!(c->cpuset))
if (!(c->cpuset = cpu_set_malloc(&c->cpuset_ncpus)))
return -ENOMEM;
- r = safe_atou(t, &cpu);
- free(t);
-
if (r < 0 || cpu >= c->cpuset_ncpus) {
log_error("[%s:%u] Failed to parse CPU affinity: %s", filename, line, rvalue);
return -EBADMSG;
@@ -973,7 +946,7 @@ static int config_parse_sysv_priority(
return 0;
}
-DEFINE_CONFIG_PARSE_ENUM(config_parse_kill_mode, kill_mode, KillMode, "Failed to parse kill mode");
+static DEFINE_CONFIG_PARSE_ENUM(config_parse_kill_mode, kill_mode, KillMode, "Failed to parse kill mode");
static int config_parse_mount_flags(
const char *filename,
@@ -1234,7 +1207,7 @@ static int config_parse_ip_tos(
return 0;
}
-DEFINE_CONFIG_PARSE_ENUM(config_parse_notify_access, notify_access, NotifyAccess, "Failed to parse notify access specifier");
+static DEFINE_CONFIG_PARSE_ENUM(config_parse_notify_access, notify_access, NotifyAccess, "Failed to parse notify access specifier");
#define FOLLOW_MAX 8
diff --git a/src/main.c b/src/main.c
index df0da0b..a2dc1bc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -42,6 +42,7 @@
#include "load-fragment.h"
#include "fdset.h"
#include "special.h"
+#include "conf-parser.h"
static enum {
ACTION_RUN,
@@ -338,6 +339,169 @@ static int parse_proc_cmdline_word(const char *word) {
return 0;
}
+static int config_parse_level(
+ const char *filename,
+ unsigned line,
+ const char *section,
+ const char *lvalue,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+
+ log_set_max_level_from_string(rvalue);
+ return 0;
+}
+
+static int config_parse_target(
+ const char *filename,
+ unsigned line,
+ const char *section,
+ const char *lvalue,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+
+ log_set_target_from_string(rvalue);
+ return 0;
+}
+
+static int config_parse_color(
+ const char *filename,
+ unsigned line,
+ const char *section,
+ const char *lvalue,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+
+ log_show_color_from_string(rvalue);
+ return 0;
+}
+
+static int config_parse_location(
+ const char *filename,
+ unsigned line,
+ const char *section,
+ const char *lvalue,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+
+ log_show_location_from_string(rvalue);
+ return 0;
+}
+
+static int config_parse_cpu_affinity(
+ const char *filename,
+ unsigned line,
+ const char *section,
+ const char *lvalue,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ char *w;
+ size_t l;
+ char *state;
+ cpu_set_t *c = NULL;
+ unsigned ncpus = 0;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+
+ FOREACH_WORD(w, l, rvalue, state) {
+ char *t;
+ int r;
+ unsigned cpu;
+
+ if (!(t = strndup(w, l)))
+ return -ENOMEM;
+
+ r = safe_atou(t, &cpu);
+ free(t);
+
+ if (!c)
+ if (!(c = cpu_set_malloc(&ncpus)))
+ return -ENOMEM;
+
+ if (r < 0 || cpu >= ncpus) {
+ log_error("[%s:%u] Failed to parse CPU affinity: %s", filename, line, rvalue);
+ CPU_FREE(c);
+ return -EBADMSG;
+ }
+
+ CPU_SET_S(cpu, CPU_ALLOC_SIZE(ncpus), c);
+ }
+
+ if (c) {
+ if (sched_setaffinity(0, CPU_ALLOC_SIZE(ncpus), c) < 0)
+ log_warning("Failed to set CPU affinity: %m");
+
+ CPU_FREE(c);
+ }
+
+ return 0;
+}
+
+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" },
+ { "CrashChVT", config_parse_int, &arg_crash_chvt, "Manager" },
+ { "CPUAffinity", config_parse_cpu_affinity, NULL, "Manager" },
+ { NULL, NULL, NULL, NULL }
+ };
+
+ static const char * const sections[] = {
+ "Manager",
+ NULL
+ };
+
+ FILE *f;
+ const char *fn;
+ int r;
+
+ fn = arg_running_as == MANAGER_SYSTEM ? SYSTEM_CONFIG_FILE : SESSION_CONFIG_FILE;
+
+ if (!(f = fopen(fn, "re"))) {
+ if (errno == ENOENT)
+ return 0;
+
+ log_warning("Failed to open configuration file '%s': %m", fn);
+ return 0;
+ }
+
+ if ((r = config_parse(fn, f, sections, items, false, NULL)) < 0)
+ log_warning("Failed to parse configuration file: %s", strerror(-r));
+
+ fclose(f);
+
+ return 0;
+}
+
static int parse_proc_cmdline(void) {
char *line;
int r;
@@ -694,6 +858,9 @@ int main(int argc, char *argv[]) {
/* If we are init, we can block sigkill. Yay. */
ignore_signals(SIGNALS_IGNORE, -1);
+ if (parse_config_file() < 0)
+ goto finish;
+
if (arg_running_as == MANAGER_SYSTEM)
if (parse_proc_cmdline() < 0)
goto finish;
diff --git a/src/system.conf b/src/system.conf
new file mode 100644
index 0000000..20218d1
--- /dev/null
+++ b/src/system.conf
@@ -0,0 +1,19 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# See system.conf(5) for details
+
+[Manager]
+#LogLevel=info
+#LogTarget=syslog-or-kmsg
+#LogColor=yes
+#LogLocation=no
+#DumpCore=yes
+#CrashShell=no
+#ShowStatus=yes
+#CrashChVT=1
+#CPUAffinity=1 2
commit c846ff4798c4c48d229587297e6df8b593c60c54
Author: Lennart Poettering <lennart at poettering.net>
Date: Wed Jul 7 00:25:41 2010 +0200
main: show welcome message on boot
diff --git a/src/main.c b/src/main.c
index 99bea75..df0da0b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -764,7 +764,8 @@ int main(int argc, char *argv[]) {
log_debug(PACKAGE_STRING " running in %s mode.", manager_running_as_to_string(arg_running_as));
- if (arg_running_as == MANAGER_SYSTEM) {
+ if (arg_running_as == MANAGER_SYSTEM && !serialization) {
+ status_welcome();
modprobe_setup(arg_nomodules);
kmod_setup();
hostname_setup();
diff --git a/src/util.c b/src/util.c
index 4795dbc..774f061 100644
--- a/src/util.c
+++ b/src/util.c
@@ -2651,6 +2651,53 @@ finish:
close_nointr_nofail(fd);
}
+void status_printf(const char *format, ...) {
+ va_list ap;
+
+ assert(format);
+
+ va_start(ap, format);
+ status_vprintf(format, ap);
+ va_end(ap);
+}
+
+void status_welcome(void) {
+
+#if defined(TARGET_FEDORA)
+ char *r;
+
+ if (read_one_line_file("/etc/system-release", &r) < 0)
+ return;
+
+ truncate_nl(r);
+
+ /* This tries to mimic the color magic the old Red Hat sysinit
+ * script did. */
+
+ if (startswith(r, "Red Hat"))
+ status_printf("\tWelcome to \x1B[0;31m%s\x1B[0m!\n", r); /* Red for RHEL */
+ else if (startswith(r, "Fedora"))
+ status_printf("\tWelcome to \x1B[0;34m%s\x1B[0m!\n", r); /* Blue for Fedora */
+ else
+ status_printf("\tWelcome to %s!\n", r);
+
+ free(r);
+
+#elif defined(TARGET_SUSE)
+ char *r;
+
+ if (read_one_line_file("/etc/SuSE-release", &r) < 0)
+ return;
+
+ truncate_nl(r);
+
+ status_printf("\tWelcome to \x1B[0;32m%s\x1B[0m!\n", r); /* Green for SUSE */
+ free(r);
+#else
+#warning "You probably should add a welcome text logic here."
+#endif
+}
+
static const char *const ioprio_class_table[] = {
[IOPRIO_CLASS_NONE] = "none",
[IOPRIO_CLASS_RT] = "realtime",
diff --git a/src/util.h b/src/util.h
index 0465915..65a5e66 100644
--- a/src/util.h
+++ b/src/util.h
@@ -292,6 +292,8 @@ int rm_rf(const char *path, bool only_dirs, bool delete_root);
cpu_set_t* cpu_set_malloc(unsigned *ncpus);
void status_vprintf(const char *format, va_list ap);
+void status_printf(const char *format, ...);
+void status_welcome(void);
const char *ioprio_class_to_string(int i);
int ioprio_class_from_string(const char *s);
More information about the systemd-commits
mailing list