From f4c7536a84adb4dda8a7cad563e616121866d228 Mon Sep 17 00:00:00 2001 From: dragonmuffin Date: Mon, 23 Sep 2024 20:40:55 +0500 Subject: [PATCH] fix: kill all processes of cgroup before exit --- starter/cgroup_prepare.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/starter/cgroup_prepare.c b/starter/cgroup_prepare.c index b4404b1..18c7bcd 100644 --- a/starter/cgroup_prepare.c +++ b/starter/cgroup_prepare.c @@ -66,6 +66,11 @@ void remove_cgroup() { char cwd[PATH_MAX]; getcwd(cwd,sizeof(cwd)); chdir(cgroups_path); + chdir(cgroup_name); + write_file("cgroup.kill","1\n"); + struct timespec tw = {0,5}; + nanosleep(&tw,NULL); + chdir(".."); rmdir(cgroup_name); chdir(cwd); }