Commit Graph

439 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 54fcb6192c core: define "exit" and "exit-force" actions for user units and only accept that
We would accept e.g. FailureAction=reboot-force in user units and then do an
exit in the user manager. Let's be stricter, and define "exit"/"exit-force" as
the only supported actions in user units.

v2:
- rename 'exit' to 'exit-force' and add new 'exit'
- add test for the parsing function
2018-10-17 19:31:49 +02:00
Yu Watanabe 958b8c7bd7 core: fix member access within null pointer
config_parse_tasks_max() is also used for parsing system.conf or
user.conf. In that case, userdata is NULL.

Fixes #10362.
2018-10-11 22:23:39 +02:00
Zbigniew Jędrzejewski-Szmek 5a72417084 pid1: drop unused path parameter to add_two_dependencies_by_name() 2018-09-15 20:02:00 +02:00
Zbigniew Jędrzejewski-Szmek 35d8c19ace pid1: drop now-unused path parameter to add_dependency_by_name() 2018-09-15 19:57:52 +02: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
Yu Watanabe fd870bac25 core: introduce cgroup_add_device_allow() 2018-08-06 13:42:14 +09: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
Zsolt Dollenstein 566b7d23eb Add support for opening files for appending
Addresses part of #8983
2018-07-20 03:54:22 -07: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 6302d1ea07 core: drop unused log message
temporary_filesystem_add() does not parse mount options.
2018-06-24 19:06:24 +02:00
YmrDtnJu a26fec2408 core: Actually use the resolved path for TemporaryFileSystem= (#9385)
The code already resolves specifiers using unit_full_printf() but then uses the
unresolved version again for temporary_filesystem_add().
2018-06-23 08:17:07 +09:00
Yu Watanabe 1e8c7bd55c namespace: drop protect_{home,system}_or_bool_from_string()
The functions protect_{home,system}_from_string() are not used
except for defining protect_{home,system}_or_bool_from_string().
This makes protect_{home,system}_from_string() support boolean
strings, and drops protect_{home,system}_or_bool_from_string().
2018-06-15 11:32:27 +02:00
Lennart Poettering 96b2fb93c5 tree-wide: beautify remaining copyright statements
Let's unify an beautify our remaining copyright statements, with a
unicode ©. This means our copyright statements are now always formatted
the same way. Yay.
2018-06-14 10:20:21 +02:00
Lennart Poettering 0c69794138 tree-wide: remove Lennart's copyright lines
These lines are generally out-of-date, incomplete and unnecessary. With
SPDX and git repository much more accurate and fine grained information
about licensing and authorship is available, hence let's drop the
per-file copyright notice. Of course, removing copyright lines of others
is problematic, hence this commit only removes my own lines and leaves
all others untouched. It might be nicer if sooner or later those could
go away too, making git the only and accurate source of authorship
information.
2018-06-14 10:20:20 +02:00
Lennart Poettering 818bf54632 tree-wide: drop 'This file is part of systemd' blurb
This part of the copyright blurb stems from the GPL use recommendations:

https://www.gnu.org/licenses/gpl-howto.en.html

The concept appears to originate in times where version control was per
file, instead of per tree, and was a way to glue the files together.
Ultimately, we nowadays don't live in that world anymore, and this
information is entirely useless anyway, as people are very welcome to
copy these files into any projects they like, and they shouldn't have to
change bits that are part of our copyright header for that.

hence, let's just get rid of this old cruft, and shorten our codebase a
bit.
2018-06-14 10:20:20 +02:00
Lennart Poettering 57e84e7535 core: rework how we validate DeviceAllow= settings
Let's make sure we don't validate "char-*" and "block-*" expressions as
paths.
2018-06-11 18:01:06 +02:00
Lennart Poettering 9d5e9b4add cgroup: relax checks for block device cgroup settings
This drops needless safety checks that ensure we only reference block
devices for blockio/io settings. The backing code was already able to
accept regular file system paths too, in which case the backing device
node of that file system would be used. Hence, let's drop the artificial
restrictions and open up this underlying functionality.
2018-06-11 18:01:06 +02:00
Lennart Poettering 6f40aa4547 core: add a couple of more error cases that should result in "bad-setting"
This changes a number of EINVAL cases to ENOEXEC, so that we enter
"bad-setting" state if they fail.
2018-06-11 12:53:12 +02:00
Yu Watanabe f106314c89 conf-parser: remove redundant utf8-validity check 2018-06-04 01:38:54 +09:00
Yu Watanabe 2f4d31c117 load-fragment: use path_simplify_and_warn() where applicable 2018-06-03 23:59:42 +09:00
Yu Watanabe 858d36c1ec path-util: introduce path_simplify()
The function is similar to path_kill_slashes() but also removes
initial './', trailing '/.', and '/./' in the path.
When the second argument of path_simplify() is false, then it
behaves as the same as path_kill_slashes(). Hence, this also
replaces path_kill_slashes() with path_simplify().
2018-06-03 23:39:26 +09:00
Lennart Poettering 4a0dbb8129
Merge pull request #9083 from yuwata/empty-assignment
load-fragment: make many settings accept empty string
2018-05-31 11:13:52 +02:00
Yu Watanabe 17ee3d72da load-fragment: use free_and_replace() 2018-05-31 13:27:06 +09:00
Yu Watanabe 3c381a671f load-fragment: add missing oom check
Fixes CID#1391379.
2018-05-31 13:26:27 +09:00
Yu Watanabe 535775805a load-fragment: move macro-defined config parsers 2018-05-31 11:09:41 +09:00
Yu Watanabe 984faf29da load-fragment: use DEFINE_CONFIG_PARSE_*() macros 2018-05-31 11:09:41 +09:00
Yu Watanabe e405b67d23 load-fragment: make IPTOS= accept the empty string 2018-05-31 11:09:41 +09:00
Yu Watanabe 00463fbf0d load-fragment: make SocketProtocol= accept the empty string 2018-05-31 11:09:41 +09:00
Yu Watanabe fa65c28176 namespace: rename parse_protect_{home,system}_or_bool() to protect_{home,system}_or_bool_to_string()
Hence, we can define config_parse_protect_{home,system}() by using
DEFINE_CONFIG_PARSE_ENUM() macro.
2018-05-31 11:09:41 +09:00
Yu Watanabe b54e98ef8e socket-util: rename parse_socket_address_bind_ipv6_only_or_bool() to socket_address_bind_ipv6_only_or_bool_from_string()
Hence, we can define config_parse_socket_bind() by using
DEFINE_CONFIG_PARSE_ENUM() macro.
2018-05-31 11:09:41 +09:00
Yu Watanabe 0a9e363870 load-fragment: drop config_parse_no_new_privileges() and use config_parse_bool() instead 2018-05-31 11:09:41 +09:00
Yu Watanabe 862fcffd9c load-fragment: make WorkingDirectory= accept the empty string 2018-05-31 11:09:41 +09:00
Yu Watanabe fb27be3f60 load-fragment: use parse_sec_fix_0() instead of updating the value later 2018-05-31 11:09:41 +09:00
Yu Watanabe 6c58305ac3 load-fragment: use config_parse_sec_fix_0() for TimeoutStopSec= 2018-05-31 11:09:41 +09:00
Yu Watanabe 71e270150f load-fragment: always include config_parse_warn_compat() in the table used by unit_dump_config_items() 2018-05-31 11:09:41 +09:00
Yu Watanabe 47544ea1cb load-fragment: drop unused function config_parse_sysv_priority() 2018-05-31 11:09:41 +09:00
Yu Watanabe b00e1a9e2a load-fragment: make CPUSchedulingPolicy= accept the empty string 2018-05-31 11:09:41 +09:00
Yu Watanabe 617d253afa load-fragment: make IOScheduling{Class,Priority}= accept the empty string 2018-05-31 11:09:41 +09:00
Yu Watanabe de5e6038ca load-fragment: setting empty string to Nice= resets the previous assignments 2018-05-31 11:09:41 +09:00
Lennart Poettering 313b78569e core: drop deprecated (and ignored) configuration items from --dump-configuration-items output 2018-05-29 15:25:22 +02:00
Lennart Poettering cdc0f9be92
Merge pull request #8817 from yuwata/cleanup-nsflags
core: allow to specify RestrictNamespaces= multiple times
2018-05-24 16:49:13 +02:00
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
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
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 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 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