Commit Graph

3138 Commits

Author SHA1 Message Date
Yu Watanabe 7a3c343cb8 tree-wide: use '#pragma once' for header guard
Follow-up for a2b635eb39 (#9959).
2018-08-30 06:10:43 +03:00
Zbigniew Jędrzejewski-Szmek 030836923d
Merge pull request #9901 from peterbaouoft/pr/preset_enable_multiple_instances
install: allow instantiated units to be enabled via presets
2018-08-29 14:22:27 +02:00
Ruixin Bao 1e475a0ab4 install: small refactor to combine two function calls into one function
Combine consecutive function calls of install_info_discover and
install_info_may_process into one short helper function.
2018-08-27 23:56:31 +00:00
Ruixin Bao 4c9565eea5 install: allow instantiated units to be enabled via presets
This patch implements https://github.com/systemd/systemd/issues/9421.

The .preset file now is able to take a rule in the format of:(e.g)
enable foo@.service bar0 bar1 bar2

In the above example, when preset-all is called, all three instances of
foo@bar0.service, foo@bar1.service and foo@bar2.service will be enabled.

When preset is called on a single service(e.g: foo@bar1.service), only
the mentioned one(foo@bar1.service) will be enabled.

Tests are added for future regression.
2018-08-27 23:56:24 +00:00
Yu Watanabe 8301aa0bf1 tree-wide: use DEFINE_TRIVIAL_REF_UNREF_FUNC() macro or friends where applicable 2018-08-27 14:01:46 +09:00
Yu Watanabe 7ecc4799a9
dissect: rescan devices before creating partition list (#9930)
Fixes #9924 which is caused by 3c1f2cee0a.
2018-08-24 22:34:13 +09:00
Yu Watanabe 152d0efa2b udev: move udev cleanup functions from udev-util.h to udev.h 2018-08-23 04:57:39 +09:00
Yu Watanabe 05becb11e8 udev-util: drop unused function udev_device_new_from_stat_rdev() 2018-08-23 04:57:39 +09:00
Yu Watanabe 3c1f2cee0a dissect: replace udev_device by sd_device 2018-08-23 04:57:39 +09:00
Yu Watanabe 7c7be5515f libudev: move cleanup functions from udev-util.h to libudev-private.h 2018-08-23 04:57:39 +09:00
Yu Watanabe 3938f568a2 libudev: accept NULL as the argument 'struct udev*' for udev_monitor_new() or friends
As udev_monitor struct or friends are now almost independent of udev
struct. So, generating these objects without udev struct is reasonable.
2018-08-23 04:57:39 +09:00
Tejun Heo 6ae4283cb1 core: add IODeviceLatencyTargetSec
This adds support for the following proposed latency based IO control
mechanism.

  https://lkml.org/lkml/2018/6/5/428
2018-08-22 16:46:18 +02:00
Zbigniew Jędrzejewski-Szmek 7692fed98b
Merge pull request #9783 from poettering/get-user-creds-flags
beef up get_user_creds() a bit and other improvements
2018-08-21 10:09:33 +02:00
Lennart Poettering fafff8f1ff user-util: rework get_user_creds()
Let's fold get_user_creds_clean() into get_user_creds(), and introduce a
flags argument for it to select "clean" behaviour. This flags parameter
also learns to other new flags:

- USER_CREDS_SYNTHESIZE_FALLBACK: in this mode the user records for
  root/nobody are only synthesized as fallback. Normally, the synthesized
  records take precedence over what is in the user database.  With this
  flag set this is reversed, and the user database takes precedence, and
  the synthesized records are only used if they are missing there. This
  flag should be set in cases where doing NSS is deemed safe, and where
  there's interest in knowing the correct shell, for example if the
  admin changed root's shell to zsh or suchlike.

- USER_CREDS_ALLOW_MISSING: if set, and a UID/GID is specified by
  numeric value, and there's no user/group record for it accept it
  anyway. This allows us to fix #9767

This then also ports all users to set the most appropriate flags.

Fixes: #9767

[zj: remove one isempty() call]
2018-08-20 15:58:21 +02:00
Lennart Poettering 91f4424012
Merge pull request #9817 from yuwata/shorten-error-logging
tree-wide: Shorten error logging and several code cleanups
2018-08-07 10:44:44 +02:00
Yu Watanabe fc95c359f6 tree-wide: use returned value from log_*_errno() 2018-08-07 15:48:37 +09:00
Filipe Brandenburger b994fe95a1 dns-domain: use CMP() in dns_name_compare_func 2018-08-06 19:26:44 -07:00
Zbigniew Jędrzejewski-Szmek 5a8b164092 meson: drop parens when appending to list
Meson does not care either way, so let's use the simpler syntax. And files()
already gives a list, so nesting this in a list wouldn't be necessary even
if meson did not flatten everything.
2018-07-31 21:02:01 +09:00
Lennart Poettering 904865b8c2 sleep-config: library code should not log beyond LOG_DEBUG 2018-07-26 11:01:29 +02:00
Lennart Poettering edda44605f sleep: offer hibernation only if the kernel image still exists
This makes hibernation unavailable if the kernel image we are currently
running was removed. This is supposed to be superficial protection
against hibernating a system we can never return from because the kernel
has been updated and the kernel we currently run is not available
anymore.

We look at a couple of places for the kernel, which should cover all
distributions I know off. Should I have missed a path I am sure people
will quickly notice and we can add more places to check. (or maybe
convince those distros to stick their kernels at a standard place)
2018-07-26 11:01:29 +02:00
Lennart Poettering 7474f15b2d sleep-config: eat up errors only after debug logging about them 2018-07-26 11:01:29 +02:00
Lennart Poettering 3dea6886c2 sleep-config: partitions can't be deleted, only files can
This fixes something I think was basically a typo introduced in
db69869f26.
2018-07-26 11:01:29 +02:00
Andrew Jorgensen 411ae92b40 shared/sleep-config: exclude zram devices from hibernation candidates
On a host with sufficiently large zram but with no actual swap, logind will
respond to CanHibernate() with yes. With this patch, it will correctly respond
no, unless there are other swap devices to consider.
2018-07-26 10:19:04 +02:00
Zbigniew Jędrzejewski-Szmek 54fe2ce1b9
Merge pull request #9504 from poettering/nss-deadlock
some nss deadlock love
2018-07-26 10:16:25 +02:00
Lennart Poettering f806dfd345 tree-wide: increase granularity of percent specifications all over the place to permille
We so far had various placed we'd parse percentages with
parse_percent(). Let's make them use parse_permille() instead, which is
downward compatible (as it also parses percent values), and increases
the granularity a bit. Given that on the wire we usually normalize
relative specifications to something like UINT32_MAX anyway changing
from base-100 to base-1000 calculations can be done easily without
breaking compat.

This commit doesn't document this change in the man pages. While
allowing more precise specifcations permille is not as commonly
understood as perent I guess, hence let's keep this out of the docs for
now.
2018-07-25 16:14:45 +02:00
Jon Ringle fbb48d4c66 Make final kill signal configurable
Usecase is to allow changing the final kill from SIGKILL to SIGQUIT which
should create a core dump useful for debugging why the service didn't stop
with the SIGTERM
2018-07-23 13:44:54 +02:00
Yu Watanabe ba323bbead meson: do not build module-util.c when libkmod is not found
Follow-up for 3cb9b42af3 (#9516).

Fixes oss-fuzz-9532.
2018-07-23 08:50:26 +02:00
Yu Watanabe f330408d62 tree-wide: drop empty lines in comments 2018-07-23 08:44:24 +02:00
Lennart Poettering 79d53eb8f7 bus-unit-util: tiny coding style fix 2018-07-20 16:57:35 +02:00
Lennart Poettering 496a6ba40e
Merge pull request #9516 from keszybz/module-load-unification
Module load unification
2018-07-20 13:55:56 +02:00
Zbigniew Jędrzejewski-Szmek 9b38ec87da shared/module-util: fix preexisting mixup with errno sign 2018-07-19 18:28:21 +02:00
Zbigniew Jędrzejewski-Szmek c3ad978633 udev-builtin-kmod: use the generic module_load() function
There should be no functional change.
2018-07-19 18:28:21 +02:00
Zbigniew Jędrzejewski-Szmek 3cb9b42af3 Move module-util.h to src/shared/ and load_module() to libshared
Unfortunately this needs libshared to link to libkmod. Before it was linked
into systemd-udevd, udevadm, and systemd each seperately. On most systems this
doesn't make much difference, because at least systemd would be installed, but
it might not be in small chroots. It is a small library, so I hope this is not
a big issue.
2018-07-16 13:08:40 +02:00
Tejun Heo 4842263577 core: add MemoryMin
The kernel added support for a new cgroup memory controller knob memory.min in
bf8d5d52ffe8 ("memcg: introduce memory.min") which was merged during v4.18
merge window.

Add MemoryMin to support memory.min.
2018-07-12 08:21:43 +02:00
Yu Watanabe 1e5f4e8ba2 conf-parser,login: logs description of error in parsing size 2018-07-03 15:18:04 +02:00
Lion Yang a9518dc369 seccomp: add swapcontext into @process for ppc32
There are some modern programming languages use userspace context switches
to implement coroutine features. PowerPC (32-bit) needs syscall "swapcontext" to get
contexts or switch between contexts, which is special.

Adding this rule should fix #9485.
2018-07-03 13:35:02 +02:00
Yu Watanabe 825862972e bus-util: update comment
Originally, request_name_handler_may_reload_dbus() was written for
timesyncd. But now it is also called by networkd or resolved.
2018-06-29 12:35:49 +09:00
Yu Watanabe afb76fdbff tree-wide: drop double newline 2018-06-29 11:02:17 +09:00
Yu Watanabe 8f5dd8c094 tree-wide: drop empty comments 2018-06-29 11:00:30 +09:00
Yu Watanabe 031651a57a bus-util: drop unnecessary !! 2018-06-29 10:38:31 +09:00
Yu Watanabe 04e075b572 bus-util: make log level lower in request_name_destroy_callback()
Fixes #9442.
2018-06-27 16:56:50 +02:00
Yu Watanabe d5c3091122 install: fix error handling in is_symlink_with_known_name() 2018-06-25 14:07:16 +09:00
Yu Watanabe 8838f46f93 machine-pool: drop unnecessary condition 2018-06-25 13:49:56 +09:00
Yu Watanabe 0ceff9068d bus-util: fix error handling 2018-06-25 13:08:02 +09:00
Yu Watanabe f18edd8a0a tree-wide: add multiple inclusion guard 2018-06-25 13:04:59 +09:00
Zbigniew Jędrzejewski-Szmek 25612ecba4 tree-wide: drop copyright lines for more authors
Acks in https://github.com/systemd/systemd/issues/9320.
2018-06-22 16:39:45 +02:00
Lennart Poettering be405b909e condition: add new conditon ConditionSecurity=uefi-secureboot
We have the detector call for this anyway, and it's useful for
conditioning out dbxtool.service, hence let's add this tiny new option.
2018-06-20 22:33:47 +02:00
Lennart Poettering 6dd9477dde
Merge pull request #9348 from keszybz/copyright-removal
Copyright removal
2018-06-20 12:27:56 +02:00
Zbigniew Jędrzejewski-Szmek d9b02e1697 tree-wide: drop copyright headers from frequent contributors
Fixes #9320.

for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do
  git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms'
done
2018-06-20 11:58:53 +02:00
Zbigniew Jędrzejewski-Szmek 3c47d50906 shared/path-lookup: remove unnecessary 'if' to help gcc
Fixes #9343.
2018-06-20 10:57:51 +02:00