1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-06 16:59:03 +03:00
Commit Graph

32987 Commits

Author SHA1 Message Date
Yu Watanabe
07411fd3bd timedate: move error mapping to bus-common-errors.[ch] 2018-04-17 14:03:25 +09:00
Zbigniew Jędrzejewski-Szmek
d6ea3b78a6 fuzz-unit-file: skip BOM (#8723)
Yet another false positive from ListenNetlink,
https://oss-fuzz.com/v2/testcase-detail/4908210742886400/7694.
2018-04-16 10:59:41 +02:00
dmig
20f978643f Support for Dell Inspiron 5378/5379 WLAN key (#8715) 2018-04-15 10:43:58 +02:00
guixxx
de03b29512 fix url for binfmt documentation (#8720)
this file went unnoticed in PR #6223
2018-04-14 15:15:19 +02:00
Giuseppe Scrivano
ef42f561fc src/core/dbus-cgroup.c: fix typo contoller -> controller (#8717)
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-04-14 11:06:11 +02:00
Zbigniew Jędrzejewski-Szmek
b037141d1b
Merge pull request #8271 from poettering/unit-prefix-search
Search unit .d/ drop-in files also in all "dash prefixes" of a unit
2018-04-13 14:45:51 +02:00
Zbigniew Jędrzejewski-Szmek
2c8a17d097
Merge pull request #8707 from poettering/copy-tweaks
tweaks to fd copying code
2018-04-13 12:10:17 +02:00
Lennart Poettering
6c0a77953c man: document the new dash truncation drop-in directories 2018-04-13 11:34:48 +02:00
Lennart Poettering
7ce49e656b test: add test for prefix unit loading 2018-04-13 11:34:48 +02:00
Lennart Poettering
5396624506 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
2018-04-13 11:34:48 +02:00
Lennart Poettering
eb2c3192dc 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.
2018-04-13 11:34:48 +02:00
Lennart Poettering
b119facd27 core: minor coding style changes 2018-04-13 11:34:48 +02:00
Lennart Poettering
952713b07a dropin: don't fully suppress logging about ENAMETOOLONG. Just downgrade to LOG_DEBUG 2018-04-13 11:34:48 +02:00
Lennart Poettering
77cc47d8b4 load-dropin: rename variable
We are converting the unit name into its template, hence name the
variable that way, instead of the misleading 'prefix'.
2018-04-13 11:34:48 +02:00
Lennart Poettering
72406c2f7d 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.
2018-04-13 11:34:48 +02:00
Lennart Poettering
39c3905646 copy: rearrange flags field definition
Let's use the usual 1U << 0,1,2,3,4 spelling for definiting flags enums.
2018-04-13 11:32:46 +02:00
Lennart Poettering
dd641ad1b8 copy: reduce number of checks
We check max_bytes twice here, let's simplify that, and reduce one level
of indentation.
2018-04-13 11:32:46 +02:00
Lennart Poettering
75036dce94 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.
2018-04-13 11:32:46 +02:00
Lennart Poettering
e0c5c7d8fa 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.
2018-04-13 11:32:46 +02:00
Lennart Poettering
7a23c7fdfe 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.
2018-04-13 11:32:46 +02:00
Lennart Poettering
5de6e11673 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.
2018-04-13 11:32:46 +02:00
Lennart Poettering
78ba8cf770 copy: add brief comment to copy_bytes() explaining its return values 2018-04-13 11:32:46 +02:00
Zbigniew Jędrzejewski-Szmek
812724c14b
Merge pull request #8710 from poettering/triviailities-yeah-yeah
some trivial additions and fixes
2018-04-12 22:21:15 +02:00
Leonard
d579a56c39 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.
2018-04-12 21:31:19 +02:00
Lennart Poettering
ce2090ab72 macro: don't rely on C's downgrade-to-bool feature for numeric comparisons 2018-04-12 11:02:47 +02:00
Lennart Poettering
42ce5f75bf install: minor enum beautifications 2018-04-12 11:02:47 +02:00
Lennart Poettering
7bc756ff00 update TODO 2018-04-12 11:02:47 +02:00
Lennart Poettering
fe4377faa5 importd: ensure we don't mishandle a NULL string 2018-04-12 11:02:47 +02:00
Lennart Poettering
8460289f35 path-util: document a few other special cases for last_path_component() 2018-04-12 11:02:47 +02:00
Lennart Poettering
342f6f80f5 process-util: add TAKE_PID(), similar to TAKE_PTR/TAKE_FD, but for child process PIDs 2018-04-11 22:30:04 +02:00
Lennart Poettering
1ce360813d 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.
2018-04-11 22:30:04 +02:00
Lennart Poettering
b667d50d34
Merge pull request #8700 from keszybz/hibernation
Various improvements related to hibernation
2018-04-11 10:26:27 +02:00
Zbigniew Jędrzejewski-Szmek
4638cd39af shared/sleep-config: rename misnamed function 2018-04-11 09:27:32 +02:00
Zbigniew Jędrzejewski-Szmek
b71c9758d1 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.
2018-04-11 09:26:14 +02:00
Zbigniew Jędrzejewski-Szmek
c8c8ee85af 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
2018-04-10 21:31:59 +02:00
Zbigniew Jędrzejewski-Szmek
bd062910c8 Move utility function to query unit state from systemctl to shared/ 2018-04-10 21:31:59 +02:00
Zbigniew Jędrzejewski-Szmek
c863dc0588 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.
2018-04-10 21:31:59 +02:00
Zbigniew Jędrzejewski-Szmek
6524f1a8eb shared/sleep-config: get rid of explicit allocation size calculation 2018-04-10 21:31:58 +02:00
Evgeny Vereshchagin
cf45dd3628
hwdb: drop a space (#8701)
This should make `parse_hwdb.py` and the CI happy again.
2018-04-10 22:10:52 +03:00
Lennart Poettering
4d09e1c8ba
Merge pull request #8676 from keszybz/drop-license-boilerplate
Drop license boilerplate
2018-04-10 14:53:31 +02:00
Zbigniew Jędrzejewski-Szmek
aad69cce2d
Merge pull request #8406 from dell/hibernate-disk-offset
Add support for setting a disk offset when hibernating
2018-04-10 09:53:17 +02:00
emelenas
87ca11cb92 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.
2018-04-10 08:15:25 +10:00
Stephen Hemminger
2063b5540e 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)
2018-04-09 22:25:08 +02:00
Mario Limonciello
0ca906ace0 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>
2018-04-09 13:17:56 -05:00
Mario Limonciello
17c40b3a8f 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>
2018-04-09 13:17:56 -05:00
Lennart Poettering
e89ab7f219
Merge pull request #8681 from keszybz/assorted-style-fixes
Assorted style fixes
2018-04-09 11:32:51 +02:00
Zbigniew Jędrzejewski-Szmek
f39cbb6e69 systemctl: pass BUS_MAP_STRDUP when needed (#8682)
This fixes an assert in "systemctl list-dependencies".
Follow-up for a7e4861c74.
2018-04-08 15:12:18 +09:00
Zbigniew Jędrzejewski-Szmek
0fad9daf4b time-sync-wait: trivial style fixes 2018-04-07 20:05:58 +02:00
Zbigniew Jędrzejewski-Szmek
30dd293c88 sd-event: use _cleanup_ to manage temporary references 2018-04-07 20:05:58 +02:00
Zbigniew Jędrzejewski-Szmek
1e9f0ccadf 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
2018-04-07 20:05:58 +02:00