api.c: fix segfault in cgroup_populate_mount_points()
In cgroup_populate_mount_points(), cgroup v1/v2 mount points get read
from /proc/mounts and 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 86); 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>
api.c: fix deleting cgroup created on shared mnt point
cgroup v1 allows mounting of two or more controllers on a single
mount point. This fails currently when trying to delete the cgroup
recursively for all the mounted controllers because the cgroup is
already deleted by the first controller of the share mount point and
the next controllers sharing the mount point complain about
missing cgroup path.
Fix this issue by introducing shared_mnt flag to cg_mount_table_s
struct and setting it during cgroup_init() on finding a mount point
shared by controllers and repeats the check in cgroup_find_parent()
on the error to check its share mount point and ignore the error if the
file doesn't exist, similar to ignoring if the file exists during
creation.
api.c: add support to attach tid to an empty cgroup v2
Currently, cgroup_attach_task_pid() checks for enabled
controllers before attaching the given tid to it, but in the case of
empty cgroup, it simply ignores the attaching due to no controllers
available, a.k.a. cgroup->index is 0. Add support to recognize empty
controller cgroups.
Fixes: https://github.com/libcgroup/libcgroup/issues/129 Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
There can be cgroup v2 cgroup with no controllers attached to it and
while checking for enabled controllers always return true in
cgroupv2_controller_enabled() for such cgroups.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
api.c: In function ‘cgroup_populate_controllers.constprop’:
api.c:1386:5: warning: ‘buf’ may be used uninitialized in this function [-Wmaybe-uninitialized]
1386 | if (buf)
| ^
api.c: In function ‘cgroup_populate_mount_points.constprop’:
api.c:1461:5: warning: ‘temp_ent’ may be used uninitialized in this function [-Wmaybe-uninitialized]
1461 | if (temp_ent)
| ^
this patch, initializes them to NULL.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Thu, 31 Mar 2022 12:21:55 +0000 (17:51 +0530)]
api.c: add support for empty cgroup v2 deletion
Add support to recognize empty cgroup v2 with no controllers attached to
it in cgroup_delete_cgroup_ext(), that gets called to remove a cgroup.
In the deletion path, cgroup_build_tasks_procs_path() builds the path
of the cgroup for re-assignment/movement of tasks from the cgroup that's
getting deleted, teach it to recognize the empty controller as cgroup
V2.
Fixes: https://github.com/libcgroup/libcgroup/issues/125 Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
TJH: Fix a couple small typos in commit message
Kamalesh Babulal [Wed, 30 Mar 2022 06:19:03 +0000 (11:49 +0530)]
api.c: API to list mount points of a cgroup type
Currently, there is no easy way for a user to list cgroup mount points,
one way to acquire required information is by manually reading the
/proc/mounts and parsing the information they are interested in.
Add a new API:
cgroup_list_mount_points(cg_version_t version, char ***mnts),
where the first argument is either CGROUP_V1 or CGROUP_V2, that
specifies the mount point types and the second argument is a char**,
that will hold the mount point paths of the cgroup version specified in
the first agrument. Note that the mnts pointers are supposed to free'd.
mnts pointers.
$ cat get_mount.c
int main(void)
{
enum cg_version_t t = CGROUP_V2;
char **mount_paths = NULL;
int i = 0;
int ret;
cgroup_init();
ret = cgroup_list_mount_points(t, &mount_paths);
if (ret != 0) {
fprintf(stderr, "Failed to get mount points\n");
return ret;
}
while (mount_paths[i]) {
fprintf(stderr, "%s\n", mount_paths[i]);
free(mount_paths[i]);
i++;
}
free(mount_paths);
return 0;
}
$ gcc -o get_mount get_mount.c -lcgroup
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Sat, 26 Mar 2022 13:40:50 +0000 (19:10 +0530)]
api.c: refactor cgroup_process_*_mnt()
Abstract appending new mount point to the cg_mount_table[] into new
function, reducing the duplication in both cgroup_process_v1_mnt()
and cgroup_process_v2_mnt().
Kamalesh Babulal [Sat, 26 Mar 2022 13:40:43 +0000 (19:10 +0530)]
api.c: refactor cgroup_init()
Refactor cgroup_init() by abstracting freeing of previous cg_mount_table,
populating controller by reading /proc/cgroups file and populating
mount points into its own function.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
TJH: Fix minor typo in commit message
Kamalesh Babulal [Tue, 22 Mar 2022 10:03:41 +0000 (15:33 +0530)]
tools-common.h: add logging helpers
fprintf(stderr, ...); is used across the tools to notify the user about
something that went wrong and needs to abort. Similarly, printf() is
used to print information, may continue with the code execution.
This patch adds helper macro err(), info(), that can replace messaging
printing to stderr/stdout, making code readable and compact.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Thu, 24 Mar 2022 13:55:40 +0000 (07:55 -0600)]
specfile: fix the samples/config path
Change the location of sample configuration files from sample/ to
samples/config/, this movement got introduced by Commit b546e328e00c
"samples: Move the config examples to samples/config/").
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Thu, 17 Mar 2022 12:47:27 +0000 (18:17 +0530)]
src/config.c: remove log level prefix
With commit 97a0e195ddd7 ("log: add log level string prefix to
logging functions"), log level prefixes gets added to message
printed by cgroup_{err,warn,info} functions, remove them from
message passed to these functions.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Sat, 19 Mar 2022 14:14:40 +0000 (19:44 +0530)]
src/api.c: remove log level prefix
With commit 97a0e195ddd7 ("log: add log level string prefix to
logging functions"), log level prefixes gets added to message
printed by cgroup_{err,warn,info} functions, remove them from
message passed to these functions.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Sat, 19 Mar 2022 14:14:29 +0000 (19:44 +0530)]
src/abstraction-common.c: remove log level prefix
With commit 97a0e195ddd7 ("log: add log level string prefix to
logging functions"), log level prefixes gets added to message
printed by cgroup_{err,warn,info} functions, remove them from
message passed to these functions.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Sat, 19 Mar 2022 06:55:25 +0000 (12:25 +0530)]
Makefile: fix samples/c build dependency
If the user chooses to build the samples/c programs, it will fail to
build, with the error:
config.status: creating samples/c/Makefile
CC setuid.o
make: *** No rule to make target '../../src/.libs/libcgroup.la', needed by 'setuid'. Stop.
it is due to the dependency on libcgroup.la, which is currently built
after samples. Fix it by moving the samples directory to be built after
src directory.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
1. Remove obsolete constructions from scripts/init/cgconfig.in
2. Add fallback logging functions for non-lsb systems.
Signed-off-by: Vladimir Nikishkin <libcgroup@lockywolf.net> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
TJH: Merged the original patch and review comments patch into one commit
Kamalesh Babulal [Wed, 16 Mar 2022 16:18:08 +0000 (21:48 +0530)]
libcgroup.doxyfile: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO types. It also introduces
reverse xmas tree local variable declarations and header file
reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 0 errors, 1 warnings, 1519 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 16:17:38 +0000 (21:47 +0530)]
include/tools.h: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG. It also introduces reverse xmas tree local
variable declarations and header file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 1 errors, 3 warnings, 73 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 16:17:11 +0000 (21:47 +0530)]
include/tasks.h: introduce coding style changes
This patch introduces coding style changes such as reverse xmas tree
local variable declarations, header file reordering, and many other
minor tweaks such as line spacing, removing trailing white spaces.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 16:16:41 +0000 (21:46 +0530)]
include/log.h: introduce coding style changes
This patch introduces coding style changes such as reverse xmas tree
local variable declarations, header file reordering, and many other
minor tweaks such as line spacing, removing trailing white spaces.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 16:16:22 +0000 (21:46 +0530)]
include/iterators.h: fix checkpatch.pl warnings
This patch introduces coding style changes such as reverse xmas tree
local variable declarations, header file reordering, and many other
minor tweaks such as line spacing, removing trailing white spaces.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 0 errors, 25 warnings, 432 lines checked
Kamalesh Babulal [Wed, 16 Mar 2022 16:16:04 +0000 (21:46 +0530)]
include/init.h: fix checkpatch.pl warnings
This patch introduces coding style changes such as reverse xmas tree
local variable declarations, header file reordering, and many other
minor tweaks such as line spacing, removing trailing white spaces.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 0 errors, 1 warnings, 86 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 16:15:44 +0000 (21:45 +0530)]
include/groups.h: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG. It also introduces reverse xmas tree local
variable declarations and header file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 0 errors, 27 warnings, 630 lines checked
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG. It also introduces reverse xmas tree local
variable declarations and header file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 2 errors, 19 warnings, 927 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG. It also introduces reverse xmas tree local
variable declarations and header file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 1 errors, 0 warnings, 44 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 16:13:15 +0000 (21:43 +0530)]
samples/walk_test.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG. It also introduces reverse xmas tree local
variable declarations and header file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 0 errors, 0 warnings, 121 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 16:12:57 +0000 (21:42 +0530)]
samples/walk_task.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG. It also introduces reverse xmas tree local
variable declarations and header file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 0 errors, 1 warnings, 49 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG. It also introduces reverse xmas tree local
variable declarations and header file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 1 errors, 0 warnings, 47 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 16:07:47 +0000 (21:37 +0530)]
samples/setuid.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG. It also introduces reverse xmas tree local
variable declarations and header file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
0 errors, 1 warnings, 82 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 16:07:14 +0000 (21:37 +0530)]
samples/read_stats.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG. It also introduces reverse xmas tree local
variable declarations and header file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 0 errors, 0 warnings, 84 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 16:05:16 +0000 (21:35 +0530)]
samples/proctest.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG. It also introduces reverse xmas tree local
variable declarations and header file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
0 errors, 1 warnings, 55 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 16:04:27 +0000 (21:34 +0530)]
samples/logger.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG. It also introduces reverse xmas tree local
variable declarations and header file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 0 errors, 0 warnings, 53 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG. It also introduces reverse xmas tree local
variable declarations and header file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 0 errors, 2 warnings, 59 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 16:00:10 +0000 (21:30 +0530)]
samples/get_procs.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG. It also introduces reverse xmas tree local
variable declarations and header file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 1 errors, 0 warnings, 36 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG. It also introduces reverse xmas tree local
variable declarations and header file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 1 errors, 1 warnings, 49 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG. It also introduces reverse xmas tree local
variable declarations and header file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 1 errors, 0 warnings, 34 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG. It also introduces reverse xmas tree local
variable declarations and header file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 1 errors, 0 warnings, 34 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 15:54:04 +0000 (21:24 +0530)]
cgrulesengd.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO and NEW_TYPEDEFS types. It
also introduces reverse xmas tree local variable declarations and header
file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 10 errors, 36 warnings, 1306 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 15:53:45 +0000 (21:23 +0530)]
cgrulesengd.h: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO and NEW_TYPEDEFS types. It
also introduces reverse xmas tree local variable declarations and header
file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 0 errors, 18 warnings, 129 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 15:51:53 +0000 (21:21 +0530)]
pam/pam_cgroup.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO types. It also introduces
reverse xmas tree local variable declarations and header file
reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 0 errors, 10 warnings, 163 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 15:51:36 +0000 (21:21 +0530)]
tools-common.h: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO and NEW_TYPEDEFS types. It
also introduces reverse xmas tree local variable declarations and header
file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 0 errors, 7 warnings, 145 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 15:50:38 +0000 (21:20 +0530)]
tools-common.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO and NEW_TYPEDEFS types. It
also introduces reverse xmas tree local variable declarations and header
file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 1 errors, 2 warnings, 312 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 16:24:34 +0000 (21:54 +0530)]
lssubsys.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO and NEW_TYPEDEFS types. It
also introduces reverse xmas tree local variable declarations and header
file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 0 errors, 16 warnings, 295 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 15:45:33 +0000 (21:15 +0530)]
lscgroup.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO and NEW_TYPEDEFS types. It
also introduces reverse xmas tree local variable declarations and header
file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 0 errors, 9 warnings, 328 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 15:45:01 +0000 (21:15 +0530)]
cgxset.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO and NEW_TYPEDEFS types. It
also introduces reverse xmas tree local variable declarations and header
file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 1 errors, 20 warnings, 385 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 15:42:43 +0000 (21:12 +0530)]
cgxget.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO and NEW_TYPEDEFS types. It
also introduces reverse xmas tree local variable declarations and header
file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 2 errors, 17 warnings, 921 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 15:37:43 +0000 (21:07 +0530)]
cgsnapshot.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO and NEW_TYPEDEFS types. It
also introduces reverse xmas tree local variable declarations and header
file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 1 errors, 39 warnings, 847 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 15:36:34 +0000 (21:06 +0530)]
cgset.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO and NEW_TYPEDEFS types. It
also introduces reverse xmas tree local variable declarations and header
file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 1 errors, 16 warnings, 284 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 15:32:16 +0000 (21:02 +0530)]
cgget.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO and NEW_TYPEDEFS types. It
also introduces reverse xmas tree local variable declarations and header
file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 2 errors, 13 warnings, 772 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 15:25:09 +0000 (20:55 +0530)]
cgexec.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO and NEW_TYPEDEFS types. It
also introduces reverse xmas tree local variable declarations and header
file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 2 errors, 8 warnings, 178 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 15:24:30 +0000 (20:54 +0530)]
cgdelete.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO and NEW_TYPEDEFS types. It
also introduces reverse xmas tree local variable declarations and header
file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 1 errors, 6 warnings, 303 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 15:23:50 +0000 (20:53 +0530)]
cgcreate.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO and NEW_TYPEDEFS types. It
also introduces reverse xmas tree local variable declarations and header
file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 0 errors, 10 warnings, 247 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 15:22:59 +0000 (20:52 +0530)]
cgconfig.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO and NEW_TYPEDEFS types. It
also introduces reverse xmas tree local variable declarations and header
file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 0 errors, 11 warnings, 213 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Wed, 16 Mar 2022 15:22:23 +0000 (20:52 +0530)]
cgclassify.c: fix checkpatch.pl warnings
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO and NEW_TYPEDEFS types. It
also introduces reverse xmas tree local variable declarations and header
file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 2 errors, 10 warnings, 203 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Mon, 14 Mar 2022 10:35:06 +0000 (16:05 +0530)]
.checkpatch.conf: add NEW_TYPEDEFS to ignore-list
There are tools/files, that introduce new typdefs and checkpatch.pl is
unhappy about it. It takes some re-work on removing and for now let's
teach checkpatch to ignore it.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Mon, 14 Mar 2022 04:38:44 +0000 (10:08 +0530)]
Adopt SPDX License tag for files missing license information
Adopt SPDX license tag for all the source files, those missing License
information. All the files in the project fall under project license,
hence explicitly adding LGPL-2.1-only identifier to them. The SPDX
license identifier is added for the files, reported by checkpatch.pl.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Mon, 14 Mar 2022 04:35:01 +0000 (10:05 +0530)]
Adopt SPDX License tag
Adopt SPDX license tag for all the source files, those already have
LGPL 2.1 bolierplate in them. Adopting SPDX license helps the
compliance tools to determine the license and also helps in reducing the
repetitive license boilerplate across source files.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Fri, 11 Mar 2022 14:54:43 +0000 (07:54 -0700)]
samples/c: drop the test suites
samples/c contains test cases, those do serve as good examples on how to
use some APIs, but there are also very elaborate test cases, which are
test suites in themselves. Let's drop these examples and allow users to
look at gunit/ftests for how to contribute to test cases. This patch
also modifies the Makefile to help users to build the examples, in case
they want to give it a quick try.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Kamalesh Babulal [Fri, 11 Mar 2022 14:51:09 +0000 (07:51 -0700)]
log: add log level string prefix to logging functions
Usage of cgroup_{err, warn, info} functions, expects the log level to be
prefixed to the message like: cgroup_warn("Warning: ..."). This patch
removes this need to prefix and automatically adds the desired prefix to
the logger function, so the usage becomes cgroup_warn("..."). This
helps in readability and avoiding typos in setting the right log level
string to the message.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/abstraction-map.c: re-arrange the header files
Re-arrange the headers files, in the following order:
1. Header files that declare the functions, are defined in this file.
2. Other header files from the libcgroup.
3. Standard header file.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/abstraction-cpuset.c: re-arrange the header files
Re-arrange the headers files, in the following order:
1. Header files that declare the functions, are defined in this file.
2. Other header files from the libcgroup.
3. Standard header file.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/abstraction-cpu.c: re-arrange the header files
Re-arrange the headers files, in the following order:
1. Header files that declare the functions, are defined in this file.
2. Other header files from the libcgroup.
3. Standard header file.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO types. It also introduces
reverse xmas tree local variable declarations and header file
reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 26 errors, 204 warnings, 5855 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO types. It also introduces
reverse xmas tree local variable declarations and header file
reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 0 errors, 55 warnings, 743 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Fix all of the warnings/errors reported by Linux Kernel's checkpatch.pl,
except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO types. It also introduces
reverse xmas tree local variable declarations and header file
reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 0 errors, 3 warnings, 96 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Fix most of the warnings/errors reported by Linux Kernel's
checkpatch.pl, except SPDX_LICENSE_TAG, USE_NEGATIVE_ERRNO types.
It also introduces reverse xmas tree local variable declarations
and header file reordering.
In summary, this patch fixes the following checkpatch.pl
recommendations:
total: 4 errors, 36 warnings, 1899 lines checked
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com> Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>