From 8e0c33be46820c11bb7a911ae0f67fd390864058 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Tue, 14 Apr 2020 00:00:00 -0500 Subject: [PATCH] library: adapted to the latest lxc conventions (again) Well, shit! With release 4.0 on March 25th the lxc/lxd folks have stuck it to us once again. They changed the cgroup lxc prefix used to identify the container name. Signed-off-by: Jim Warner --- proc/readproc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/proc/readproc.c b/proc/readproc.c index 9b4d9950..1c503a50 100644 --- a/proc/readproc.c +++ b/proc/readproc.c @@ -910,15 +910,17 @@ static const char *lxc_containers (const char *path) { 1:cpuset,cpu,cpuacct,devices,freezer,net_cls,blkio,perf_event,net_prio:/lxc/lxc-P */ if (file2str(path, "cgroup", &ub) > 0) { - /* ouch, next two defaults could be changed at lxc ./configure time + /* ouch, the next defaults could be changed at lxc ./configure time ( and a changed 'lxc.cgroup.pattern' is only available to root ) */ - static const char *lxc_delm1 = "lxc.payload/"; // with lxc-3.1.0 - static const char *lxc_delm2 = "lxc/"; // thru lxc-3.0.3 + static const char *lxc_delm1 = "lxc.payload."; // with lxc-4.0.0 + static const char *lxc_delm2 = "lxc.payload/"; // thru lxc-3.2.1 + static const char *lxc_delm3 = "lxc/"; // thru lxc-3.0.3 const char *delim; char *p1; if ((p1 = strstr(ub.buf, (delim = lxc_delm1))) - || ((p1 = strstr(ub.buf, (delim = lxc_delm2))))) { + || ((p1 = strstr(ub.buf, (delim = lxc_delm2))) + || ((p1 = strstr(ub.buf, (delim = lxc_delm3)))))) { static struct lxc_ele { struct lxc_ele *next; const char *name;