chiark / gitweb /
elogind.git
5 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

5 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

5 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

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

5 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

5 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

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

5 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

5 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

5 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]

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

5 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

5 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

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

5 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

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

5 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

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

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

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

5 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

5 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

5 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

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

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

5 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

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

5 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

5 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

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

5 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

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

5 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!

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

5 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

5 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

5 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

5 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

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

5 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

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

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

5 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

5 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

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

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

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

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

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

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

5 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

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

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

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

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

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

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

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

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

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

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

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

5 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

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

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

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

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

5 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

5 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

5 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

5 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

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

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

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

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

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

5 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

5 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

5 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

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

http://lists.freedesktop.org/archives/systemd-devel/2014-August/022460.html

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

5 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

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

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

5 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

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

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

5 years agotest-path-util: use assert_se in all assertions
Filipe Brandenburger [Tue, 26 Aug 2014 05:05:03 +0000 (22:05 -0700)]
test-path-util: use assert_se in all assertions

Otherwise they get optimized out when CPPFLAGS='-DNDEBUG' is used, and that
causes the tests to fail.

Tested:
- make check TESTS='test-path-util' CPPFLAGS='-DNDEBUG'

5 years agotest-compress: make sure asserts with side effects use assert_se()
Filipe Brandenburger [Tue, 26 Aug 2014 05:05:02 +0000 (22:05 -0700)]
test-compress: make sure asserts with side effects use assert_se()

Otherwise the test fails when built with CPPFLAGS='-DNDEBUG' which disables
assertions.

Tested:
- make check TESTS='test-compress' CPPFLAGS='-DNDEBUG'

5 years agonetworkd-wait-online: add missing short option 'i' to optstring
Łukasz Stelmach [Tue, 26 Aug 2014 10:28:28 +0000 (12:28 +0200)]
networkd-wait-online: add missing short option 'i' to optstring

5 years agomissing: add BPF_XOR
Michael Olbrich [Thu, 21 Aug 2014 10:38:08 +0000 (12:38 +0200)]
missing: add BPF_XOR

BPF_XOR was introduced in kernel 3.7

5 years agoNEWS: Fix typos.
Ansgar Burchardt [Mon, 25 Aug 2014 22:19:54 +0000 (00:19 +0200)]
NEWS: Fix typos.

5 years agoupdate TODO
Lennart Poettering [Tue, 26 Aug 2014 18:23:49 +0000 (20:23 +0200)]
update TODO

5 years agoudev: hwdb - do not look at "usb_device" parents
Kay Sievers [Tue, 26 Aug 2014 16:27:36 +0000 (18:27 +0200)]
udev: hwdb - do not look at "usb_device" parents

Based on a patch from Simon McVittie <simon.mcvittie@collabora.co.uk>.

Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758050

5 years agoRevert "systemctl: fix broken list-unit-files with --root"
Lennart Poettering [Tue, 26 Aug 2014 02:03:24 +0000 (04:03 +0200)]
Revert "systemctl: fix broken list-unit-files with --root"

This reverts commit 41a451cc2901a5deb985aea4cc8de204a22e5612.

This breaks checks for masking of units file, since we invoke
null_or_empty_path() on the resulting path.

5 years agoupdate TODO
Lennart Poettering [Tue, 26 Aug 2014 01:59:05 +0000 (03:59 +0200)]
update TODO

5 years agosd-event: sd_event_prepare - stay in PREPARED if sd_event_wait() indicates that no...
Tom Gundersen [Mon, 25 Aug 2014 22:22:06 +0000 (00:22 +0200)]
sd-event: sd_event_prepare - stay in PREPARED if sd_event_wait() indicates that no sources are pending

5 years agosd-event: split run into prepare/wait/dispatch
Tom Gundersen [Fri, 15 Aug 2014 16:49:29 +0000 (18:49 +0200)]
sd-event: split run into prepare/wait/dispatch

This will allow sd-event to be integrated into an external event loop, which
in turn will allow (say) glib-based applications to use our various libraries,
without manually integrating each of them (bus, rtnl, dhcp, ...).

The external event-loop should integrate sd-event int he following way:

Every iteration must start with a call to sd_event_prepare(), which will
return 0 if no event sources are ready to be processed, a positive value if
they are and a negative value on error. sd_event_prepare() may only be called
following sd_event_dispatch(); a call to sd_event_wait() indicating that no
sources are ready to be dispatched; or a failed call to sd_event_dispatch() or
sd_event_wait().

A successful call to sd_event_prepare() indicating that no event sources are
ready to be dispatched must be followed by a call to sd_event_wait(),
which will return 0 if it timed out without event sources being ready to
be processed, a negative value on error and a positive value otherwise.
sd_event_wait() may only be called following a successful call to
sd_event_prepare() indicating that no event sources are ready to be dispatched.

If sd_event_wait() indicates that some events sources are ready to be
dispatched, it must be followed by a call to sd_event_dispatch(). This
is the only time sd_event_dispatch() may be called.

5 years agosystemctl: fix broken list-unit-files with --root
Lukas Nykryn [Mon, 25 Aug 2014 13:29:50 +0000 (15:29 +0200)]
systemctl: fix broken list-unit-files with --root

This patch modifies unit_file_get_list which will now return
hashmap of structures where f->path is *without* root_dir prefix.

This change should be ok, because current code either does not use
root_dir at all or calls basename() on the f->path.

5 years agoupdate TODO
Lennart Poettering [Fri, 22 Aug 2014 16:10:22 +0000 (18:10 +0200)]
update TODO

5 years agocore: split up "starting" manager state into "initializing" and "starting"
Lennart Poettering [Fri, 22 Aug 2014 16:07:18 +0000 (18:07 +0200)]
core: split up "starting" manager state into "initializing" and "starting"

We'll stay in "initializing" until basic.target has reached, at which
point we will enter "starting".

This is preparation so that we can change the startip timeout to only
apply to the first phase of startup, not the full procedure.

5 years agocore: introduce "poweroff" as new failure action types
Lennart Poettering [Fri, 22 Aug 2014 14:59:46 +0000 (16:59 +0200)]
core: introduce "poweroff" as new failure action types

Also, change the default action on a system start-up timeout to powering off.