Browse Source

Merge remaining elogind/master root files of the systemd upstream tag 'v220'

Sven Eden 6 years ago
  1. 12
  2. 57
  3. 41
  4. 229
  5. 4
  6. 110
  7. 19


@ -22,6 +22,10 @@
@ -78,7 +82,6 @@
@ -120,7 +123,6 @@
@ -141,10 +143,12 @@
@ -152,7 +156,6 @@
@ -234,6 +237,7 @@
@ -255,6 +259,7 @@
@ -280,3 +285,4 @@ config.log


@ -1,6 +1,10 @@
- 8ch indent, no tabs, except for files in man/ which are 2ch indent,
and still no tabs
- We prefer /* comments */ over // comments, please. This is not C++, after
all. (Yes we know that C99 supports both kinds of comments, but still,
- Don't break code lines too eagerly. We do *not* force line breaks at
80ch, all of today's screens should be much larger than that. But
then again, don't overdo it, ~140ch should be enough really.
@ -117,7 +121,8 @@
no speed benefit, and on calls like printf() "float"s get promoted
to "double"s anyway, so there is no point.
- Do not invoke functions when you allocate variables on the stack. Wrong:
- Do not mix function invocations with variable definitions in one
line. Wrong:
int a = foobar();
@ -142,7 +147,9 @@
- Do not use types like "short". They *never* make sense. Use ints,
longs, long longs, all in unsigned+signed fashion, and the fixed
size types uint32_t and so on, as well as size_t, but nothing else.
size types uint32_t and so on, as well as size_t, but nothing
else. Do not use kernel types like u32 and so on, leave that to the
- Public API calls (i.e. functions exported by our shared libraries)
must be marked "_public_" and need to be prefixed with "sd_". No
@ -239,3 +246,49 @@
2, i.e. stdin, stdout, stderr, should those fds be closed. Given the
special semantics of those fds, it's probably a good idea to avoid
them. F_DUPFD_CLOEXEC with "3" as parameter avoids them.
- When you define a destructor or unref() call for an object, please
accept a NULL object and simply treat this as NOP. This is similar
to how libc free() works, which accepts NULL pointers and becomes a
NOP for them. By following this scheme a lot of if checks can be
removed before invoking your destructor, which makes the code
substantially more readable and robust.
- Related to this: when you define a destructor or unref() call for an
object, please make it return the same type it takes and always
return NULL from it. This allows writing code like this:
p = foobar_unref(p);
which will always work regardless if p is initialized or not, and
guarantees that p is NULL afterwards, all in just one line.
- Use alloca(), but never forget that it is not OK to invoke alloca()
within a loop or within function call parameters. alloca() memory is
released at the end of a function, and not at the end of a {}
block. Thus, if you invoke it in a loop, you keep increasing the
stack pointer without ever releasing memory again. (VLAs have better
behaviour in this case, so consider using them as an alternative.)
Regarding not using alloca() within function parameters, see the
BUGS section of the alloca(3) man page.
- Use memzero() or even better zero() instead of memset(..., 0, ...)
- Instead of using memzero()/memset() to initialize structs allocated
on the stack, please try to use c99 structure initializers. It's
short, prettier and actually even faster at execution. Hence:
struct foobar t = {
.foo = 7,
.bar = "bazz",
instead of:
struct foobar t;
zero(t); = 7; = "bazz";
- When returning a return code from main(), please preferably use
EXIT_FAILURE and EXIT_SUCCESS as defined by libc.


@ -38,9 +38,9 @@ SUBDIRS = . po
# Keep the test-suite.log
# Dirs of external packages
@ -65,8 +65,11 @@ PKTTYAGENT=$(bindir)/pkttyagent
# Our own, non-special dirs
factory_etcdir = $(prefix)/share/factory/etc
factory_pamdir = $(prefix)/share/factory/etc/pam.d
factory_etcdir = $(datadir)/factory/etc
factory_pamdir = $(datadir)/factory/etc/pam.d
@ -131,8 +134,10 @@ AM_CPPFLAGS = \
-DSYSTEM_SHUTDOWN_PATH=\"$(systemshutdowndir)\" \
-DHALT=\"$(HALT)\" \
-DUDEVLIBEXECDIR=\"$(udevlibexecdir)\" \
-DKEXEC=\"$(KEXEC)\" \
-DLIBDIR=\"$(libdir)\" \
-DROOTLIBDIR=\"$(rootlibdir)\" \
-DTEST_DIR=\"$(abs_top_srcdir)/test\" \
-I $(top_srcdir)/src \
-I $(top_builddir)/src/shared \
@ -471,6 +476,12 @@ libelogind_shared_la_SOURCES = \
src/shared/base-filesystem.h \
src/shared/memfd-util.c \
src/shared/memfd-util.h \
src/shared/process-util.c \
src/shared/process-util.h \
src/shared/random-util.c \
src/shared/random-util.h \
src/shared/terminal-util.c \
src/shared/terminal-util.h \
src/shared/uid-range.c \
src/shared/uid-range.h \
src/shared/nss-util.h \
@ -482,7 +493,9 @@ libelogind_shared_la_SOURCES = \
src/shared/import-util.c \
src/shared/import-util.h \
src/shared/sysctl-util.c \
src/shared/sysctl-util.h \
src/shared/hostname-util.h \
nodist_libelogind_shared_la_SOURCES = \
src/shared/errno-from-name.h \
@ -619,7 +632,9 @@ libelogind_internal_la_SOURCES = \
src/systemd/sd-login.h \
src/systemd/sd-id128.h \
src/systemd/sd-daemon.h \
src/systemd/sd-path.h \
src/systemd/sd-network.h \
src/systemd/sd-hwdb.h \
src/systemd/sd-device.h \
src/libelogind/sd-bus/sd-bus.c \
src/libelogind/sd-bus/bus-control.c \
@ -678,11 +693,17 @@ libelogind_internal_la_SOURCES = \
src/libelogind/sd-id128/sd-id128.c \
src/libelogind/sd-daemon/sd-daemon.c \
src/libelogind/sd-login/sd-login.c \
src/libelogind/sd-path/sd-path.c \
src/libelogind/sd-network/sd-network.c \
src/libelogind/sd-network/network-util.h \
src/libelogind/sd-network/network-util.c \
src/libelogind/sd-hwdb/sd-hwdb.c \
src/libelogind/sd-hwdb/hwdb-util.h \
src/libelogind/sd-hwdb/hwdb-internal.h \
src/libelogind/sd-device/device-internal.h \
src/libelogind/sd-device/device-util.h \
src/libelogind/sd-device/device-enumerator.c \
src/libelogind/sd-device/device-enumerator-private.h \
src/libelogind/sd-device/sd-device.c \
src/libelogind/sd-device/device-private.c \
@ -694,10 +715,6 @@ libelogind_internal_la_CFLAGS = \
libelogind_internal_la_LIBADD = \
@ -735,12 +752,8 @@ EXTRA_DIST += \
src/libelogind/sd-bus/DIFFERENCES \
# ------------------------------------------------------------------------------
elogind_SOURCES = \


@ -1,5 +1,234 @@
systemd System and Service Manager
* The gudev library has been extracted into a separate repository
available at:
It is now managed as part of the Gnome project. Distributions
are recommended to pass --disable-gudev to systemd and use
gudev from the Gnome project instead. gudev is still included
in systemd, for now. It will be removed soon, though. Please
also see the announcement-thread on systemd-devel:
* systemd now exposes a CPUUsageNSec= property for each
service unit on the bus, that contains the overall consumed
CPU time of a service (the sum of what each process of the
service consumed). This value is only available if
CPUAccounting= is turned on for a service, and is then shown
in the "systemctl status" output.
* Support for configuring alternative mappings of the old SysV
runlevels to systemd targets has been removed. They are now
hardcoded in a way that runlevels 2, 3, 4 all map to and 5 to (which
previously was already the default behaviour).
* The auto-mounter logic gained support for mount point
expiry, using a new TimeoutIdleSec= setting in .automount
units. (Also available as x-systemd.idle-timeout= in /etc/fstab).
* The EFI System Partition (ESP) as mounted to /boot by
systemd-efi-boot-generator will now be unmounted
automatically after 2 minutes of not being used. This should
minimize the risk of ESP corruptions.
* New /etc/fstab options x-systemd.requires= and
x-systemd.requires-mounts-for= are now supported to express
additional dependencies for mounts. This is useful for
journalling file systems that support external journal
devices or overlay file systems that require underlying file
systems to be mounted.
* systemd does not support direct live-upgrades (via systemctl
daemon-reexec) from versions older than v44 anymore. As no
distribution we are aware of shipped such old versions in a
stable release this should not be problematic.
* When systemd forks off a new per-connection service instance
it will now set the $REMOTE_ADDR environment variable to the
remote IP address, and $REMOTE_PORT environment variable to
the remote IP port. This behaviour is similar to the
corresponding environment variables defined by CGI.
* systemd-networkd gained support for uplink failure
detection. The BindCarrier= option allows binding interface
configuration dynamically to the link sense of other
interfaces. This is useful to achieve behaviour like in
network switches.
* systemd-networkd gained support for configuring the DHCP
client identifier to use when requesting leases.
* systemd-networkd now has a per-network UseNTP= option to
configure whether NTP server information acquired via DHCP
is passed on to services like systemd-timesyncd.
* systemd-networkd gained support for vti6 tunnels.
* Note that systemd-networkd manages the sysctl variable
/proc/sys/net/ipv[46]/conf/*/forwarding for each interface
it is configured for since v219. The variable controls IP
forwarding, and is a per-interface alternative to the global
/proc/sys/net/ipv[46]/ip_forward. This setting is
configurable in the IPForward= option, which defaults to
"no". This means if networkd is used for an interface it is
no longer sufficient to set the global sysctl option to turn
on IP forwarding! Instead, the .network file option
IPForward= needs to be turned on! Note that the
implementation of this behaviour was broken in v219 and has
been fixed in v220.
* Many bonding and vxlan options are now configurable in
* systemd-nspawn gained a new --property= setting to set unit
properties for the container scope. This is useful for
setting resource parameters (e.g "CPUShares=500") on
containers started from the command line.
* systemd-nspawn gained a new --private-users= switch to make
use of user namespacing available on recent Linux kernels.
* systemd-nspawn may now be called as part of a shell pipeline
in which case the pipes used for stdin and stdout are passed
directly to the process invoked in the container, without
indirection via a pseudo tty.
* systemd-nspawn gained a new switch to control the UNIX
signal to use when killing the init process of the container
when shutting down.
* systemd-nspawn gained a new --overlay= switch for mounting
overlay file systems into the container using the new kernel
overlayfs support.
* When a container image is imported via systemd-importd and
the host file system is not btrfs, a loopback block device
file is created in /var/lib/machines.raw with a btrfs file
system inside. It is then mounted to /var/lib/machines to
enable btrfs features for container management. The loopback
file and btrfs file system is grown as needed when container
images are imported via systemd-importd.
* systemd-machined/systemd-importd gained support for btrfs
quota, to enforce container disk space limits on disk. This
is exposed in "machinectl set-limit".
* systemd-importd now can import containers from local .tar,
.raw and .qcow2 images, and export them to .tar and .raw. It
can also import dkr v2 images now from the network (on top
of v1 as before).
* systemd-importd gained support for verifying downloaded
images with gpg2 (previously only gpg1 was supported).
* systemd-machined, systemd-logind, systemd: most bus calls
are now accessible to unprivileged processes via
PolicyKit. Also, systemd-logind will now allow users to kill
their own sessions without further privileges or
* systemd-shutdownd has been removed. This service was
previously responsible for implementing scheduled shutdowns
as exposed in /usr/bin/shutdown's time parameter. This
functionality has now been moved into systemd-logind and is
accessible via a bus interface.
* "systemctl reboot" gained a new switch --firmware-setup that
can be used to reboot into the EFI firmware setup, if that
is available. systemd-logind now exposes an API on the bus
to trigger such reboots, in case graphical desktop UIs want
to cover this functionality.
* "systemctl enable", "systemctl disable" and "systemctl mask"
now support a new "--now" switch. If specified the units
that are enabled will also be started, and the ones
disabled/masked also stopped.
* The Gummiboot EFI boot loader tool has been merged into
systemd, and renamed to "systemd-boot". The bootctl tool has been
updated to support systemd-boot.
* An EFI kernel stub has been added that may be used to create
kernel EFI binaries that contain not only the actual kernel,
but also an initrd, boot splash, command line and OS release
information. This combined binary can then be signed as a
single image, so that the firmware can verify it all in one
step. systemd-boot has special support for EFI binaries created
like this and can extract OS release information from them
and show them in the boot menu. This functionality is useful
to implement cryptographically verified boot schemes.
* Optional support has been added to systemd-fsck to pass
fsck's progress report to an AF_UNIX socket in the file
* udev will no longer create device symlinks for all block
devices by default. A blacklist for excluding special block
devices from this logic has been turned into a whitelist
that requires picking block devices explicitly that require
device symlinks.
* A new (currently still internal) API sd-device.h has been
added to libsystemd. This modernized API is supposed to
replace libudev eventually. In fact, already much of libudev
is now just a wrapper around sd-device.h.
* A new hwdb database for storing metadata about pointing
stick devices has been added.
* systemd-tmpfiles gained support for setting file attributes
similar to the "chattr" tool with new 'h' and 'H' lines.
* systemd-journald will no longer unconditionally set the
btrfs NOCOW flag on new journal files. This is instead done
with tmpfiles snippet using the new 'h' line type. This
allows easy disabling of this logic, by masking the
journal-nocow.conf tmpfiles file.
* systemd-journald will now translate audit message types to
human readable identifiers when writing them to the
journal. This should improve readability of audit messages.
* The LUKS logic gained support for the offset= and skip=
options in /etc/crypttab, as previously implemented by
* /usr/lib/os-release gained a new optional field VARIANT= for
distributions that support multiple variants (such as a
desktop edition, a server edition, ...)
Contributions from: Aaro Koskinen, Adam Goode, Alban Crequy,
Alberto Fanjul Alonso, Alexander Sverdlin, Alex Puchades, Alin
Rauta, Alison Chaiken, Andrew Jones, Arend van Spriel,
Benedikt Morbach, Benjamin Franzke, Benjamin Tissoires, Blaž
Tomažič, Chris Morgan, Chris Morin, Colin Walters, Cristian
Rodríguez, Daniel Buch, Daniel Drake, Daniele Medri, Daniel
Mack, Daniel Mustieles, daurnimator, Davide Bettio, David
Herrmann, David Strauss, Didier Roche, Dimitri John Ledkov,
Eric Cook, Gavin Li, Goffredo Baroncelli, Hannes Reinecke,
Hans de Goede, Hans-Peter Deifel, Harald Hoyer, Iago López
Galeiras, Ivan Shapovalov, Jan Engelhardt, Jan Janssen, Jan
Pazdziora, Jan Synacek, Jasper St. Pierre, Jay Faulkner, John
Paul Adrian Glaubitz, Jonathon Gilbert, Karel Zak, Kay
Sievers, Koen Kooi, Lennart Poettering, Lubomir Rintel, Lucas
De Marchi, Lukas Nykryn, Lukas Rusak, Lukasz Skalski, Łukasz
Stelmach, Mantas Mikulėnas, Marc-Antoine Perennou, Marcel
Holtmann, Martin Pitt, Mathieu Chevrier, Matthew Garrett,
Michael Biebl, Michael Marineau, Michael Olbrich, Michal
Schmidt, Michal Sekletar, Mirco Tischler, Nir Soffer, Patrik
Flykt, Pavel Odvody, Peter Hutterer, Peter Lemenkov, Peter
Waller, Piotr Drąg, Raul Gutierrez S, Richard Maw, Ronny
Chevalier, Ross Burton, Sebastian Rasmussen, Sergey Ptashnick,
Seth Jennings, Shawn Landden, Simon Farnsworth, Stefan Junker,
Stephen Gallagher, Susant Sahani, Sylvain Plantefève, Thomas
Haller, Thomas Hindoe Paaboel Andersen, Tobias Hunger, Tom
Gundersen, Torstein Husebø, Umut Tezduyar Lindskog, Will
Woods, Zachary Cook, Zbigniew Jędrzejewski-Szmek
-- Berlin, 2015-05-??
* Introduce a new API "sd-hwdb.h" for querying the hardware


@ -29,7 +29,7 @@ provide a subset of the interfaces of systemd 219.
To contribute to elogind, fork the current source code from github:
Send a pull request for the changes you like.
@ -39,7 +39,7 @@ To chat about elogind:
Finally, bug reports:
Why bother?


@ -12,10 +12,6 @@ Bugfixes:
Environment=ONE='one' "TWO='two two' too" THREE=
ExecStart=/bin/python3 -c 'import sys;print(sys.argv)' $ONE $TWO $THREE
* MEMORY return code is overloaded for syntax errors in the command line.
str_split_quoted() should return a real return code, so spawn_child can
report the failure properly.
* When systemctl --host is used, underlying ssh connection can remain open.
bus_close does not kill children?
@ -23,46 +19,93 @@ External:
* Fedora: add an rpmlint check that verifies that all unit files in the RPM are listed in %systemd_post macros.
* Fedora: move kernel image to /usr/lib/modules/, kernel-install will take care of populating /boot
* Fedora: remove /etc/resolv.conf tmpfiles hack
* wiki: update journal format documentation for lz4 additions
* When lz4 gets an API for lz4 command output, make use of it to
compress coredumps in a way compatible with /usr/bin/lz4.
Before 220:
* introduce an NSS module that uses machined info to give container UIDs pretty names when user namespacing is used.
* rework fsckd/fsck's connection logic or remove fsck entirely
* stop using off_t, it's a crazy type. Use uint64_t instead.
* fix userns support in nspawn, or remove it entirely
* logind: follow PropertiesChanged state more closely, to deal with quick logouts and relogins
* make unmount-on-eject work again
* change to KillMode=mixed by default
* bus-proxy: GetConnectionSELinuxSecurityContext() is completely broken
* introduce argv0contains=
* logind: make sure the syncrhonous polkit checks are not interactive, i.e. supporess client side interactive bus message header flag for them
* invent a better systemd-run scheme for naming scopes, that works with remoting
* timer units triggering services with failing conditions run busy:
* add journalctl -H that talks via ssh to a remote peer and passes through binary logs data
* change journalctl -M to acquire fd to journal directory via machined, and then operate on that via openat() instead of absolute paths
* the default stop timeout for units is not documented anywhere.
* add a version of --merge which also merges /var/log/journal/remote
* .timer units should optionally support CLOCK_BOOTTIME in addition to CLOCK_MONOTONIC
* log accumulated resource usage after each service invocation
* networkd: dhcp server: try to assign stable IP addresses based on client's MAC address
* nspawn: a nice way to boot up without machine id set, so that it is set at boot automatically for supporting --ephemeral. Maybe hash the host machine id together with the machine name to generate the machine id for the container
* logind: rename session scope so that it includes the UID. THat way
the session scope can be arranged freely in slices and we don't have
make assumptions about their slice anymore.
* journalctl: -m should access container journals directly by enumerating them via machined, and also watch containers coming and going. Benefit: nspawn --ephemeral would start working nicely with the journal.
* nspawn: don't copy /etc/resolv.conf from host into container unless we are in shared-network mode
* nspawn: optionally automatically add FORWARD rules to iptables whenever nspawn is running, remove them when shut down.
* importd: generate a nice warning if mkfs.btrfs is missing
* nspawn: add a logic for cleaning up read-only, hidden container images in /var/lib/machines that are not ancestors of any non-hidden containers
* nspawn: Improve error message when --bind= is used on a non-existing source directory
* rm_rf() should be able to remove subvolumes
* nspawn: maybe make copying of /etc/resolv.conf optional, and skip it if --read-only is used
* systemd-run should support a mode where we wait for the unit to be started up
* man: document how update dkr images works with machinectl
* nspawn: as soon as networkd has a bus interface, hook up --network-interface=, --network-bridge= with networkd, to trigger netdev creation should an interface be missing
* networkd: make DHCP server IP range configurable, including only with a single IP address
* rework C11 utf8.[ch] to use char32_t instead of uint32_t when referring
to unicode chars, to make things more expressive.
* "machinectl migrate" or similar to copy a container from or to a
difference host, via ssh
* tmpfiles: creating new directories/subvolumes/fifos/device nodes
should not follow symlinks. None of the other adjustment or creation
calls follow symlinks.
* fstab-generator: default to tmpfs-as-root if only usr= is specified on the kernel cmdline
* docs: bring up to date
* mounting and unmounting mount points manually with different source
devices will result in collected collected on all devices used.
* add a job mode that will fail if a transaction would mean stopping
running units. Use this in timedated to manage the NTP service
* Maybe add support for the equivalent of "ethtool advertise" to .link files?
* .timer units should optionally support CLOCK_BOOTTIME in addition to CLOCK_MONOTONIC
* create a btrfs qgroup for /var/lib/machines, and add all container
subvolumes we create to it.
* nspawn: add --overlay= to support overlay file systems, similar to
--tmpfs= and --bind=.
* When logging about multiple units (stopping BoundTo units, conflicts, etc.),
log both units as UNIT=, so that journalctl -u triggers on both.
@ -85,15 +128,9 @@ Features:
that are not supported...
* PID 1: when invoking systemctl preset-all on first boots, operate in
an exclusively additive way, i.e. never remove any pre-existing
symlinks, only add new ones.
* Introduce $LISTEN_NAMES to complement $LISTEN_FDS, containing a
colon separated list of identifiers for the fds passed.
* when the fstab-generator runs in the initrd, it should create a /dev/null mask for systemd-fsck-root.service, to avoid that the the root fs is fsck'ed twice.
* maybe introduce WantsMountsFor=? Usecase:
@ -125,7 +162,7 @@ Features:
* logind: maybe allow configuration of the StopTimeout for session scopes
* Set NoNewPriviliges= on all of our own services, where that makes sense
* Set NoNewPrivileges= on all of our own services, where that makes sense
* Rework systemctl's GetAll property parsing to use the generic bus_map_all_properties() API
@ -700,17 +737,6 @@ Features:
* when breaking cycles drop sysv services first, then services from /run, then from /etc, then from /usr
* automount: implement expire:
- set superblock timeout AUTOFS_DEV_IOCTL_TIMEOUT_CMD
- periodically run AUTOFS_DEV_IOCTL_EXPIRE_CMD
- every timeout/4 (original autofs logic)
- blocking, needs a thread
- run until -EAGAIN
- receive expire packet on pipe if kernel tells the timeout is over
- call umount
- answer expire packet on pipe with AUTOFS_DEV_IOCTL_{READY,FAIL}_CMD
* ExecOnFailure=/usr/bin/foo
* udev:


@ -1,15 +1,15 @@
# This file is part of systemd.
# This file is part of elogind.
# Copyright 2010-2012 Lennart Poettering
# Copyright 2010-2012 Kay Sievers
# systemd is free software; you can redistribute it and/or modify it
# elogind is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
# systemd is distributed in the hope that it will be useful, but
# elogind is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# Lesser General Public License for more details.
@ -20,10 +20,10 @@
[], [], [[
#include <inttypes.h>
#include <netinet/in.h>
@ -303,7 +304,7 @@ AM_CONDITIONAL(HAVE_DBUS, [test "$have_dbus" = "yes"])
# ------------------------------------------------------------------------------
AS_HELP_STRING([--with-udevrulesdir=DIR], [Directory for udev rules files]),
@ -484,7 +485,7 @@ fi
[run systemd --system with a specific SMACK label]),
[run elogind --system with a specific SMACK label]),
[AC_DEFINE_UNQUOTED(SMACK_RUN_LABEL, ["$withval"], [Run with a smack label])],