1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-27 10:25:37 +03:00
Commit Graph

30270 Commits

Author SHA1 Message Date
Lennart Poettering
86ffb32560 execute: drop explicit log_open()/log_close() now that it is unnecessary 2017-09-26 17:46:34 +02:00
Lennart Poettering
2c027c62dd execute: make use of the new logging mode in execute.c 2017-09-26 17:46:34 +02:00
Lennart Poettering
16e4fd87c5 log: add a mode where we open the log fds for every single log message
This we can then make use in execute.c to make error logging a bit less
special when preparing for process execution, as we can still log but
don't have any fds open continously.
2017-09-26 17:46:33 +02:00
Lennart Poettering
7558e10c98 log: let's make use of the fact that our functions return the negative error code for log_oom() too 2017-09-26 17:46:33 +02:00
Lennart Poettering
82677ae4c7 execute: downgrade a log message ERR → WARNING, since we proceed ignoring its result 2017-09-26 17:46:33 +02:00
Lennart Poettering
8002fb9747 execute: rework logging in setup_keyring() to include unit info
Let's use log_unit_error() instead of log_error() everywhere (and
friends).
2017-09-26 17:46:33 +02:00
Lennart Poettering
dedf371909 swap: introduce SWAP_STATE_WITH_PROCESS() similar to MOUNT_STATE_WITH_PROCESS() 2017-09-26 16:17:22 +02:00
Lennart Poettering
50864457e1 swap: adjust swap.c in a similar way to what we just did to mount.c
Also drop the redundant states and make all similar changes too.
Thankfully the swap.c state engine is much simpler than mount.c's, hence
this should be easier to digest.
2017-09-26 16:17:22 +02:00
Lennart Poettering
c634f3d2fc mount: rename mount_state_active() → MOUNT_STATE_WITH_PROCESS()
The function returns true for all states that have a control process
running, and each time we call it that's what we want to know, hence
let's rename it accordingly. Moreover, the more generic unit states have
an ACTIVE state, and it is defined quite differently from the set of
states this function returns true for, hence let's avoid confusion and
not reuse the word "ACTIVE" here in a different context.

Finally, let's uppercase this, since in most ways it's pretty much
identical to a macro
2017-09-26 16:17:22 +02:00
Lennart Poettering
22af0e5873 mount: rework mount state engine
This changes the mount unit state engine in the following ways:

1. The MOUNT_MOUNTING_SIGTERM and MOUNT_MOUNTING_SIGKILL are removed.
   They have been pretty much equivalent to MOUNT_UNMOUNTING_SIGTERM and
   MOUNT_UNMOUNTING_SIGKILL in what they do, and the outcome has been
   the same as well: the unit is stopped. Hence, let's simplify things a
   bit, and merge them. Note that we keep
   MOUNT_REMOUNTING_{SIGTERM|SIGKILL} however, as those states have a
   different outcome: the unit remains started.

2. mount_enter_signal() will now honour the SendSIGKILL= option of the
   mount unit if it was set. This was previously done already when we
   entered the signal states through a timeout, and was simply missing
   here.

3. A new helper function mount_enter_dead_or_mounted() is added that
   places the mount unit in either MOUNT_DEAD or MOUNT_MOUNTED,
   depending on what the kernel thinks about the mount's state. This
   function is called at various places now, wherever we finished an
   operation, and want to make sure our own state reflects again what
   the kernel thinks. Previously we had very similar code in a number of
   places and in other places didn't recheck the kernel state. Let's do
   that with the same logic and function at all relevant places now.

4. Rework mount_stop(): never forget about running control processes.
   Instead: when we have a start (i.e. a /bin/mount) process running,
   and are asked to stop, then enter the kill states for it, so that it
   gets cleaned up. This fixes #6048. Moreover, when we have a reload
   process running convert the possible states into the relevant
   unmounting states, so that we can properly execute the requested
   operation.

Fixes #6048
2017-09-26 16:17:22 +02:00
Lennart Poettering
850b741084 mount: clean up reload_result management a bit
Let's only collect the first failure in the load result, and let's clear
it explicitly when we are about to enter a new reload operation. This
makes it more alike the handling of the main result value (which also
only stores the first failure), and also the handling of service.c's
reload state.
2017-09-26 16:17:22 +02:00
Lennart Poettering
a6951a5079 service: rework service_kill_control_processes()
Let's make sure we explicitly also kill any control process we know of,
given that it might have moved outside of our control group.
2017-09-26 16:17:22 +02:00
Lennart Poettering
ca543871b7 set: add new helper set_make() which is like set_new() + multiple set_put() in vararg 2017-09-26 16:17:22 +02:00
Jan Synacek
0cde65e263 test-cpu-set-util.c: fix typo in comment (#6916) 2017-09-26 16:07:34 +02:00
Zbigniew Jędrzejewski-Szmek
4005677730 basic/log: fix return value from log_struct_iovec_internal()
This returned value so far wasn't used anywhere, so there's no change
in behaviour.
2017-09-26 16:04:33 +02:00
Lennart Poettering
2ebc688fc1 Merge pull request #6917 from keszybz/restore-some-tests
Restore some tests
2017-09-26 16:00:28 +02:00
Jan Synacek
efd0802231 test-cpu-set-util.c: fix typo in comment (#6916) 2017-09-26 13:50:31 +02:00
Zbigniew Jędrzejewski-Szmek
fdf666bc76 meson: hook up hwdb-test.sh again
The motivation for the ./systemd-hwdb is the same as in the grandparent
for systemd-sysv-generator.
2017-09-26 13:44:38 +02:00
Zbigniew Jędrzejewski-Szmek
b7191b2a9b meson: hook up udev-test.pl again
Seems it was dropped along with the automake rules in
72cdb3e783.
2017-09-26 13:44:38 +02:00
Zbigniew Jędrzejewski-Szmek
73e406e140 sysv-generator-test: do not query $builddir
This variable is not set by meson, so let's not try to use it.

We could use some more elaborate scheme (e.g. based on $MESON_BUILD_ROOT and
$MESON_SUBDIR) to find the path to systemd-sysv-generator, but it seems
that plain ./systemd-sysv-generator works just as well and has the advantage
that it's easy to invoke the test by hand (as long as one cd's to the
meson build dir).
2017-09-26 13:44:38 +02:00
Zbigniew Jędrzejewski-Szmek
a4b57b322e sysv-generator-test: drop python2 work-around
We require python3 for meson anyway, so support python2 doesn't seem
useful anymore.
2017-09-26 13:44:38 +02:00
Lennart Poettering
f39c13e093 journal-verfiy: add a couple of missing le64toh() calls (#6888)
Apparently BE users don't verify their journals...

Noticed as result of #6887
2017-09-25 22:26:10 +02:00
Jonathan Lebon
35207e259e string-util: use size_t for strjoina macro (#6914)
`strlen` returns a `size_t` and `alloca` expects a `size_t`.
2017-09-25 21:56:57 +02:00
Zbigniew Jędrzejewski-Szmek
3594f80144 install: drop left-over debug message (#6913) 2017-09-25 19:59:49 +02:00
Zbigniew Jędrzejewski-Szmek
c533658a1c shared/bus-util: format uid==-1 and gid==-1 as [not set]
$ systemctl show systemd-journald -p UID,GID
UID=4294967295
GID=4294967295

↓

$ systemctl show systemd-journald -p UID,GID
UID=[not set]
GID=[not set]

Just seeing the number is very misleading.

Fixes #6511.
2017-09-25 11:23:59 +02:00
Zbigniew Jędrzejewski-Szmek
6088cefb21 basic/cap-list: report empty capability set as ""
$ systemctl show systemd-journald -p CapabilityBoundingSet,AmbientCapabilities
CapabilityBoundingSet=cap_chown cap_dac_override cap_dac_read_search cap_fowner cap_setgid ...
AmbientCapabilities=(null)

↓

$ systemctl show systemd-journald -p CapabilityBoundingSet,AmbientCapabilities
CapabilityBoundingSet=cap_chown cap_dac_override cap_dac_read_search cap_fowner cap_setgid ...
AmbientCapabilities=

Partially fixes #6511. Add some basic tests for the printing function.
2017-09-25 11:11:20 +02:00
Zbigniew Jędrzejewski-Szmek
efaa3176ad Merge pull request #6893 from poettering/cgroup-delegate-yay
cgroup delegation fixes, as well as socket unit slice assignment
2017-09-24 20:53:04 +02:00
Zbigniew Jędrzejewski-Szmek
a2deeb41f6 Merge pull request #6891 from poettering/read-line
add read_line() helper as bounded getline() and make use of it at some places
2017-09-24 20:51:01 +02:00
Lennart Poettering
cddaa1f034 Merge pull request #6887 from rantala/6447
journal: add object sanity check to journal_file_move_to_object() (#6447)
2017-09-24 19:52:07 +02:00
Zbigniew Jędrzejewski-Szmek
2e33df93de fileio: return 0 from read_one_line_file on success
Fixup for f4b51a2d09. Suggested by Evgeny Vereshchagin.
2017-09-24 14:27:21 +02:00
Tommi Rantala
10e8445bcc journal: add missing le64toh() calls in journal_file_check_object()
Lennart Poettering noticed missing le64toh() calls.
2017-09-24 11:56:52 +03:00
Zbigniew Jędrzejewski-Szmek
2c9de13912 test-fileio: also test read_line() with actual files
Just in case the real FILE and the one from fmemopen weren't exactly
the same.
2017-09-24 10:50:27 +02:00
Zbigniew Jędrzejewski-Szmek
9707d55213 test-fileio: close two leaked file handles 2017-09-24 10:50:27 +02:00
Zbigniew Jędrzejewski-Szmek
1b7ac91f94 man: add missing verb in timedatectl(1) (#6896)
As noted by Michael Biebl.
2017-09-23 16:51:41 +02:00
Zbigniew Jędrzejewski-Szmek
b6e386ca1c Merge pull request #6894 from poettering/read-full-file-optimize
fileio: various fixes
2017-09-23 13:31:02 +02:00
Lennart Poettering
b887cfa652 Merge pull request #6892 from keszybz/enablement-work
Fix various issues with enabled/disabled units
2017-09-23 12:44:49 +02:00
Zbigniew Jędrzejewski-Szmek
8f313f4feb test-conf-parser: add tests for the new long lines, including overflow handling 2017-09-23 11:08:57 +02:00
Zbigniew Jędrzejewski-Szmek
a12807aaea test-conf-parser: use _cleanup_ 2017-09-23 11:08:57 +02:00
Zbigniew Jędrzejewski-Szmek
f858e5148e fileio: use _cleanup_ for FILE unlocking 2017-09-23 11:08:57 +02:00
Lennart Poettering
620218fbd9 update TODO 2017-09-23 11:08:57 +02:00
Lennart Poettering
e6dde451a5 conf-parse: remove 4K line length limit
Let's use read_line() to solve our long line limitation.

Fixes #3302.
2017-09-23 11:08:57 +02:00
Zbigniew Jędrzejewski-Szmek
e3f46367f5 test-conf-parser: add some basic tests for config_parse()
This function is pretty important, but we weren't calling it directly
even once in tests.

v2: add a few tests for escaping and line continuations
2017-09-23 11:08:57 +02:00
Lennart Poettering
5a89faf0e0 fileio: initialize errno to zero before we do fread()
if there was something in the read buffer already errno might not be set
on error, let's detect that case.
2017-09-22 21:05:03 +02:00
Lennart Poettering
ff0e7e05c9 fileio: try to read one byte too much in read_full_stream()
Let's read one byte more than the file size we read from stat() on the
first fread() invocation. That way, the first read() will already be
short and indicate eof to fread().

This is a minor optimization, and replaces #3908.
2017-09-22 21:03:33 +02:00
Lennart Poettering
9dd1b1e869 fileio: move fsync() logic into write_string_stream_ts()
That way, write_string_stream_ts() becomes more powerful, and we can
remove duplicate code from  write_string_file_atomic() and
write_string_file_ts().
2017-09-22 20:59:39 +02:00
Lennart Poettering
b183713383 fileio: make write_string_stream() accept flags parameter
Let's make write_string_stream() and write_string_file() more alike, and
pass the same flag set so that we can remove a number of boolean
parameters.
2017-09-22 20:55:34 +02:00
Lennart Poettering
2eabcc772b fileio: support writing atomic files with timestamp
Let's make sure "ts" is taken into account when writing atomic files,
too.
2017-09-22 20:45:06 +02:00
Lennart Poettering
2351e44d3e cgroup-util: replace one use of fgets() by read_line() 2017-09-22 20:34:15 +02:00
Lennart Poettering
f4b51a2d09 fileio: rework read_one_line_file() on top of read_line() 2017-09-22 20:34:15 +02:00
Lennart Poettering
189912440f def: add new constant LONG_LINE_MAX
LONG_LINE_MAX is much like LINE_MAX, but longer.

As it turns out LINE_MAX at 4096 is too short for many usecases. Since
the general concept of having a common maximum line length limit makes
sense let's add our own, and make it larger (1MB for now).
2017-09-22 20:34:15 +02:00