chiark / gitweb /
elogind.git
6 years agoterminal: remove unused variable
Thomas Hindoe Paaboel Andersen [Wed, 27 Aug 2014 21:23:10 +0000 (23:23 +0200)]
terminal: remove unused variable

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

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

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

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

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

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

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

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

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

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

6 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

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

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

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

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

6 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

6 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

6 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

6 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

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

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

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

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

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

6 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

6 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

6 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

6 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

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

6 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

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

6 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

6 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'

6 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'

6 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'

6 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

6 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

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

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

6 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

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

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

6 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

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

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

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

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

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

6 years agoresolved: fix typo in log message
Lennart Poettering [Fri, 22 Aug 2014 14:58:25 +0000 (16:58 +0200)]
resolved: fix typo in log message

6 years agocore: print 'startup finished' messages even if we log to console
Lennart Poettering [Fri, 22 Aug 2014 14:41:00 +0000 (16:41 +0200)]
core: print 'startup finished' messages even if we log to console

6 years agocore: add support for a configurable system-wide start-up timeout
Lennart Poettering [Fri, 22 Aug 2014 14:36:38 +0000 (16:36 +0200)]
core: add support for a configurable system-wide start-up timeout

When this system-wide start-up timeout is hit we execute one of the
failure actions already implemented for services that fail.

This should not only be useful on embedded devices, but also on laptops
which have the power-button reachable when the lid is closed. This
devices, when in a backpack might get powered on by accident due to the
easily reachable power button. We want to make sure that the system
turns itself off if it starts up due this after a while.

When the system manages to fully start-up logind will suspend the
machine by default if the lid is closed. However, in some cases we don't
even get as far as logind, and the boot hangs much earlier, for example
because we ask for a LUKS password that nobody ever enters.

Yeah, this is a real-life problem on my Yoga 13, which has one of those
easily accessible power buttons, even if the device is closed.

6 years agomissing.h: add a cpp warning for __NR_memfd_create on MIPS
Daniel Mack [Fri, 22 Aug 2014 14:10:02 +0000 (16:10 +0200)]
missing.h: add a cpp warning for __NR_memfd_create on MIPS

6 years agomissing.h: add fake __NR_memfd_create for MIPS
Daniel Mack [Fri, 22 Aug 2014 13:39:36 +0000 (15:39 +0200)]
missing.h: add fake __NR_memfd_create for MIPS

We don't have the correct __NR_memfd_create syscall number yet, so set it to
0xffffffff for now to prevent compile time errors.

6 years agoshared: add MAXSIZE() and use it in resolved
David Herrmann [Fri, 22 Aug 2014 11:55:57 +0000 (13:55 +0200)]
shared: add MAXSIZE() and use it in resolved

The MAXSIZE() macro takes two types and returns the size of the larger
one. It is much simpler to use than MAX(sizeof(A), sizeof(B)) and also
avoids any compiler-extensions, unlike CONST_MAX() and MAX() (which are
needed to avoid evaluating arguments more than once). This was suggested
by Daniele Nicolodi <daniele@grinta.net>.

Also make resolved use this macro instead of CONST_MAX(). This enhances
readability quite a bit.

6 years agodbus1-generator: properly free the FILE*
Lennart Poettering [Fri, 22 Aug 2014 10:44:17 +0000 (12:44 +0200)]
dbus1-generator: properly free the FILE*

Also, rework the code to make use of fflush_and_check().

Issue discovered by Simon Danner.

6 years agoupdate TODO
Lennart Poettering [Thu, 21 Aug 2014 17:12:43 +0000 (19:12 +0200)]
update TODO

6 years agosystemctl: in list-unit-files, always show legend, even if we know about no unit...
Lennart Poettering [Thu, 21 Aug 2014 17:10:26 +0000 (19:10 +0200)]
systemctl: in list-unit-files, always show legend, even if we know about no unit files

6 years agoinstall: simplify usage of _cleanup_ macros
Lennart Poettering [Thu, 21 Aug 2014 17:08:30 +0000 (19:08 +0200)]
install: simplify usage of _cleanup_ macros

6 years agoservice: allow services of Type=oneshot that specify no ExecStart= commands
Lennart Poettering [Thu, 21 Aug 2014 16:50:42 +0000 (18:50 +0200)]
service: allow services of Type=oneshot that specify no ExecStart= commands

This is useful for services that simply want to run something on
shutdown, but not at bootup. They should only set ExecStop= but leave
ExecStart= unset.

6 years agoupdate TODO
Lennart Poettering [Thu, 21 Aug 2014 16:01:47 +0000 (18:01 +0200)]
update TODO

6 years agoservice: use the right timeout for stop processes we fork
Lennart Poettering [Thu, 21 Aug 2014 16:01:22 +0000 (18:01 +0200)]
service: use the right timeout for stop processes we fork

6 years agoexecute: explain in a comment, why close_all_fds() is invoked the second time differently
Lennart Poettering [Thu, 21 Aug 2014 15:35:19 +0000 (17:35 +0200)]
execute: explain in a comment, why close_all_fds() is invoked the second time differently

6 years agobus: when terminating our bus-actviated services that exit-on-idle send STOPPING...
Lennart Poettering [Thu, 21 Aug 2014 15:20:19 +0000 (17:20 +0200)]
bus: when terminating our bus-actviated services that exit-on-idle send STOPPING=1 via sd_notify()

This should fix a race where a service thatis idle drops its name, and
is immediately requested by another client, which causes dbus-daemon to
ask systemd to activate it again, but since systemd still assumes it is
running it won't do anything.

6 years agoupdate TODO
Lennart Poettering [Thu, 21 Aug 2014 15:20:00 +0000 (17:20 +0200)]
update TODO

6 years agonotify: send STOPPING=1 from our daemons
Lennart Poettering [Thu, 21 Aug 2014 15:19:28 +0000 (17:19 +0200)]
notify: send STOPPING=1 from our daemons

6 years agocore: allow informing systemd about service status changes with RELOADING=1 and STOPP...
Lennart Poettering [Thu, 21 Aug 2014 15:03:15 +0000 (17:03 +0200)]
core: allow informing systemd about service status changes with RELOADING=1 and STOPPING=1 sd_notify() messages

6 years agomanager: don#t dispatch sd_notify() messages and SIGCHLD multiple times to the same...
Lennart Poettering [Thu, 21 Aug 2014 14:52:41 +0000 (16:52 +0200)]
manager: don#t dispatch sd_notify() messages and SIGCHLD multiple times to the same units

6 years agomanager: reuse sockaddr_union instead of redefining our own version of it
Lennart Poettering [Thu, 21 Aug 2014 14:51:44 +0000 (16:51 +0200)]
manager: reuse sockaddr_union instead of redefining our own version of it

6 years agoservice,strv: introduce strv_find_startswith() and make use of it
Lennart Poettering [Thu, 21 Aug 2014 14:22:34 +0000 (16:22 +0200)]
service,strv: introduce strv_find_startswith() and make use of it

Unlike strv_find_prefix() the new call will return a pointer to the
suffix of the item we found, instead of the whole item. This is more
closer inline with what startswith() does, and allows us to simplify a
couple of invocations.

6 years agoservice: don't invoke functions at the same time as declaring variables
Lennart Poettering [Thu, 21 Aug 2014 14:20:17 +0000 (16:20 +0200)]
service: don't invoke functions at the same time as declaring variables

6 years agoservice: remove some pointless linebreaks, to make things more readable
Lennart Poettering [Thu, 21 Aug 2014 14:19:25 +0000 (16:19 +0200)]
service: remove some pointless linebreaks, to make things more readable

6 years agoservice: asynchronous_close() already checks for negative parameters, no need to...
Lennart Poettering [Thu, 21 Aug 2014 14:17:02 +0000 (16:17 +0200)]
service: asynchronous_close() already checks for negative parameters, no need to duplicate that

6 years agocore: unify how we generate the prefix string when dumping unit state
Lennart Poettering [Thu, 21 Aug 2014 14:15:49 +0000 (16:15 +0200)]
core: unify how we generate the prefix string when dumping unit state

6 years agoutil: make asynchronous_close() really work like an asynchronous version of safe_close()
Lennart Poettering [Thu, 21 Aug 2014 14:13:43 +0000 (16:13 +0200)]
util: make asynchronous_close() really work like an asynchronous version of safe_close()

Save/restore errno, like we do in safe_close(). And don't fork a thread
if the parameter is already negative.

6 years agoutil: simplify close_nointr() a bit
Lennart Poettering [Thu, 21 Aug 2014 14:13:15 +0000 (16:13 +0200)]
util: simplify close_nointr() a bit

6 years agoutil: change return value of startswith() to non-const
Lennart Poettering [Thu, 21 Aug 2014 14:10:59 +0000 (16:10 +0200)]
util: change return value of startswith() to non-const

This way we can use it on non-const strings, and don't end up with a
const'ified result.

This is similar to libc's strstr() which also takes a const string but
returns a non-const one.

6 years agoCODING_STYLE: document that we don't break lines at 80ch
Lennart Poettering [Thu, 21 Aug 2014 14:10:37 +0000 (16:10 +0200)]
CODING_STYLE: document that we don't break lines at 80ch

6 years agojournalctl: add "-t --identifier=STRING" option
Harald Hoyer [Tue, 19 Aug 2014 09:27:34 +0000 (11:27 +0200)]
journalctl: add "-t --identifier=STRING" option

This turns journalctl to the counterpart of systemd-cat.
Messages sent with

systemd-cat --identifier foo --prioritiy debug

can now be shown with

journalctl --identifier foo --prioritiy debug

"--identifier" is not merged with "--unit" to make a clear
distinction between syslog and systemd units.
syslog identifiers can be chosen freely by anyone.

6 years agosd-event: add API to access epoll_fd
Tom Gundersen [Fri, 15 Aug 2014 19:04:07 +0000 (21:04 +0200)]
sd-event: add API to access epoll_fd

This is a prerequisite for integrating sd-event into an external
event loop.

6 years agoresolved: write resolv.conf search - switch arguments
Tom Gundersen [Wed, 20 Aug 2014 13:56:14 +0000 (15:56 +0200)]
resolved: write resolv.conf search - switch arguments

Found by Lukáš Nykrýn.

6 years agojournal-upload: make sure that 'r' is initialized
Lukas Nykryn [Wed, 20 Aug 2014 13:13:06 +0000 (15:13 +0200)]
journal-upload: make sure that 'r' is initialized

6 years agoutil: return after freeing all members of array
Lukas Nykryn [Wed, 20 Aug 2014 13:02:09 +0000 (15:02 +0200)]
util: return after freeing all members of array

6 years agojournal-remote: remove unreachable code
Lukas Nykryn [Wed, 20 Aug 2014 12:51:27 +0000 (14:51 +0200)]
journal-remote: remove unreachable code

6 years agoresolved: fix which return codes we check
Lennart Poettering [Wed, 20 Aug 2014 12:47:35 +0000 (14:47 +0200)]
resolved: fix which return codes we check

Discovered by Lukas Nykryn

6 years agoresolved-dns-rr: fix typo
Lukas Nykryn [Wed, 20 Aug 2014 12:34:23 +0000 (14:34 +0200)]
resolved-dns-rr: fix typo

a->rrsig.type_covered != a->rrsig.type_covered" is always false
regardless of the values of its operands because those operands are identical.

6 years agomachine-id-setup: don't try to read UUID from VM/container manager if we operate...
Lennart Poettering [Wed, 20 Aug 2014 11:49:39 +0000 (13:49 +0200)]
machine-id-setup: don't try to read UUID from VM/container manager if we operate on a root directory that's not /

This should make sure no UUID from the host systemd-machine-id-setup is
running on leaks onto a disk image that is provisioned with the tool.

6 years agobuild: remove repeated KMOD section
Tom Gundersen [Wed, 20 Aug 2014 09:25:23 +0000 (11:25 +0200)]
build: remove repeated KMOD section

6 years agosystemctl: fail in the case that no unit files were found
Lukas Nykryn [Tue, 19 Aug 2014 18:53:29 +0000 (20:53 +0200)]
systemctl: fail in the case that no unit files were found

Previously systemctl died with message

-bash-4.2# systemctl --root /rawhi list-unit-files
(src/systemctl/systemctl.c:868) Out of memory.

in the case that no unit files were found in the --root
or the directory did not exist.

So lets return ENOENT in the case that --root does not exist
and empty list in the case that there are no unit files.

6 years agoCONST_MAX breaks gcc on fedora 20 with optimiztation v216
Lennart Poettering [Tue, 19 Aug 2014 22:57:17 +0000 (00:57 +0200)]
CONST_MAX breaks gcc on fedora 20 with optimiztation

6 years agobuild: include more optional modules in build string
Lennart Poettering [Tue, 19 Aug 2014 22:47:43 +0000 (00:47 +0200)]
build: include more optional modules in build string

6 years agoupdate hwdb
Lennart Poettering [Tue, 19 Aug 2014 22:38:39 +0000 (00:38 +0200)]
update hwdb

6 years agoindentation/spurious whitespace fixes
Lennart Poettering [Tue, 19 Aug 2014 22:18:04 +0000 (00:18 +0200)]
indentation/spurious whitespace fixes

6 years agojournal-upload: allow the tool to start
Lennart Poettering [Tue, 19 Aug 2014 22:17:46 +0000 (00:17 +0200)]
journal-upload: allow the tool to start

6 years agocmdline: for new tools avoid introduce new negative switches, and properly align...
Lennart Poettering [Tue, 19 Aug 2014 22:15:05 +0000 (00:15 +0200)]
cmdline: for new tools avoid introduce new negative switches, and properly align --help texts

Negative switches are a bad un-normalized thing. We alerady have some,
but we should try harder to avoid intrdoucing new ones.

Hence, instead of adding two switches:

        --foobar
        --no-foobar

Let's instead use the syntax

        --foobar
        --foobar=yes
        --foobar=no

Where the first two are equivalent. The boolean argument is parsed
following the usual rules.

Change all new negative switches this way.

This patch also properly aligns the --help table, so that single char
switches always get a column separate of the long switches.

6 years agoREADME: mention the new optional libidn dependency
Lennart Poettering [Tue, 19 Aug 2014 22:14:09 +0000 (00:14 +0200)]
README: mention the new optional libidn dependency

6 years agoupdate NEWS
Lennart Poettering [Tue, 19 Aug 2014 21:37:16 +0000 (23:37 +0200)]
update NEWS

6 years agoman: fix typos
Ronny Chevalier [Tue, 19 Aug 2014 21:21:43 +0000 (23:21 +0200)]
man: fix typos

6 years agoNEWS
Tom Gundersen [Tue, 19 Aug 2014 21:44:17 +0000 (23:44 +0200)]
NEWS

6 years agosysusers: initialize r
Thomas Hindoe Paaboel Andersen [Tue, 19 Aug 2014 21:27:44 +0000 (23:27 +0200)]
sysusers: initialize r

Needed for the stdin case where it could otherwise end up being used
uninitialized.