chiark / gitweb /
7 years agoupdate TODO
Lennart Poettering [Wed, 3 Sep 2014 16:59:17 +0000 (18:59 +0200)]
update TODO

7 years agobase-file-system: always generate error messages locally
Lennart Poettering [Wed, 3 Sep 2014 17:00:21 +0000 (19:00 +0200)]
base-file-system: always generate error messages locally

Functions either should generate error messages for everything they do
themselves, or for nothing and let the caller do it. But they certainly
shouldn't generate errors for some messages but not for others. Since
the function in this case is one that generates messages on its own, it
really should do that for everything, not just for some things, hence.

7 years agoupdate TODO
Lukas Nykryn [Wed, 3 Sep 2014 11:59:59 +0000 (13:59 +0200)]
update TODO

Yum was creating <container>/var/run/ and hence this directory
was created before filesystem package could create the symlink
/var/run -> /run.
This should be now fixed in yum.

7 years agoinitrd-parse-etc.service: ignore return code of daemon-reload
Harald Hoyer [Wed, 3 Sep 2014 11:28:31 +0000 (13:28 +0200)]
initrd-parse-etc.service: ignore return code of daemon-reload

It seems the return code of systemctl daemon-reload can be !=0 in some
circumstances, which causes a failure of the unit and breaks booting in
the initrd.

7 years agobase_filesystem_create: do not try to create "/root" if it exists
Harald Hoyer [Wed, 3 Sep 2014 11:22:40 +0000 (13:22 +0200)]
base_filesystem_create: do not try to create "/root" if it exists

The check, if the directory/file already exists is only executed, if
there is a symlink target specified. In case of "/root", there is none,
so it is unconditionally tried to create the directory.

In case of a readonly filesystem, errno != EEXIST, but errno == EROFS,
so base_filesystem_create() and switch_root does not succeed.

This patch checks for existance not only in the symlink case.

7 years agoman: fix file extension in udev rules example
Zbigniew Jędrzejewski-Szmek [Tue, 2 Sep 2014 23:37:04 +0000 (19:37 -0400)]
man: fix file extension in udev rules example

7 years agoRevert "timesyncd: remove retry_timer logic which is covered by the server timeout"
Kay Sievers [Tue, 2 Sep 2014 13:28:56 +0000 (15:28 +0200)]
Revert "timesyncd: remove retry_timer logic which is covered by the server timeout"

This reverts commit 665c6a9eab46b0b253af6566ca9fc70c866b3fcd.

On Tue, Sep 2, 2014 at 3:17 PM, Miroslav Lichvar <> wrote:
> With the other patch allowing missed replies included it's now getting
> stuck as there is no timer to send the 2nd and 3rd request.

7 years agotimesyncd: don't reset polling interval when reselecting server
Kay Sievers [Tue, 2 Sep 2014 12:33:59 +0000 (14:33 +0200)]
timesyncd: don't reset polling interval when reselecting server

Original patch from: Miroslav Lichvar <>

7 years agotimesyncd: allow two missed replies before reselecting server
Miroslav Lichvar [Tue, 2 Sep 2014 12:29:51 +0000 (14:29 +0200)]
timesyncd: allow two missed replies before reselecting server

After receiving a reply from the server, allow two missed replies before
switching to another server to avoid unnecessary clock hopping when
packets are getting lost in the network.

7 years agotimesyncd: remove retry_timer logic which is covered by the server timeout
Kay Sievers [Tue, 2 Sep 2014 12:27:00 +0000 (14:27 +0200)]
timesyncd: remove retry_timer logic which is covered by the server timeout

7 years agotimesyncd: wait before reconnecting to first server
Miroslav Lichvar [Wed, 27 Aug 2014 14:47:24 +0000 (16:47 +0200)]
timesyncd: wait before reconnecting to first server

When all servers are exhausted, wait for one poll interval before trying
to connect again to the first server in the list. Also, keep increasing
the polling interval to make sure a client not getting any valid replies
will not send requests to any server more frequently than is allowed by
the maximum polling interval.

7 years agosd-rtnl: don't assign to unused variable
Tom Gundersen [Mon, 1 Sep 2014 20:59:52 +0000 (22:59 +0200)]
sd-rtnl: don't assign to unused variable

Reported by Thomas H.P. Andersen <>.

7 years agorules: remove firmware loading rules
Zbigniew Jędrzejewski-Szmek [Mon, 1 Sep 2014 16:55:23 +0000 (12:55 -0400)]
rules: remove firmware loading rules

blueness> poettering, was there a reason for not removing
          50-firmware.rules when you nuked userland firmware

Followup for v216-119-gbe2ea723b1.

7 years agologin: simplify controller handling
David Herrmann [Mon, 1 Sep 2014 12:04:44 +0000 (14:04 +0200)]
login: simplify controller handling

Simplify the way we handler session-controllers and fix several
 * send ReleaseDevice() signals on forced session takeover
 * fix mem-leaks for busnames in case VT preparation fails (non-critical)
 * avoid passing pre-allocated names to helpers

7 years agologin: fix mem leak
Thomas Hindoe Paaboel Andersen [Sun, 31 Aug 2014 21:34:01 +0000 (23:34 +0200)]
login: fix mem leak

7 years agoconfig-parser: fix mem leak
Thomas Hindoe Paaboel Andersen [Sun, 31 Aug 2014 21:13:12 +0000 (23:13 +0200)]
config-parser: fix mem leak

7 years agojournal-remote: fix check if realloc failed
Thomas Hindoe Paaboel Andersen [Sun, 31 Aug 2014 20:54:40 +0000 (22:54 +0200)]
journal-remote: fix check if realloc failed

7 years agotest-network: fix off-by-one error in test
Tom Gundersen [Sun, 31 Aug 2014 17:22:33 +0000 (19:22 +0200)]
test-network: fix off-by-one error in test

7 years agomissing: add IFF_MULTI_QUEUE
Tom Gundersen [Sun, 31 Aug 2014 16:50:23 +0000 (18:50 +0200)]
missing: add IFF_MULTI_QUEUE

This was added in 3.8, but we should building with 3.7 headers.

Reported by Samuli Suominen <>.

7 years agojournalctl: Allow to disable line cap with --lines=all
Jan Janssen [Sun, 31 Aug 2014 09:12:22 +0000 (11:12 +0200)]
journalctl: Allow to disable line cap with --lines=all

7 years agoQuote unit names in suggested systemctl commandlines
Zbigniew Jędrzejewski-Szmek [Sun, 31 Aug 2014 04:42:27 +0000 (00:42 -0400)]
Quote unit names in suggested systemctl commandlines

The fact that unit names have to be quoted can be a bit surprising.
Show quotes in the hint commandline, but only after checking that this
is necessary, since quotes are visually heavy and usually not needed.

7 years agounits: update rescue.service and emergency.service
Zbigniew Jędrzejewski-Szmek [Sun, 31 Aug 2014 02:34:56 +0000 (22:34 -0400)]
units: update rescue.service and emergency.service

^D works in emergency.service too. One needs to log in when in rescue
mode too.

7 years agounits: m4 is not needed for rescue.service
Zbigniew Jędrzejewski-Szmek [Sun, 31 Aug 2014 03:59:37 +0000 (23:59 -0400)]
units: m4 is not needed for rescue.service

7 years agounits: make emergency.service conflict with rescue.service
Zbigniew Jędrzejewski-Szmek [Sun, 31 Aug 2014 02:33:40 +0000 (22:33 -0400)]
units: make emergency.service conflict with rescue.service

They both use StandardInput=tty-force so they cannot be run

7 years agotimesyncd-manager: don't clear current_server_name if ServerAddress is NULL
Steven Noonan [Sat, 30 Aug 2014 12:58:06 +0000 (05:58 -0700)]
timesyncd-manager: don't clear current_server_name if ServerAddress is NULL

[zj: add comment]

7 years agosd-dhcp6-client: properly calculate buffer size when parsing options
Zbigniew Jędrzejewski-Szmek [Sat, 30 Aug 2014 22:31:21 +0000 (18:31 -0400)]
sd-dhcp6-client: properly calculate buffer size when parsing options

Also make pointer calculations more explicit so they are
easier to understand.

7 years agotest-dhcp6-client: Fix option length
Patrik Flykt [Fri, 29 Aug 2014 06:20:46 +0000 (09:20 +0300)]
test-dhcp6-client: Fix option length

The whole DHCPv6 test message length was incorrectly used as the length
of DHCPv6 options causing the following bad memory access:

$ build/test-dhcp6-client
Assertion 'interface_index >= -1' failed at ../src/libsystemd-network/sd-dhcp6-client.c:129, function sd_dhcp6_client_set_index(). Ignoring.
==29135==ERROR: AddressSanitizer: global-buffer-overflow on address 0x7fe204aa9148 at pc 0x7fe204a5958f bp 0x7fff3e47d470 sp 0x7fff3e47d460
READ of size 1 at 0x7fe204aa9148 thread T0
    #0 0x7fe204a5958e in option_parse_hdr ../src/libsystemd-network/dhcp6-option.c:145
    #1 0x7fe204a59884 in dhcp6_option_parse ../src/libsystemd-network/dhcp6-option.c:165
    #2 0x7fe204a4eb9c in test_advertise_option ../src/libsystemd-network/test-dhcp6-client.c:227
    #3 0x7fe204a51c58 in main ../src/libsystemd-network/test-dhcp6-client.c:584
    #4 0x7fe2031590df in __libc_start_main (/lib64/
    #5 0x7fe204a4cc5b (/home/test/systemd/build/test-dhcp6-client+0x25c5b)

0x7fe204aa9148 is located 2 bytes to the right of global variable 'msg_advertise' from '../src/libsystemd-network/test-dhcp6-client.c' (0x7fe204aa9080) of size 198
0x7fe204aa9148 is located 56 bytes to the left of global variable 'msg_reply' from '../src/libsystemd-network/test-dhcp6-client.c' (0x7fe204aa9180) of size 173
SUMMARY: AddressSanitizer: global-buffer-overflow ../src/libsystemd-network/dhcp6-option.c:145 option_parse_hdr

7 years agocgroup-util: shorten cg_path_get_session
Zbigniew Jędrzejewski-Szmek [Fri, 29 Aug 2014 12:48:33 +0000 (07:48 -0500)]
cgroup-util: shorten cg_path_get_session

7 years agosystemd: fix error message
Zbigniew Jędrzejewski-Szmek [Sat, 30 Aug 2014 21:22:42 +0000 (17:22 -0400)]
systemd: fix error message

7 years agotest-compress: also test with incompressible inputs
Zbigniew Jędrzejewski-Szmek [Sat, 30 Aug 2014 18:47:36 +0000 (14:47 -0400)]
test-compress: also test with incompressible inputs

7 years agojournal/compress: use LZ4_compress_continue()
Evangelos Foutras [Sat, 30 Aug 2014 07:13:43 +0000 (10:13 +0300)]
journal/compress: use LZ4_compress_continue()

We can't use LZ4_compress_limitedOutput_continue() because in the
worst-case scenario the compressed output can be slightly bigger than
the input block. This generally affects very few blocks and is no reason
to abort the compression process.

I ran into this when I noticed that Chromium core dumps weren't being
compressed. After switching to LZ4_compress_continue() a ~330MB Chromium
core dump gets compressed to ~17M.

7 years agosd-ipv4ll: name the correct source
Tom Gundersen [Fri, 29 Aug 2014 11:08:16 +0000 (13:08 +0200)]
sd-ipv4ll: name the correct source

7 years agoFix a few more typos
Ruben Kerkhof [Sat, 30 Aug 2014 15:13:16 +0000 (17:13 +0200)]
Fix a few more typos

7 years agoUpdate french translation
Sylvain Plantefève [Sat, 30 Aug 2014 14:25:59 +0000 (16:25 +0200)]
Update french translation

7 years agolibudev: fix symbol version for udev_queue_flush() and udev_queue_get_fd()
Michael Biebl [Sat, 30 Aug 2014 00:01:51 +0000 (02:01 +0200)]
libudev: fix symbol version for udev_queue_flush() and udev_queue_get_fd()

Those symbols were introduced in commit
14cb733684d3c3f50d088a3a370ddf8e8894dfa4 and released in v215.

7 years agoudev: bump event timeout to 60 seconds
Kay Sievers [Sat, 30 Aug 2014 09:36:32 +0000 (11:36 +0200)]
udev: bump event timeout to 60 seconds

7 years agoudev: remove userspace firmware loading support
Kay Sievers [Sat, 30 Aug 2014 09:34:20 +0000 (11:34 +0200)]
udev: remove userspace firmware loading support

7 years agocompletion: filter templates from restartable units
Dave Reisner [Sat, 30 Aug 2014 00:35:15 +0000 (20:35 -0400)]
completion: filter templates from restartable units

Since c6a373a2634854, we might encounter unit templates via the
'list-units' verb. These aren't restartable (and we throw errors), so
make sure they're filtered out of the completion options.

fixes downstream bug:

7 years agoUpdate Russian translation
Sergey Ptashnick [Fri, 29 Aug 2014 15:48:47 +0000 (19:48 +0400)]
Update Russian translation

By analogy with commit 1977376274.

7 years agotimesyncd: check root distance
Miroslav Lichvar [Wed, 27 Aug 2014 14:47:20 +0000 (16:47 +0200)]
timesyncd: check root distance

NTPv4 servers don't reply with unsynchronized status when they lost
synchronization, they only keep increasing the root dispersion and it's
up to the client to decide at which point they no longer consider it

Ignore replies with root distance over 5 seconds.

7 years agotimesyncd: get kernel timestamp in nanoseconds
Miroslav Lichvar [Wed, 27 Aug 2014 14:47:19 +0000 (16:47 +0200)]
timesyncd: get kernel timestamp in nanoseconds

7 years agotimesyncd: fix calculation of transmit time
Miroslav Lichvar [Wed, 27 Aug 2014 14:47:18 +0000 (16:47 +0200)]
timesyncd: fix calculation of transmit time

The kernel timestamp (recv_time) is made earlier than current time
(now_ts), use the timestamp captured before sending packet directly.

7 years agotimesyncd: check if stratum is valid
Miroslav Lichvar [Wed, 27 Aug 2014 14:47:17 +0000 (16:47 +0200)]
timesyncd: check if stratum is valid

7 years agoFix a few typos in log messages
Ruben Kerkhof [Fri, 29 Aug 2014 11:28:04 +0000 (13:28 +0200)]
Fix a few typos in log messages

7 years agosystemd-journal-upload: fix invalid After=
Marius Tessmann [Thu, 28 Aug 2014 20:01:46 +0000 (22:01 +0200)]
systemd-journal-upload: fix invalid After=

After= belongs into [Unit], not [Install]. Found with systemd-analyze

7 years agosystemd-firstboot: fix typo in man page
Marius Tessmann [Thu, 28 Aug 2014 20:01:45 +0000 (22:01 +0200)]
systemd-firstboot: fix typo in man page

7 years agosystemd-firstboot.service: fix man page section
Marius Tessmann [Thu, 28 Aug 2014 20:01:44 +0000 (22:01 +0200)]
systemd-firstboot.service: fix man page section

Found with systemd-analyze verify.

7 years agosd-event: simplify sd_event_source_set_name()
David Herrmann [Thu, 28 Aug 2014 20:44:28 +0000 (22:44 +0200)]
sd-event: simplify sd_event_source_set_name()

free_and_strdup() does exactly the same as sd_event_source_set_name(), use

7 years agosd-event: name event sources used in libraries
Tom Gundersen [Thu, 28 Aug 2014 13:46:29 +0000 (15:46 +0200)]
sd-event: name event sources used in libraries

This should help in debugging failing event sources.

7 years agosd-event: use event source name rather than address in debug messages
Tom Gundersen [Thu, 28 Aug 2014 13:48:07 +0000 (15:48 +0200)]
sd-event: use event source name rather than address in debug messages

7 years agosd-event: allow naming event sources
Tom Gundersen [Thu, 28 Aug 2014 13:47:39 +0000 (15:47 +0200)]
sd-event: allow naming event sources

7 years agosd-rtnl: log if kernel buffer is overrun as we currently can't handle that case
Tom Gundersen [Thu, 28 Aug 2014 13:59:13 +0000 (15:59 +0200)]
sd-rtnl: log if kernel buffer is overrun as we currently can't handle that case

7 years agohibernate-resume: refuse to run outside of an initrd
Lennart Poettering [Thu, 28 Aug 2014 18:24:12 +0000 (20:24 +0200)]
hibernate-resume: refuse to run outside of an initrd

7 years agoupdate TODO
Lennart Poettering [Thu, 28 Aug 2014 18:23:52 +0000 (20:23 +0200)]
update TODO

7 years agonetworkctl: do not mix dns and ntp servers
Zbigniew Jędrzejewski-Szmek [Mon, 18 Aug 2014 21:22:26 +0000 (17:22 -0400)]
networkctl: do not mix dns and ntp servers

7 years agobus: don't skip interfaces in bus_message_map_properties_changed()
David Herrmann [Thu, 28 Aug 2014 13:24:00 +0000 (15:24 +0200)]
bus: don't skip interfaces in bus_message_map_properties_changed()

Skipping interfaces randomly without the caller specifying it is nasty.
Avoid this and let the caller do that themselves.

7 years agolocale: fix sending PropertiesChanged for x11 keymap changed
David Herrmann [Thu, 28 Aug 2014 13:22:26 +0000 (15:22 +0200)]
locale: fix sending PropertiesChanged for x11 keymap changed

The sd_bus_emit_properties_changed() call for x11 keymap changes lacks
commas.. whoops. Fix it! Now localed emits PropertiesChanged signals

7 years agouse the switch_root function in shutdown
Harald Hoyer [Thu, 21 Aug 2014 14:21:26 +0000 (16:21 +0200)]
use the switch_root function in shutdown

removes code duplication

also move switch-root to shared

7 years agomacro: use unique variable names for math-macros
David Herrmann [Thu, 28 Aug 2014 12:45:38 +0000 (14:45 +0200)]
macro: use unique variable names for math-macros

Similar to container_of(), we now use unique variable names for the bascic
math macros MAX, MIN, CLAMP, LESS_BY. Furthermore, unit tests are added to
verify they work as expected.

For a rationale, see:
    commit fb835651aff79a1e7fc5795086c9b26e59a8e6ca
    Author: David Herrmann <>
    Date:   Fri Aug 22 14:41:37 2014 +0200

        shared: make container_of() use unique variable names

7 years agobus: fix use-after-free in slot-release
David Herrmann [Thu, 28 Aug 2014 10:42:03 +0000 (12:42 +0200)]
bus: fix use-after-free in slot-release

We must not access slot->floating after we possible dropped the last
reference to it. Fix all callback-invocations to first check
slot->floating and possible disconnect the slot, then release the last

7 years agoterminal: free sysview-device names on destruction
David Herrmann [Thu, 28 Aug 2014 10:25:58 +0000 (12:25 +0200)]
terminal: free sysview-device names on destruction

Don't leak the device-names during device destruction in sysview. Somehow,
the device-name is "const char*", so make it "char*" first to avoid
warnings when calling free() on it.

7 years agoterminal: free xkb state on keyboard destruction
David Herrmann [Thu, 28 Aug 2014 10:21:33 +0000 (12:21 +0200)]
terminal: free xkb state on keyboard destruction

Fix leaking the xkb-state during keyboard destruction, leaking lots of xkb
references into the wild.

7 years agonspawn: fix --network-interface
Tom Gundersen [Thu, 28 Aug 2014 10:15:51 +0000 (12:15 +0200)]
nspawn: fix --network-interface

Use SETLINK when modifying an existing link.

7 years agoterminal: sysview: don't return uninitialized error codes
David Herrmann [Thu, 28 Aug 2014 09:01:31 +0000 (11:01 +0200)]
terminal: sysview: don't return uninitialized error codes

In case 'scan_evdev' and 'scan_drm' are both false, we never set 'r' to
anyhting, thus return an uninitialized error code. Fix this by always
returning 0 as we catch negative codes earlier, anyway. Thanks to Thomas
H.P. Anderson for the report.

7 years agosd-journal: verify that object start with the field name
Zbigniew Jędrzejewski-Szmek [Wed, 27 Aug 2014 03:54:31 +0000 (23:54 -0400)]
sd-journal: verify that object start with the field name

If the journal is corrupted, we might return an object that does
not start with the expected field name and/or is shorter than it

7 years agosd-journal: properly convert object->size on big endian
Zbigniew Jędrzejewski-Szmek [Sun, 24 Aug 2014 02:35:03 +0000 (22:35 -0400)]
sd-journal: properly convert object->size on big endian

mmap code crashes when attempting to map an object of zero size.

7 years agoterminal: remove unused variable
Thomas Hindoe Paaboel Andersen [Wed, 27 Aug 2014 21:23:10 +0000 (23:23 +0200)]
terminal: remove unused variable

7 years agoupdate TODO
Lennart Poettering [Wed, 27 Aug 2014 19:43:33 +0000 (21:43 +0200)]
update TODO

7 years agoutil: fix minimal race where we might miss SIGTERMs when forking off an agent
Lennart Poettering [Wed, 27 Aug 2014 19:42:20 +0000 (21:42 +0200)]
util: fix minimal race where we might miss SIGTERMs when forking off an agent

Before forking, block all signals, and unblock them afterwards. This way
the child will have them blocked, and we won't lose them.

7 years agoman: add sample glib/sd-event integration
Tom Gundersen [Wed, 27 Aug 2014 17:04:29 +0000 (19:04 +0200)]
man: add sample glib/sd-event integration

This should be moved to man pages, but for now the C code is included directly.

Suggested by Zbyszek.

7 years agoterminal: add systemd-evcat input debugging tool
David Herrmann [Wed, 27 Aug 2014 16:38:01 +0000 (18:38 +0200)]
terminal: add systemd-evcat input debugging tool

Like systemd-subterm, this new systemd-evcat tool should only be used to
debug libsystemd-terminal. systemd-evcat attaches to the running session
and pushes all evdev devices attached to the current session into an
idev-session. All events of the created idev-devices are then printed to
stdout for input-event debugging.

7 years agoterminal: add xkb-based keyboard devices to idev
David Herrmann [Wed, 27 Aug 2014 16:34:55 +0000 (18:34 +0200)]
terminal: add xkb-based keyboard devices to idev

The idev-keyboard object provides keyboard devices to the idev interface.
It uses libxkbcommon to provide proper keymap support.

So far, the keyboard implementation is pretty straightforward with one
keyboard device per matching evdev element. We feed everything into the
system keymap and provide proper high-level keyboard events to the
application. Compose-features and IM need to be added later.

7 years agoterminal: add evdev elements to idev
David Herrmann [Wed, 27 Aug 2014 16:31:34 +0000 (18:31 +0200)]
terminal: add evdev elements to idev

The evdev-element provides linux evdev interfaces as idev-elements. This
way, all real input hardware devices on linux can be used with the idev

We use libevdev to interface with the kernel. It's a simple wrapper
library around the kernel evdev API that takes care to resync devices
after kernel-queue overflows, which is a rather non-trivial task.
Furthermore, it's a well tested interface used by all other major input
users (Xorg, weston, libinput, ...).
Last but not least, it provides nice keycode to keyname lookup tables (and
vice versa), which is really nice for debugging input problems.

7 years agoterminal: add input interface
David Herrmann [Wed, 27 Aug 2014 16:17:27 +0000 (18:17 +0200)]
terminal: add input interface

The idev-interface provides input drivers for all libsystemd-terminal
based applications. It is split into 4 main objects:
    idev_context: The context object tracks global state of the input
                  interface. This will include data like system-keymaps,
                  xkb contexts and more.
    idev_session: A session serves as controller for a set of devices.
                  Each session on an idev-context is independent of each
                  other. The session is also the main notification object.
                  All events raised via idev are reported through the
                  session interface. Apart of that, the session is a
                  pretty dumb object that just contains devices.
    idev_element: Elements provide real hardware in the idev stack. For
                  each hardware device, one element is added. Elements
                  have no knowledge of higher-level device types, they
                  only provide raw input data to the upper levels. For
                  example, each evdev device is represented by a different
                  element in an idev session.
     idev_device: Devices are objects that the application deals with. An
                  application is usually not interested in elements (and
                  those are hidden to applications), instead, they want
                  high-level input devices like keyboard, touchpads, mice
                  and more. Device are the high-level interface provided
                  by idev. Each device might be fed by a set of elements.
                  Elements drive the device. If elements are removed,
                  devices are destroyed. If elements are added, suitable
                  devices are created.

Applications should monitor the system for sessions and hardware devices.
For each session they want to operate on, they create an idev_session
object and add hardware to that object. The idev interface requires the
application to monitor the system (preferably via sysview_*, but not
required) for hardware devices. Whenever hardware is added to the idev
session, new devices *might* be created. The relationship between hardware
and high-level idev-devices is hidden in the idev-session and not exposed.

Internally, the idev elements and devices are virtual objects. Each real
hardware and device type inherits those virtual objects and provides real
elements and devices. Those types will be added in follow-up commits.

Data flow from hardware to the application is done via idev_*_feed()
functions. Data flow from applications to hardware is done via
idev_*_feedback() functions. Feedback is usually used for LEDs, FF and
similar operations.

7 years agoterminal: add system view interface
David Herrmann [Tue, 26 Aug 2014 13:03:41 +0000 (15:03 +0200)]
terminal: add system view interface

We're going to need multiple binaries that provide session-services via
logind device management. To avoid re-writing the seat/session/device
scan/monitor interface for each of them, this commit adds a generic helper
to libsystemd-terminal:

The sysview interface scans and tracks seats, sessions and devices on a
system. It basically mirrors the state of logind on the application side.
Now, each session-service can listen for matching sessions and
attach to them. On each session, managed device access is provided. This
way, it is pretty simple to write session-services that attach to multiple
sessions (even split across seats).

7 years agobus: split bus_map_all_properties into multiple helpers
David Herrmann [Sun, 24 Aug 2014 16:55:58 +0000 (18:55 +0200)]
bus: split bus_map_all_properties into multiple helpers

The bus_map_all_properties() helper calls
org.freedesktop.DBus.Properties.GetAll() on a given target and parses the
result according to a given property-table. This simplifies dealing with
DBus.Properties significantly. However, the function is blocking and thus
not really useful in many situations.

This patch extracts the core of this function and adds two new helpers
which directly take dbus-messages as arguments. This way, you can issue
asynchronous requests and parse the result via these helpers:

      This is the same as bus_map_all_properties() but takes the result
      message from a GetAll() request as argument. You can thus issue an
      asynchronous GetAll() request and then use this helper once you got
      the result.

      This function takes a signal-message that was retrieved via a
      PropertiesChanged signal and then parses it like if you retrieved
      it via GetAll(). Furthermore, this function returns the number of
      matched properties that got invalidated by the PropertiesChanged
      signal, but didn't carry the new value. This way, the caller can
      issue a new GetAll() request and then parse the result.

The old function bus_map_all_properties() is functionally unchanged, but
now uses bus_message_map_all_properties() internally.

7 years agoutil: make lookup_uid() global
David Herrmann [Wed, 27 Aug 2014 16:03:29 +0000 (18:03 +0200)]
util: make lookup_uid() global

This is a useful helper, make it global. It will be required for
libsystemd-terminal, at minimum.

7 years agoudev: add missing new-line in udevadm error
David Herrmann [Wed, 27 Aug 2014 16:02:17 +0000 (18:02 +0200)]
udev: add missing new-line in udevadm error

fprintf() does not add new-lines automatically like log_*() does. Add the
missing \n specified so "udevadm" invoked without arguments adds a newline
    udevadm: missing or unknown command

7 years agologin: fix memory-leak on DropController()
David Herrmann [Fri, 22 Aug 2014 12:57:11 +0000 (14:57 +0200)]
login: fix memory-leak on DropController()

Our bus-name watch helpers only remove a bus-name if it's not a
controller, anymore. If we call manager_drop_busname() before
unregistering the controller, the busname will not be dropped. Therefore,
first drop the controller, then drop the bus-name.

7 years agoshared: make container_of() use unique variable names
David Herrmann [Fri, 22 Aug 2014 12:41:37 +0000 (14:41 +0200)]
shared: make container_of() use unique variable names

If you stack container_of() macros, you will get warnings due to shadowing
variables of the parent context. To avoid this, use unique names for

Two new helpers are added:
  UNIQ: This evaluates to a truly unique value never returned by any
        evaluation of this macro. It's a shortcut for __COUNTER__.
  UNIQ_T: Takes two arguments and concatenates them. It is a shortcut for
          CONCATENATE, but meant to defined typed local variables.

As you usually want to use variables that you just defined, you need to
reference the same unique value at least two times. However, UNIQ returns
a new value on each evaluation, therefore, you have to pass the unique
values into the macro like this:

    #define my_macro(a, b) __max_macro(UNIQ, UNIQ, (a), (b))
    #define __my_macro(uniqa, uniqb, a, b) ({
                typeof(a) UNIQ_T(A, uniqa) = (a);
                typeof(b) UNIQ_T(B, uniqb) = (b);
                MY_UNSAFE_MACRO(UNIQ_T(A, uniqa), UNIQ_T(B, uniqb));

This way, MY_UNSAFE_MACRO() can safely evaluate it's arguments multiple
times as they are local variables. But you can also stack invocations to
the macro my_macro() without clashing names.

This is the same as if you did:

    #define my_macro(a, b) __max_macro(__COUNTER__, __COUNTER__, (a), (b))
    #define __my_macro(prefixa, prefixb, a, b) ({
                typeof(a) CONCATENATE(A, prefixa) = (a);
                typeof(b) CONCATENATE(B, prefixb) = (b);
                MY_UNSAFE_MACRO(CONCATENATE(A, prefixa), CONCATENATE(B, prefixb));

...but in my opinion, the first macro is easier to write and read.

This patch starts by converting container_of() to use this new helper.
Other macros may follow (like MIN, MAX, CLAMP, ...).

7 years agoshared: drop UNIQUE()
David Herrmann [Fri, 22 Aug 2014 12:38:28 +0000 (14:38 +0200)]
shared: drop UNIQUE()

The UNIQUE() macro works fine if used in un-stacked macros. However, once
you stack them like:
        MAX(MIN(a, b),
            CLAMP(MAX(c, d), e, f))
you will get warnings due to shadowing other variables. gcc uses the last
line of a macro expansion as value for __LINE__, therefore, we cannot even
avoid this by splitting the expressions across lines.

Remove the only user of UNIQUE() so we introduce a new helper in

7 years agoTODO
Tom Gundersen [Wed, 27 Aug 2014 15:46:00 +0000 (17:46 +0200)]

7 years agotmpfiles: make resolv.conf entry conditional on resolved support
Tom Gundersen [Wed, 27 Aug 2014 15:45:41 +0000 (17:45 +0200)]
tmpfiles: make resolv.conf entry conditional on resolved support

7 years agosystemctl: fix broken list-unit-files with --root
Lukas Nykryn [Tue, 26 Aug 2014 11:33:08 +0000 (13:33 +0200)]
systemctl: fix broken list-unit-files with --root

7 years agokeymap: Adjust for more Samsung 900X4 series
Martin Pitt [Wed, 27 Aug 2014 06:41:10 +0000 (08:41 +0200)]
keymap: Adjust for more Samsung 900X4 series

Reportedly also applies to NP900X4B, so relax the match to apply to all models
of this series.

7 years agopo: update Polish translation
Piotr Drąg [Sun, 24 Aug 2014 16:18:35 +0000 (18:18 +0200)]
po: update Polish translation

7 years agoDocument "...|..." udev match syntax
Andrei Borzenkov [Sun, 24 Aug 2014 07:11:33 +0000 (11:11 +0400)]
Document "...|..." udev match syntax

7 years agoman: reword sd-hibernate-resume description and add link
Zbigniew Jędrzejewski-Szmek [Wed, 27 Aug 2014 01:14:11 +0000 (21:14 -0400)]
man: reword sd-hibernate-resume description and add link

"each device" was suggesting that this service might be instantiated
multiple times. "hibernation resume" was too jargon-y.

7 years agohibernate-resume-generator: add a generator for instantiating the resume unit.
Ivan Shapovalov [Tue, 26 Aug 2014 20:17:45 +0000 (00:17 +0400)]
hibernate-resume-generator: add a generator for instantiating the resume unit.

hibernate-resume-generator understands resume= kernel command line parameter
and instantiates the systemd-resume@.service accordingly if it is passed.

This enables resume from hibernation using device specified on the kernel
command line, and it may be specified either as "/dev/disk/by-foo/bar"
or "FOO=bar", not only "/dev/sdXY" which is understood by the in-kernel

So now resume= is brought on par with root= in terms of possible ways to
specify a device.

7 years agohibernate-resume: add a tool to write a device node's major:minor to /sys/power/resume.
Ivan Shapovalov [Tue, 26 Aug 2014 20:17:44 +0000 (00:17 +0400)]
hibernate-resume: add a tool to write a device node's major:minor to /sys/power/resume.

This can be used to initiate a resume from hibernation by path to a swap
device containing the hibernation image.

The respective templated unit is also added. It is instantiated using
path to the desired resume device.

7 years agounits: order systemd-fsck@.service after
Ivan Shapovalov [Tue, 26 Aug 2014 20:17:43 +0000 (00:17 +0400)]
units: order systemd-fsck@.service after

With this change, it becomes possible to order a unit to activate before any
modifications to the file systems. This is especially useful for supporting
resume from hibernation.

7 years agologind: add HandleLidSwitchDocked= option to logind.conf + documentation
Ben Wolsieffer [Tue, 26 Aug 2014 20:08:02 +0000 (22:08 +0200)]
logind: add HandleLidSwitchDocked= option to logind.conf + documentation

7 years agosd-journal: never log anything by default from a library
Lennart Poettering [Tue, 26 Aug 2014 19:47:46 +0000 (21:47 +0200)]
sd-journal: never log anything by default from a library

7 years agoutil: make use of newly added reset_signal_mask() call wherever appropriate
Lennart Poettering [Tue, 26 Aug 2014 19:11:35 +0000 (21:11 +0200)]
util: make use of newly added reset_signal_mask() call wherever appropriate

7 years agoutil: reset signals when we fork off agents
Lennart Poettering [Tue, 26 Aug 2014 19:04:21 +0000 (21:04 +0200)]
util: reset signals when we fork off agents

If we invoke agents, we should make sure we actually can kill them
again. I mean, it's probably not our job to cleanup the signals if our
tools are invoked in weird contexts, but at least we should make sure,
that the subprocesses we invoke and intend to control work as intended.

Also see:

7 years agoutil: make sure reset_all_signal_handlers() continues with all other signal handlers...
Lennart Poettering [Tue, 26 Aug 2014 19:03:20 +0000 (21:03 +0200)]
util: make sure reset_all_signal_handlers() continues with all other signal handlers when one sigaction() fails

After all, we usually don't check for failures here, and it is better to
do as much as we can...

7 years agosd-bus: don't include internal header memfd.h in public header sd-bus.h
Hristo Venev [Tue, 26 Aug 2014 18:40:35 +0000 (20:40 +0200)]
sd-bus: don't include internal header memfd.h in public header sd-bus.h

7 years agosystemctl: Correct error message printed when bus_process_wait fails
Sjoerd Simons [Sat, 23 Aug 2014 19:11:44 +0000 (21:11 +0200)]
systemctl: Correct error message printed when bus_process_wait fails

Actually use the variable containing the return code of bus_process_wait when
printing the error message as a result of it failing.

7 years agosd-bus: remove unused call bus_kernel_create_monitor()
Lennart Poettering [Tue, 26 Aug 2014 18:35:31 +0000 (20:35 +0200)]
sd-bus: remove unused call bus_kernel_create_monitor()

Noticed by Djalal Harouni

7 years agotest-util: use assert_se() for call to safe_mkdir with side effect
Filipe Brandenburger [Tue, 26 Aug 2014 05:05:04 +0000 (22:05 -0700)]
test-util: use assert_se() for call to safe_mkdir with side effect

Otherwise it gets optimized out when CPPFLAGS='-DNDEBUG' is used.

- make check TESTS='test-util' CPPFLAGS='-DNDEBUG'