Commit graph

4013 commits

Author SHA1 Message Date
Yu Watanabe c9f620bfec core: support unit specifiers in IODeviceWeight= and friends 2018-05-20 23:08:50 +09:00
Yu Watanabe 063c4b1a92 core/load-fragment: update log messages 2018-05-20 23:08:29 +09:00
David Tardon a7a7163df7 fix race between daemon-reload and other commands
When "systemctl daemon-reload" is run at the same time as "systemctl
start foo", the latter might hang. That's because commands like start
wait for JobRemoved signal to know when the job is finished. But if the
job is finished during reloading, the signal is never sent.

The hang can be easily reproduced by running

    # for ((N=1; N>0; N++)) ; do echo $N ; systemctl daemon-reload ; done
    # for ((N=1; N>0; N++)) ; do echo $N ; systemctl start systemd-coredump.socket ; done

in two different terminals. The start command will hang after 1-2
iterations.

This keeps track of jobs that were started before reload and finished
during it and sends JobRemoved after the reload has finished.
2018-05-19 11:37:00 +02:00
Lennart Poettering 6f8fa29465
Merge pull request #8981 from keszybz/ratelimit-and-dbus
Ratelimit renaming and dbus error message fix
2018-05-18 21:38:30 +02:00
Franck Bui 752bcb770b core: keep the kernel coredump defaults when systemd-coredump is disabled
If systemd-coredump is disabled (at build time), PID1 should keep the
(old) kernel defaults as they are.
2018-05-18 20:37:54 +02:00
Lennart Poettering c385b10a13
Merge pull request #8993 from keszybz/sd-resolve-coverity-and-related-fixes
sd-resolve coverity and related fixes
2018-05-18 20:30:12 +02:00
Lennart Poettering 0612ac38a7
Merge pull request #8985 from yuwata/bus-macro-3
tree-wide: use BUS_DEFINE_PROPERTY_GET* macros
2018-05-18 20:25:52 +02:00
Lennart Poettering c55b280158
Merge pull request #9026 from yuwata/followup-9021
core: refuse StateDirectory=private
2018-05-18 20:02:43 +02:00
Yu Watanabe 5e2d3a5496 core: use free_and_replace() 2018-05-18 17:35:23 +09:00
Yu Watanabe e760d687dc core: fix coding style 2018-05-18 17:34:59 +09:00
Zbigniew Jędrzejewski-Szmek 7fbb5dd5e2
Merge pull request #8940 from poettering/nspawn-attrs
nspawn: make a couple of additional container parameters configurable
2018-05-18 10:33:10 +02:00
Yu Watanabe 8994a11790 core: refuse StateDirectory=private
Follow-up for e886568873 (#9021).
2018-05-18 13:30:21 +09:00
Lennart Poettering e886568873 core: refuse StateDirectory=private, as our internal DynamicUser=1 symlink is called that way
Let's better be safe than sorry.
2018-05-18 10:59:15 +09:00
Lennart Poettering 9f8168eb23 process-util: add new helper call for adjusting the OOM score
And let's make use of it in execute.c
2018-05-17 20:47:21 +02:00
Lennart Poettering e9eb2c02f0 basic: split parsing of the OOM score adjust value into its own function in parse-util.c
And port config_parse_exec_oom_score_adjust() over to use it.

While we are at it, let's also fix config_parse_exec_oom_score_adjust()
to accept an empty string for turning off OOM score adjustments set
earlier.
2018-05-17 20:47:21 +02:00
Lennart Poettering 34a5df58da rlimit-util: introduce setrlimit_closest_all()
This new call applies all configured resource limits in one.
2018-05-17 20:40:04 +02:00
Lennart Poettering 31ce987c2b rlimit-util: add a common destructor call for arrays of struct rlimit 2018-05-17 20:36:52 +02:00
Lennart Poettering 4f424df760 core: move config_parse_limit() to the generic conf-parser.[ch]
That way we can use it in nspawn.

Also, while we are at it, let's rename the call config_parse_rlimit(),
i.e. insert the "r", to clarify what kind of limit this is about.
2018-05-17 20:36:52 +02:00
Lennart Poettering 6550c24c7f rlimit-util: rework rlimit_{from|to}_string() to work without "Limit" prefix
let's make the call more generic, so that we can also easily use it for
parsing "RLIMIT_xyz" style constants.
2018-05-17 20:36:52 +02:00
Yu Watanabe a8f2b6912e core: systemd1.manage-unit-files policy implies systemd1.manage-units
This makes e.g. `systemctl enable --now` ask password only once.

Follow-up for b07abe63d3abf03df559f7cb2c9863943df22274.
2018-05-18 00:02:58 +09:00
Yu Watanabe 51b66c7a8a core: systemd1.manage-unit-files policy implies systemd1.reload-daemon
Closes #5013.
2018-05-15 15:01:05 -07:00
Felipe Sateler 57b7a260c2 core: undo the dependency inversion between unit.h and all unit types 2018-05-15 14:24:34 -04:00
Felipe Sateler 90a8f0b9a9 core: Break circular dependency between unit.h and cgroup.h 2018-05-15 14:23:32 -04:00
Yu Watanabe 14f7edb094 core/dbus-unit: do not pass whole Unit object 2018-05-15 23:11:26 +09:00
Yu Watanabe 874bd264a0 core/dbus-unit: introduce unit_can_{start,stop,isolate}_refuse_manual() functions 2018-05-15 23:11:20 +09:00
Yu Watanabe 92c23c5a70 core: use BUS_DEFINE_PROPERTY_GET* macros 2018-05-15 23:11:16 +09:00
Alan Jenkins 4330dc03a0 service: FileDescriptorStoreMax should also imply NotifyAccess
Commenting out "WatchdogTimeout=3min" in systemd-logind.service causes
NotifyAccess to go from "main" to "none", breaking support for logind
restart.  Let's fix that.
2018-05-15 12:33:56 +02:00
Zbigniew Jędrzejewski-Szmek 6978efcffb core/mount-setup: remove part of check which is always true
f1470e424b removed one check, but missed a similar
one a few lines down.

CID #1390949.
2018-05-14 08:50:00 +02:00
Yu Watanabe af4fa99d6a core: use _cleanup_set_free_ instread of _cleanup_(set_freep) 2018-05-14 14:13:57 +09:00
Zbigniew Jędrzejewski-Szmek 886eaf052d core: remove two unnecessary newlines 2018-05-13 22:08:30 +02:00
Zbigniew Jędrzejewski-Szmek 930c124c3f pid1: do not write invalid utf-8 in error message
We'd write a sequence that was invalid unicode and this caused the d-bus
connection to be terminated:

$ busctl get-property org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/dbus_2esocket org.freedesktop.systemd1.Unit SubState
s "running"
$ busctl get-property org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/dbus_e2socket org.freedesktop.systemd1.Unit SubState
Remote peer disconnected
$ busctl get-property org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/dbus_e2socket org.freedesktop.systemd1.Unit SubState
(hangs)

Fixes #8978.
2018-05-13 22:08:30 +02:00
Zbigniew Jędrzejewski-Szmek 7994ac1d85 Rename ratelimit_test to ratelimit_below
When I see "test", I have to think three times what the return value
means. With "below" this is immediately clear. ratelimit_below(&limit)
sounds almost like English and is imho immediately obvious.

(I also considered ratelimit_ok, but this strongly implies that being under the
limit is somehow better. Most of the times this is true, but then we use the
ratelimit to detect triple-c-a-d, and "ok" doesn't fit so well there.)

C.f. a1bcaa07.
2018-05-13 22:08:30 +02:00
Yu Watanabe 3ff52e8f52 dbus-manager: introduce property_get_{hashmap,set}_size() 2018-05-13 12:21:17 +09:00
Yu Watanabe d1d8547137 dbus-unit: check userdata before obtaining data 2018-05-13 12:21:15 +09:00
Yu Watanabe cb7f88fcf4 dbus-unit: use BUS_DEFINE_PROPERTY_GET* macros 2018-05-13 12:21:13 +09:00
Yu Watanabe 6bfb45bea4 dbus-swap: use BUS_DEFINE_PROPERTY_GET* macros 2018-05-13 12:21:11 +09:00
Yu Watanabe a54f28bc1e dbus-socket: use BUS_DEFINE_PROPERTY_GET* macros 2018-05-13 12:21:09 +09:00
Yu Watanabe f724fd4c25 dbus-mount: use BUS_DEFINE_PROPERTY_GET* macros 2018-05-13 12:21:08 +09:00
Yu Watanabe 23c9a63a98 dbus-manager: use BUS_DEFINE_PROPERTY_GET* macros 2018-05-13 12:21:06 +09:00
Yu Watanabe 019b34cae6 dbus-execute: use BUS_DEFINE_PROPERTY_GET* macros 2018-05-13 12:21:04 +09:00
David Tardon 95f14a3e21 core: use automatic cleanup more 2018-05-12 18:29:41 +02:00
David Tardon c0a1bfacfe systemd-analyze: make dump work for large # of units
If there is a large number of units, the size of the generated dump
string can overstep DBus message size limit. So let's pass that string
via a fd.
2018-05-11 08:11:02 -07:00
Lennart Poettering e4915c2797
Merge pull request #8953 from yuwata/bus-macro
core: simplify dbus properties
2018-05-10 22:51:17 -07:00
Yu Watanabe 945403e6ed path-util: introduce empty_to_root() and use it many places 2018-05-11 01:47:33 +09:00
Yu Watanabe 54138a8de1 core: merge duplicated functions 2018-05-11 01:41:06 +09:00
Yu Watanabe 79a603758d core: send NULL instead of empty string 2018-05-11 01:22:49 +09:00
Yu Watanabe 9d5527f26e core: use offsetof() for Syslog{Level,Facility} dbus properties 2018-05-11 00:39:52 +09:00
Zbigniew Jędrzejewski-Szmek 717fb9bc24
Merge pull request #8950 from dtardon/cleanup
use automatic cleanup more
2018-05-10 17:23:40 +02:00
Yu Watanabe 0515650329 core: use bus_property_get_*() functions instead of NULL 2018-05-10 23:02:57 +09:00
Yu Watanabe cf9d43a8e0 core: drop property_get_syscall_errno() 2018-05-10 22:36:13 +09:00