Kamalesh Babulal [Wed, 11 May 2022 16:21:46 +0000 (10:21 -0600)]
configure: fix the extra spaces in --enable-bindings
Extra spaces between the default action assignment for the feature
--enable-bindings feature, fails with:
./configure: line 12510: with_bindings: command not found
fix the issue by removing the extra spaces in the assignment.
api.c: fix segfault while processing cgroup mount points
The cgroup v1 and cgroup v2 mount points get read from /proc/mounts in
cgroup_process_v1_mnt()/cgroup_process_v2_mnt() respectively and gets
populated into cg_mount_table[]. The size of cg_mount_table[] is set
to CG_CONTROLLER_MAX, that's defined as 100 and if the system has more
than CG_CONTROLLER_MAX, unique mount points, it will segfault while
processing them. Fix this by checking, the mount point count after
processing every mount entry and bailout in case it reaches
CG_CONTROLLER_MAX.
The issue can be reproduced using, following simple bash commands on
cgroup v1:
1. sudo for i in $(seq 0 100); do sudo mkdir /name$i; done
2. sudo for i in $(seq 0 100); do sudo mount -t cgroup -o
none,name=named$i none /name$i; done
3. sudo cgget -g <controller>:<existing cgroup name>
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Thu, 27 Jan 2022 19:47:55 +0000 (12:47 -0700)]
api.c: add support for cgroup.threads
cgroup_build_tasks_procs_path(), that builds the proc path for moving
the tid, doesn't check for the cgroup type and appends cgroup.procs for
both cgroup v1/v2. With cgroup v2, this results in building a wrong
proc path if the cgroup type is threaded. This patch adds support to
check for the cgroup v2 type and build the proc path according to the
below table:
cgroup.type | proc file | Description |
----------------+----------------+------------------------------------+
domain | cgroup.procs | regular cgroup, all threads gets |
| | moved to the cgroup. |
domain threaded | cgroup.procs | root of threaded subtree, all |
| | threads gets moved to the cgroup. |
threaded | cgroup.threads | cgroup under threaded subtree, |
| | single threads with matching tid, |
| | gets moved to the cgroup. |
domain invalid | N/A | invalid state of a cgroup under the|
| | threaded subtree. |
Closes: https://github.com/libcgroup/libcgroup/issues/64 Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
cherry picked from commit 4c577f91050b1ad00e5ed2b2abb40fc4978db996)
Kamalesh Babulal [Tue, 18 Jan 2022 15:35:04 +0000 (08:35 -0700)]
api.c: cache cgrules with CGFLAG_USECACHE flag
pam_cgroup.so plugin uses /etc/cgrules.conf to assign processes
to the requested cgroup. This works well with active
cgrulesengd but in the instances where cgrulesengd is disabled,
the rules are not read and cached by default. Fix this is by
reloading and caching the rules when called with CGFLAG_USECACHE
flag.
Fixes: https://github.com/libcgroup/libcgroup/issues/84 Reported-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
TJH: Minor commit comment changes
(cherry picked from commit 80a0bd4b8873df38060309e775d609dcc219531f)
Ingo van Lil [Thu, 16 Dec 2021 20:34:00 +0000 (13:34 -0700)]
Initialize cgroup version for named V1 hierarchy
Commit 3aac9889 added the 'version' field in cg_mount_table_s and
initializes it in cgroup_process_v1_mnt(). The same initialization is
required in a second place dealing with named hierarchies.
Signed-off-by: Ingo van Lil <inguin@gmx.de> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit d0a1979e8078e7669daf1713bb97ef408a2befbc)
Ross Burton [Fri, 3 Dec 2021 15:38:27 +0000 (08:38 -0700)]
automake: idiomatically mark test libraries as convenience libraries
Instead of installing then deleting, mark the libraries which are only
used at build time and should not be installed as noinst, so they don't
get installed at all.
Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit 1932bd3c46fc5f3532d6583ccc2ccd4c8d8530a2)
Tom Hromatka [Fri, 12 Nov 2021 18:32:03 +0000 (18:32 +0000)]
github: Run test 028 last
A merge conflict moved the running of test 028 before
running `make check`. Run test 028-cgclear-basic_cgclear.py
last because it is destructive to the cgroup hierarchy.
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Fri, 12 Nov 2021 13:56:37 +0000 (06:56 -0700)]
automake: Don't install testing libraries
libcgset and libcgfortesting are libraries that are used by the
unit test framework and are not intended to be installed when
`make install` is invoked. Delete them from the install path.
Closes: https://github.com/libcgroup/libcgroup/issues/62 Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit 6c941e8b26fbd6613c96ed65e08290aa21ff33de)
Tom Hromatka [Fri, 12 Nov 2021 13:52:51 +0000 (06:52 -0700)]
automake: Link libcgset with libcgroup
When linking with the -Wl,--no-undefined flag enabled, libcgset
fails due to undefined symbols. Fix this by enabling this flag
and linking with libcgroup.la
Closes: https://github.com/libcgroup/libcgroup/issues/66 Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit b4015e3f96fc430029a37e94edc151e16727e8f1)
Kamalesh Babulal [Thu, 21 Oct 2021 21:25:55 +0000 (15:25 -0600)]
github: re-arrange workflow run commands
The current workflow executes the functional tests from the make check
called at the top-level source directory. Though this runs the tests
case, it also has an unintended side effect of re-running gunit tests
for every functional test combination in the workflow. Fix it, by
re-arranging the function test run commands, to change into
tests/ftests directory before executing make check.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit 348f50bed7bfab1a63a649b4a65120fb03a7d3c2)
Ross Burton [Fri, 10 Sep 2021 17:42:20 +0000 (11:42 -0600)]
configure.ac: check for the library containing fts_open
The musl C library doesn't provide fts.h[1], so libcgroup doesn't
compile with musl. However, there is a standalone implementation of fts
for musl users[2] which can be used.
Use AC_SEARCH_LIBS to search for fts_open, which will check if it is part
of libc, and if not look in libfts, then set LIBS if needed.
Signed-off-by: Ross Burton <ross.burton@arm.com>
[TJH: minor formatting changes to match existing configure.ac] Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit 27ba904355575153308bdc0fa48344ef1be55ca1)
Replace __BEGIN_DECLS and __END_DECLS with extern "C".
The macros __BEGIN_DECLS and __END_DECLS are a GNU-ism found in
glibc and uClibc, but not musl. We replace them by the more general
extern "C" { ... } block exposed only if we have __cplusplus.
Forward ported from a patch by Anthony G. Basile <blueness@gentoo.org>.
Signed-off-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit 215974e67a24edf9097507e8707190b6a42c7207)
Tomasz Kłoczko [Wed, 12 May 2021 20:35:40 +0000 (20:35 +0000)]
automake: replace INCLUDES by CPPFLAGS
automake shows warnings like below:
src/Makefile.am:16: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/Makefile.am: installing 'build-aux/depcomp'
src/bindings/Makefile.am:2: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/daemon/Makefile.am:3: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/pam/Makefile.am:1: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
src/tools/Makefile.am:3: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
Signed-off-by: Tomasz Kłoczko <kloczek@github.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Tue, 27 Apr 2021 17:08:38 +0000 (17:08 +0000)]
lscgroup: Fix strncpy() truncation warning
Fix the following strncpy() string truncation warning:
In function ‘strncat’,
inlined from ‘print_cgroup’ at lscgroup.c:149:4:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:136:10: warning: ‘__builtin___strncat_chk’ output
may be truncated copying between 0 and 4095 bytes from a string of length 4095 [-Wstringop-truncation]
136 | return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Tue, 27 Apr 2021 17:04:21 +0000 (17:04 +0000)]
lssubsys: Fix strncpy() truncation warning
Fix the following strncpy() string truncation warning:
In function ‘strncpy’,
inlined from ‘print_all_controllers_in_hierarchy’ at lssubsys.c:131:4,
inlined from ‘cgroup_list_all_controllers’ at lssubsys.c:225:9,
inlined from ‘main’ at lssubsys.c:293:8:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output may be truncated copying 4095 bytes from a string of length 4095 [-Wstringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Tue, 27 Apr 2021 17:03:18 +0000 (17:03 +0000)]
lssubsys: Fix strncpy() truncation warning
Fix the following strncpy() string truncation warning:
In function ‘strncpy’,
inlined from ‘print_all_controllers_in_hierarchy’ at lssubsys.c:127:4,
inlined from ‘cgroup_list_all_controllers’ at lssubsys.c:223:9,
inlined from ‘main’ at lssubsys.c:291:8:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output may be truncated copying 4095 bytes from a string of length 4095 [-Wstringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Tue, 27 Apr 2021 16:58:12 +0000 (16:58 +0000)]
lssubsys: Fix strncpy() truncation warning
Fix the following strncpy() string truncation warning:
In function ‘strncat’,
inlined from ‘print_all_controllers_in_hierarchy’ at lssubsys.c:134:4,
inlined from ‘cgroup_list_all_controllers’ at lssubsys.c:222:9,
inlined from ‘main’ at lssubsys.c:290:8:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:136:10: warning: ‘__builtin___strncat_chk’ output may be truncated copying 4095 bytes from a string of length 4095 [-Wstringop-truncation]
136 | return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Tue, 27 Apr 2021 16:53:44 +0000 (16:53 +0000)]
cgget: Fix strncpy() truncation warning
Fix the following strncpy() string truncation warning:
In function ‘strncat’,
inlined from ‘fill_empty_controller’ at cgget.c:584:2:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:136:10: warning: ‘__builtin___strncat_chk’ output may be truncated copying between 0 and 4095 bytes from a string of length 4095 [-Wstringop-truncation]
136 | return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Tue, 27 Apr 2021 16:48:33 +0000 (16:48 +0000)]
config.c: Fix strncpy() truncation warning
Fix the following strncpy() string truncation warning:
In function ‘strncpy’,
inlined from ‘cgroup_config_create_template_group’ at config.c:1850:5:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output may be truncated copying 4095 bytes from a string of length 4095 [-Wstringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Tue, 27 Apr 2021 16:46:24 +0000 (16:46 +0000)]
config.c: Fix strncpy() truncation warning
Fix the following strncpy() string truncation warning:
In function ‘strncpy’,
inlined from ‘cgroup_config_create_template_group’ at config.c:1844:5:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output may be truncated copying 4095 bytes from a string of length 4095 [-Wstringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Tue, 27 Apr 2021 16:42:41 +0000 (16:42 +0000)]
config.c: Fix strncpy() truncation warning
Fix the following strncpy() string truncation warning:
In function ‘strncpy’,
inlined from ‘cgroup_config_create_template_group’ at config.c:1841:5:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output may be truncated copying 4095 bytes from a string of length 4095 [-Wstringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Tue, 27 Apr 2021 16:40:39 +0000 (16:40 +0000)]
api.c: Fix strncpy() truncation warning
Fix the following strncpy() string truncation warning:
In function ‘strncat’,
inlined from ‘cgroup_get_cgroup’ at api.c:3153:3:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:136:10: warning: ‘__builtin___strncat_chk’ output may be truncated copying between 0 and 4095 bytes from a string of length 4095 [-Wstringop-truncation]
136 | return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Tue, 27 Apr 2021 16:35:46 +0000 (16:35 +0000)]
api.c: Fix strncpy() truncation warning
Fix the following strncpy() string truncation warning:
In function ‘strncpy’,
inlined from ‘cgroup_parse_rules_file’ at api.c:814:3:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin_strncpy’ output may be truncated copying 4095 bytes from a string of length 4095 [-Wstringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Tue, 27 Apr 2021 16:32:10 +0000 (16:32 +0000)]
api.c: Fix strncpy() truncation warning
Fix the following strncpy() string truncation warning:
In function ‘strncpy’,
inlined from ‘cgroup_parse_rules_file’ at api.c:798:3:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin___strncpy_chk’ output may be truncated copying between 0 and 255 bytes from a string of length 255 [-Wstringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Tue, 27 Apr 2021 16:30:21 +0000 (16:30 +0000)]
api.c: Fix strncpy() truncation warning
Fix the following strncpy() string truncation warning:
In function ‘strncpy’,
inlined from ‘cgroup_parse_rules_file’ at api.c:676:3:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: ‘__builtin___strncpy_chk’ output may be truncated copying between 0 and 255 bytes from a string of length 4352 [-Wstringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Mon, 12 Apr 2021 15:25:00 +0000 (09:25 -0600)]
wrapper.c: Fix fprintf argument warning
Fix a warning in cgroup_add_value_string() where '%d' was
being passed to fprintf when it should have been using '%ld'.
wrapper.c: In function ‘cgroup_add_value_string’:
wrapper.c:207:51: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
207 | fprintf(stderr, "value exceeds the maximum of %d
characters\n",
| ~^
| |
| int
| %ld
208 | sizeof(cntl_value->value) - 1);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| long unsigned int
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Mon, 12 Apr 2021 15:18:56 +0000 (09:18 -0600)]
api.c: Fix string truncation warnings
Fix two snprintf string truncation warnings in
cg_build_path_locked().
api.c:1475:38: warning: ‘snprintf’ output may be truncated before the
last format character [-Wformat-truncation=]
1475 | snprintf(path, FILENAME_MAX, "%s/",
| ^
api.c:1475:5: note: ‘snprintf’ output between 2 and 4097 bytes into a
destination of size 4096
1475 | snprintf(path, FILENAME_MAX, "%s/",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1476 | cg_mount_table[i].mount.path);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
api.c:1470:40: warning: ‘/’ directive output may be truncated writing 1
byte into a region of size between 0 and 4095 [-Wformat-truncation=]
1470 | snprintf(path, FILENAME_MAX, "%s/%s/",
| ^
api.c:1470:5: note: ‘snprintf’ output 3 or more bytes (assuming 4098)
into a destination of size 4096
1470 | snprintf(path, FILENAME_MAX, "%s/%s/",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1471 | cg_mount_table[i].mount.path,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1472 | cg_namespace_table[i]);
| ~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Wed, 31 Mar 2021 16:44:11 +0000 (16:44 +0000)]
tools: Create a cgset library for testing purposes
Create libcgset.la so that functions within cgset can be
unit tested.
A functional test would be preferable in this case, but I'm
looking to test a very specific scenario - where there's an
'=' sign in the value of a setting's name/value pair. To the
best of my knowledge, only the rdma (v1) and io (v2)
controllers have settings that utilize an '=' in such a fashion.
I can't think of an easy way to test rdma across our test fleet,
and our automated systems don't support the v2 io controller
yet. Thus a unit test for now.
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Tue, 30 Mar 2021 18:54:06 +0000 (18:54 +0000)]
cgset: Fix parsing of name/values with an '=' in the value
Fix parsing of name/value pairs that contain an '='
character in the value string. For example, the io.max
setting utilizes the '=' character:
cgset -r io.max="8:16 wbps=1024" foo
Fixes: https://github.com/libcgroup/libcgroup/issues/33 Reported-by: Santiago Ruano Rincón <santiago.ruano-rincon@imt-atlantique.fr> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Mon, 29 Mar 2021 16:46:52 +0000 (16:46 +0000)]
bootstrap: github: Ignore systemd hierarchy
Ignore the "name=systemd" hierarchy by setting the autoconf
--enable-opaque-hierarchy flag equal to "name=systemd". This
instructs libcgroup to ignore mounts named "name=systemd" and
thus these mounts aren't added to the cg_mount_table[].
Suggested-by: Michal Koutný <mkoutny@suse.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Wed, 10 Mar 2021 18:20:24 +0000 (18:20 +0000)]
api.c: Don't fail a recursive write if value isn't dirty
When cgroup_modify_cgroup() invokes cgroup_set_values_recursive(),
some of the settings within the cgroup may not be writable. Avoid
failing the entire write by ignoring write failures on settings that
do not explicitly have the dirty flag set.
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Wed, 10 Feb 2021 17:25:10 +0000 (17:25 +0000)]
cgget: Major refactor
Previously cgget used data structures unlike anywhere else
within libcgroup. cgget had arrays of strings to hold the
list of controllers, settings, and values.
Update cgget to utilize struct cgroup and struct
cgroup_controller.
This patch is intended to have no functional changes.
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Mon, 8 Feb 2021 23:05:24 +0000 (16:05 -0700)]
wrapper.c: Add support for empty values in cgroup_add_value_string()
cgroup_add_value_string() is the fundamental building block
for adding a name/value pair to a cgroup_controller struct.
Add support for a NULL value field.
Currently it only supports adding a valid value, but in a
subsequent commit, cgget will utilize this function to build
up a hierarchy of cgroups, controllers, and setting names.
The values are NULL at the time the struct are populated and
will be read from sysfs at a later time.
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Tue, 23 Feb 2021 20:47:38 +0000 (13:47 -0700)]
api.c: Fix erroneous error handling in cgroup_set_values_recursive()
Ignore the positive length returned by asprintf() and only act
upon the error code returned from cg_set_control_value(). Previously
cgroup_set_values_recursive() mishandled the error handling when
the value's dirty flag was set.
Reported-by: Bharani viswas <bharani.viswas@gmail.com> Fixes: 092e4aeb0416f ("api.c: Refactor duplicate logic in cgroup modify and create") Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Thu, 17 Dec 2020 18:39:11 +0000 (11:39 -0700)]
cgsnapshot: Replace hardcoded "tasks" file
Replace the hardcoded building of the tasks path in
cgsnapshot with a call to cgroup_build_tasks_procs_path().
By calling cgroup_build_tasks_procs_path(), cgsnapshot
now supports both cgroup v1 and cgroup v2.
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com> Reviewed-by: Dhaval Giani <dhaval.giani@oracle.com>
Tom Hromatka [Thu, 17 Dec 2020 18:24:13 +0000 (11:24 -0700)]
github: Display ftests.sh.log in the CI GUI
Now that we invoke ftests.sh in the functional tests'
Makefile.am, test-suite.log isn't that useful. Display
ftests.sh.log in the Github Actions GUI since
ftests.sh.log contains pass/fail info for each test.
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Thu, 17 Dec 2020 15:03:32 +0000 (08:03 -0700)]
github: Improve logging and reporting
Display the high-level log, test-suite.log, in
the github work for all jobs. Also, archive the
functional test logs to facilitate debugging a
failed run.
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Tom Hromatka [Tue, 15 Dec 2020 22:11:01 +0000 (15:11 -0700)]
README.md: Update the coveralls badge
The coveralls.io badge wasn't consistently updating
after a successful run. Remove the "?branch=master"
parameter and switch to using a png rather than an
svg.
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>