From: Michael Tremer Date: Sat, 14 Dec 2024 15:22:24 +0000 (+0000) Subject: jail: Enable accouting in the parent group X-Git-Tag: 0.9.30~706 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb21dd57101a3cfe5ee87c51b0dd4c2a993748ab;p=pakfire.git jail: Enable accouting in the parent group We cannot enable any of this in the child group because then we cannot fork anything into it any more. Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/jail.c b/src/libpakfire/jail.c index 13e827674..147782d90 100644 --- a/src/libpakfire/jail.c +++ b/src/libpakfire/jail.c @@ -1505,15 +1505,8 @@ static int __pakfire_jail_exec(struct pakfire_jail* jail, // Fetch our UUID const char* uuid = pakfire_jail_uuid(jail); - // Create a temporary cgroup - r = pakfire_cgroup_child(&ctx.cgroup, jail->cgroup, uuid, 0); - if (r < 0) { - ERROR(jail->ctx, "Could not create cgroup for jail: %s\n", strerror(-r)); - goto ERROR; - } - // Enable accounting to collect stats - r = pakfire_cgroup_enable_accounting(ctx.cgroup); + r = pakfire_cgroup_enable_accounting(jail->cgroup); if (r < 0) { switch (-r) { case ENOTSUP: @@ -1525,6 +1518,13 @@ static int __pakfire_jail_exec(struct pakfire_jail* jail, } } + // Create a temporary cgroup + r = pakfire_cgroup_child(&ctx.cgroup, jail->cgroup, uuid, 0); + if (r < 0) { + ERROR(jail->ctx, "Could not create cgroup for jail: %s\n", strerror(-r)); + goto ERROR; + } + // Clone into this cgroup args.cgroup = r = pakfire_cgroup_fd(ctx.cgroup); if (r < 0) {