]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
wrapper: Make cgroup_compare_cgroup() order agnostic
authorTom Hromatka <tom.hromatka@oracle.com>
Tue, 7 Mar 2023 22:34:34 +0000 (15:34 -0700)
committerTom Hromatka <tom.hromatka@oracle.com>
Mon, 3 Apr 2023 14:43:57 +0000 (08:43 -0600)
commit50222392d930e7be15231d0cfde9072eea172242
tree17fa1da6a48569e34ffa4bf906e567d3479e45bf
parenteca89d792f57b21dda820693a9b9b3fb8d253400
wrapper: Make cgroup_compare_cgroup() order agnostic

cgroup_compare_cgroup() can be used to compare two struct cgroup
instances.  Improve its comparison algorithm so that it can successfully
identify cgroups as the same if the only difference is the order of the
controllers stored within them.

With this change, the following two cgroups would be identified as
equal.

cgroup_a
name = foo
controller[0] = memory
controller[1] = cpu

cgroup_b
name = foo
controller[0] = cpu
controller[1] = memory

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/wrapper.c