]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/basic/cgroup-util.h
cgroup-util: rework cg_get_keyed_attribute() a bit
authorLennart Poettering <lennart@poettering.net>
Fri, 9 Feb 2018 17:35:52 +0000 (18:35 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 9 Feb 2018 17:35:52 +0000 (18:35 +0100)
commitb734a4ff1433e3804a0cbf0801fb81a059f97a79
treeac50ed1f57522ee7a0b9c14bb892fd3878c5b1c1
parent744c39ff7e2646bcf90b9710b89e4769f8820025
cgroup-util: rework cg_get_keyed_attribute() a bit

Let's make sure we don't clobber the return parameter on failure, to
follow our coding style. Also, break the loop early if we have all
attributes we need.

This also changes the keys parameter to a simple char**, so that we can
use STRV_MAKE() for passing the list of attributes to read.

This also makes it possible to distuingish the case when the whole
attribute file doesn't exist from one key in it missing. In the former
case we return -ENOENT, in the latter we now return -ENXIO.
src/basic/cgroup-util.c
src/basic/cgroup-util.h
src/cgtop/cgtop.c
src/core/cgroup.c