From 206752dd9c777deb70846bcd218b5f5bc23d71d7 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 14 May 2024 17:08:44 -0700 Subject: [PATCH] libcgroup: update to 2.0.3 Upstream moved to GitHub. Backport non GNU strerror_r patch. Signed-off-by: Rosen Penev --- libs/libcgroup/Makefile | 10 +- libs/libcgroup/patches/010-cdefs.patch | 240 ---------------------- libs/libcgroup/patches/010-strerror.patch | 51 +++++ libs/libcgroup/patches/020-tests.patch | 9 - 4 files changed, 56 insertions(+), 254 deletions(-) delete mode 100644 libs/libcgroup/patches/010-cdefs.patch create mode 100644 libs/libcgroup/patches/010-strerror.patch delete mode 100644 libs/libcgroup/patches/020-tests.patch diff --git a/libs/libcgroup/Makefile b/libs/libcgroup/Makefile index 121eb93422..7b42ebfb30 100644 --- a/libs/libcgroup/Makefile +++ b/libs/libcgroup/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libcgroup -PKG_VERSION:=0.41 -PKG_RELEASE:=3 +PKG_VERSION:=2.0.3 +PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 -PKG_SOURCE_URL:=@SF/libcg -PKG_HASH:=e4e38bdc7ef70645ce33740ddcca051248d56b53283c0dc6d404e17706f6fb51 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/libcgroup/libcgroup/releases/download/v$(PKG_VERSION) +PKG_HASH:=b29b5704de3d0fadf199fe4e17eeeaecba7f0dd1b85569c96eec37c7672e3026 PKG_MAINTAINER:=Daniel Danzberger PKG_LICENSE:=LGPL-2.1-or-later diff --git a/libs/libcgroup/patches/010-cdefs.patch b/libs/libcgroup/patches/010-cdefs.patch deleted file mode 100644 index 27abb26f96..0000000000 --- a/libs/libcgroup/patches/010-cdefs.patch +++ /dev/null @@ -1,240 +0,0 @@ ---- a/include/libcgroup/config.h -+++ b/include/libcgroup/config.h -@@ -5,12 +5,10 @@ - #error "Only should be included directly." - #endif - --#ifndef SWIG --#include -+#ifdef __cplusplus -+extern "C" { - #endif - --__BEGIN_DECLS -- - /** - * @defgroup group_config 5. Configuration - * @{ -@@ -107,6 +105,8 @@ int cgroup_config_create_template_group( - * @} - * @} - */ --__END_DECLS -+#ifdef __cplusplus -+} -+#endif - - #endif /*_LIBCGROUP_CONFIG_H*/ ---- a/include/libcgroup/error.h -+++ b/include/libcgroup/error.h -@@ -5,12 +5,10 @@ - #error "Only should be included directly." - #endif - --#ifndef SWIG --#include -+#ifdef __cplusplus -+extern "C" { - #endif - --__BEGIN_DECLS -- - /** - * @defgroup group_errors 6. Error handling - * @{ -@@ -99,6 +97,8 @@ int cgroup_get_last_errno(void); - * @} - * @} - */ --__END_DECLS -+#ifdef __cplusplus -+} -+#endif - - #endif /* _LIBCGROUP_INIT_H */ ---- a/include/libcgroup/groups.h -+++ b/include/libcgroup/groups.h -@@ -6,12 +6,13 @@ - #endif - - #ifndef SWIG --#include - #include - #include - #endif - --__BEGIN_DECLS -+#ifdef __cplusplus -+extern "C" { -+#endif - - /** - * Flags for cgroup_delete_cgroup_ext(). -@@ -577,6 +578,8 @@ char *cgroup_get_cgroup_name(struct cgro - */ - - --__END_DECLS -+#ifdef __cplusplus -+} -+#endif - - #endif /* _LIBCGROUP_GROUPS_H */ ---- a/include/libcgroup/init.h -+++ b/include/libcgroup/init.h -@@ -5,12 +5,10 @@ - #error "Only should be included directly." - #endif - --#ifndef SWIG --#include -+#ifdef __cplusplus -+extern "C" { - #endif - --__BEGIN_DECLS -- - /** - * @defgroup group_init 1. Initialization - * @{ -@@ -58,6 +56,8 @@ int cgroup_get_subsys_mount_point(const - * @} - * @} - */ --__END_DECLS -+#ifdef __cplusplus -+} -+#endif - - #endif /* _LIBCGROUP_INIT_H */ ---- a/include/libcgroup/iterators.h -+++ b/include/libcgroup/iterators.h -@@ -8,10 +8,11 @@ - #ifndef SWIG - #include - #include --#include - #endif - --__BEGIN_DECLS -+#ifdef __cplusplus -+extern "C" { -+#endif - - /** - * @defgroup group_iterators 3. Iterators -@@ -423,6 +424,8 @@ int cgroup_get_subsys_mount_point_end(vo - * @} - */ - --__END_DECLS -+#ifdef __cplusplus -+} -+#endif - - #endif /* _LIBCGROUP_ITERATORS_H */ ---- a/include/libcgroup/log.h -+++ b/include/libcgroup/log.h -@@ -5,13 +5,11 @@ - #error "Only should be included directly." - #endif - --#ifndef SWIG --#include --#endif -- - #include - --__BEGIN_DECLS -+#ifdef __cplusplus -+extern "C" { -+#endif - - /** - * @defgroup group_log 7. Logging -@@ -142,6 +140,8 @@ extern int cgroup_parse_log_level_str(co - * @} - * @} - */ --__END_DECLS -+#ifdef __cplusplus -+} -+#endif - - #endif /* _LIBCGROUP_LOG_H */ ---- a/include/libcgroup/tasks.h -+++ b/include/libcgroup/tasks.h -@@ -8,11 +8,12 @@ - #include - - #ifndef SWIG --#include - #include - #endif - --__BEGIN_DECLS -+#ifdef __cplusplus -+extern "C" { -+#endif - - /** Flags for cgroup_change_cgroup_uid_gid(). */ - enum cgflags { -@@ -204,6 +205,8 @@ int cgroup_register_unchanged_process(pi - * @} - * @} - */ --__END_DECLS -+#ifdef __cplusplus -+} -+#endif - - #endif /* _LIBCGROUP_TASKS_H */ ---- a/src/daemon/cgrulesengd.h -+++ b/src/daemon/cgrulesengd.h -@@ -15,9 +15,9 @@ - #ifndef _CGRULESENGD_H - #define _CGRULESENGD_H - --#include -- --__BEGIN_DECLS -+#ifdef __cplusplus -+extern "C" { -+#endif - - #include "config.h" - #include "libcgroup.h" -@@ -119,7 +119,9 @@ void cgre_flash_templates(int signum); - */ - void cgre_catch_term(int signum); - --__END_DECLS -+#ifdef __cplusplus -+} -+#endif - - #endif /* _CGRULESENGD_H */ - ---- a/src/libcgroup-internal.h -+++ b/src/libcgroup-internal.h -@@ -16,7 +16,9 @@ - - #define __LIBCG_INTERNAL - --__BEGIN_DECLS -+#ifdef __cplusplus -+extern "C" { -+#endif - - #include "config.h" - #include -@@ -279,6 +281,8 @@ extern void cgroup_dictionary_iterator_e - */ - int cg_chmod_path(const char *path, mode_t mode, int owner_is_umask); - --__END_DECLS -+#ifdef __cplusplus -+} -+#endif - - #endif diff --git a/libs/libcgroup/patches/010-strerror.patch b/libs/libcgroup/patches/010-strerror.patch new file mode 100644 index 0000000000..051165e8b2 --- /dev/null +++ b/libs/libcgroup/patches/010-strerror.patch @@ -0,0 +1,51 @@ +From 942ef655237b90909edf53eafd121842cdc07ce1 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 13 Jan 2023 12:44:07 -0700 +Subject: [PATCH] api: Use GNU strerror_r when available + +GNU strerror_r is only available in glibc, musl impelents the XSI +version which is slightly different, therefore check if GNU version is +available before using it, otherwise use the XSI compliant version. + +Signed-off-by: Khem Raj +Signed-off-by: Kamalesh Babulal +Signed-off-by: Tom Hromatka +TJH: Minor formatting change so that the line doesn't exceed 100 chars +--- + configure.ac | 5 +++++ + src/api.c | 9 +++++++-- + 2 files changed, 12 insertions(+), 2 deletions(-) + +--- a/configure.ac ++++ b/configure.ac +@@ -186,6 +186,11 @@ AC_FUNC_REALLOC + AC_FUNC_STAT + AC_CHECK_FUNCS([getmntent hasmntopt memset mkdir rmdir strdup]) + ++orig_CFLAGS="$CFLAGS" ++CFLAGS="$CFLAGS -D_GNU_SOURCE" ++AC_FUNC_STRERROR_R ++CFLAGS="$orig_CFLAGS" ++ + AC_SEARCH_LIBS( + [fts_open], + [fts], +--- a/src/api.c ++++ b/src/api.c +@@ -4598,9 +4598,14 @@ const char *cgroup_strerror(int code) + { + int idx = code % ECGROUPNOTCOMPILED; + +- if (code == ECGOTHER) ++ if (code == ECGOTHER) { ++#ifdef STRERROR_R_CHAR_P + return strerror_r(cgroup_get_last_errno(), errtext, MAXLEN); +- ++#else ++ return strerror_r(cgroup_get_last_errno(), errtext, sizeof (errtext)) ? ++ "unknown error" : errtext; ++#endif ++ } + if (idx >= sizeof(cgroup_strerror_codes)/sizeof(cgroup_strerror_codes[0])) + return "Invalid error code"; + diff --git a/libs/libcgroup/patches/020-tests.patch b/libs/libcgroup/patches/020-tests.patch deleted file mode 100644 index 72d64b497e..0000000000 --- a/libs/libcgroup/patches/020-tests.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- a/Makefile.am -+++ b/Makefile.am -@@ -1,5 +1,5 @@ - AUTOMAKE_OPTIONS = foreign --SUBDIRS = dist doc include samples scripts src tests -+SUBDIRS = dist include samples scripts src - - EXTRA_DIST = README_daemon libcgroup.doxyfile README_systemd -