Lennart Poettering [Thu, 10 Oct 2013 02:40:28 +0000 (04:40 +0200)]
bus: add minimal event loop API
So far we tried to use epoll directly wherever we needed an event loop.
However, that has various shortcomings, such as the inability to handle
larger amounts of timers (since each timerfd costs one fd, which is a
very limited resource, usually bounded to 1024), and inability to do
priorisation between multiple queued events.
Let's add a minimal event loop API around epoll that is suitable for
implementation of our own daemons and maybe one day can become public
API for those who desire it.
This loop is part of libsystemd-bus, but may be used independently of
it.
Zbigniew Jędrzejewski-Szmek [Thu, 10 Oct 2013 02:13:13 +0000 (22:13 -0400)]
journald: remove rotated file from hashmap when rotation fails
Before, when the user journal file was rotated, journal_file_rotate
could close the old file and fail to open the new file. In that
case, we would leave the old (deallocated) file in the hashmap.
On subsequent accesses, we could retrieve this stale entry, leading
to a segfault.
When journal_file_rotate fails with the file pointer set to 0,
old file is certainly gone, and cannot be used anymore.
https://bugzilla.redhat.com/show_bug.cgi?id=890463
Zbigniew Jędrzejewski-Szmek [Thu, 10 Oct 2013 02:13:04 +0000 (22:13 -0400)]
journald: replace new+snprintf with asprintf
Kay Sievers [Wed, 9 Oct 2013 23:38:11 +0000 (01:38 +0200)]
do not accept "garbage" from acpi firmware performance data (FPDT)
00000000 46 42 50 54 38 00 00 00 02 00 30 02 00 00 00 00 |FBPT8.....0.....|
00000010 23 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |#E..............|
00000020 f5 6a 51 00 00 00 00 00 00 00 00 00 00 00 00 00 |.jQ.............|
00000030 00 00 00 00 00 00 00 00 70 74 61 6c 58 00 00 00 |........ptalX...|
Auke Kok [Wed, 9 Oct 2013 17:52:15 +0000 (10:52 -0700)]
Smack: Test if smack is enabled before mounting
Since on most systems with xattr systemd will compile with Smack
support enabled, we still attempt to mount various fs's with
Smack-only options.
Before mounting any of these Smack-related filesystems with
Smack specific mount options, check if Smack is functionally
active on the running kernel.
If Smack is really enabled in the kernel, all these Smack mounts
are now *fatal*, as they should be.
We no longer mount smackfs if systemd was compiled without
Smack support. This makes it easier to make smackfs mount
failures a critical error when Smack is enabled.
We no longer mount these filesystems with their Smack specific
options inside containers. There these filesystems will be
mounted with there non-mount smack options for now.
Kay Sievers [Wed, 9 Oct 2013 15:31:00 +0000 (17:31 +0200)]
udev: add SECLABEL{selinux}= support
Martin Pitt [Wed, 9 Oct 2013 14:05:15 +0000 (16:05 +0200)]
keymap: Fix Samsung 900X[34]C
It appears that it's not really the 900 vs. 940 or the X3 vs X4, but the
A/B/C/D suffix after that which makes the difference between the keymaps. On a
NP900X3C-A04RU you get
MODALIAS=dmi:bvn*:bvr*:bd*:svnSAMSUNGELECTRONICSCO.,LTD.:pn900X3C/900X3D/900X4C/900X4D:*
So change the matches to use AB vs. CDG as the differentiator.
Thanks to Anatoly Markov for reporting and testing!
Kay Sievers [Wed, 9 Oct 2013 02:17:39 +0000 (04:17 +0200)]
udev: reset Linux Security Module labels if no custom rules are given
Lennart Poettering [Wed, 9 Oct 2013 02:04:10 +0000 (04:04 +0200)]
bus: fix missing initialization
Lennart Poettering [Wed, 9 Oct 2013 02:04:04 +0000 (04:04 +0200)]
tests: fix some memory leaks in tests
Lennart Poettering [Wed, 9 Oct 2013 02:03:45 +0000 (04:03 +0200)]
journald: fix minor memory leak
Lennart Poettering [Wed, 9 Oct 2013 02:02:54 +0000 (04:02 +0200)]
build-sys: add a makefile target to run all tests through valgrind
Kay Sievers [Wed, 9 Oct 2013 01:39:57 +0000 (03:39 +0200)]
build-sys: add sd-bus-vtable.h header
Lennart Poettering [Wed, 9 Oct 2013 01:28:59 +0000 (03:28 +0200)]
bus: fix GetAll() userdata passing
Lennart Poettering [Wed, 9 Oct 2013 01:27:22 +0000 (03:27 +0200)]
bus: don't require that if a child object node exists its parent node must too
Lennart Poettering [Wed, 9 Oct 2013 01:26:34 +0000 (03:26 +0200)]
bus: fix synthetic error messages
Lennart Poettering [Wed, 9 Oct 2013 00:37:10 +0000 (02:37 +0200)]
libsystemd-bus: add lightweight object vtable implementation for exposing objects on the bus
This adds a lightweight scheme how to define interfaces in static fixed
arrays which then can be easily registered on a bus connection. This
makes it much easier to write bus services.
This automatically handles implementation of the Properties,
ObjectManager, and Introspection bus interfaces.
Lennart Poettering [Tue, 8 Oct 2013 22:13:55 +0000 (00:13 +0200)]
core: unify the way we denote serialization attributes
Sylvia Else [Mon, 7 Oct 2013 03:06:35 +0000 (23:06 -0400)]
systemd: serialize/deserialize forbid_restart value
The Service type's forbid_restart field was not preserved by
serialization/deserialization, so the fact that the service should not
be restarted after stopping was lost.
If a systemctl stop foo command has been given, but the foo service
has not yet stopped, and then the systemctl --system daemon-reload was
given, then when the foo service eventually stopped, systemd would
restart it.
https://bugs.freedesktop.org/show_bug.cgi?id=69800
Zbigniew Jędrzejewski-Szmek [Mon, 7 Oct 2013 01:55:18 +0000 (21:55 -0400)]
journalctl: flip to --full by default
We already shew lines in full when using a pager or not on a
tty. The commit disables ellipsization in the sole remaining case,
namely when --follow is used.
This has been a popular request for a long time, and indeed, full
output seems much more useful. Old behaviour can still be requested by
using --no-full. Old options retain their behaviour for compatiblity,
but aren't advertised as much. This change applies only to jornalctl,
not to systemctl, when ellipsization is useful to keep the layout.
https://bugzilla.redhat.com/show_bug.cgi?id=984758
Kay Sievers [Mon, 7 Oct 2013 23:59:10 +0000 (01:59 +0200)]
udev: support custom Linux Security Module labels for device nodes
Auke Kok [Wed, 25 Sep 2013 22:49:42 +0000 (15:49 -0700)]
Run with a custom SMACK domain (label).
Allows the systemd --system process to change its current
SMACK label to a predefined custom label (usually "system")
at boot time.
This is needed to have a few system-generated folders and
sockets automatically be created with the right SMACK
label. Without that, processes either cannot communicate with
systemd or systemd fails to perform some actions.
Auke Kok [Thu, 26 Sep 2013 21:41:09 +0000 (14:41 -0700)]
Mount /run, /dev/shm usable to tasks when using SMACK.
Once systemd itself is running in a security domain for SMACK,
it will fail to start countless tasks due to missing privileges
for mounted and created directory structures. For /run and shm
specifically, we grant all tasks access.
These 2 mounts are allowed to fail, which will happen if the
system is not running a SMACK enabled kernel or security=none is
passed to the kernel.
Dave Reisner [Sun, 6 Oct 2013 22:26:23 +0000 (18:26 -0400)]
shared/util: fix off-by-one error in tag_to_udev_node
Triggered false negatives when encoding a string which needed every
character to be escaped, e.g. "LABEL=/".
Zbigniew Jędrzejewski-Szmek [Sun, 6 Oct 2013 02:47:52 +0000 (22:47 -0400)]
utf8: fix utf8_is_printable
Zbigniew Jędrzejewski-Szmek [Sat, 5 Oct 2013 17:09:43 +0000 (13:09 -0400)]
core: do not add "what" to RequiresMountsFor for network mounts
For cifs mount like //server/share, we would get
RequiresMountsFor=/server/share, which probably isn't
harmful, but quite confusing.
Unfortunately a bunch of static functions had to be moved
up, but patch is really one line.
Dave Reisner [Fri, 4 Oct 2013 22:22:40 +0000 (18:22 -0400)]
mount: check for NULL before reading pm->what
Since
a57f7e2c828b85, a mount unit with garbage in it would cause
systemd to crash on loading it.
ref: https://bugs.freedesktop.org/show_bug.cgi?id=70148
Lennart Poettering [Fri, 4 Oct 2013 19:16:40 +0000 (21:16 +0200)]
logind: fix bus introspection data for TakeControl()
Lennart Poettering [Fri, 4 Oct 2013 15:01:37 +0000 (17:01 +0200)]
manager: when verifying whether clients may change environment using selinux check for "reload" rather "reboot"
This appears to be a copy/paste error.
Lennart Poettering [Fri, 4 Oct 2013 15:01:32 +0000 (17:01 +0200)]
update TODO
Zbigniew Jędrzejewski-Szmek [Fri, 4 Oct 2013 02:15:08 +0000 (22:15 -0400)]
systemd: order remote mounts from mountinfo before remote-fs.target
Usually the network is stopped before filesystems are umounted.
Ordering network filesystems before remote-fs.target means that their
unmounting will be performed earlier, and can terminate sucessfully.
https://bugs.freedesktop.org/show_bug.cgi?id=70002
Zbigniew Jędrzejewski-Szmek [Fri, 4 Oct 2013 02:13:55 +0000 (22:13 -0400)]
Introduce _cleanup_endmntent_
Zbigniew Jędrzejewski-Szmek [Fri, 4 Oct 2013 02:13:01 +0000 (22:13 -0400)]
gpt-auto-generator: exit immediately if in container
Otherwise we get an ugly warning when running systemd in
a container.
Zbigniew Jędrzejewski-Szmek [Wed, 28 Aug 2013 12:01:30 +0000 (08:01 -0400)]
execute: more debugging messages
Václav Pavlín [Thu, 3 Oct 2013 13:47:26 +0000 (15:47 +0200)]
man: Improve the description of parameter X in tmpfiles.d page
Zbigniew Jędrzejewski-Szmek [Wed, 2 Oct 2013 11:23:10 +0000 (13:23 +0200)]
execute.c: always set $SHELL
In e6dca81 $SHELL was added to user@.service. Let's
instead provide it to all units which have a user.
Dave Reisner [Wed, 2 Oct 2013 19:35:16 +0000 (15:35 -0400)]
tmpfiles.d: include setgid perms for /run/log/journal
4608af4333d0f7f5 set permissions for journal storage on persistent disk
but not the volatile storage.
ref: https://bugs.archlinux.org/task/37170
Lennart Poettering [Wed, 2 Oct 2013 17:40:43 +0000 (19:40 +0200)]
nspawn: always copy /etc/resolv.conf rather than bind mount
We were already creating the file if it was missing, and this way
containers can reconfigure the file without running into problems.
This also makes resolv.conf handling more alike to handling of
/etc/localtime, which is also not a bind mount.
Lennart Poettering [Wed, 2 Oct 2013 17:38:52 +0000 (19:38 +0200)]
mkdir: pass a proper function pointer to mkdir_safe_internal
Lennart Poettering [Wed, 2 Oct 2013 17:38:28 +0000 (19:38 +0200)]
strv: don't access potentially NULL string arrays
Lennart Poettering [Wed, 2 Oct 2013 17:38:09 +0000 (19:38 +0200)]
efi: never call qsort on potentially NULL arrays
Lennart Poettering [Wed, 2 Oct 2013 17:37:44 +0000 (19:37 +0200)]
modules-load: fix error handling
Lennart Poettering [Wed, 2 Oct 2013 17:37:30 +0000 (19:37 +0200)]
dbus: fix return value of dispatch_rqueue()
Lennart Poettering [Wed, 2 Oct 2013 17:37:11 +0000 (19:37 +0200)]
bus: fix potentially uninitialized memory access
Lennart Poettering [Wed, 2 Oct 2013 17:36:43 +0000 (19:36 +0200)]
journald: add missing error check
Lennart Poettering [Wed, 2 Oct 2013 17:36:28 +0000 (19:36 +0200)]
cryptsetup: fix OOM handling when parsing mount options
Václav Pavlín [Wed, 2 Oct 2013 14:42:42 +0000 (16:42 +0200)]
systemctl: fix name mangling for sysv units
Lennart Poettering [Wed, 2 Oct 2013 12:03:56 +0000 (14:03 +0200)]
acpi: make sure we never free an uninitialized pointer
Dave Reisner [Wed, 2 Oct 2013 11:46:24 +0000 (07:46 -0400)]
fix lingering references to /var/lib/{backlight,random-seed}
This should have been part of
ef5bfcf668e6029faa78534dfe.
Lukas Nykryn [Wed, 2 Oct 2013 11:39:49 +0000 (13:39 +0200)]
acpi-fptd: fix memory leak in acpi_get_boot_usec
Lennart Poettering [Wed, 2 Oct 2013 02:54:07 +0000 (04:54 +0200)]
cgroup: there's no point in labelling cgroupfs dirs, so let's not do that
This allows us to get rid of the dep on libsystemd-label for cgroup
management.
https://bugs.freedesktop.org/show_bug.cgi?id=69966
Lennart Poettering [Wed, 2 Oct 2013 02:52:48 +0000 (04:52 +0200)]
build-sys: mkdir.[ch] should be in libsystemd-shared
Otherwise, why is mkdir-label.[ch] split out?
Lennart Poettering [Wed, 2 Oct 2013 01:02:25 +0000 (03:02 +0200)]
build-ss: prepare new release
Lennart Poettering [Tue, 1 Oct 2013 21:11:23 +0000 (23:11 +0200)]
hashmap: randomize hash functions a bit
David Herrmann [Tue, 1 Oct 2013 17:21:35 +0000 (19:21 +0200)]
Update TODO
Remove "logind fbdev removal" as it is no longer supported.
David Herrmann [Tue, 1 Oct 2013 16:08:54 +0000 (18:08 +0200)]
logind: remove fbdev session-device support
fbdev does not support access-handover so it is quite useless to route it
through logind. If compositors want to use it they ought to open it
themselves. It's highly recommended to be ignored entirely, though. fbdev
is about to be deprecated in the kernel.
David Herrmann [Tue, 1 Oct 2013 15:59:44 +0000 (17:59 +0200)]
logind: run with CAP_SYS_ADMIN
DRM Master access requires CAP_SYS_ADMIN, yay! Add it to the capability
bounding set for systemd-logind. As CAP_SYS_ADMIN actually allows a huge
set of actions, this mostly renders the restriction-set useless. Anyway,
patches are already pending to reduce the restriction on the kernel side.
But these won't really make it into any stable-release so for now we're
stuck with CAP_SYS_ADMIN.
David Herrmann [Tue, 1 Oct 2013 15:58:58 +0000 (17:58 +0200)]
logind: send PropertyChanged during deactivation
We only send the PropertyChanged signal for the to-be-activated session
but not for the to-be-deactivated one. Fix that so both listeners get
notified about the new state.
David Herrmann [Tue, 1 Oct 2013 15:53:43 +0000 (17:53 +0200)]
logind: check whether first drmSetMaster succeeded
The initial drmSetMaster may fail if there is an active master already. We
must not assume that all existing clients comply to logind rules. We check
for this during session-activation already but didn't during device setup.
Fix this by checking the return code.
As drmSetMaster has had horrible return codes in the past (0 for failure?
EINVAL for denied access, ..) we need to be quite pedantic. To guarantee
an open file-descriptor we need to close the device and reopen it without
master if setting master failed first.
David Herrmann [Tue, 1 Oct 2013 15:48:15 +0000 (17:48 +0200)]
logind: fix session-device dbus notify
Had this fix lying around here for some time. Thanks to missing
type-checking for va-args we passed in the actual major/minor values
instead of pointers to it. Fix it by saving the values on the stack first
and passing in the pointers.
Tom Gundersen [Wed, 25 Sep 2013 22:38:34 +0000 (00:38 +0200)]
kernel-install: add compat with 'installkernel'
If 'kernel-install' is called as 'installkernel' it will be compatible with the
syntax used by the kernel's build system.
This means it can be called by doing 'make install' in a kernel build
directory, if the correct symlink has been installed (which we don't do by
default yet).
[Edit harald@redhat.com: removed basename and use shift]
Lennart Poettering [Tue, 1 Oct 2013 11:35:37 +0000 (13:35 +0200)]
update TODO
Lennart Poettering [Tue, 1 Oct 2013 03:06:56 +0000 (05:06 +0200)]
core: whenever a new PID is passed to us, make sure we watch it
Chen Jie [Thu, 12 Sep 2013 01:21:41 +0000 (09:21 +0800)]
util.c: ignore pollfd.revent for loop_read/loop_write
Let read()/write() report any error/EOF.
Evan Callicoat [Tue, 24 Sep 2013 02:01:04 +0000 (21:01 -0500)]
units: Add SHELL environment variable
With the advent of systemd --user sessions, it's become very interesting to spawn X as a user unit, as well as accompanying processes that may have previously been in a .xinitrc/.xsession, or even just to replace a collection of XDG/GDM/KDM/etc session files with independent systemd --user units. The simplest case here would be to login on a tty, with the traditional /usr/sbin/login "login manager".
However, systemd --user (spawned by user@.service) is at the top level of the slice for the user, and does not inherit any environment variables from the login process. Given the number of common applications which rely on SHELL being set in the environment, it seems like the cleanest way to provide this variable is to set it to %s in the user@.service.
Ideally in the long-term, applications which rely on SHELL being set should be fixed to just grab it from getpwnam() or similar, but until that becomes more common, I propose this simple change to make user sessions a little bit nicer out of the box.
Lennart Poettering [Tue, 1 Oct 2013 01:22:41 +0000 (03:22 +0200)]
build-sys: don't fallback to upstart defaults
Cristian Rodríguez [Mon, 30 Sep 2013 02:17:42 +0000 (23:17 -0300)]
systemctl: remove legacy upstart compatibility
Patrick McCarty [Tue, 1 Oct 2013 00:43:38 +0000 (17:43 -0700)]
smack-setup: fix path to Smack/CIPSO mappings
The correct path to the dir with CIPSO mappings is /etc/smack/cipso.d/;
/etc/smack/cipso is a file that can include these mappings as well,
though it is no longer supported in upstream libsmack.
Kay Sievers [Mon, 30 Sep 2013 22:19:25 +0000 (00:19 +0200)]
Revert "build-sys: link libsystemd-login with libsystemd-label.la"
Systemd-logind does not pull in cg_create(), if we unconditionally link
this, all users of systemd-logind qill need the label stuff and therefore
link against selinux.
It is probably a build-system issue, or something that need to be sorted
out in a differnt way than linking not needed libs.
This reverts commit
ceadabb102b05b237bfab11e1f742975ee4daeb1.
Lennart Poettering [Mon, 30 Sep 2013 22:15:15 +0000 (00:15 +0200)]
Update TODO
Lennart Poettering [Mon, 30 Sep 2013 22:13:18 +0000 (00:13 +0200)]
hashmap: size hashmap bucket array dynamically
Instead of fixing the hashmap bucket array to 127 entries dynamically
size it, starting with a smaller one of 31. As soon as a fill level of
75% is reached, quadruple the size, and so on.
This should siginficantly optimize the lookup time in large tables
(from O(n) back to O(1)), and save memory on smaller tables (which most
are).
Lennart Poettering [Mon, 30 Sep 2013 22:08:30 +0000 (00:08 +0200)]
local: fix memory leak when putting together locale settings
Also, we need to use proper strv_env_xyz() calls when putting together
the environment array, since otherwise settings won't be properly
overriden.
And let's get rid of strv_appendf(), is overkill and there was only one
user.
Lennart Poettering [Mon, 30 Sep 2013 22:06:48 +0000 (00:06 +0200)]
main: don't free fds array twice
Zbigniew Jędrzejewski-Szmek [Mon, 30 Sep 2013 21:58:44 +0000 (23:58 +0200)]
logs-show.c: show all messages for a slice
Michał Górny [Mon, 30 Sep 2013 08:08:09 +0000 (10:08 +0200)]
build-sys: link libsystemd-login with libsystemd-label.la
libsystemd-login.la uses cg_create() that currently seems to be a part
of libsystemd-label.la. However, it doesn't link against that library
and it seems that none of the (unconditional) libraries it uses do. In
the end, people end up getting «undefined reference to `cg_create'»
when trying to build e.g. dbus.
Lennart Poettering [Mon, 30 Sep 2013 16:56:34 +0000 (18:56 +0200)]
man: mention the systemd homepage from systemd(1)
Lennart Poettering [Mon, 30 Sep 2013 16:54:12 +0000 (18:54 +0200)]
update TODO
Lennart Poettering [Mon, 30 Sep 2013 16:54:05 +0000 (18:54 +0200)]
man: link cgroups api docs from relevant man pages
Andrey Borzenkov [Sun, 29 Sep 2013 11:37:30 +0000 (15:37 +0400)]
set IgnoreOnIsolate=true for systemd-cryptsetup@.service
When crypttab contains noauto, cryptsetup service does not have any
explicit dependencies. If service is started later manually (directly or via
mount dependency) it will be stopped on isolate.
mount units already have IgnoreOnIsolate set by default. Set it by
default for cryptsetup units as well.
Zbigniew Jędrzejewski-Szmek [Sun, 29 Sep 2013 12:40:58 +0000 (14:40 +0200)]
Fix buffer overrun when enumerating files
https://bugs.freedesktop.org/show_bug.cgi?id=69887
Based-on-a-patch-by: Hans Petter Jansson <hpj@copyleft.no>
Dave Reisner [Sat, 28 Sep 2013 18:51:39 +0000 (14:51 -0400)]
kmod-static-nodes: condition execution on modules.devname
Michael Scherer [Fri, 27 Sep 2013 09:43:28 +0000 (11:43 +0200)]
Add a bit more explicit message, to help confused users
Seeing http://www.happyassassin.net/2013/09/27/further-sysadmin-adventures-wheres-my-freeipa-badge/
it seems that the default message is a bit confusing for people
who never encountered it before, so adding a link to the manpage could
help them.
Tom Gundersen [Wed, 25 Sep 2013 20:58:00 +0000 (22:58 +0200)]
kernel-install: avoid using 'cp --preserve'
Force 0644 and root:root instead, to avoid problems with fat filesystems.
Zbigniew Jędrzejewski-Szmek [Fri, 27 Sep 2013 06:24:00 +0000 (08:24 +0200)]
build-sys: restore detection of sphinx
Zbigniew Jędrzejewski-Szmek [Fri, 27 Sep 2013 05:58:57 +0000 (07:58 +0200)]
Do not use unitialized variable and remove duplicated line
Lennart Poettering [Fri, 27 Sep 2013 00:59:50 +0000 (02:59 +0200)]
Update TODO
Lennart Poettering [Fri, 27 Sep 2013 00:02:21 +0000 (02:02 +0200)]
swap: properly expose timeout property on the bus
Lennart Poettering [Thu, 26 Sep 2013 22:35:36 +0000 (00:35 +0200)]
dbus: fix introspection for TimerSlackNSec
Lennart Poettering [Thu, 26 Sep 2013 22:11:54 +0000 (00:11 +0200)]
systemctl: make sure set-property mangles unit names
Lennart Poettering [Thu, 26 Sep 2013 22:05:07 +0000 (00:05 +0200)]
man: drop references to "cgroup" wher appropriate
Since cgroups are mostly now an implementation detail of systemd lets
deemphasize it a bit in the man pages. This renames systemd.cgroup(5) to
systemd.resource-control(5) and uses the term "resource control" rather
than "cgroup" where appropriate.
This leaves the word "cgroup" in at a couple of places though, like for
example systemd-cgtop and systemd-cgls where cgroup stuff is at the core
of what is happening.
Lennart Poettering [Thu, 26 Sep 2013 20:49:44 +0000 (22:49 +0200)]
core: drop some out-of-date references to cgroup settings
Lennart Poettering [Thu, 26 Sep 2013 19:32:47 +0000 (21:32 +0200)]
logind: never consider a closing session relevant for PK checks
https://bugzilla.redhat.com/show_bug.cgi?id=1010215
Mike Gilbert [Thu, 26 Sep 2013 18:39:41 +0000 (20:39 +0200)]
main: set umask before creating any files
This avoids a problem when we inherit a non-zero umask from the
initramfs. This would cause /run/systemd to be created with the wrong
mode.
Lennart Poettering [Thu, 26 Sep 2013 18:31:37 +0000 (20:31 +0200)]
logind: if a user is sitting in front of the computer and can shutdown the machine anyway he should also be able to reboot it
Lennart Poettering [Thu, 26 Sep 2013 18:14:24 +0000 (20:14 +0200)]
core: rework how we match mount units against each other
Previously to automatically create dependencies between mount units we
matched every mount unit agains all others resulting in O(n^2)
complexity. On setups with large amounts of mount units this might make
things slow.
This change replaces the matching code to use a hashtable that is keyed
by a path prefix, and points to a set of units that require that path to
be around. When a new mount unit is installed it is hence sufficient to
simply look up this set of units via its own file system paths to know
which units to order after itself.
This patch also changes all unit types to only create automatic mount
dependencies via the RequiresMountsFor= logic, and this is exposed to
the outside to make things more transparent.
With this change we still have some O(n) complexities in place when
handling mounts, but that's currently unavoidable due to kernel APIs,
and still substantially better than O(n^2) as before.
https://bugs.freedesktop.org/show_bug.cgi?id=69740
Lennart Poettering [Thu, 26 Sep 2013 18:03:20 +0000 (20:03 +0200)]
unit-name: when escaping a path consider the empty path identical to the root dir
Lennart Poettering [Thu, 26 Sep 2013 17:58:33 +0000 (19:58 +0200)]
util: properly handle the root dir in PATH_FOREACH_PREFIX
Also add PATH_FOREACH_PREFIX_MORE which includes the specified dir
itself in the iteration
Lennart Poettering [Thu, 26 Sep 2013 17:57:58 +0000 (19:57 +0200)]
cgroup: when referencing cgroup controller trees allow omission of the path
Zbigniew Jędrzejewski-Szmek [Wed, 25 Sep 2013 15:04:41 +0000 (17:04 +0200)]
Move part of logind.c into a separate file
liblogind-core.la was underlinked, missing a few functions
defined in logind.c. They are moved to a new file, logind-core.c,
and this file is linked into liblogind-core.la.
In addition, logind-acl.c is attached to the liblogind-core.la,
instead of systemd-logind directly.
Zbigniew Jędrzejewski-Szmek [Wed, 25 Sep 2013 11:26:08 +0000 (13:26 +0200)]
Move functions around to fix underlinking in test-machine-tables