chiark / gitweb /
Sven Eden [Thu, 18 Jan 2018 22:01:12 +0000 (23:01 +0100)]
Prep v235.3 : Fix cgroup hierarchy detection code
There is no sub-grouping with elogind, so /sys/fs/cgroup/elogind is
not needed to be mounted as cgroup fs in legacy mode.
Fixes Bug https://bugs.gentoo.org/644834
Sven Eden [Mon, 15 Jan 2018 19:34:18 +0000 (20:34 +0100)]
Version 235.2 Release
Sven Eden [Mon, 15 Jan 2018 19:20:52 +0000 (20:20 +0100)]
If elogind is just started, /sys/fs/cgroup/elogind might not exist, yet on legacy and hybrid systems.
Sven Eden [Sun, 14 Jan 2018 17:09:55 +0000 (18:09 +0100)]
Version 235.1 Release
Sven Eden [Sun, 14 Jan 2018 17:07:25 +0000 (18:07 +0100)]
Prep 235: Don't allow multiple jobs being executed at the same time
Sven Eden [Thu, 11 Jan 2018 07:12:13 +0000 (08:12 +0100)]
Prep 235: Removed orphaned header
Sven Eden [Wed, 10 Jan 2018 17:06:23 +0000 (18:06 +0100)]
Prep 235: Make cgroups2 available, hybrid mode already works.
Sven Eden [Tue, 9 Jan 2018 17:59:35 +0000 (18:59 +0100)]
Prep 235: Make elogind masks in sd-bus.h c90 compatible again.
Sven Eden [Tue, 9 Jan 2018 17:57:22 +0000 (18:57 +0100)]
Prep 235: Enabled sd_peer_get_session() and sd_peer_get_owner_uid() to try to work with eloginds session id to user mapping.
Sven Eden [Tue, 9 Jan 2018 17:52:14 +0000 (18:52 +0100)]
Prep 235: Enabled sd_bus_creds_get_slice(), sd_bus_creds_get_user_slice(), sd_peer_get_user_slice() and sd_pid_get_user_slice() to try to work with eloginds session id to user mapping.
Sven Eden [Tue, 9 Jan 2018 17:35:22 +0000 (18:35 +0100)]
Prep 235: Enabled sd_peer_get_slice() and sd_pid_get_slice() to at least try to work. This is considered experimental.
Sven Eden [Tue, 9 Jan 2018 08:13:45 +0000 (09:13 +0100)]
Prep 235: Although systemd slices are unsupported, make cg_path_get_slice() available, but in 'elogind jargon'
Sven Eden [Tue, 9 Jan 2018 07:46:25 +0000 (08:46 +0100)]
src/systemd/meson.build: Fix add_install_script() call
Sven Eden [Mon, 8 Jan 2018 17:42:40 +0000 (18:42 +0100)]
Remove coccinelle files that slithered back in.
Sven Eden [Mon, 8 Jan 2018 07:37:08 +0000 (08:37 +0100)]
Dev: Add loginctl target to Code::Blocks project file
Sven Eden [Mon, 8 Jan 2018 07:36:28 +0000 (08:36 +0100)]
Prep 235: Add loginctl target to Makefile
Sven Eden [Fri, 15 Dec 2017 05:01:07 +0000 (06:01 +0100)]
Forgot to symlink _sdcommon.h
Sven Eden [Wed, 13 Dec 2017 18:21:30 +0000 (19:21 +0100)]
Prep 235: Implement an alternative approach for sd_pid_get_owner_uid(), making test-login to no longer fail.
Sven Eden [Wed, 13 Dec 2017 07:54:48 +0000 (08:54 +0100)]
Add test-login target for Code::Blocks for easier debugging.
Sven Eden [Wed, 13 Dec 2017 07:50:52 +0000 (08:50 +0100)]
sd-bus.h, sd-daemon.h : MAke elogind masks ISO C90 compatible.
Sven Eden [Tue, 12 Dec 2017 17:35:44 +0000 (18:35 +0100)]
basic/siphash24.c: Only disable -Wimplicit-fallthrough on gcc-7+
Sven Eden [Tue, 12 Dec 2017 17:32:40 +0000 (18:32 +0100)]
Update README - Attempt to reduce the chance of becoming flame-bait.
Sven Eden [Tue, 12 Dec 2017 17:21:24 +0000 (18:21 +0100)]
Prep v234.4: ake all supportable API functions visible
(v234 addition).
Sven Eden [Tue, 12 Dec 2017 17:18:28 +0000 (18:18 +0100)]
Prep v237.3: Make all supportable API functions visible
(v233 addition).
Sven Eden [Tue, 12 Dec 2017 17:06:57 +0000 (18:06 +0100)]
Prep v232.6: Make all supportable API functions visible
(v232 addition).
Sven Eden [Tue, 12 Dec 2017 17:02:58 +0000 (18:02 +0100)]
time-util: Disable explicit fallthrough wanring on gcc-7+
Sven Eden [Tue, 12 Dec 2017 06:54:16 +0000 (07:54 +0100)]
Prep 229.9: Make all supportable API functions visible.
The process of cleaning up elogind, meaning to mask all bits that are
unneeded by elogind, has been finished a while ago.
It is therefore time to re-enable all previously masked API functions
that elogind can support. This will make it easier for future
developers to integrate elogind into their software where they
already support systemd-login.
Sven Eden [Mon, 11 Dec 2017 16:14:55 +0000 (17:14 +0100)]
Mask unused entries in .po files.
Sven Eden [Mon, 11 Dec 2017 16:12:50 +0000 (17:12 +0100)]
basic/exec-utils:do_execute() : Remove "maybe unitialized" warning
Sven Eden [Mon, 11 Dec 2017 16:06:40 +0000 (17:06 +0100)]
Cleaned up orphaned files
Sven Eden [Mon, 11 Dec 2017 07:33:35 +0000 (08:33 +0100)]
src/basic/meson.build: Prepare generate_cap_list fix for our migration scripts
Sven Eden [Sun, 10 Dec 2017 14:15:12 +0000 (15:15 +0100)]
Fix and fortify cap-list generation and inlcude symlinking for gentoo build system.
Sven Eden [Fri, 8 Dec 2017 16:53:48 +0000 (17:53 +0100)]
Meson build system: Recreate the symlinking of elogind/systemd/*.h headers into elogin/
Sven Eden [Fri, 8 Dec 2017 16:52:41 +0000 (17:52 +0100)]
Fix various build failures with the latest systemd updates.
Sven Eden [Fri, 8 Dec 2017 07:02:34 +0000 (08:02 +0100)]
Apply missing updates from upstream
Zbigniew Jędrzejewski-Szmek [Fri, 6 Oct 2017 08:04:49 +0000 (10:04 +0200)]
man: explain precedence for options which take a list (#7010)
Hopefully finally fixes #6639.
Yu Watanabe [Fri, 6 Oct 2017 07:33:21 +0000 (16:33 +0900)]
meson: fix feature list (#7011)
Lennart Poettering [Thu, 5 Oct 2017 15:14:04 +0000 (17:14 +0200)]
build-sys: bump so revisions for prepation of 235
Lennart Poettering [Wed, 27 Sep 2017 15:30:50 +0000 (17:30 +0200)]
unit: when JobTimeoutSec= is turned off, implicitly turn off JobRunningTimeoutSec= too
We added JobRunningTimeoutSec= late, and Dracut configured only
JobTimeoutSec= to turn of root device timeouts before. With this change
we'll propagate a reset of JobTimeoutSec= into JobRunningTimeoutSec=,
but only if the latter wasn't set explicitly.
This should restore compatibility with older elogind versions.
Fixes: #6402
Hans de Goede [Wed, 4 Oct 2017 23:06:55 +0000 (01:06 +0200)]
hwdb: Add accelerometer orientation entry for Chuwi Hi8 Pro tablet (#6998)
Add an accelerometer orientation entry for the Chuwi Hi8 Pro tablet.
Lennart Poettering [Wed, 4 Oct 2017 19:40:01 +0000 (21:40 +0200)]
dynamic-user: don't use a UID that currently owns IPC objects (#6962)
This fixes a mostly theoretical potential security hole: if for some
reason we failed to remove IPC objects created for a dynamic user (maybe
because a MAC/SElinux erronously prohibited), then we should not hand
out the same UID again until they are successfully removed.
With this commit we'll enumerate the IPC objects currently existing, and
step away from using a UID for the dynamic UID logic if there are any
matching it.
Zbigniew Jędrzejewski-Szmek [Wed, 4 Oct 2017 17:32:59 +0000 (19:32 +0200)]
hwdb: switch meson to use ids_parser.py (#6964)
Also drop the now-unused perl implementation (that doesn't do sorting),
so it's incompatible anyway.
Lennart Poettering [Mon, 2 Oct 2017 14:09:24 +0000 (16:09 +0200)]
logind: don's change dry-run boolean before we actually enqueue the operation
Let's not affect change before the PK check.
Lennart Poettering [Mon, 2 Oct 2017 14:08:49 +0000 (16:08 +0200)]
logind: reorder things a bit
Let's keep the three sleep method implementations close to each other.
Lennart Poettering [Mon, 2 Oct 2017 14:03:55 +0000 (16:03 +0200)]
logind: add Halt() and CanHalt() APIs
This adds new method calls Halt() and CanHalt() to the logind bus APIs.
They aren't overly useful (as the whole concept of halting isn't really
too useful), however they clean up one major asymmetry: currently, using
the "shutdown" legacy commands it is possibly to enqueue a "halt"
operation through logind, while logind officially doesn't actually
support this. Moreover, the path through "shutdown" currently ultimately
fails, since the referenced "halt" action isn't actually defined in
PolicyKit.
Finally, the current logic results in an unexpected asymmetry in
systemctl: "systemctl poweroff", "systemctl reboot" are currently
asynchronous (due to the logind involvement) while "systemctl halt"
isnt. Let's clean this up, and make all three APIs implemented by
logind natively, and all three hence asynchronous in "systemctl".
Moreover, let's add the missing PK action.
Fixes: #6957
Zbigniew Jędrzejewski-Szmek [Wed, 4 Oct 2017 17:32:12 +0000 (19:32 +0200)]
udevadm,basic: replace nulstr_contains with STR_IN_SET (#6965)
STR_IN_SET is a newer approach which is easier to write and read, and which
seems to result in space savings too:
before:
4949848 build/src/shared/libelogind-shared-234.so
350704 build/systemctl
4967184 build/elogind
826216 build/udevadm
after:
4949848 build/src/shared/libelogind-shared-234.so
350704 build/systemctl
4966888 build/elogind
826168 build/udevadm
Alan Jenkins [Tue, 3 Oct 2017 11:26:02 +0000 (12:26 +0100)]
logind: use pid_is_valid() where appropriate
These two sites _do_ match the definition of pid_is_valid(); they don't
provide any special handling for the invalid PID value 0. (They're used
by dbus methods, so the PID value 0 is handled with reference to the dbus
client creds, outside of these functions).
Yu Watanabe [Wed, 4 Oct 2017 14:01:32 +0000 (23:01 +0900)]
tree-wide: use IN_SET macro (#6977)
Zbigniew Jędrzejewski-Szmek [Wed, 4 Oct 2017 13:22:07 +0000 (15:22 +0200)]
test-sizeof: add pid_t and gid_t
C.f. #6975.
Zbigniew Jędrzejewski-Szmek [Wed, 4 Oct 2017 13:17:09 +0000 (15:17 +0200)]
test-copy: fix operation when test-copy is too small
Fixes #6981.
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2017 11:15:27 +0000 (13:15 +0200)]
meson: generate ENABLE_* names automatically
After previous changes, the naming of configuration options and internal
defines is consistent.
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2017 10:22:40 +0000 (12:22 +0200)]
build-sys: s/HAVE_SMACK/ENABLE_SMACK/
Same justification as for HAVE_UTMP.
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2017 10:20:49 +0000 (12:20 +0200)]
build-sys: s/HAVE_IMA/ENABLE_IMA/
Same justification as for HAVE_UTMP.
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2017 10:11:49 +0000 (12:11 +0200)]
build-sys: require all defines under #if to be present
This should help to catch any errors with typos and HAVE/ENABLE mismatches.
Sven Eden [Thu, 7 Dec 2017 17:59:58 +0000 (18:59 +0100)]
Apply updates from upstream
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2017 08:41:51 +0000 (10:41 +0200)]
build-sys: use #if Y instead of #ifdef Y everywhere
The advantage is that is the name is mispellt, cpp will warn us.
$ git grep -Ee "conf.set\('(HAVE|ENABLE)_" -l|xargs sed -r -i "s/conf.set\('(HAVE|ENABLE)_/conf.set10('\1_/"
$ git grep -Ee '#ifn?def (HAVE|ENABLE)' -l|xargs sed -r -i 's/#ifdef (HAVE|ENABLE)/#if \1/; s/#ifndef (HAVE|ENABLE)/#if ! \1/;'
$ git grep -Ee 'if.*defined\(HAVE' -l|xargs sed -i -r 's/defined\((HAVE_[A-Z0-9_]*)\)/\1/g'
$ git grep -Ee 'if.*defined\(ENABLE' -l|xargs sed -i -r 's/defined\((ENABLE_[A-Z0-9_]*)\)/\1/g'
+ manual changes to meson.build
squash! build-sys: use #if Y instead of #ifdef Y everywhere
v2:
- fix incorrect setting of HAVE_LIBIDN2
Alan Jenkins [Tue, 3 Oct 2017 11:05:24 +0000 (12:05 +0100)]
Revert "tree-wide: use pid_is_valid() at more places"
This reverts commit
ee043777be58251e7441b4f04594e9e3792d7fb2.
It broke almost everywhere it touched. The places that
handn't been converted, were mostly followed by special
handling for the invalid PID `0`. That explains why they
tested for `pid < 0` instead of `pid <= 0`.
I think that one was the first commit I reviewed, heh.
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2017 10:09:40 +0000 (12:09 +0200)]
meson: check for sys/auxv.h
This check was present in configure.ac, but was never added under meson.
The code under HAVE_SYS_AUX_H has been dead ever since :(.
Zbigniew Jędrzejewski-Szmek [Tue, 3 Oct 2017 08:32:34 +0000 (10:32 +0200)]
build-sys: change all HAVE_DECL_ macros to HAVE_
This is a legacy of autotools, where one detection routine used a different
prefix then the others.
$ git grep -e HAVE_DECL_ -l|xargs sed -i s/HAVE_DECL_/HAVE_/g
Lennart Poettering [Mon, 2 Oct 2017 08:51:19 +0000 (10:51 +0200)]
path-util: some updates to path_make_relative()
Don't miscount number of "../" to generate, if we "." is included in an
input path.
Also, refuse if we encounter "../" since we can't possibly follow that
up properly, without file system access.
Some other modernizations.
Lennart Poettering [Thu, 28 Sep 2017 17:13:44 +0000 (19:13 +0200)]
core: chown() StateDirectory= and friends recursively when starting a service
This is particularly useful when used in conjunction with DynamicUser=1,
where the UID might change for every invocation, but is useful in other
cases too, for example, when these directories are shared between
systems where the UID assignments differ slightly.
Andreas Rammhold [Fri, 29 Sep 2017 07:58:22 +0000 (09:58 +0200)]
tree-wide: use `!IN_SET(..)` for `a != b && a != c && …`
The included cocci was used to generate the changes.
Thanks to @flo-wer for pointing this case out.
Andreas Rammhold [Thu, 28 Sep 2017 22:37:23 +0000 (00:37 +0200)]
tree-wide: use IN_SET where possible
In addition to the changes from #6933 this handles cases that could be
matched with the included cocci file.
Lennart Poettering [Fri, 29 Sep 2017 15:58:11 +0000 (17:58 +0200)]
sd-bus: drop bloom fields
These fields are unused since kdbus support has been removed.
Lennart Poettering [Fri, 29 Sep 2017 15:57:34 +0000 (17:57 +0200)]
sd-bus: drop match cookie concept
THe match cookie was used by kdbus to identify matches we install
uniquely. But given that kdbus is gone, the cookie serves no process
anymore, let's kill it.
Lennart Poettering [Fri, 29 Sep 2017 15:48:29 +0000 (17:48 +0200)]
sd-bus: when showing brief message info show error name in debug out put too
When debug logging is enabled we show brief information about every bus
message we send or receieve. Pretty much all information is shown,
except for the error name if a message is an error (interestingly we do
print the error text however). Fix that, and add the error name as well.
Lennart Poettering [Fri, 29 Sep 2017 12:36:06 +0000 (14:36 +0200)]
mount-util: add fusectl to list of API VFS
Lennart Poettering [Fri, 29 Sep 2017 12:23:17 +0000 (14:23 +0200)]
dissect: split list of discard-supporting fs out into mount-util.c
Let's manage the list of file systems that do a specific thing at one
place, following similar naming.
No functional changes.
Lennart Poettering [Fri, 29 Sep 2017 12:19:22 +0000 (14:19 +0200)]
dissect: automatically mark partitions read-only that have a read-only file system
Specifically, squashfs and iso9660 are always read-only, hence make sure
we never even think about mounting them writable.
Zbigniew Jędrzejewski-Szmek [Thu, 28 Sep 2017 17:24:16 +0000 (19:24 +0200)]
meson: move library version defines to the top (#6939)
Lennart Poettering [Thu, 28 Sep 2017 09:29:52 +0000 (11:29 +0200)]
meson: bump release to 235
Yu Watanabe [Thu, 28 Sep 2017 08:17:04 +0000 (17:17 +0900)]
libelogind: use IN_SET macro
Lennart Poettering [Tue, 26 Sep 2017 20:49:09 +0000 (22:49 +0200)]
cgroup: IN_SET() FTW!
Lennart Poettering [Tue, 26 Sep 2017 20:43:08 +0000 (22:43 +0200)]
cgroup: after determining that a cgroup is empty, asynchronously dispatch this
This makes sure that if we learn via inotify or another event source
that a cgroup is empty, and we checked that this is indeed the case (as
we might get spurious notifications through inotify, as the inotify
logic through the "cgroups.event" is pretty unspecific and might be
trigger for a variety of reasons), then we'll enqueue a defer event for
it, at a priority lower than SIGCHLD handling, so that we know for sure
that if there's waitid() data for a process we used it before
considering the cgroup empty notification.
Fixes: #6608
Lennart Poettering [Tue, 26 Sep 2017 20:15:02 +0000 (22:15 +0200)]
core: rename cgroup_queue → cgroup_realize_queue
We are about to add second cgroup-related queue, called
"cgroup_empty_queue", hence let's rename "cgroup_queue" to
"cgroup_realize_queue" (as that is its purpose) to minimize confusion
about the two queues.
Just a rename, no functional changes.
Zbigniew Jędrzejewski-Szmek [Wed, 27 Sep 2017 15:54:06 +0000 (17:54 +0200)]
core/cgroup: add a helper macro for a common pattern (#6926)
Lennart Poettering [Tue, 26 Sep 2017 16:26:20 +0000 (18:26 +0200)]
fs-util: propagate EEXIST error in symlink_idempotent() as EEXIST
We really shouldn't silently translate the error code here for no
reason.
Lennart Poettering [Tue, 26 Sep 2017 15:45:09 +0000 (17:45 +0200)]
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.
Lennart Poettering [Mon, 25 Sep 2017 18:26:47 +0000 (20:26 +0200)]
log: let's make use of the fact that our functions return the negative error code for log_oom() too
Lennart Poettering [Mon, 25 Sep 2017 17:53:19 +0000 (19:53 +0200)]
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.
Lennart Poettering [Mon, 25 Sep 2017 17:13:37 +0000 (19:13 +0200)]
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
Lennart Poettering [Mon, 25 Sep 2017 15:15:59 +0000 (17:15 +0200)]
set: add new helper set_make() which is like set_new() + multiple set_put() in vararg
Zbigniew Jędrzejewski-Szmek [Tue, 26 Sep 2017 14:04:33 +0000 (16:04 +0200)]
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.
Jonathan Lebon [Mon, 25 Sep 2017 19:56:57 +0000 (15:56 -0400)]
string-util: use size_t for strjoina macro (#6914)
`strlen` returns a `size_t` and `alloca` expects a `size_t`.
Zbigniew Jędrzejewski-Szmek [Mon, 25 Sep 2017 09:23:59 +0000 (11:23 +0200)]
shared/bus-util: format uid==-1 and gid==-1 as [not set]
$ systemctl show elogind-journald -p UID,GID
UID=
4294967295
GID=
4294967295
↓
$ systemctl show elogind-journald -p UID,GID
UID=[not set]
GID=[not set]
Just seeing the number is very misleading.
Fixes #6511.
Zbigniew Jędrzejewski-Szmek [Mon, 25 Sep 2017 09:09:57 +0000 (11:09 +0200)]
basic/cap-list: report empty capability set as ""
$ systemctl show elogind-journald -p CapabilityBoundingSet,AmbientCapabilities
CapabilityBoundingSet=cap_chown cap_dac_override cap_dac_read_search cap_fowner cap_setgid ...
AmbientCapabilities=(null)
↓
$ systemctl show elogind-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.
Zbigniew Jędrzejewski-Szmek [Sun, 24 Sep 2017 12:27:21 +0000 (14:27 +0200)]
fileio: return 0 from read_one_line_file on success
Fixup for
f4b51a2d09. Suggested by Evgeny Vereshchagin.
Lennart Poettering [Fri, 22 Sep 2017 19:05:03 +0000 (21:05 +0200)]
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.
Lennart Poettering [Fri, 22 Sep 2017 19:03:33 +0000 (21:03 +0200)]
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.
Lennart Poettering [Fri, 22 Sep 2017 18:59:39 +0000 (20:59 +0200)]
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().
Lennart Poettering [Fri, 22 Sep 2017 18:55:34 +0000 (20:55 +0200)]
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.
Lennart Poettering [Fri, 22 Sep 2017 18:45:06 +0000 (20:45 +0200)]
fileio: support writing atomic files with timestamp
Let's make sure "ts" is taken into account when writing atomic files,
too.
Lennart Poettering [Fri, 22 Sep 2017 17:58:24 +0000 (19:58 +0200)]
cgroup: rework which files we chown() on delegation
On cgroupsv2 we should also chown()/chmod() the subtree_control file,
so that children can use controllers the way they like.
On cgroupsv1 we should also chown()/chmod() cgroups.clone_children, as
not setting this for new cgroups makes little sense, and hence delegated
clients should be able to write to it.
Note that error handling for both cases is different. subtree_control
matters so we check for errors, but the clone_children/tasks stuff
doesn't really, as it's legacy stuff. Hence we only log errors and
proceed.
Fixes: #6216
Lennart Poettering [Fri, 22 Sep 2017 17:57:07 +0000 (19:57 +0200)]
cgroup-util: downgrade log messages from library code to LOG_DEBUG
These errors don't really matter, that's why we log and proceed in the
current code. However, we currently log at LOG_WARNING, but we really
shouldn't given that this is library code. Hence downgrade this to
LOG_DEBUG.
Lennart Poettering [Thu, 21 Sep 2017 12:05:35 +0000 (14:05 +0200)]
core: whenever a unit terminates, log its consumed resources to the journal
This adds a new recognizable log message for each unit invocation that
contains structured information about consumed resources of the unit as
a whole after it terminated. This is particular useful for apps that
want to figure out what the resource consumption of a unit given a
specific invocation ID was.
The log message is only generated for units that have at least one
XyzAccounting= property turned on, and currently only covers IP traffic and CPU
time metrics.
Lennart Poettering [Thu, 21 Sep 2017 11:52:34 +0000 (13:52 +0200)]
io-util: add new IOVEC_INIT/IOVEC_MAKE macros
This adds IOVEC_INIT() and IOVEC_MAKE() for initializing iovec structures
from a pointer and a size. On top of these IOVEC_INIT_STRING() and
IOVEC_MAKE_STRING() are added which take a string and automatically
determine the size of the string using strlen().
This patch removes the old IOVEC_SET_STRING() macro, given that
IOVEC_MAKE_STRING() is now useful for similar purposes. Note that the
old IOVEC_SET_STRING() invocations were two characters shorter than the
new ones using IOVEC_MAKE_STRING(), but I think the new syntax is more
readable and more generic as it simply resolves to a C99 literal
structure initialization. Moreover, we can use very similar syntax now
for initializing strings and pointer+size iovec entries. We canalso use
the new macros to initialize function parameters on-the-fly or array
definitions. And given that we shouldn't have so many ways to do the
same stuff, let's just settle on the new macros.
(This also converts some code to use _cleanup_ where dynamically
allocated strings were using IOVEC_SET_STRING() before, to modernize
things a bit)
Lennart Poettering [Thu, 7 Sep 2017 14:31:01 +0000 (16:31 +0200)]
cgroup: refuse to return accounting data if accounting isn't turned on
We used to be a bit sloppy on this, and handed out accounting data even
for units where accounting wasn't explicitly enabled. Let's be stricter
here, so that we know the accounting data is actually fully valid. This
is necessary, as the accounting data is no longer stored exclusively in
cgroupfs, but is partly maintained external of that, and flushed during
unit starts. We should hence only expose accounting data we really know
is fully current.
Lennart Poettering [Thu, 7 Sep 2017 12:32:33 +0000 (14:32 +0200)]
core: when coming back from reload/reexec, reapply all cgroup properties
With this change we'll invalidate all cgroup settings after coming back
from a daemon reload/reexec, so that the new settings are instantly
applied.
This is useful for the BPF case, because we don't serialize/deserialize
the BPF program fd, and hence have to install a new, updated BPF program
when coming back from the reload/reexec. However, this is also useful
for the rest of the cgroup settings, as it ensures that user
configuration really takes effect wherever we can.
Lennart Poettering [Thu, 7 Sep 2017 12:07:13 +0000 (14:07 +0200)]
core: serialize/deserialize IP accounting across daemon reload/reexec
Make sure the current IP accounting counters aren't lost during
reload/reexec.
Note that we destroy all BPF file objects during a reload: the BPF
programs, the access and the accounting maps. The former two need to be
regenerated anyway with the newly loaded configuration data, but the
latter one needs to survive reloads/reexec. In this implementation I
opted to only save/restore the accounting map content instead of the map
itself. While this opens a (theoretic) window where IP traffic is still
accounted to the old map after we read it out, and we thus miss a few
bytes this has the benefit that we can alter the map layout between
versions should the need arise.
Daniel Mack [Thu, 3 Nov 2016 16:31:25 +0000 (17:31 +0100)]
Add test for eBPF firewall code