[LTP] [PATCH] lapi/namespace_constants.h: Add CLONE_NEWCGROUP

Yang Xu xuyang2018.jy@fujitsu.com
Tue Nov 29 03:28:37 CET 2022


This fix undefined CLONE_NEWCGROUP problem on centos7.

Fixes: 5f2a365da ("cgroup_core02: copy from kernel selftest test_cgcore_lesser_ns_open")
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
I have verified it on my ltp fork[1]
[1]https://github.com/xuyang0410/ltp/actions/runs/3570059301/jobs/6000664209
 include/lapi/namespaces_constants.h                 | 3 +++
 testcases/kernel/controllers/cgroup/cgroup_core02.c | 1 +
 2 files changed, 4 insertions(+)

diff --git a/include/lapi/namespaces_constants.h b/include/lapi/namespaces_constants.h
index 447f16c5b..e34b0d6a8 100644
--- a/include/lapi/namespaces_constants.h
+++ b/include/lapi/namespaces_constants.h
@@ -21,6 +21,9 @@
 #ifndef CLONE_NEWUSER
 #  define CLONE_NEWUSER	0x10000000
 #endif
+#ifndef CLONE_NEWCGROUP
+#  define CLONE_NEWCGROUP 0x02000000
+#endif
 #ifndef CLONE_NEWUTS
 #  define CLONE_NEWUTS	0x04000000
 #endif
diff --git a/testcases/kernel/controllers/cgroup/cgroup_core02.c b/testcases/kernel/controllers/cgroup/cgroup_core02.c
index 0dff71eea..e6d599b36 100644
--- a/testcases/kernel/controllers/cgroup/cgroup_core02.c
+++ b/testcases/kernel/controllers/cgroup/cgroup_core02.c
@@ -31,6 +31,7 @@
 #include <pwd.h>
 #include "tst_test.h"
 #include "tst_safe_file_at.h"
+#include "lapi/namespaces_constants.h"
 
 static struct tst_cg_group *cg_child_a, *cg_child_b;
 static uid_t nobody_uid;
-- 
2.23.0



More information about the ltp mailing list