chiark / gitweb /
elogind.git
9 years agolocaled: check for partially matching converted keymaps
Zbigniew Jędrzejewski-Szmek [Thu, 4 Sep 2014 02:55:54 +0000 (22:55 -0400)]
localed: check for partially matching converted keymaps

If a user specifies multiple X11 keymaps, with a (at least the first
one) nonempty variant, and we don't match the whole combo, use
a converted keymap which includes the variant in preference to
the default, variantless, keymap.

E.g.: We would convert X11 config "layout=fr variant=mac" to "fr-mac",
but "layout=fr,us variant=mac," to "fr", because we don't have a
converted keymap which would match "fr,us", and we don't have a legacy
mapping for "fr,us". This is unexpected, and if we cannot match both,
it is still better to match the primary mapping and use "fr-mac".

9 years agolocaled: introduce helper function to simplify matching
Zbigniew Jędrzejewski-Szmek [Thu, 4 Sep 2014 02:55:52 +0000 (22:55 -0400)]
localed: introduce helper function to simplify matching

9 years agolocaled: log locale/keymap changes in detail
Zbigniew Jędrzejewski-Szmek [Thu, 4 Sep 2014 02:55:16 +0000 (22:55 -0400)]
localed: log locale/keymap changes in detail

Converting X11 to legacy keymaps and back is a fucking mess. Let's
make it at least possible to request detailed logs of what is being
changed and why (LOG_DEBUG level).

At LOG_INFO level, we would log the requested change of X11 or console
keymap, but not the resulting change after conversion to console or X11.
Make sure that every change of configuration on disk has a matching
line in the logs.

9 years agolocaled: remove free_and_copy
Zbigniew Jędrzejewski-Szmek [Thu, 4 Sep 2014 02:53:23 +0000 (22:53 -0400)]
localed: remove free_and_copy

It was mostly a duplicate of free_and_strdup().

9 years agolocaled: double free in error path and modernization
Zbigniew Jędrzejewski-Szmek [Wed, 3 Sep 2014 14:28:24 +0000 (10:28 -0400)]
localed: double free in error path and modernization

Very unlikely to trigger, but in principle strv_free
could be called twice: once explictly, and once from cleanup.

9 years agobuild-sys: configure option to disable hibernation
Umut Tezduyar Lindskog [Tue, 2 Sep 2014 10:31:49 +0000 (12:31 +0200)]
build-sys: configure option to disable hibernation

9 years agoman: two fixes, reported on irc by 'wget'
Lennart Poettering [Wed, 3 Sep 2014 17:31:22 +0000 (19:31 +0200)]
man: two fixes, reported on irc by 'wget'

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

9 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.

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

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

9 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.

9 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.

9 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

https://bugzilla.redhat.com/show_bug.cgi?id=634736

9 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 <mlichvar@redhat.com> 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.

9 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 <mlichvar@redhat.com>

9 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.

9 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

9 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.

9 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 <phomes@gmail.com>.

9 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
          loading?

Followup for v216-119-gbe2ea723b1.

9 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
shortcomings:
 * 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

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

9 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

9 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

9 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

9 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 <ssuominen@gentoo.org>.

9 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

9 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.

https://bugs.freedesktop.org/show_bug.cgi?id=82832

9 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.

9 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

9 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
concurrently.

https://bugs.freedesktop.org/show_bug.cgi?id=82778
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=757072

9 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

https://bugs.freedesktop.org/show_bug.cgi?id=83091

[zj: add comment]

9 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.

9 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/libc.so.6+0x200df)
    #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

9 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

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

9 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

9 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.

9 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

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

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

9 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.

9 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

9 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

9 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: https://bugs.archlinux.org/task/41719

9 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.

9 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
synchronized.

Ignore replies with root distance over 5 seconds.

9 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

9 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.

9 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

9 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

9 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
verify.

9 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

9 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.

9 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
it!

9 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.

9 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

9 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

9 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

9 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

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

9 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

9 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.

9 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
again.

9 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

9 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 <dh.herrmann@gmail.com>
    Date:   Fri Aug 22 14:41:37 2014 +0200

        shared: make container_of() use unique variable names

9 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
reference.

9 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.

9 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.

9 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.

9 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.

9 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
should.

9 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.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758392
https://bugs.freedesktop.org/show_bug.cgi?id=82894

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

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

9 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.

9 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.

9 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.

9 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.

9 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
interface.

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.

9 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.

9 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).

9 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:

  bus_message_map_all_properties():
      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.

  bus_message_map_properties_changed():
      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.

9 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.

9 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
to:
    udevadm: missing or unknown command

9 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.

9 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
variables.

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, ...).

9 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
follow-ups.

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

9 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

9 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

9 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.

https://launchpad.net/bugs/902332

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

https://bugs.freedesktop.org/show_bug.cgi?id=83015

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

9 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.

9 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
implementation.

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

9 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.

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

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.

9 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

https://bugs.freedesktop.org/show_bug.cgi?id=82485

9 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