platform/upstream/systemd.git
6 years agounits: leave systemd-time-wait-sync disabled by default
Peter A. Bigot [Tue, 10 Apr 2018 16:05:25 +0000 (11:05 -0500)]
units: leave systemd-time-wait-sync disabled by default

Also mark its presence conditional on ENABLE_TIMESYNCD.

6 years agofix url for binfmt documentation (#8720)
guixxx [Sat, 14 Apr 2018 13:15:19 +0000 (10:15 -0300)]
fix url for binfmt documentation (#8720)

this file went unnoticed in PR #6223

6 years agosrc/core/dbus-cgroup.c: fix typo contoller -> controller (#8717)
Giuseppe Scrivano [Sat, 14 Apr 2018 09:06:11 +0000 (11:06 +0200)]
src/core/dbus-cgroup.c: fix typo contoller -> controller (#8717)

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
6 years agoMerge pull request #8271 from poettering/unit-prefix-search
Zbigniew Jędrzejewski-Szmek [Fri, 13 Apr 2018 12:45:51 +0000 (14:45 +0200)]
Merge pull request #8271 from poettering/unit-prefix-search

Search unit .d/ drop-in files also in all "dash prefixes" of a unit

6 years agoMerge pull request #8707 from poettering/copy-tweaks
Zbigniew Jędrzejewski-Szmek [Fri, 13 Apr 2018 10:10:17 +0000 (12:10 +0200)]
Merge pull request #8707 from poettering/copy-tweaks

tweaks to fd copying code

6 years agoman: document the new dash truncation drop-in directories
Lennart Poettering [Fri, 23 Feb 2018 19:42:57 +0000 (20:42 +0100)]
man: document the new dash truncation drop-in directories

6 years agotest: add test for prefix unit loading
Lennart Poettering [Wed, 21 Mar 2018 18:55:54 +0000 (19:55 +0100)]
test: add test for prefix unit loading

6 years agodropin: when looking for dropins for a unit, also look within "-" prefix unit dirs
Lennart Poettering [Fri, 23 Feb 2018 11:32:23 +0000 (12:32 +0100)]
dropin: when looking for dropins for a unit, also look within "-" prefix unit dirs

This extends the logic by which we look for drop-ins for unit files when
loading them. Previously for a unit "foo-quux-bar.service" we'd look in
a directory "foo-quux-bar.service.d" accompanying it for extension
dropins. With this change we'll additionally look in:
"foo-quux-.service.d" and "foo-.service.d", i.e. we'll truncate the unit
name after every dash.

This is an alternative to templating for many services, as it permits
configuring defaults for sets of units that all use the same prefix in
the unit name. This is particularly useful in slice, mount and
automount units which reflect a hierarchy of concepts, as it permits
setting defaults for specific subsets of the tree. For example, in order
to provide every user with a memory of 1G it's now possible to do:

    # mkdir -p /etc/systemd/system/user-.slice.d
    # cat > /etc/systemd/system/user-.slice.d/50-memory.conf << EOF
    [Slice]
    MemoryMax=1G
    EOF
    # systemctl daemon-reload

This makes use of the fact that every user gets his own slice unit when
logging in, named "user-$UID.slice".

This doesn't precisely provide what is requested in #2556, but it does
provide equivalent functionality.

Fixes: #2556
See: #3504 #7599

6 years agosystemctl: fix indentation in output of "systemcl status" if there are multiple drop...
Lennart Poettering [Fri, 23 Feb 2018 11:31:30 +0000 (12:31 +0100)]
systemctl: fix indentation in output of "systemcl status" if there are multiple drop-in dirs

We were a few whitespace off. Let's fix that.

6 years agocore: minor coding style changes
Lennart Poettering [Fri, 23 Feb 2018 11:30:14 +0000 (12:30 +0100)]
core: minor coding style changes

6 years agodropin: don't fully suppress logging about ENAMETOOLONG. Just downgrade to LOG_DEBUG
Lennart Poettering [Wed, 21 Mar 2018 18:08:46 +0000 (19:08 +0100)]
dropin: don't fully suppress logging about ENAMETOOLONG. Just downgrade to LOG_DEBUG

6 years agoload-dropin: rename variable
Lennart Poettering [Fri, 23 Feb 2018 11:20:14 +0000 (12:20 +0100)]
load-dropin: rename variable

We are converting the unit name into its template, hence name the
variable that way, instead of the misleading 'prefix'.

6 years agounit-name: add new unit_name_build_from_type() helper
Lennart Poettering [Thu, 22 Feb 2018 17:24:57 +0000 (18:24 +0100)]
unit-name: add new unit_name_build_from_type() helper

The new helper is much like unit_name_build() but expects a UnitType
value instead of a suffix.

6 years agocopy: rearrange flags field definition
Lennart Poettering [Fri, 23 Mar 2018 17:27:31 +0000 (18:27 +0100)]
copy: rearrange flags field definition

Let's use the usual 1U << 0,1,2,3,4 spelling for definiting flags enums.

6 years agocopy: reduce number of checks
Lennart Poettering [Fri, 23 Mar 2018 17:26:58 +0000 (18:26 +0100)]
copy: reduce number of checks

We check max_bytes twice here, let's simplify that, and reduce one level
of indentation.

6 years agocopy: drop _unlikely_() that isn't obviously the case
Lennart Poettering [Fri, 23 Mar 2018 17:24:07 +0000 (18:24 +0100)]
copy: drop _unlikely_() that isn't obviously the case

If a tool only invokes copy_bytes() a single time the _unlikely_() will always be
wrong, and is hence not useful. Let's drop it and let the compiler
figure our what to do, instead of misleading it.

Also, some coding style imprvoements.

6 years agocopy: hide in copy_bytes() the strange way splice() handles O_NONBLOCK
Lennart Poettering [Fri, 23 Mar 2018 16:44:15 +0000 (17:44 +0100)]
copy: hide in copy_bytes() the strange way splice() handles O_NONBLOCK

splice() ignores O_NONBLOCK on pipes but not on other fds. Let's handle
that properly, and query O_ONBLOCK manually in that case, ensuring
systematic behaviour in either case.

6 years agocopy: extend copy_bytes() a bit
Lennart Poettering [Fri, 23 Mar 2018 15:41:42 +0000 (16:41 +0100)]
copy: extend copy_bytes() a bit

Optionally, when we copy between fds with simple read/write, let's
return any remaining data we already read into the buffer if write
fails. This is useful to allow callers to use the read data otherwise,
perhaps implementing a different fallback for copying.

6 years agocopy: tweak reflink logic in copy_bytes() a bit
Lennart Poettering [Fri, 23 Mar 2018 15:36:56 +0000 (16:36 +0100)]
copy: tweak reflink logic in copy_bytes() a bit

Let's use btrfs_clone_range() if partial copies are desired. And use
btrfs_reflink() only for full-file reflinks.

6 years agocopy: add brief comment to copy_bytes() explaining its return values
Lennart Poettering [Fri, 9 Mar 2018 21:44:47 +0000 (22:44 +0100)]
copy: add brief comment to copy_bytes() explaining its return values

6 years agoMerge pull request #8710 from poettering/triviailities-yeah-yeah
Zbigniew Jędrzejewski-Szmek [Thu, 12 Apr 2018 20:21:15 +0000 (22:21 +0200)]
Merge pull request #8710 from poettering/triviailities-yeah-yeah

some trivial additions and fixes

6 years agoISO-C compatibility: Remove empty initializer (#8713)
Leonard [Thu, 12 Apr 2018 19:31:19 +0000 (21:31 +0200)]
ISO-C compatibility:  Remove empty initializer (#8713)

ISO-C doesn't allow empty initializers, so replace it by explicitly
initializing to zero.

Also add braces because x is a union and we initialize a subobject, so
a compiler might warn about suggesting braces.  Shut that up.

6 years agomacro: don't rely on C's downgrade-to-bool feature for numeric comparisons
Lennart Poettering [Wed, 11 Apr 2018 19:36:52 +0000 (21:36 +0200)]
macro: don't rely on C's downgrade-to-bool feature for numeric comparisons

6 years agoinstall: minor enum beautifications
Lennart Poettering [Mon, 9 Apr 2018 17:45:04 +0000 (19:45 +0200)]
install: minor enum beautifications

6 years agoupdate TODO
Lennart Poettering [Fri, 6 Apr 2018 16:57:48 +0000 (18:57 +0200)]
update TODO

6 years agoimportd: ensure we don't mishandle a NULL string
Lennart Poettering [Fri, 6 Apr 2018 16:57:36 +0000 (18:57 +0200)]
importd: ensure we don't mishandle a NULL string

6 years agopath-util: document a few other special cases for last_path_component()
Lennart Poettering [Thu, 5 Apr 2018 16:00:39 +0000 (18:00 +0200)]
path-util: document a few other special cases for last_path_component()

6 years agoprocess-util: add TAKE_PID(), similar to TAKE_PTR/TAKE_FD, but for child process...
Lennart Poettering [Tue, 27 Mar 2018 13:01:02 +0000 (15:01 +0200)]
process-util: add TAKE_PID(), similar to TAKE_PTR/TAKE_FD, but for child process PIDs

6 years agoutil: introduce typesafe_qsort(), a typesafe version of qsort()/qsort_safe()
Lennart Poettering [Tue, 27 Mar 2018 12:56:29 +0000 (14:56 +0200)]
util: introduce typesafe_qsort(), a typesafe version of qsort()/qsort_safe()

It does two things:

1. It derives the element size from the array argument type

2. It derives the right type for the function from the array argument
   type

Using this macro call should make the invocations of qsort() quite a bit
safer.

6 years agoMerge pull request #8700 from keszybz/hibernation
Lennart Poettering [Wed, 11 Apr 2018 08:26:27 +0000 (10:26 +0200)]
Merge pull request #8700 from keszybz/hibernation

Various improvements related to hibernation

6 years agoshared/sleep-config: rename misnamed function
Zbigniew Jędrzejewski-Szmek [Wed, 11 Apr 2018 07:27:32 +0000 (09:27 +0200)]
shared/sleep-config: rename misnamed function

6 years agoshared/sleep-config: return a custom message when not enough swap for hibernation
Zbigniew Jędrzejewski-Szmek [Wed, 11 Apr 2018 06:51:06 +0000 (08:51 +0200)]
shared/sleep-config: return a custom message when not enough swap for hibernation

$ sudo swapoff -av
swapoff /dev/vda4
$ sudo systemctl hibernate
Failed to hibernate system via logind: Not enough swap space for hibernation

Fixes #6729.

6 years agologind: refuse operations if the target unit is masked or unavailable
Zbigniew Jędrzejewski-Szmek [Tue, 10 Apr 2018 11:15:00 +0000 (13:15 +0200)]
logind: refuse operations if the target unit is masked or unavailable

If hibernate.target is masked, and systemctl hibernate is invoked, havoc ensues.
logind starts the hibernation operation, but then doesn't go through with it;
gnome-shell segfaults. Let's be nice to the user and refuse doing anything in
that case.

$ sudo systemctl mask hibernate.target
$ busctl call org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager CanHibernate
s "no"
$ sudo systemctl hibernate
Failed to hibernate system via logind: Access denied
Failed to start hibernate.target: Unit hibernate.target is masked.

https://bugzilla.redhat.com/show_bug.cgi?id=1468003#c4

6 years agoMove utility function to query unit state from systemctl to shared/
Zbigniew Jędrzejewski-Szmek [Tue, 10 Apr 2018 10:35:36 +0000 (12:35 +0200)]
Move utility function to query unit state from systemctl to shared/

6 years agoshared/sleep-fix: fix check if s-then-h is possible
Zbigniew Jędrzejewski-Szmek [Tue, 10 Apr 2018 09:39:14 +0000 (11:39 +0200)]
shared/sleep-fix: fix check if s-then-h is possible

can_sleep() returns 0 if the operation is impossible, but
the code assumed that negative is returned in that case,
in effect reporting s2h was possible even if hibernation or
suspend were not possible.

6 years agoshared/sleep-config: get rid of explicit allocation size calculation
Zbigniew Jędrzejewski-Szmek [Tue, 10 Apr 2018 09:23:46 +0000 (11:23 +0200)]
shared/sleep-config: get rid of explicit allocation size calculation

6 years agohwdb: drop a space (#8701)
Evgeny Vereshchagin [Tue, 10 Apr 2018 19:10:52 +0000 (22:10 +0300)]
hwdb: drop a space (#8701)

This should make `parse_hwdb.py` and the CI happy again.

6 years agoMerge pull request #8676 from keszybz/drop-license-boilerplate
Lennart Poettering [Tue, 10 Apr 2018 12:53:31 +0000 (14:53 +0200)]
Merge pull request #8676 from keszybz/drop-license-boilerplate

Drop license boilerplate

6 years agoMerge pull request #8406 from dell/hibernate-disk-offset
Zbigniew Jędrzejewski-Szmek [Tue, 10 Apr 2018 07:53:17 +0000 (09:53 +0200)]
Merge pull request #8406 from dell/hibernate-disk-offset

Add support for setting a disk offset when hibernating

6 years agoAdd override axis for Toshiba Satellite R830 (#8694)
emelenas [Mon, 9 Apr 2018 22:15:25 +0000 (00:15 +0200)]
Add override axis for Toshiba Satellite R830 (#8694)

Incorrect range and resolution for the touchpad at a Toshiba Satellite R830 reported by kernel. After running

$ sudo touchpad-edge-detector 85x50 /dev/input/event4

the new axis overrides are as follows

#Toshiba Satellite R830
evdev:name:SynPS/2 Synaptics TouchPad:dmi:svnTOSHIBA:pnSATELLITER830
EVDEV_ABS_00=1238:5785:53
EVDEV_ABS_01=1045:4826:76
EVDEV_ABS_35=1238:5785:53
EVDEV_ABS_36=1045:4826:76

Those overrides have been tested to work.

6 years agohwdb: add support for VMBUS guids (#8677)
Stephen Hemminger [Mon, 9 Apr 2018 20:25:08 +0000 (13:25 -0700)]
hwdb: add support for VMBUS guids (#8677)

This addresses missing feature on #8677

Devices in Hyper-V/Azure exist on vmbus and are identified by
UUID value. This patch adds a hardware table so that udevadm
can report properties. I chose names are based on the values
reported in Window Device Manager (for consistency).
The table includes several devices that are not used by Linux
but are present and ignored.

For example:

$ udevadm info -q property /sys/bus/vmbus/devices/58f75a6d-d949-4320-99e1-a2a2576d581c
DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0004:00/VMBUS:00/58f75a6d-d949-4320-99e1-a2a2576d581c
DRIVER=hid_hyperv
ID_MODEL_FROM_DATABASE=Microsoft Hyper-V Mouse
MODALIAS=vmbus:9eb6a8cf4a5bc04cb98b8ba1a1f3f95a
SUBSYSTEM=vmbus
USEC_INITIALIZED=11076966

Or with updated kernel the driverctl script.

$ driverctl -b vmbus -v list-devices
1eccfd72-4b41-45ef-b73a-4a6e44c12924 hv_balloon (Microsoft Hyper-V Dynamic Memory)
242ff919-07db-4180-9c2e-b86cb68c8c55 hv_util (Microsoft Hyper-V Data Exchange)
2450ee40-33bf-4fbd-892e-9fb06e9214cf hv_util (Microsoft Hyper-V Backup/Restore)
2dd1ce17-079e-403c-b352-a1921ee207ee hv_util (Microsoft Hyper-V Time Sync)
4487b255-b88c-403f-bb51-d1f69cf17f87 (none) (Microsoft Hyper-V Virtual Machine Activation)
53557f8e-057d-425b-9265-01c0fd7e273e hv_netvsc (Microsoft Hyper-V Network Adapter)
5620e0c7-8062-4dce-aeb7-520c7ef76171 hyperv_fb (Microsoft Hyper-V Video)
58f75a6d-d949-4320-99e1-a2a2576d581c hid_hyperv (Microsoft Hyper-V Mouse)
849a776e-8120-4e4a-9a36-7e3d95ac75b3 hv_netvsc (Microsoft Hyper-V Network Adapter)
99221fa0-24ad-11e2-be98-001aa01bbf6e (none) (Microsoft Hyper-V Remote Desktop Control)
b2f44faf-2a29-42ba-91b2-f13fd30a2d4b hv_storvsc (Microsoft Hyper-V SCSI Controller)
b6650ff7-33bc-4840-8048-e0676786f393 hv_util (Microsoft Hyper-V Guest Shutdown)
d34b2567-b9b6-42b9-8778-0a4ec0b955bf hyperv_keyboard (Microsoft Hyper-V Keyboard)
f5bee29c-1741-4aad-a4c2-8fdedb46dcc2 (none) (Microsoft Hyper-V Remote Desktop Virtualization)
fd149e91-82e0-4a7d-afa6-2a4166cbd7c0 hv_util (Microsoft Hyper-V Heartbeat)

6 years agosleep: Move the error level debugging for write_mode and write_state
Mario Limonciello [Thu, 29 Mar 2018 13:56:23 +0000 (08:56 -0500)]
sleep: Move the error level debugging for write_mode and write_state

This makes it more consistent with other code used in the file.

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
6 years agosleep: Add support for setting a disk offset when hibernating
Mario Limonciello [Thu, 8 Mar 2018 08:41:50 +0000 (02:41 -0600)]
sleep: Add support for setting a disk offset when hibernating

The Linux kernel is adding support for configuring the offset
into a disk.  This allows swapfiles to be more usable as users
will no longer need to set the offset on their kernel command
line.

Use this API in systemd when hibernating as well.

Signed-off-by: Mario Limonciello <mario.limonciello@dell.com>
6 years agoMerge pull request #8681 from keszybz/assorted-style-fixes
Lennart Poettering [Mon, 9 Apr 2018 09:32:51 +0000 (11:32 +0200)]
Merge pull request #8681 from keszybz/assorted-style-fixes

Assorted style fixes

6 years agosystemctl: pass BUS_MAP_STRDUP when needed (#8682)
Zbigniew Jędrzejewski-Szmek [Sun, 8 Apr 2018 06:12:18 +0000 (08:12 +0200)]
systemctl: pass BUS_MAP_STRDUP when needed (#8682)

This fixes an assert in "systemctl list-dependencies".
Follow-up for a7e4861c7471bfe563078d11acbcecbf2d755462.

6 years agotime-sync-wait: trivial style fixes
Zbigniew Jędrzejewski-Szmek [Sat, 7 Apr 2018 17:19:49 +0000 (19:19 +0200)]
time-sync-wait: trivial style fixes

6 years agosd-event: use _cleanup_ to manage temporary references
Zbigniew Jędrzejewski-Szmek [Sat, 7 Apr 2018 17:14:37 +0000 (19:14 +0200)]
sd-event: use _cleanup_ to manage temporary references

6 years agoanalyze: give a hint what is it means that boot is still active
Zbigniew Jędrzejewski-Szmek [Sat, 7 Apr 2018 16:43:47 +0000 (18:43 +0200)]
analyze: give a hint what is it means that boot is still active

$ build/systemd-analyze time
Bootup is not yet finished (org.freedesktop.systemd1.Manager.FinishTimestampMonotonic=0).
Please try again later.
Hint: Use 'systemctl list-jobs' to see active jobs

6 years agocore: minor comment update
Zbigniew Jędrzejewski-Szmek [Wed, 4 Apr 2018 12:36:56 +0000 (14:36 +0200)]
core: minor comment update

6 years agodissect: drop unnecessary parenthesis
Zbigniew Jędrzejewski-Szmek [Wed, 4 Apr 2018 07:05:56 +0000 (09:05 +0200)]
dissect: drop unnecessary parenthesis

6 years agoanalyze: Do no require a full d-bus bus for the plot command (#8539)
Guillem Jover [Sat, 7 Apr 2018 18:02:20 +0000 (20:02 +0200)]
analyze: Do no require a full d-bus bus for the plot command (#8539)

The plot command requires a full d-bus bus to fetch the host
information, which seems rather optional, and having a running dbus
daemon is not always desirable. So instead, we try to acquire a full
bus, and if that fails we acquire the systemd bus, in which case we
omit the host information from the output.

We refactor acquire_bus() into two new functions which in addition
makes the call sites clearer.

6 years agosystemd-udevd: limit children-max by available memory (#8668)
Martin Wilck [Sat, 7 Apr 2018 15:33:48 +0000 (17:33 +0200)]
systemd-udevd: limit children-max by available memory (#8668)

Udev workers consume typically 50-100MiB virtual memory.
On systems with lots of CPUs and relatively low memory, that may
easily cause workers to be OOM-killed.

This patch limits the number of workers to 8 per GiB memory.
But don't let the limit drop below the smallest value we had
without this patch (8 + 1 * 2 = 10); on small systems, udev's
memory footprint is likely lower.

6 years agoClarify checker/helper in systemd-fsck@.service manpage (#8674)
Brian J. Murrell [Sat, 7 Apr 2018 15:12:26 +0000 (11:12 -0400)]
Clarify checker/helper in systemd-fsck@.service manpage (#8674)

Clarify the helper/checker terminology in the systemd-fsck@.service manpage to
make the description more clear about what is responsible for deciding if a filesystem
needs checking.

6 years agosrc/network: add missing SPDX identifiers
Zbigniew Jędrzejewski-Szmek [Fri, 6 Apr 2018 17:02:13 +0000 (19:02 +0200)]
src/network: add missing SPDX identifiers

6 years agotree-wide: drop license boilerplate
Zbigniew Jędrzejewski-Szmek [Fri, 6 Apr 2018 16:58:55 +0000 (18:58 +0200)]
tree-wide: drop license boilerplate

Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.

6 years agofuzz-unit-file: allow a space between variable name and "=" (#8670)
Zbigniew Jędrzejewski-Szmek [Fri, 6 Apr 2018 09:36:17 +0000 (11:36 +0200)]
fuzz-unit-file: allow a space between variable name and "=" (#8670)

The parser allows that, so the check when to skip needs this too.

https://oss-fuzz.com/v2/issue/5106486364602368/7422

6 years agoMerge pull request #8663 from poettering/dissect-tighten
Zbigniew Jędrzejewski-Szmek [Fri, 6 Apr 2018 08:14:25 +0000 (10:14 +0200)]
Merge pull request #8663 from poettering/dissect-tighten

Small fixes for image dissection code.

6 years agocore/device: remove unnecessary check (#8661)
Yu Watanabe [Fri, 6 Apr 2018 06:45:13 +0000 (15:45 +0900)]
core/device: remove unnecessary check (#8661)

Follow-up for 0dfb0a0abd98f8726a39f26e4d737f47ec0fd53b.

6 years agonspawn: wait for network namespace creation before interface setup (#8633)
Philip Sequeira [Thu, 5 Apr 2018 14:04:27 +0000 (14:04 +0000)]
nspawn: wait for network namespace creation before interface setup (#8633)

Otherwise, network interfaces can be "moved" into the container's
namespace while it's still the same as the host namespace, in which case
e.g. host0 for a veth ends up on the host side instead of inside the
container.

Regression introduced in 0441378080489e4ab6704cd0a2d78cb1ceaca899.

Fixes #8599.

6 years agoMerge pull request #8662 from poettering/rfkill-enxio
Zbigniew Jędrzejewski-Szmek [Thu, 5 Apr 2018 11:20:38 +0000 (13:20 +0200)]
Merge pull request #8662 from poettering/rfkill-enxio

handle ENODEV and ENXIO gracefully in rfkill

6 years agodissect: when pulling metadata from an image, don't bother with /home or ESP
Lennart Poettering [Thu, 5 Apr 2018 11:15:43 +0000 (13:15 +0200)]
dissect: when pulling metadata from an image, don't bother with /home or ESP

When we try to read meta-data from an image, don't bother with mounting
/home or the ESP, as that's not where the metadata is. This not only
speeds things up a bit, but also has the benefit that setups where an
unencrypted root is mixed with an encrypted /home (which I have on one
of my own systems) won't result in errors that the crypto key is needed.

6 years agoupdate TODO
Lennart Poettering [Thu, 5 Apr 2018 11:07:31 +0000 (13:07 +0200)]
update TODO

6 years agojournald: bump rate limits (#8660)
David Tardon [Thu, 5 Apr 2018 11:06:59 +0000 (13:06 +0200)]
journald: bump rate limits (#8660)

Apparently, it is quite common to hit a problem, where systemd-journald
would drop messages because service is logging too fast.

6 years agodissect: tighten block device checks a bit
Lennart Poettering [Thu, 5 Apr 2018 11:03:37 +0000 (13:03 +0200)]
dissect: tighten block device checks a bit

This extends on #8609, and makes two changes:

1. We'll now explicitly check that the child devices of a block device
   we are interested in (i.e. the partitions) are block devices themselves.
   On newer kernels the mmc rpmb stuff is actually exposed as char rather
   than block device as before, and they probably should have been that in
   the first place. By adding this check we'll hence filter out these weird
   devices through a second rule too, that hopefully makes things a bit
   more future-proof, should more devices like this be added eventually,
   or other subsystems do a similar thing.

2. When counting partitions we'll now also check the devnum of the
   device being non-null, which we already do when matching up the devices
   in the second iteration. This should make things more robust, and
   prevent other kinds of miscounting, which after all was the main
   issue #8609 fixed.

6 years agorfkill: treat ENXIO/ENODEV the same way as ENOENT
Lennart Poettering [Thu, 5 Apr 2018 10:43:08 +0000 (12:43 +0200)]
rfkill: treat ENXIO/ENODEV the same way as ENOENT

If an rfkill device disappears between the time we get notified about
the existance and we fully opened it we might get ENXIO or ENODEV (i.e.
the two kinds of "device not found" errors, which are typically
generated when for example a device node has no actual backing device
behind it). let's handle that the same way as ENOENT, and downgrade the
log message to LOG_DEBUG.

Fixes: #8586

6 years agorfkill: use our usual style for writing destructors
Lennart Poettering [Thu, 5 Apr 2018 10:42:47 +0000 (12:42 +0200)]
rfkill: use our usual style for writing destructors

Let's accept NULL values gracefully, and let's return NULL.

6 years agoMerge pull request #8617 from keszybz/tmpfiles-relax
Lennart Poettering [Thu, 5 Apr 2018 09:54:02 +0000 (11:54 +0200)]
Merge pull request #8617 from keszybz/tmpfiles-relax

Do not exit with error when systemd-tmpfiles --boot fails

6 years agoMerge pull request #8656 from yuwata/random-fixes
Lennart Poettering [Thu, 5 Apr 2018 08:19:12 +0000 (10:19 +0200)]
Merge pull request #8656 from yuwata/random-fixes

use TAKE_PTR() and TAKE_FD() macros, and small fixes

6 years agotmpfiles: ignore "operational" errors during setup
Zbigniew Jędrzejewski-Szmek [Thu, 29 Mar 2018 14:37:21 +0000 (16:37 +0200)]
tmpfiles: ignore "operational" errors during setup

We still get the errors logged, but we don't fail the service. This
is better for users because rerunning tmpfiles-setup.service a second
time is dangerous (c.f. cd9f5b68ce08375eb1d68a4ddaa7a24a5092d7ba).
Note that this only touches sd-tmpfiles-setup.service and
sd-tmpfiles-setup-dev.service. sd-tmpfiles-clean.service is as before.

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

6 years agotmpfiles: add a new return code for "operational failure" when processing
Zbigniew Jędrzejewski-Szmek [Thu, 29 Mar 2018 14:19:33 +0000 (16:19 +0200)]
tmpfiles: add a new return code for "operational failure" when processing

Things can fail, and we have no control over it:
- file system issues (immutable bits, file system errors, MAC refusals, etc)
- kernel refusing certain arguments when writing to /proc/sys or /sys
Let's add a new code for the case where we parsed configuration but failed
to execute it because of external errors.

6 years agocore/device: trivial simplification
Yu Watanabe [Thu, 5 Apr 2018 05:24:59 +0000 (14:24 +0900)]
core/device: trivial simplification

6 years agotree-wide: use TAKE_PTR() and TAKE_FD() macros
Yu Watanabe [Thu, 5 Apr 2018 05:26:26 +0000 (14:26 +0900)]
tree-wide: use TAKE_PTR() and TAKE_FD() macros

6 years agonetwork: fix typo in log message
Yu Watanabe [Wed, 4 Apr 2018 15:33:22 +0000 (00:33 +0900)]
network: fix typo in log message

6 years agomeson: sort source files
Yu Watanabe [Tue, 3 Apr 2018 07:19:25 +0000 (16:19 +0900)]
meson: sort source files

6 years agobus-util: fix a meaningless assertion
Yu Watanabe [Thu, 29 Mar 2018 12:20:30 +0000 (21:20 +0900)]
bus-util: fix a meaningless assertion

6 years agoMerge pull request #8605 from poettering/drop-in-name-fix
Zbigniew Jędrzejewski-Szmek [Wed, 4 Apr 2018 09:52:14 +0000 (11:52 +0200)]
Merge pull request #8605 from poettering/drop-in-name-fix

Fix validation of unit file drop-in naming in install.c.

6 years agotest-path: Set umask explicitly (#8616)
Filipe Brandenburger [Wed, 4 Apr 2018 09:17:19 +0000 (02:17 -0700)]
test-path: Set umask explicitly (#8616)

Running `test-path` under an umask such as 027 fails with:

  Assertion '(s.st_mode & S_IRWXO) == 0004' failed at ../src/test/test-path.c:247, function test_path_makedirectory_directorymode(). Aborting.

Looking at directory /tmp/test-path_makedirectory, it was indeed created
with mode 0740, applying the umask to the requested 0744.

Set an explicit umask for this test, to ensure reproducible results.

6 years agounits: use `systemctl exit` to kill the user manager (#8648)
Filipe Brandenburger [Wed, 4 Apr 2018 09:14:37 +0000 (02:14 -0700)]
units: use `systemctl exit` to kill the user manager (#8648)

Use `systemctl --user --force exit` to implement the systemd-exit
user service.

This removes our dependence on an external `kill` binary and the
concerns about whether they recognize SIGRTMIN+n by name or what their
interpretation of SIGRTMIN is.

Tested: `systemctl --user start systemd-exit.service` kills the
  `systemd --user` instance for my user.

6 years agofix missed bracket of exec-personality-ppc64le.service (#8650)
Feng Sun [Wed, 4 Apr 2018 09:10:42 +0000 (17:10 +0800)]
fix missed bracket of exec-personality-ppc64le.service (#8650)

Signed-off-by: Neil Sun <neilsun@yunify.com>
6 years agoMerge pull request #8624 from yuwata/fix-8371
Zbigniew Jędrzejewski-Szmek [Wed, 4 Apr 2018 07:39:10 +0000 (09:39 +0200)]
Merge pull request #8624 from yuwata/fix-8371

bash-completion: fixes for busctl

6 years agooss-fuzz: Fallback to `ninja-build` when available (#8641)
Filipe Brandenburger [Wed, 4 Apr 2018 07:32:59 +0000 (00:32 -0700)]
oss-fuzz: Fallback to `ninja-build` when available (#8641)

The ninja binary is deployed as `ninja-build` in older distros such as
RHEL 7/CentOS 7.  Detect that and use `ninja-build` instead of `ninja`
when it's available.

6 years agoMerge pull request #8643 from poettering/coding-style-fixlets
Evgeny Vereshchagin [Tue, 3 Apr 2018 23:13:05 +0000 (02:13 +0300)]
Merge pull request #8643 from poettering/coding-style-fixlets

Trivial CODING_STYLE additions

6 years agoCODING_STYLE: document suggested suffixes to use in documentation
Lennart Poettering [Thu, 29 Mar 2018 14:28:21 +0000 (16:28 +0200)]
CODING_STYLE: document suggested suffixes to use in documentation

6 years agoCODING_STYLE: two minor additions
Lennart Poettering [Thu, 29 Mar 2018 14:28:00 +0000 (16:28 +0200)]
CODING_STYLE: two minor additions

6 years agoCODING_STYLE: mention that we ship .editconfig/.vimrc/.dir-locals.el in our repo
Lennart Poettering [Thu, 29 Mar 2018 14:27:45 +0000 (16:27 +0200)]
CODING_STYLE: mention that we ship .editconfig/.vimrc/.dir-locals.el in our repo

6 years agoupdate TODO
Lennart Poettering [Thu, 29 Mar 2018 15:47:03 +0000 (17:47 +0200)]
update TODO

6 years agotmpfiles: fix directory removal with force symlink (#8619)
Ricardo Salveti de Araujo [Tue, 3 Apr 2018 13:05:11 +0000 (10:05 -0300)]
tmpfiles: fix directory removal with force symlink (#8619)

symlink_atomic returns -EISDIR when the target symlink path is a
directory.

Fixes #7447

Signed-off-by: Ricardo Salveti <ricardo@opensourcefoundries.com>
6 years agocore: skip the removal of cgroups in the TEST_RUN_MINIMAL mode (#8622)
Evgeny Vereshchagin [Tue, 3 Apr 2018 13:04:22 +0000 (16:04 +0300)]
core: skip the removal of cgroups in the TEST_RUN_MINIMAL mode (#8622)

When `systemd` is run in the TEST_RUN_MINIMAL mode, it doesn't really
set up cgroups, so it shouldn't try to remove anything.

Closes https://github.com/systemd/systemd/issues/8474.

6 years agodissect: Don't count RPMB and boot partitions (#8609)
João Paulo Rechi Vita [Tue, 3 Apr 2018 12:51:18 +0000 (05:51 -0700)]
dissect: Don't count RPMB and boot partitions (#8609)

Filter-out RPMB partitions and boot partitions from MMC devices when
counting partitions enumerated by the kernel. Also factor out the now
duplicated code into a separate function.

This complement the previous fixes to the problem reported in
https://github.com/systemd/systemd/issues/5806

6 years agoMerge pull request #8628 from jwrdegoede/hwdb-sensors2
Lennart Poettering [Tue, 3 Apr 2018 12:49:39 +0000 (14:49 +0200)]
Merge pull request #8628 from jwrdegoede/hwdb-sensors2

Hwdb sensors2

6 years agoman: machinectl: update fedora exmple URL (#8642)
Radostin Stoyanov [Tue, 3 Apr 2018 03:06:53 +0000 (04:06 +0100)]
man: machinectl: update fedora exmple URL (#8642)

6 years agococcinelle: fix typo in file name (#8640)
Alexander Kurtz [Mon, 2 Apr 2018 14:30:26 +0000 (16:30 +0200)]
coccinelle: fix typo in file name (#8640)

6 years agoMerge pull request #8626 from floppym/initctl
Lennart Poettering [Sat, 31 Mar 2018 10:56:58 +0000 (12:56 +0200)]
Merge pull request #8626 from floppym/initctl

sysvinit-2.89 compatibility fixes

6 years agogenerate-af-list.sh: slightly generalize pattern, fix w/musl (#8629)
Will Dietz [Sat, 31 Mar 2018 10:55:45 +0000 (05:55 -0500)]
generate-af-list.sh: slightly generalize pattern, fix w/musl (#8629)

Accept definitions to other AF_ constants, not just PF_ ones,
such as:

  #define AF_LINUX AF_LOCAL

It may not be necessary to impose any restriction on the
definitions of the macros extracted, but for now
keep most of that requirement but match AF_* as well.

6 years agohwdb: Add accelerometer orientation quirk for the Pipo W4 tablet
Hans de Goede [Fri, 30 Mar 2018 21:39:29 +0000 (23:39 +0200)]
hwdb: Add accelerometer orientation quirk for the Pipo W4 tablet

Add an accelerometer orientation quirk for the Pipo W4 tablet.

6 years agosystemctl: try opening /run/initctl before /dev/initctl
Mike Gilbert [Fri, 30 Mar 2018 15:04:57 +0000 (11:04 -0400)]
systemctl: try opening /run/initctl before /dev/initctl

This ensures compatability with old/new sysvinit.

http://git.savannah.nongnu.org/cgit/sysvinit.git/commit/?id=80dbcf3de3c1b83aeaa713a8fe5b8d35d8649af2

6 years agounits: initctl: move the fifo to /run/initctl to match sysvinit
Mike Gilbert [Fri, 30 Mar 2018 15:00:17 +0000 (11:00 -0400)]
units: initctl: move the fifo to /run/initctl to match sysvinit

The fifo location was moved in sysvinit-2.89.

http://git.savannah.nongnu.org/cgit/sysvinit.git/commit/?id=80dbcf3de3c1b83aeaa713a8fe5b8d35d8649af2

6 years agohwdb: Add accelerometer orientation quirk for the Lenovo Ideapad Miix 310
Hans de Goede [Fri, 30 Mar 2018 18:00:27 +0000 (20:00 +0200)]
hwdb: Add accelerometer orientation quirk for the Lenovo Ideapad Miix 310

Add an accelerometer orientation quirk for the Lenovo Ideapad Miix 310.
Note this quirk is limited to the production batches which ship with a
portrait panel, rather then with a landscape panel (recognized by the
different BIOS version these 2 variants use).

6 years agohwdb: Add accelerometer orientation quirk for the MSI S100 2-in-1
Hans de Goede [Fri, 30 Mar 2018 15:10:21 +0000 (17:10 +0200)]
hwdb: Add accelerometer orientation quirk for the MSI S100 2-in-1

Add an accelerometer orientation quirk for the MSI S100 2-in-1.

6 years agohwdb: Add accelerometer orientation quirk for the Yours Y8W81 tablet
Hans de Goede [Fri, 9 Mar 2018 13:55:11 +0000 (14:55 +0100)]
hwdb: Add accelerometer orientation quirk for the Yours Y8W81 tablet

Add an accelerometer orientation quirk for the Yours Y8W81 8" tablet.

For future reference: this tablet has the same case and mostly the same
internals as the Chuwi Vi8. Both seem to be from an ODM called inet-tek.
Both are labelled: "INET-I86M-REVxx" on the PCB, with the Chuwi Vi8 being
REV03 (and having a ALC5640 audio codec) and the Yours Y8W81 being REV21
(and having a ALC5651 audio codec).