]> git.ipfire.org Git - pakfire.git/commitdiff
build: Move cgroup accounting here
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 14 Dec 2024 16:13:57 +0000 (16:13 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 14 Dec 2024 16:13:57 +0000 (16:13 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/build.c
src/libpakfire/jail.c

index 93d3c85617609c741bcdbdf516595ad1bcfbc19c..2df93a737d456a086cba8940fd5f4b9a85a574a2 100644 (file)
@@ -1355,6 +1355,19 @@ static int pakfire_build_setup_cgroup(struct pakfire_build* build) {
                goto ERROR;
        }
 
+       // Enable accounting to collect stats
+       r = pakfire_cgroup_enable_accounting(build->cgroup);
+       if (r < 0) {
+               switch (-r) {
+                       case ENOTSUP:
+                               DEBUG(build->ctx, "Could not enable accounting in cgroup\n");
+                               break;
+
+                       default:
+                               goto ERROR;
+               }
+       }
+
        // Fetch config
        config = pakfire_get_config(build->pakfire);
        if (!config)
index eac4ea2f2c4b2553a65a89667c225691b72a4770..e32fdb293c537494e3e3e23951bfd621d6687487 100644 (file)
@@ -1506,19 +1506,6 @@ static int __pakfire_jail_exec(struct pakfire_jail* jail,
                // Fetch our UUID
                const char* uuid = pakfire_jail_uuid(jail);
 
-               // Enable accounting to collect stats
-               r = pakfire_cgroup_enable_accounting(jail->cgroup);
-               if (r < 0) {
-                       switch (-r) {
-                               case ENOTSUP:
-                                       DEBUG(jail->ctx, "Could not enable accounting in cgroup\n");
-                                       break;
-
-                               default:
-                                       goto ERROR;
-                       }
-               }
-
                // Create a temporary cgroup
                r = pakfire_cgroup_child(&ctx.cgroup, jail->cgroup, uuid, 0);
                if (r < 0) {