chiark / gitweb /
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)
committerSven Eden <yamakuzure@gmx.net>
Wed, 30 May 2018 05:59:09 +0000 (07:59 +0200)
commitfa4505314d65df4bd778543ea3753d6efd696ca1
tree58ad048ec4f6ac83275a0b2f253f90594713d8be
parentc3b7f359b022902190c58c1d8f17eb70265bc603
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/core/cgroup.c