parent
078a975efb
commit
e623b7ca46
2
.gitignore
vendored
2
.gitignore
vendored
@ -7,3 +7,5 @@
|
||||
/626dfc9e8dbad6dde09f43cfa086f31e945e2c8a.tar.gz
|
||||
/libcgroup-v2.0.2.tar.gz
|
||||
/3d3364813b7b80f42aa74f0bec9de33efadf4200.tar.gz
|
||||
/libcgroup-v3.0.tar.gz
|
||||
/7c998caddcd8236fe4191841e361b401697fb777.tar.gz
|
||||
|
@ -1,11 +1,12 @@
|
||||
Fedora specific configuration - we want to mount all controllers by default for libvirt.
|
||||
|
||||
diff -up libcgroup-0.34/samples/cgconfig.conf.orig libcgroup-0.34/samples/cgconfig.conf
|
||||
--- libcgroup-0.34/samples/cgconfig.conf.orig 2009-03-04 10:40:06.000000000 +0100
|
||||
+++ libcgroup-0.34/samples/cgconfig.conf 2009-10-19 10:17:37.000000000 +0200
|
||||
@@ -10,39 +10,8 @@
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
diff --git a/samples/config/cgconfig.conf b/samples/config/cgconfig.conf
|
||||
index de29594..2020d71 100644
|
||||
--- a/samples/config/cgconfig.conf
|
||||
+++ b/samples/config/cgconfig.conf
|
||||
@@ -4,39 +4,8 @@
|
||||
#
|
||||
# Authors: Balbir Singh <balbir@linux.vnet.ibm.com>
|
||||
#
|
||||
-#group daemons/www {
|
||||
-# perm {
|
||||
@ -47,10 +48,10 @@ diff -up libcgroup-0.34/samples/cgconfig.conf.orig libcgroup-0.34/samples/cgconf
|
||||
+# so there is not much to do.
|
||||
+# See man cgconfig.conf for further details, how to create groups
|
||||
+# on system boot using this file.
|
||||
+
|
||||
diff -up libcgroup-0.35.1/samples/cgconfig.sysconfig.orig libcgroup-0.35.1/samples/cgconfig.sysconfig
|
||||
--- libcgroup-0.35.1/samples/cgconfig.sysconfig.orig 2010-03-09 14:56:34.000000000 +0100
|
||||
+++ libcgroup-0.35.1/samples/cgconfig.sysconfig 2010-03-09 16:30:12.000000000 +0100
|
||||
diff --git a/samples/config/cgconfig.sysconfig b/samples/config/cgconfig.sysconfig
|
||||
index 5a61bf6..0f4f6d1 100644
|
||||
--- a/samples/config/cgconfig.sysconfig
|
||||
+++ b/samples/config/cgconfig.sysconfig
|
||||
@@ -5,8 +5,6 @@
|
||||
# controller to limit cpu.shares of this default group and allowing some more
|
||||
# important group take most of the CPU.
|
||||
|
@ -1,19 +1,19 @@
|
||||
diff --git a/src/api.c b/src/api.c
|
||||
index 4a980a1..df9afe8 100644
|
||||
index f8c5acd..3f7d831 100644
|
||||
--- a/src/api.c
|
||||
+++ b/src/api.c
|
||||
@@ -170,6 +170,10 @@ static int cg_chown_file(FTS *fts, FTSENT *ent, uid_t owner, gid_t group)
|
||||
return ret;
|
||||
}
|
||||
@@ -52,6 +52,10 @@ const struct cgroup_library_version library_version = {
|
||||
.release = CGROUP_VER_RELEASE,
|
||||
};
|
||||
|
||||
+int cg_chmod_file(FTS *fts, FTSENT *ent, mode_t dir_mode,
|
||||
+ int dirm_change, mode_t file_mode, int filem_change,
|
||||
+ int owner_is_umask);
|
||||
+
|
||||
/*
|
||||
* TODO: Need to decide a better place to put this function.
|
||||
* The errno which happend the last time (have to be thread specific)
|
||||
*/
|
||||
@@ -177,6 +181,8 @@ static int cg_chown_recursive(char **path, uid_t owner, gid_t group)
|
||||
@@ -184,6 +188,8 @@ static int cg_chown_recursive(char **path, uid_t owner, gid_t group)
|
||||
{
|
||||
int ret = 0;
|
||||
FTS *fts;
|
||||
@ -21,9 +21,9 @@ index 4a980a1..df9afe8 100644
|
||||
+ mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH;
|
||||
|
||||
cgroup_dbg("chown: path is %s\n", *path);
|
||||
fts = fts_open(path, FTS_PHYSICAL | FTS_NOCHDIR |
|
||||
@@ -194,6 +200,7 @@ static int cg_chown_recursive(char **path, uid_t owner, gid_t group)
|
||||
cgroup_warn("Warning: fts_read failed\n");
|
||||
fts = fts_open(path, FTS_PHYSICAL | FTS_NOCHDIR | FTS_NOSTAT, NULL);
|
||||
@@ -201,6 +207,7 @@ static int cg_chown_recursive(char **path, uid_t owner, gid_t group)
|
||||
cgroup_warn("fts_read failed\n");
|
||||
break;
|
||||
}
|
||||
+ cg_chmod_file(fts, ent, mode, 0, mode, 1, 1);
|
||||
|
@ -1,61 +1,13 @@
|
||||
diff --git a/src/config.c b/src/config.c
|
||||
index 1306033..88cc5dd 100644
|
||||
--- a/src/config.c
|
||||
+++ b/src/config.c
|
||||
@@ -326,7 +326,7 @@ int config_group_task_perm(char *perm_type, char *value, int flag)
|
||||
long val = atoi(value);
|
||||
char buffer[CGROUP_BUFFER_LEN];
|
||||
struct cgroup *config_cgroup;
|
||||
- int table_index;
|
||||
+ int table_index, ret;
|
||||
|
||||
switch (flag) {
|
||||
case CGROUP:
|
||||
@@ -370,10 +370,10 @@ int config_group_task_perm(char *perm_type, char *value, int flag)
|
||||
if (!group)
|
||||
goto group_task_error;
|
||||
|
||||
- getgrnam_r(value, group, buffer,
|
||||
+ ret = getgrnam_r(value, group, buffer,
|
||||
CGROUP_BUFFER_LEN, &group_buffer);
|
||||
|
||||
- if (group_buffer == NULL) {
|
||||
+ if (ret != 0 || group_buffer == NULL) {
|
||||
free(group);
|
||||
goto group_task_error;
|
||||
}
|
||||
@@ -439,7 +439,7 @@ int config_group_admin_perm(char *perm_type, char *value, int flag)
|
||||
struct cgroup *config_cgroup;
|
||||
long val = atoi(value);
|
||||
char buffer[CGROUP_BUFFER_LEN];
|
||||
- int table_index;
|
||||
+ int table_index, ret;
|
||||
|
||||
switch (flag) {
|
||||
case CGROUP:
|
||||
@@ -482,10 +482,10 @@ int config_group_admin_perm(char *perm_type, char *value, int flag)
|
||||
if (!group)
|
||||
goto admin_error;
|
||||
|
||||
- getgrnam_r(value, group, buffer,
|
||||
+ ret = getgrnam_r(value, group, buffer,
|
||||
CGROUP_BUFFER_LEN, &group_buffer);
|
||||
|
||||
- if (group_buffer == NULL) {
|
||||
+ if (ret != 0 || group_buffer == NULL) {
|
||||
free(group);
|
||||
goto admin_error;
|
||||
}
|
||||
diff --git a/src/daemon/cgrulesengd.c b/src/daemon/cgrulesengd.c
|
||||
index 4cef53e..90920d1 100644
|
||||
index 7c51412..d95f6a5 100644
|
||||
--- a/src/daemon/cgrulesengd.c
|
||||
+++ b/src/daemon/cgrulesengd.c
|
||||
@@ -654,7 +654,7 @@ close:
|
||||
@@ -652,7 +652,7 @@ close:
|
||||
|
||||
static int cgre_create_netlink_socket_process_msg(void)
|
||||
{
|
||||
- int sk_nl = 0, sk_unix = 0, sk_max;
|
||||
+ int sk_nl = -1, sk_unix = -1, sk_max;
|
||||
enum proc_cn_mcast_op *mcop_msg;
|
||||
struct sockaddr_nl my_nla;
|
||||
char buff[BUFF_SIZE];
|
||||
int rc = -1;
|
||||
struct sockaddr_un saddr;
|
||||
|
@ -1,9 +1,9 @@
|
||||
diff --git a/src/api.c b/src/api.c
|
||||
index 8e6efe6..f41cb7e 100644
|
||||
index 3f7d831..1e4f021 100644
|
||||
--- a/src/api.c
|
||||
+++ b/src/api.c
|
||||
@@ -3084,29 +3084,29 @@ static int cg_rd_ctrl_file(const char *subsys, const char *cgroup,
|
||||
const char *file, char **value)
|
||||
@@ -3227,26 +3227,26 @@ int cgroup_delete_cgroup_ext(struct cgroup *cgroup, int flags)
|
||||
static int cg_rd_ctrl_file(const char *subsys, const char *cgroup, const char *file, char **value)
|
||||
{
|
||||
char path[FILENAME_MAX];
|
||||
- FILE *ctrl_file = NULL;
|
||||
@ -29,17 +29,14 @@ index 8e6efe6..f41cb7e 100644
|
||||
return ECGOTHER;
|
||||
}
|
||||
|
||||
/*
|
||||
- * using %as crashes when we try to read from files like
|
||||
+ * using %as or fread crashes when we try to read from files like
|
||||
* memory.stat
|
||||
*/
|
||||
- /* Using %as crashes when we try to read from files like memory.stat */
|
||||
- ret = fread(*value, 1, CG_CONTROL_VALUE_MAX-1, ctrl_file);
|
||||
+ /* Using %as or fread crashes when we try to read from files like memory.stat */
|
||||
+ ret = read(ctrl_file, *value, CG_CONTROL_VALUE_MAX-1);
|
||||
if (ret < 0) {
|
||||
free(*value);
|
||||
*value = NULL;
|
||||
@@ -3116,7 +3116,7 @@ static int cg_rd_ctrl_file(const char *subsys, const char *cgroup,
|
||||
@@ -3256,7 +3256,7 @@ static int cg_rd_ctrl_file(const char *subsys, const char *cgroup, const char *f
|
||||
(*value)[ret-1] = '\0';
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,16 @@
|
||||
diff --git a/src/api.c b/src/api.c
|
||||
index f41cb7e..5088c58 100644
|
||||
index 1e4f021..33e99b6 100644
|
||||
--- a/src/api.c
|
||||
+++ b/src/api.c
|
||||
@@ -4076,10 +4076,10 @@ int cgroup_change_cgroup_flags(uid_t uid, gid_t gid,
|
||||
available, "%d", pid);
|
||||
@@ -4177,9 +4177,9 @@ int cgroup_change_cgroup_flags(uid_t uid, gid_t gid, const char *procname, pid_t
|
||||
written = snprintf(newdest + j, available, "%d", pid);
|
||||
break;
|
||||
case 'p':
|
||||
- if(procname) {
|
||||
- if (procname) {
|
||||
+ if(procname && strlen(basename(procname))) {
|
||||
written = snprintf(newdest + j,
|
||||
available, "%s",
|
||||
written = snprintf(newdest + j, available, "%s",
|
||||
- procname);
|
||||
+ basename(procname));
|
||||
} else {
|
||||
written = snprintf(newdest + j,
|
||||
available, "%d", pid);
|
||||
written = snprintf(newdest + j, available, "%d",
|
||||
pid);
|
||||
|
@ -1,34 +0,0 @@
|
||||
From f97b7af366bd07c17fb63606116f5dfae665e08c Mon Sep 17 00:00:00 2001
|
||||
From: Tom Hromatka <tom.hromatka@oracle.com>
|
||||
Date: Wed, 23 Feb 2022 08:00:29 -0700
|
||||
Subject: [PATCH] configure: Delete legacy test artifacts
|
||||
|
||||
The legacy tests (now located in the libcgroup-tests)
|
||||
repository have been moved to
|
||||
https://github.com/libcgroup/libcgroup-tests/tree/main/examples
|
||||
and are no longer being run. Remove all references to
|
||||
the tests from the configure.ac file.
|
||||
|
||||
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
|
||||
Reviewed-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
|
||||
---
|
||||
configure.ac | 6 ------
|
||||
1 file changed, 6 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 30932001..ce8a7850 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -207,12 +207,6 @@ AC_CONFIG_FILES([Makefile
|
||||
tests/Makefile
|
||||
tests/ftests/Makefile
|
||||
tests/gunit/Makefile
|
||||
- tests/tools/testenv.sh
|
||||
- tests/tools/Makefile
|
||||
- tests/tools/cgconfigparser/Makefile
|
||||
- tests/tools/cgclassify/Makefile
|
||||
- tests/tools/multimount/Makefile
|
||||
- tests/runlibcgrouptest.sh
|
||||
src/Makefile
|
||||
src/daemon/Makefile
|
||||
src/tools/Makefile
|
@ -1,17 +1,17 @@
|
||||
diff --git a/tests/gunit/Makefile.am b/tests/gunit/Makefile.am
|
||||
index 654002c..96399e9 100644
|
||||
index ba91039..e2b88e3 100644
|
||||
--- a/tests/gunit/Makefile.am
|
||||
+++ b/tests/gunit/Makefile.am
|
||||
@@ -22,8 +22,6 @@
|
||||
@@ -9,8 +9,6 @@
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/src \
|
||||
-I$(top_srcdir)/src/tools \
|
||||
- -I$(top_builddir)/googletest/googletest/include \
|
||||
- -I$(top_builddir)/googletest/googletest \
|
||||
- -I$(top_srcdir)/googletest/googletest/include \
|
||||
- -I$(top_srcdir)/googletest/googletest \
|
||||
-std=c++11 \
|
||||
-Wno-write-strings \
|
||||
-DSTATIC= \
|
||||
@@ -31,10 +29,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include \
|
||||
@@ -18,10 +16,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include \
|
||||
LDADD = $(top_builddir)/src/.libs/libcgroupfortesting.la \
|
||||
$(top_builddir)/src/tools/.libs/libcgset.la
|
||||
|
||||
@ -23,10 +23,13 @@ index 654002c..96399e9 100644
|
||||
|
||||
check_PROGRAMS = gtest
|
||||
TESTS = gtest
|
||||
@@ -56,5 +51,4 @@ gtest_SOURCES = gtest.cpp \
|
||||
@@ -43,8 +38,7 @@ gtest_SOURCES = gtest.cpp \
|
||||
014-cgroupv2_get_subtree_control.cpp \
|
||||
015-cgroupv2_controller_enabled.cpp \
|
||||
016-cgset_parse_r_flag.cpp
|
||||
-gtest_LDFLAGS = -L$(top_builddir)/googletest/googletest -l:libgtest.so \
|
||||
- -rpath $(abs_top_builddir)/googletest/googletest
|
||||
-gtest_LDFLAGS = -L$(top_srcdir)/googletest/googletest -l:libgtest.so \
|
||||
- -rpath $(abs_top_srcdir)/googletest/googletest
|
||||
+gtest_LDFLAGS = -l:libgtest.so
|
||||
|
||||
clean-local:
|
||||
${RM} test-procpidcgroup
|
||||
|
@ -1,11 +1,11 @@
|
||||
%bcond_with tests
|
||||
|
||||
%global tests_commit 3d3364813b7b80f42aa74f0bec9de33efadf4200
|
||||
%global tests_commit 7c998caddcd8236fe4191841e361b401697fb777
|
||||
|
||||
Summary: Library to control and monitor control groups
|
||||
Name: libcgroup
|
||||
Version: 2.0.2
|
||||
Release: 2%{?dist}
|
||||
Version: 3.0
|
||||
Release: 1%{?dist}
|
||||
License: LGPLv2+
|
||||
URL: http://libcg.sourceforge.net/
|
||||
Source0: https://github.com/%{name}/%{name}/archive/v%{version}/%{name}-v%{version}.tar.gz
|
||||
@ -17,7 +17,6 @@ Patch1: libcgroup-0.37-chmod.patch
|
||||
Patch2: libcgroup-0.40.rc1-coverity.patch
|
||||
Patch3: libcgroup-0.40.rc1-fread.patch
|
||||
Patch4: libcgroup-0.40.rc1-templates-fix.patch
|
||||
Patch5: libcgroup-2.0.2-configure.ac.patch
|
||||
|
||||
Patch100: libcgroup-tests-unbundle-gtest.patch
|
||||
|
||||
@ -71,7 +70,6 @@ provide scripts to manage that configuration.
|
||||
%patch2 -p1 -b .coverity
|
||||
%patch3 -p1 -b .fread
|
||||
%patch4 -p1 -b .templates-fix
|
||||
%patch5 -p1 -b .configure.ac
|
||||
|
||||
%setup -D -T -a 1
|
||||
mv -T %{name}-tests-%{tests_commit} tests
|
||||
@ -89,8 +87,8 @@ autoreconf -vif
|
||||
|
||||
# install config files
|
||||
install -d ${RPM_BUILD_ROOT}%{_sysconfdir}
|
||||
install -m 644 samples/cgconfig.conf $RPM_BUILD_ROOT/%{_sysconfdir}/cgconfig.conf
|
||||
install -m 644 samples/cgsnapshot_blacklist.conf $RPM_BUILD_ROOT/%{_sysconfdir}/cgsnapshot_blacklist.conf
|
||||
install -m 644 samples/config/cgconfig.conf $RPM_BUILD_ROOT/%{_sysconfdir}/cgconfig.conf
|
||||
install -m 644 samples/config/cgsnapshot_blacklist.conf $RPM_BUILD_ROOT/%{_sysconfdir}/cgsnapshot_blacklist.conf
|
||||
|
||||
# sanitize pam module, we need only pam_cgroup.so
|
||||
rm -f $RPM_BUILD_ROOT%{_libdir}/security/pam_cgroup.{,l}a
|
||||
@ -136,7 +134,7 @@ make -C tests/gunit check
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
%license COPYING
|
||||
%doc README
|
||||
%{_libdir}/libcgroup.so.2*
|
||||
%{_libdir}/libcgroup.so.3*
|
||||
|
||||
%files tools
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
@ -147,11 +145,12 @@ make -C tests/gunit check
|
||||
%{_bindir}/cgcreate
|
||||
%{_bindir}/cgget
|
||||
%{_bindir}/cgset
|
||||
%{_bindir}/cgxget
|
||||
%{_bindir}/cgxset
|
||||
%{_bindir}/cgdelete
|
||||
%{_bindir}/lscgroup
|
||||
%{_bindir}/lssubsys
|
||||
%{_sbindir}/cgconfigparser
|
||||
%{_sbindir}/cgclear
|
||||
%{_bindir}/cgsnapshot
|
||||
%{_bindir}/cgclassify
|
||||
%attr(0755, root, root) %{_bindir}/cgexec
|
||||
@ -176,6 +175,10 @@ make -C tests/gunit check
|
||||
%{_libdir}/pkgconfig/libcgroup.pc
|
||||
|
||||
%changelog
|
||||
* Sat Aug 06 2022 Nikola Forró <nforro@redhat.com> - 3.0-1
|
||||
- New upstream release 3.0
|
||||
resolves: #2115990
|
||||
|
||||
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
||||
|
4
sources
4
sources
@ -1,2 +1,2 @@
|
||||
SHA512 (libcgroup-v2.0.2.tar.gz) = ffda4212c93388f838c4b93a5820b6de4fce96e786b14f4c7476336f552ff7a390675fdf210f2b194ecbbab4801c7c688e9a668a96696cde681682cff45a0119
|
||||
SHA512 (3d3364813b7b80f42aa74f0bec9de33efadf4200.tar.gz) = 7eae070c1ce4c8af7ef9daa252088dbe6d871f8979ac0d0876c70dbb89c55bef7cd437e6c878de8db8ddb54c82f79b60c643fc936ffabde5ee952cee4f463326
|
||||
SHA512 (libcgroup-v3.0.tar.gz) = cdc5b041bdff022de416276a2dfcb6b8e02d1d4be3ef6875412ae346f0a5609d3b71a9cb0d5e4209d6ddeed40b97313f218d52161a05b0aed719b9bcf53f6796
|
||||
SHA512 (7c998caddcd8236fe4191841e361b401697fb777.tar.gz) = 88a6d54d3d1f8cc757905af1a60306cbfc2f440ec5eddec3541bb620a5c8936cf7fb34458c930b10f8360773263ae8515fb12f2bdc4aa7edc8f761ce1a71c76f
|
||||
|
Loading…
Reference in New Issue
Block a user