sm-commit AT lists.ibiblio.org
Subject: Source Mage code commit list
List archive
[[SM-Commit] ] GIT changes to master grimoire by Ismael Luceno (5a36759f0f9971213e78a60633c0814478b30cb2)
- From: Ismael Luceno <scm AT sourcemage.org>
- To: sm-commit AT lists.ibiblio.org, sm-commit AT lists.sourcemage.org
- Subject: [[SM-Commit] ] GIT changes to master grimoire by Ismael Luceno (5a36759f0f9971213e78a60633c0814478b30cb2)
- Date: Sun, 23 Aug 2026 00:31:23 +0000
GIT changes to master grimoire by Ismael Luceno <ismael AT sourcemage.org>:
dev/null
|binary
devel/gnu-smalltalk/BUILD
| 2
devel/gnu-smalltalk/DEPENDS
| 7
devel/gnu-smalltalk/DETAILS
| 7
devel/gnu-smalltalk/HISTORY
| 15
devel/gnu-smalltalk/PRE_BUILD
| 4
devel/gnu-smalltalk/patches/0001-Include-string.h-in-getopt.c.patch
| 28 +
devel/gnu-smalltalk/patches/0002-Use-the-standard-va_copy.patch
| 30 +
devel/gnu-smalltalk/patches/0003-gtk-Skip-header-files-that-cannot-be-found.patch
| 28 +
devel/gnu-smalltalk/patches/0004-blox-Direct-usage-of-result-is-deprecated.patch
| 51 ++
devel/gnu-smalltalk/patches/0005-iconv-Honour-ICONV_CONST.patch
| 27 +
devel/gnu-smalltalk/patches/0006-xml-Fix-the-signature-of-the-skipped-entity-handler.patch
| 27 +
libs/libcgroup/DETAILS
| 2
libs/libcgroup/HISTORY
| 17
libs/libcgroup/INSTALL
| 20
libs/libcgroup/conf/cgconfig.conf
| 61 --
libs/libcgroup/etc/cgconfig.conf
| 71 +++
libs/libcgroup/init.d/cgconfig
| 223 +++++++++-
libs/libcgroup/init.d/cgconfig.conf
| 38 +
libs/libcgroup/init.d/cgred
| 21
libs/libcgroup/init.d/cgred.conf
| 2
libs/libcgroup/profile.d/cgroup-session.sh
| 32 +
22 files changed, 609 insertions(+), 104 deletions(-)
New commits:
commit 5a36759f0f9971213e78a60633c0814478b30cb2
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>
gnu-smalltalk 3.2.5
commit 6516fac83054ef92027779f3b811667a89de6ba4
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>
libcgroup: Implement cgroups v2 config
diff --git a/devel/gnu-smalltalk/A750566F.gpg
b/devel/gnu-smalltalk/A750566F.gpg
deleted file mode 100644
index e9f5f9c..0000000
Binary files a/devel/gnu-smalltalk/A750566F.gpg and /dev/null differ
diff --git a/devel/gnu-smalltalk/BUILD b/devel/gnu-smalltalk/BUILD
new file mode 100755
index 0000000..5278aa8
--- /dev/null
+++ b/devel/gnu-smalltalk/BUILD
@@ -0,0 +1,2 @@
+force_dialect gnu17 &&
+default_build
diff --git a/devel/gnu-smalltalk/DEPENDS b/devel/gnu-smalltalk/DEPENDS
index ca217cf..80c6f88 100755
--- a/devel/gnu-smalltalk/DEPENDS
+++ b/devel/gnu-smalltalk/DEPENDS
@@ -1,3 +1,8 @@
+case "$HOST" in
+ (*-musl)
+ depends libexecinfo LIBS=-lexecinfo
+ ;;
+esac &&
optional_depends tk "" "" "for Tk support" &&
optional_depends gtk+2 \
"--enable-gtk=yes" \
@@ -5,7 +10,7 @@ optional_depends gtk+2 \
"for GTK+ GUI support"
if is_depends_enabled $SPELL gtk+2 ; then
config_query GTK_BLOX "Build EXPERIMENTAL GTK+ version of BLOX?" n &&
- if [[ "$GTK_BLOX" = "y" ]]; then
+ if [[ "$GTK_BLOX" = "y" ]]; then
depends gtk+2 "--enable-gtk=blox"
fi
fi
diff --git a/devel/gnu-smalltalk/DETAILS b/devel/gnu-smalltalk/DETAILS
index ec70eee..9b10cf8 100755
--- a/devel/gnu-smalltalk/DETAILS
+++ b/devel/gnu-smalltalk/DETAILS
@@ -1,12 +1,9 @@
SPELL=gnu-smalltalk
- VERSION=3.1
+ VERSION=3.2.5
SOURCE=smalltalk-$VERSION.tar.gz
- SOURCE2=$SOURCE.sig
+
SOURCE_HASH=sha512:385e5fba2acb8870759e5178282210c09c45685d0cf776bc50f4ed10c9afacf9164547ba8099ea3ed9a92a2a253aa9c2b011a7a9f2dff47ea9cfdf3b42029ebc
SOURCE_DIRECTORY=$BUILD_DIRECTORY/smalltalk-$VERSION
SOURCE_URL[0]=$GNU_URL/smalltalk/$SOURCE
- SOURCE2_URL[0]=${SOURCE_URL[0]}.sig
- SOURCE_GPG=A750566F.gpg:$SOURCE2:UPSTREAM_KEY
- SOURCE2_IGNORE=signature
LICENSE[0]=GPL
WEB_SITE=http://smalltalk.gnu.org/
ENTERED=20050219
diff --git a/devel/gnu-smalltalk/HISTORY b/devel/gnu-smalltalk/HISTORY
index 5493581..2228437 100644
--- a/devel/gnu-smalltalk/HISTORY
+++ b/devel/gnu-smalltalk/HISTORY
@@ -1,3 +1,18 @@
+2026-08-23 Ismael Luceno <ismael AT sourcemage.org>
+ * DETAILS: updated spell to 3.2.5; switched to SOURCE_HASH
+ * A750566F.gpg: removed, no longer needed
+ * BUILD: added, build as C17
+ * DEPENDS, PRE_BUILD, patches/0001-Include-string.h-in-getopt.c.patch,
+ patches/0002-Use-the-standard-va_copy.patch,
+ patches/0005-iconv-Honour-ICONV_CONST.patch:
+ fixed build against musl
+ * patches/0003-gtk-Skip-header-files-that-cannot-be-found.patch:
+ fixed build of the GTK package against glib 2.88
+ * patches/0004-blox-Direct-usage-of-result-is-deprecated.patch:
+ fixed build of the Blox package against tcl 8.6
+ *
patches/0006-xml-Fix-the-signature-of-the-skipped-entity-handler.patch:
+ fixed build of the XML-Expat package
+
2011-09-26 Bor Kraljič <pyrobor AT ver.si>
* DETAILS: converted to upstream signature checking
* A750566F.gpg: added gpg keyring
diff --git a/devel/gnu-smalltalk/PRE_BUILD b/devel/gnu-smalltalk/PRE_BUILD
new file mode 100755
index 0000000..f7fb0a1
--- /dev/null
+++ b/devel/gnu-smalltalk/PRE_BUILD
@@ -0,0 +1,4 @@
+default_pre_build &&
+cd "$SOURCE_DIRECTORY" &&
+apply_patch_dir patches &&
+sedit 's!maybe_os in$!& linux-musl*|\\!' build-aux/config.sub
diff --git
a/devel/gnu-smalltalk/patches/0001-Include-string.h-in-getopt.c.patch
b/devel/gnu-smalltalk/patches/0001-Include-string.h-in-getopt.c.patch
new file mode 100644
index 0000000..57f492a
--- /dev/null
+++ b/devel/gnu-smalltalk/patches/0001-Include-string.h-in-getopt.c.patch
@@ -0,0 +1,28 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Ismael Luceno <ismael AT sourcemage.org>
+Date: Sat, 22 Aug 2026 12:00:00 +0200
+Subject: [PATCH] Include <string.h> in getopt.c
+
+getopt.c only includes <string.h> when __GNU_LIBRARY__ is defined, which
+no libc but glibc defines; on musl strcmp() and strlen() end up implicitly
+declared, which GCC 14 and later reject.
+
+Upstream-Status: Pending
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ lib-src/getopt.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/lib-src/getopt.c b/lib-src/getopt.c
+index d7719dc3888b..de884ac2b240 100644
+--- a/lib-src/getopt.c
++++ b/lib-src/getopt.c
+@@ -62,6 +62,8 @@
+
+ #ifndef ELIDE_CODE
+
++#include <string.h>
++
+
+ /* This needs to come after some library #include
+ to get __GNU_LIBRARY__ defined. */
diff --git a/devel/gnu-smalltalk/patches/0002-Use-the-standard-va_copy.patch
b/devel/gnu-smalltalk/patches/0002-Use-the-standard-va_copy.patch
new file mode 100644
index 0000000..698621d
--- /dev/null
+++ b/devel/gnu-smalltalk/patches/0002-Use-the-standard-va_copy.patch
@@ -0,0 +1,30 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Ismael Luceno <ismael AT sourcemage.org>
+Date: Sat, 22 Aug 2026 12:00:00 +0200
+Subject: [PATCH] Use the standard va_copy
+
+__va_copy is a pre-C99 glibc spelling that musl does not provide, so the
+fallback plain assignment of a va_list was used instead, which is invalid
+where va_list is an array type. va_copy is C99 and always available.
+
+Upstream-Status: Pending
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ libgst/callin.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libgst/callin.c b/libgst/callin.c
+index 4cccf879e3da..5f83c2441dc4 100644
+--- a/libgst/callin.c
++++ b/libgst/callin.c
+@@ -99,8 +99,8 @@ _gst_va_msg_send (OOP receiver,
+ if (!_gst_smalltalk_initialized)
+ _gst_initialize (NULL, NULL, GST_NO_TTY);
+
+-#ifdef __va_copy
+- __va_copy (save, ap);
++#ifdef va_copy
++ va_copy (save, ap);
+ #else
+ save = ap;
+ #endif
diff --git
a/devel/gnu-smalltalk/patches/0003-gtk-Skip-header-files-that-cannot-be-found.patch
b/devel/gnu-smalltalk/patches/0003-gtk-Skip-header-files-that-cannot-be-found.patch
new file mode 100644
index 0000000..aecf533
--- /dev/null
+++
b/devel/gnu-smalltalk/patches/0003-gtk-Skip-header-files-that-cannot-be-found.patch
@@ -0,0 +1,28 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Ismael Luceno <ismael AT sourcemage.org>
+Date: Sat, 22 Aug 2026 12:00:00 +0200
+Subject: [PATCH] gtk: Skip header files that cannot be found
+
+mkorder.awk ignores preprocessor conditionals while chasing #include
+lines, so it looks for glib/gwin32.h, which glib only installs on Windows.
+Skip headers that are not there instead of failing the build.
+
+Upstream-Status: Pending
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ packages/gtk/mkorder.awk | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/packages/gtk/mkorder.awk b/packages/gtk/mkorder.awk
+index ea17c0dc906e..ecb0eb2a9ce0 100644
+--- a/packages/gtk/mkorder.awk
++++ b/packages/gtk/mkorder.awk
+@@ -64,7 +64,7 @@ function process_file(name, file) {
+ return
+ processed[file] = 1
+ if (file == "")
+- print "error: cannot find " name
++ return
+ else {
+ scan(file)
+ print file
diff --git
a/devel/gnu-smalltalk/patches/0004-blox-Direct-usage-of-result-is-deprecated.patch
b/devel/gnu-smalltalk/patches/0004-blox-Direct-usage-of-result-is-deprecated.patch
new file mode 100644
index 0000000..0218e36
--- /dev/null
+++
b/devel/gnu-smalltalk/patches/0004-blox-Direct-usage-of-result-is-deprecated.patch
@@ -0,0 +1,51 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Holger Hans Peter Freyther <holger AT freyther.de>
+Date: Mon, 26 May 2014 07:53:05 +0200
+Subject: [PATCH] blox: Direct usage of result is deprecated and stops working
+
+Use Tcl_GetStringResult(interp) instead of interp->result on
+newer versions of Tcl. It looks like Tcl_GetStringResult has
+been present in the entire 8.0 series.
+
+2014-05-26 Holger Hans Peter Freyther <holger AT moiji-mobile.com>
+
+ * BloxTK.c: Use Tcl_GetStringResult to access the result.
+
+Upstream-Status: Backport [84fc8a50f692624921d4233dec1a3c8796f5b5da]
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ packages/blox/tk/BloxTK.c | 4 ++--
+ packages/blox/tk/ChangeLog | 4 ++++
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/packages/blox/tk/BloxTK.c b/packages/blox/tk/BloxTK.c
+index 2ba40b81071d..2f06b7f0a591 100644
+--- a/packages/blox/tk/BloxTK.c
++++ b/packages/blox/tk/BloxTK.c
+@@ -173,12 +173,12 @@ tclInit (void)
+
+ if (Tcl_Init (interp) == TCL_ERROR)
+ {
+- fprintf (stderr, "Tcl_Init failed: %s\n", interp->result);
++ fprintf (stderr, "Tcl_Init failed: %s\n",
Tcl_GetStringResult(interp));
+ exit (1);
+ }
+ if (Tk_Init (interp) == TCL_ERROR)
+ {
+- fprintf (stderr, "Tk_Init failed: %s\n", interp->result);
++ fprintf (stderr, "Tk_Init failed: %s\n", Tcl_GetStringResult(interp));
+ exit (1);
+ }
+ Tcl_CreateCommand (interp, "callback", doCallback, NULL, NULL);
+diff --git a/packages/blox/tk/ChangeLog b/packages/blox/tk/ChangeLog
+index aefd2dcb0fe5..159b17765719 100644
+--- a/packages/blox/tk/ChangeLog
++++ b/packages/blox/tk/ChangeLog
+@@ -1,3 +1,7 @@
++2014-05-26 Holger Hans Peter Freyther <holger AT moiji-mobile.com>
++
++ * BloxTK.c: Use Tcl_GetStringResult to access the result.
++
+ 2010-12-04 Paolo Bonzini <bonzini AT gnu.org>
+
+ * package.xml: Remove now superfluous <file> tags.
diff --git a/devel/gnu-smalltalk/patches/0005-iconv-Honour-ICONV_CONST.patch
b/devel/gnu-smalltalk/patches/0005-iconv-Honour-ICONV_CONST.patch
new file mode 100644
index 0000000..caa4f1c
--- /dev/null
+++ b/devel/gnu-smalltalk/patches/0005-iconv-Honour-ICONV_CONST.patch
@@ -0,0 +1,27 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Ismael Luceno <ismael AT sourcemage.org>
+Date: Sat, 22 Aug 2026 12:00:00 +0200
+Subject: [PATCH] iconv: Honour ICONV_CONST
+
+The second argument of iconv() is only const in the GNU implementation;
+configure already computes ICONV_CONST for exactly this.
+
+Upstream-Status: Pending
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ packages/iconv/iconv.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/packages/iconv/iconv.c b/packages/iconv/iconv.c
+index 80c97c666ea9..e7904cc4e5d0 100644
+--- a/packages/iconv/iconv.c
++++ b/packages/iconv/iconv.c
+@@ -66,7 +66,7 @@ iconvWrapper (iconv_t handle, OOP readBufferOOP, int
readPos,
+ int readCount, OOP writeBufferOOP, int writeCount,
+ OOP bytesLeftOOP)
+ {
+- const char *inbuf;
++ ICONV_CONST char *inbuf;
+ size_t inbytesleft;
+ char *outbuf;
+ size_t outbytesleft;
diff --git
a/devel/gnu-smalltalk/patches/0006-xml-Fix-the-signature-of-the-skipped-entity-handler.patch
b/devel/gnu-smalltalk/patches/0006-xml-Fix-the-signature-of-the-skipped-entity-handler.patch
new file mode 100644
index 0000000..b69c91f
--- /dev/null
+++
b/devel/gnu-smalltalk/patches/0006-xml-Fix-the-signature-of-the-skipped-entity-handler.patch
@@ -0,0 +1,27 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Ismael Luceno <ismael AT sourcemage.org>
+Date: Sat, 22 Aug 2026 12:00:00 +0200
+Subject: [PATCH] xml: Fix the signature of the skipped entity handler
+
+XML_SkippedEntityHandler takes an is_parameter_entity argument.
+
+Upstream-Status: Pending
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ packages/xml/expat/expat.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/packages/xml/expat/expat.c b/packages/xml/expat/expat.c
+index 0ceee46c2cc0..d76beb1e6081 100644
+--- a/packages/xml/expat/expat.c
++++ b/packages/xml/expat/expat.c
+@@ -478,7 +478,8 @@ gst_EndNamespaceDeclHandler (void *userData,
+
+ static void
+ gst_SkippedEntityHandler (void *userData,
+- const XML_Char * entityName)
++ const XML_Char * entityName,
++ int is_parameter_entity)
+ {
+ XML_Parser p = userData;
+ OOP parserOOP = XML_GetUserData (p);
diff --git a/libs/libcgroup/DETAILS b/libs/libcgroup/DETAILS
index e182580..3047fe3 100755
--- a/libs/libcgroup/DETAILS
+++ b/libs/libcgroup/DETAILS
@@ -2,7 +2,7 @@
VERSION=0.42.2
SOURCE_HASH=sha512:06490bc75fa33f477d7310faec0c4b594a59d9dd3144a67809e8dae1342e6e3bb840a0767d39f5e38a05aab145753960b742accb3ceae23f645a3200c82cfb4f
SECURITY_PATCH=1
- PATCHLEVEL=1
+ PATCHLEVEL=2
SOURCE=$SPELL-$VERSION.tar.bz2
SOURCE_DIRECTORY=$BUILD_DIRECTORY/$SPELL-$VERSION
DOC_DIRS=""
diff --git a/libs/libcgroup/HISTORY b/libs/libcgroup/HISTORY
index 2b9dd61..56a7ee8 100644
--- a/libs/libcgroup/HISTORY
+++ b/libs/libcgroup/HISTORY
@@ -1,3 +1,20 @@
+2026-08-23 Ismael Luceno <ismael AT sourcemage.org>
+ * init.d/cgconfig: Set up the unified (cgroup v2) hierarchy by
default:
+ mount it, enable the available controllers and delegate
+ user.slice/user-<uid>.slice to each user, so that rootless container
+ runtimes have a cgroup they may write to.
+ Fall back to cgconfigparser when /etc/cgconfig.conf declares v1
+ mount points.
+ * init.d/cgconfig.conf: Added the cgroup v2 settings
+ * profile.d/cgroup-session.sh, INSTALL: Move each login session into a
+ scope below its user's delegated slice
+ * conf/cgconfig.conf: Commented out the v1 mount block; it took the
+ controllers away from v2, memory among them
+ * init.d/cgred: Explain why cgrulesengd cannot run, instead of failing
+ with "Cannot find cgroups": it is cgroup v1 only and needs
+ CONFIG_CONNECTOR
+ * DETAILS: PATCHLEVEL++
+
2021-04-15 Treeve Jelbert <treeve AT sourcemage.org>
* DETAILS: version 0.42.2
now at github
diff --git a/libs/libcgroup/INSTALL b/libs/libcgroup/INSTALL
index 39ac495..572179e 100755
--- a/libs/libcgroup/INSTALL
+++ b/libs/libcgroup/INSTALL
@@ -5,17 +5,17 @@ install -d -m 0755 "${INSTALL_ROOT}"/etc/cgconfig.d/ &&
install_config_file "${SOURCE_DIRECTORY}"/samples/cgrules.conf \
"${INSTALL_ROOT}"/etc/cgrules.conf &&
-install_config_file "${SOURCE_DIRECTORY}"/samples/cgconfig.conf \
- "${INSTALL_ROOT}"/etc/cgconfig.conf &&
-
install_config_file "${SOURCE_DIRECTORY}"/samples/cgsnapshot_blacklist.conf
\
"${INSTALL_ROOT}"/etc/cgsnapshot_blacklist.conf
&&
-install_config_file "${SCRIPT_DIRECTORY}"/conf/cgconfig.conf \
- "${INSTALL_ROOT}"/etc/cgconfig.conf &&
+# samples/cgconfig.conf with the cgroup v2 caveats appended; the
init.d/*.conf
+# counterparts are installed into /etc/sysconfig by sorcery itself
+install_config_file "${SCRIPT_DIRECTORY}"/etc/cgconfig.conf \
+ "${INSTALL_ROOT}"/etc/cgconfig.conf &&
-# Install SysConfig files as Sorcery doesn't seem to want to pick up the
init.d/*.conf files
-for SYSCONF in cgconfig cgred; do
- install_config_file "${SPELL_DIRECTORY}"/init.d/${SYSCONF}.conf \
- "${INSTALL_ROOT}"/etc/sysconfig/${SYSCONF}
-done
+# Puts each login session in a scope below the subtree cgconfig delegates to
+# its user; without it sessions stay in the root cgroup, where an
unprivileged
+# process may not create a cgroup of its own.
+install -d "$INSTALL_ROOT"/etc/profile.d/ &&
+install_config_file "$SPELL_DIRECTORY"/profile.d/cgroup-session.sh \
+ "$INSTALL_ROOT"/etc/profile.d/cgroup-session.sh
diff --git a/libs/libcgroup/conf/cgconfig.conf
b/libs/libcgroup/conf/cgconfig.conf
deleted file mode 100644
index c5f50f0..0000000
--- a/libs/libcgroup/conf/cgconfig.conf
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# Copyright IBM Corporation. 2007
-#
-# Authors: Balbir Singh <balbir AT linux.vnet.ibm.com>
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of version 2.1 of the GNU Lesser General Public License
-# as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it would be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-#
-#group daemons/www {
-# perm {
-# task {
-# uid = root;
-# gid = webmaster;
-# }
-# admin {
-# uid = root;
-# gid = root;
-# }
-# }
-# cpu {
-# cpu.shares = 1000;
-# }
-#}
-#
-#group daemons/ftp {
-# perm {
-# task {
-# uid = root;
-# gid = ftpmaster;
-# }
-# admin {
-# uid = root;
-# gid = root;
-# }
-# }
-# cpu {
-# cpu.shares = 500;
-# }
-#}
-#
-#mount {
-# cpu = /mnt/cgroups/cpu;
-# cpuacct = /mnt/cgroups/cpuacct;
-#}
-
-# From
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Resource_Management_Guide/ch-Using_Control_Groups.html#The_cgconfig.conf_File
-# Setup some default groups otherwise cgconfig does nothing
-mount {
- cpuset = /cgroup/cpuset;
- cpu = /cgroup/cpu;
- cpuacct = /cgroup/cpuacct;
- memory = /cgroup/memory;
- devices = /cgroup/devices;
- freezer = /cgroup/freezer;
- net_cls = /cgroup/net_cls;
- blkio = /cgroup/blkio;
-}
diff --git a/libs/libcgroup/etc/cgconfig.conf
b/libs/libcgroup/etc/cgconfig.conf
new file mode 100644
index 0000000..2b28e47
--- /dev/null
+++ b/libs/libcgroup/etc/cgconfig.conf
@@ -0,0 +1,71 @@
+# /etc/cgconfig.conf - control group hierarchies and groups, as read by
+# cgconfigparser(8). Not to be confused with /etc/sysconfig/cgconfig, which
+# is where the cgconfig service takes its own settings from.
+#
+# Copyright IBM Corporation. 2007
+#
+# Authors: Balbir Singh <balbir AT linux.vnet.ibm.com>
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2.1 of the GNU Lesser General Public License
+# as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+#group daemons/www {
+# perm {
+# task {
+# uid = root;
+# gid = webmaster;
+# }
+# admin {
+# uid = root;
+# gid = root;
+# }
+# }
+# cpu {
+# cpu.shares = 1000;
+# }
+#}
+#
+#group daemons/ftp {
+# perm {
+# task {
+# uid = root;
+# gid = ftpmaster;
+# }
+# admin {
+# uid = root;
+# gid = root;
+# }
+# }
+# cpu {
+# cpu.shares = 500;
+# }
+#}
+#
+#mount {
+# cpu = /mnt/cgroups/cpu;
+# cpuacct = /mnt/cgroups/cpuacct;
+#}
+
+# This file is only used for the legacy (cgroup v1) hierarchies, and
libcgroup
+# 0.42.x speaks nothing else. By default the cgconfig service ignores it and
+# sets up the unified (cgroup v2) hierarchy instead - see
+# /etc/sysconfig/cgconfig.
+#
+# A controller belongs to exactly one hierarchy, so uncommenting a "mount"
+# block here takes those controllers away from v2 and switches the cgconfig
+# service over to cgconfigparser. On a current kernel that costs you the
+# controllers that no longer have a v1 implementation, memory among them
+# (CONFIG_MEMCG_V1), so only do it if something actually needs v1.
+#
+#mount {
+# cpu = /cgroup/cpu;
+# cpuacct = /cgroup/cpuacct;
+# devices = /cgroup/devices;
+# freezer = /cgroup/freezer;
+# net_cls = /cgroup/net_cls;
+# blkio = /cgroup/blkio;
+#}
diff --git a/libs/libcgroup/init.d/cgconfig b/libs/libcgroup/init.d/cgconfig
index 67e7a38..a29dd6b 100644
--- a/libs/libcgroup/init.d/cgconfig
+++ b/libs/libcgroup/init.d/cgconfig
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Start/Stop the workload manager
+# Set up the control group hierarchy.
#
# Copyright IBM Corporation. 2008
#
@@ -15,9 +15,11 @@
#
# cgconfig Control Groups Configuration Startup
# chkconfig: - 5 95
-# description: This script runs the cgconfigparser utility to parse and setup
-# the control group filesystem. It uses /etc/cgconfig.conf
-# and parses the configuration specified in there.
+# description: Sets up the control group filesystem. On the unified (cgroup
+# v2) hierarchy it mounts /sys/fs/cgroup, makes the available
+# controllers usable by child cgroups and delegates a subtree to
+# each user. If /etc/cgconfig.conf declares v1 mount points it
+# falls back to running cgconfigparser on it instead.
### BEGIN INIT INFO
# Short-Description: Create and setup control group filesystem(s)
@@ -34,16 +36,170 @@ NEEDS="+local_fs +syslog"
# get correct location of binaries from configure
prefix=/usr/;exec_prefix=${prefix};sbindir=${exec_prefix}/sbin
servicename=cgconfig
-PROGRAM=$sbindir/cgconfigparser
+# auto_init insists PROGRAM be executable, and the unified hierarchy needs
+# nothing from libcgroup itself; cgconfigparser is only used for the v1 path.
+PROGRAM=/bin/mount
+CGCONFIGPARSER=$sbindir/cgconfigparser
CONFIG_FILE=/etc/cgconfig.conf
lockfile=/var/lock/${servicename}
# read the config
CREATE_DEFAULT=yes
+CGROUP_ROOT=/sys/fs/cgroup
+CGROUP_MOUNT_OPTIONS=nsdelegate,memory_recursiveprot
+# Controllers to hand down to child cgroups; empty means every controller the
+# kernel offers.
+CGROUP_CONTROLLERS=
+# Parent of the per-user delegated subtrees.
+USER_SLICE=user.slice
+# Delegate a subtree to every user in this UID range, plus DELEGATE_USERS.
+DELEGATE=yes
+DELEGATE_UID_MIN=1000
+DELEGATE_UID_MAX=60000
+DELEGATE_USERS=
if [ -e /etc/sysconfig/cgconfig ]; then
. /etc/sysconfig/cgconfig
fi
+#
+# cgroup v2 (unified hierarchy)
+#
+# A controller belongs to exactly one hierarchy, so v1 and v2 cannot both be
+# used for it; whichever is mounted first wins. This is why the v1 path
below
+# is only taken when the admin has explicitly asked for it.
+#
+
+cgroup_fstype() {
+ awk -v root="$CGROUP_ROOT" '$2 == root { type = $3 } END { print type
}' \
+ /proc/self/mounts
+}
+
+# True when /etc/cgconfig.conf asks for v1 mount points, i.e. when the admin
+# has deliberately configured the legacy hierarchies.
+wants_cgroup_v1() {
+ [ -s "$CONFIG_FILE" ] &&
+ grep -q '^[[:space:]]*mount[[:space:]]*{' "$CONFIG_FILE"
+}
+
+mount_cgroup2() {
+ case "$(cgroup_fstype)" in
+ (cgroup2)
+ return 0
+ ;;
+ (cgroup)
+ print_status warning "$CGROUP_ROOT holds a cgroup v1
hierarchy"
+ echo "$servicename: replace the $CGROUP_ROOT line in
/etc/fstab with"
+ echo "$servicename: none $CGROUP_ROOT cgroup2
$CGROUP_MOUNT_OPTIONS 0 0"
+ echo "$servicename: the controllers cannot be handed to v2
while v1 holds them"
+ return 1
+ ;;
+ esac
+
+ mkdir -p "$CGROUP_ROOT" &&
+ mount -t cgroup2 -o "$CGROUP_MOUNT_OPTIONS" cgroup2 "$CGROUP_ROOT"
+}
+
+# A cgroup can only offer a controller to its children after listing it in
+# cgroup.subtree_control, and it can only offer what its own parent gave it
in
+# cgroup.controllers. Enable them one at a time so that one controller the
+# kernel refuses does not take the rest down with it.
+enable_controllers() {
+ local cg=$1 avail want c
+
+ avail=$(cat "$cg/cgroup.controllers" 2>/dev/null) || return 0
+ want=${CGROUP_CONTROLLERS:-$avail}
+
+ for c in $want; do
+ case " $avail " in
+ (*" $c "*)
+ echo "+$c" > "$cg/cgroup.subtree_control" 2>/dev/null
+ ;;
+ esac
+ done
+
+ return 0
+}
+
+# Delegation hands a subtree to an unprivileged user. The kernel checks the
+# owner of the directory itself, of cgroup.procs and cgroup.threads (moving a
+# process) and of cgroup.subtree_control (handing controllers further down);
+# nothing else must become writable, or the user could escape the subtree.
+delegate_cgroup() {
+ local cg=$1 owner=$2 f
+
+ mkdir -p "$cg" || return 1
+ chown "$owner" "$cg" || return 1
+
+ for f in cgroup.procs cgroup.threads cgroup.subtree_control; do
+ if [ -e "$cg/$f" ]; then
+ chown "$owner" "$cg/$f" || return 1
+ fi
+ done
+
+ return 0
+}
+
+delegated_users() {
+ awk -F: -v min="$DELEGATE_UID_MIN" -v max="$DELEGATE_UID_MAX" \
+ '$3 >= min && $3 <= max { print $3 }' /etc/passwd
+
+ local user uid
+
+ for user in $DELEGATE_USERS; do
+ uid=$(id -u "$user" 2>/dev/null) && echo "$uid"
+ done
+}
+
+setup_user_slices() {
+ local slice=$CGROUP_ROOT/$USER_SLICE uid
+
+ mkdir -p "$slice" || return 1
+
+ # user.slice itself never holds processes - sessions go into a scope
+ # below their own user-<uid>.slice - so it is free to pass controllers
+ # down.
+ enable_controllers "$slice"
+
+ for uid in $(delegated_users | sort -un); do
+ delegate_cgroup "$slice/user-$uid.slice" "$uid" ||
+ print_status warning "could not delegate
user-$uid.slice"
+ done
+
+ return 0
+}
+
+start_v2() {
+ mount_cgroup2 || return 1
+
+ # The root cgroup is the only one exempt from the "no internal
+ # processes" rule, so it can keep the boot-time processes and still
+ # pass controllers down.
+ enable_controllers "$CGROUP_ROOT"
+
+ if [ "$DELEGATE" = "yes" ]; then
+ setup_user_slices || return 1
+ fi
+
+ print_status success
+ return 0
+}
+
+stop_v2() {
+ local slice=$CGROUP_ROOT/$USER_SLICE cg
+
+ # rmdir on a cgroup that still holds processes fails, so this only
+ # reaps the ones that are genuinely finished.
+ for cg in "$slice"/*/*/ "$slice"/*/ "$slice"/; do
+ [ -d "$cg" ] && rmdir "$cg" 2>/dev/null
+ done
+
+ return 0
+}
+
+#
+# cgroup v1 (legacy, driven by /etc/cgconfig.conf)
+#
+
create_default_groups() {
defaultcgroup=
@@ -92,19 +248,13 @@ create_default_groups() {
2>/dev/null || :
}
-start() {
- echo -n "Starting cgconfig service: "
+start_v1() {
if [ -f "$lockfile" ] && lscgroup > /dev/null 2>&1; then
print_status warning "cgroups are already mounted"
return 0
fi &&
- if [ ! -s $CONFIG_FILE ]; then
- print_status failure "$CONFIG_FILE is not configured"
- return 6
- fi &&
-
- $PROGRAM -l $CONFIG_FILE
+ $CGCONFIGPARSER -l $CONFIG_FILE
evaluate_retval || ( print_status failure "Failed to parse
$CONFIG_FILE" && return 1 )
if [ $CREATE_DEFAULT = "yes" ]; then
@@ -114,26 +264,55 @@ start() {
touch "$lockfile" || ( print_status failure "Failed to touch
$lockfile" && return 1 )
}
-stop() {
- echo -n "Stopping cgconfig service: "
+stop_v1() {
cgclear -l $CONFIG_FILE
rm -f "$lockfile"
evaluate_retval
}
-status() {
- if [ -f "$lockfile" ]; then
- print_status success "${servicename} already started" &&
- return 0
+#
+# init script entry points
+#
+
+start() {
+ echo -n "Starting cgconfig service: "
+
+ if wants_cgroup_v1; then
+ start_v1
else
- print_status failure "${servicename} not started" &&
- return 0
+ start_v2
+ fi
+}
+
+stop() {
+ echo -n "Stopping cgconfig service: "
+
+ if [ "$(cgroup_fstype)" = cgroup2 ]; then
+ stop_v2
+ print_status success
+ else
+ stop_v1
fi
}
+status() {
+ case "$(cgroup_fstype)" in
+ (cgroup2)
+ print_status success "${servicename}: unified hierarchy on
$CGROUP_ROOT"
+ ;;
+ (cgroup)
+ print_status success "${servicename}: legacy v1 hierarchy on
$CGROUP_ROOT"
+ ;;
+ (*)
+ print_status failure "${servicename} not started"
+ ;;
+ esac
+
+ return 0
+}
+
restart() {
stop
sleep 1
start
}
-
diff --git a/libs/libcgroup/init.d/cgconfig.conf
b/libs/libcgroup/init.d/cgconfig.conf
index 5a61bf6..0ff2454 100644
--- a/libs/libcgroup/init.d/cgconfig.conf
+++ b/libs/libcgroup/init.d/cgconfig.conf
@@ -1,3 +1,41 @@
+# /etc/sysconfig/cgconfig - control group setup
+#
+# The cgconfig service sets up the unified (cgroup v2) hierarchy unless
+# /etc/cgconfig.conf contains a "mount { ... }" block, in which case it hands
+# that file to cgconfigparser and the legacy v1 settings below apply instead.
+
+# --- unified hierarchy (cgroup v2) ---------------------------------------
+
+# Where the unified hierarchy lives. If /etc/fstab already mounts it, this
+# only has to agree with the fstab entry:
+# none /sys/fs/cgroup cgroup2 nsdelegate,memory_recursiveprot 0 0
+CGROUP_ROOT=/sys/fs/cgroup
+
+# Mount options used when the service has to mount it itself. nsdelegate
makes
+# the kernel treat a cgroup namespace root as a delegation boundary, which is
+# what keeps an unprivileged container inside its own subtree.
+CGROUP_MOUNT_OPTIONS=nsdelegate,memory_recursiveprot
+
+# Controllers to make available to child cgroups. Empty means every
controller
+# the kernel offers (see /sys/fs/cgroup/cgroup.controllers).
+CGROUP_CONTROLLERS=
+
+# Give each user a cgroup subtree of their own under user.slice. Rootless
+# container runtimes need this: they create a cgroup for the container and
+# move the container process into it, which the root cgroup does not allow.
+# The matching /etc/profile.d/cgroup-session.sh moves each login session into
+# a scope below its user's slice.
+DELEGATE=yes
+USER_SLICE=user.slice
+
+# Which users get a subtree. The range matches UID_MIN/UID_MAX in
+# /etc/login.defs; DELEGATE_USERS adds names outside it.
+DELEGATE_UID_MIN=1000
+DELEGATE_UID_MAX=60000
+DELEGATE_USERS=
+
+# --- legacy hierarchies (cgroup v1) --------------------------------------
+
# Service cgconfig can create a default group in all mounted hierarchies and
# move all processes there on boot. If no default rule is specified in
# /etc/cgrules.conf, the default group is named '/sysdefault'.
diff --git a/libs/libcgroup/init.d/cgred b/libs/libcgroup/init.d/cgred
index 6b7cb9a..0677a39 100644
--- a/libs/libcgroup/init.d/cgred
+++ b/libs/libcgroup/init.d/cgred
@@ -47,8 +47,8 @@ pidfile=/var/run/cgred.pid
[ -x $PROGRAM ] || exit 1
# Read in configuration options.
-if [ -f "/etc/sysconfig/cgred.conf" ] ; then
- . /etc/sysconfig/cgred.conf
+if [ -f "/etc/sysconfig/cgred" ] ; then
+ . /etc/sysconfig/cgred
OPTIONS="$NODAEMON $LOG"
if [ -n "$LOG_FILE" ]; then
OPTIONS="$OPTIONS --logfile=$LOG_FILE"
@@ -73,7 +73,22 @@ start()
num=`grep "cgroup" /proc/mounts | awk '$3=="cgroup"' | wc -l`
if [ $num -eq 0 ]; then
echo
- print_status failure $"Cannot find cgroups, is cgconfig
service running?"
+ if awk '$3 == "cgroup2" { found = 1 } END { exit !found }'
/proc/mounts; then
+ print_status failure $"cgrulesengd only understands
cgroup v1, and this host runs the unified hierarchy"
+ echo "$servicename: disable this service; cgconfig
delegates a subtree"
+ echo "$servicename: to each user instead of
classifying processes here"
+ else
+ print_status failure $"Cannot find cgroups, is
cgconfig service running?"
+ fi
+ return 1
+ fi
+
+ # cgrulesengd hears about new processes through the kernel's process
+ # event connector, which registers /proc/net/connector when it is
built
+ # in. Without it the daemon starts and then stays permanently idle.
+ if [ ! -e /proc/net/connector ]; then
+ echo
+ print_status failure $"kernel lacks CONFIG_CONNECTOR,
cgrulesengd cannot see new processes"
return 1
fi
loadproc ${PROGRAM} ${OPTIONS}
diff --git a/libs/libcgroup/init.d/cgred.conf
b/libs/libcgroup/init.d/cgred.conf
index edd0dc7..ab87072 100644
--- a/libs/libcgroup/init.d/cgred.conf
+++ b/libs/libcgroup/init.d/cgred.conf
@@ -1,4 +1,4 @@
-# /etc/sysconfig/cgred.conf - CGroup Rules Engine Daemon configuration file
+# /etc/sysconfig/cgred - CGroup Rules Engine Daemon configuration file
#
# The four options listed below (CONFIG_FILE, LOG_FILE, NODAEMON, LOG) are
# the only valid ones. Defining anything else in this file will cause the
diff --git a/libs/libcgroup/profile.d/cgroup-session.sh
b/libs/libcgroup/profile.d/cgroup-session.sh
new file mode 100644
index 0000000..218c749
--- /dev/null
+++ b/libs/libcgroup/profile.d/cgroup-session.sh
@@ -0,0 +1,32 @@
+# Move this login session into a cgroup of its own.
+#
+# Processes start out in the root cgroup, which only root may write to, so an
+# unprivileged tool that wants a cgroup - a rootless container runtime, or
+# anything setting a limit on the session - has nowhere to put one. The
+# cgconfig service delegates /sys/fs/cgroup/user.slice/user-<uid>.slice to
each
+# user; this puts the session in a scope below it, which becomes the root of
+# the cgroup namespace of anything the session unshares.
+#
+# Everything here is best effort: a host without the delegated subtree just
+# keeps the old behaviour.
+
+if [ -d /sys/fs/cgroup/user.slice ]; then
+ _cg_slice=/sys/fs/cgroup/user.slice/user-$(id -u).slice
+
+ if [ -w "$_cg_slice/cgroup.procs" ]; then
+ # Reap the scopes of sessions that have ended. rmdir fails on
a
+ # cgroup that still holds processes, so live ones are
untouched.
+ for _cg_old in "$_cg_slice"/session-*.scope; do
+ rmdir "$_cg_old" 2>/dev/null
+ done
+
+ _cg_scope=$_cg_slice/session-$$.scope
+
+ mkdir -p "$_cg_scope" 2>/dev/null &&
+ echo $$ > "$_cg_scope/cgroup.procs" 2>/dev/null
+
+ unset _cg_old _cg_scope
+ fi
+
+ unset _cg_slice
+fi
- [[SM-Commit] ] GIT changes to master grimoire by Ismael Luceno (5a36759f0f9971213e78a60633c0814478b30cb2), Ismael Luceno, 08/22/2026
Archive powered by MHonArc 2.6.24.