summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2021-11-28 20:08:45 +0100
committerBenBE <BenBE@geshi.org>2021-11-28 20:19:10 +0100
commitb98a4f8d56a61b5f98269d757cc69bd07b2b49b5 (patch)
tree450798c31f21d317a980d20c97ded3802dc0e3f2
parent55e073a455b32ffef7992cfdefded9978b8d0468 (diff)
Include support for legacy LXC cgroup naming
-rw-r--r--linux/CGroupUtils.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/linux/CGroupUtils.c b/linux/CGroupUtils.c
index 1c8b05ff..6f3b6fe7 100644
--- a/linux/CGroupUtils.c
+++ b/linux/CGroupUtils.c
@@ -67,6 +67,8 @@ static bool CGroup_filterName_internal(const char *cgroup, StrBuf_state* s, StrB
const char* str_machine_slice = "machine.slice";
const char* str_user_slice_prefix = "/user-";
+ const char* str_lxc_monitor_legacy = "lxc.monitor";
+ const char* str_lxc_payload_legacy = "lxc.payload";
const char* str_lxc_monitor_prefix = "lxc.monitor.";
const char* str_lxc_payload_prefix = "lxc.payload.";
@@ -193,6 +195,34 @@ static bool CGroup_filterName_internal(const char *cgroup, StrBuf_state* s, StrB
continue;
}
+ // LXC legacy cgroup naming
+ if (Label_checkEqual(labelStart, labelLen, str_lxc_monitor_legacy) ||
+ Label_checkEqual(labelStart, labelLen, str_lxc_payload_legacy)) {
+ bool isMonitor = Label_checkEqual(labelStart, labelLen, str_lxc_monitor_legacy);
+
+ labelStart = nextSlash;
+ while (*labelStart == '/')
+ labelStart++;
+
+ nextSlash = strchrnul(labelStart, '/');
+ if (nextSlash - labelStart > 0) {
+ if (!StrBuf_putsz(s, w, isMonitor ? "[LXC:" : "[lxc:"))
+ return false;
+
+ if (!StrBuf_putsn(s, w, labelStart, nextSlash - labelStart))
+ return false;
+
+ if (!w(s, ']'))
+ return false;
+
+ cgroup = nextSlash;
+ continue;
+ }
+
+ labelStart = cgroup;
+ nextSlash = labelStart + labelLen;
+ }
+
if (Label_checkSuffix(labelStart, labelLen, str_service_suffix)) {
const size_t serviceNameLen = labelLen - strlen(str_service_suffix);

© 2014-2024 Faster IT GmbH | imprint | privacy policy