This patchset adds cgroup v2 support to cgroup_init() and
cg_test_mounted_fs().  For simple cgroup interfaces like cgget
and cgset, these were the only changes necessary to add cgroup
v2 support to those tools.

I tested the changes by hand on a cgroup v1 mount, a cgroup v2
mount, and the cgroup v2 unified hierarchy.  I have started
adding cgroup v2 support to the automated functional test suite,
but a lot of work remains.

Since the tests have been split into a separate git repo, those
patches will come out in a separate patchset.

$ sudo ./cgset -r cpu.weight=999 foo
$ sudo ./cgget -r cpu.weight foo
foo:
cpu.weight: 999

Changes from v2 to v3:
* Switched to using strtok_r rather than strtok
* Minor readability improvements
* Fixed a bug where an empty cgroup.controllers file would erroneously
  return an error

Changes from v1 to v2:
* Split out the "add cgroup v2 support" patch into four separate
  patches

Previous email threads are available here:
https://sourceforge.net/p/libcg/mailman/message/37004989/
https://sourceforge.net/p/libcg/mailman/message/37007410/

Corresponding testing patchset is available here.  (Note that I'll
be sending a new version out shortly):
https://sourceforge.net/p/libcg/mailman/message/37005000/

Code is available on github here:
https://github.com/drakenclimber/libcgroup/tree/issues/cgget_v2_v3

Automated test results are here:
https://travis-ci.com/github/drakenclimber/libcgroup/builds/169337479

Code coverage increased by 0.8% and is available here:
https://coveralls.io/builds/31199229

Tom Hromatka (7):
  api.c: Refactor cgroup v1 logic in cgroup_init()
  api.c: Add cgroup version enumeration
  api.c: Only stat the cgroup tasks file if it's a v1 mount
  api.c: Add support for cgroup v2 to cg_test_mounted_fs()
  api.c: cgget: cgset: Add cgroup v2 support
  api.c: Declare cgroup_process_v1_mnt() as STATIC
  api.c: Declare cgroup_process_v2_mnt() as STATIC

 src/api.c                | 353 ++++++++++++++++++++++++++-------------
 src/libcgroup-internal.h |  12 ++
 2 files changed, 251 insertions(+), 114 deletions(-)

-- 
2.25.3



_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to