Lines Matching refs:cgroup

21 static int cg_kill_wait(const char *cgroup)  in cg_kill_wait()  argument
25 fd = cg_prepare_for_wait(cgroup); in cg_kill_wait()
29 ret = cg_write(cgroup, "cgroup.kill", "1"); in cg_kill_wait()
46 static int child_fn(const char *cgroup, void *arg) in child_fn() argument
60 char *cgroup = NULL; in test_cgkill_simple() local
63 cgroup = cg_name(root, "cg_test_simple"); in test_cgkill_simple()
64 if (!cgroup) in test_cgkill_simple()
67 if (cg_create(cgroup)) in test_cgkill_simple()
71 pids[i] = cg_run_nowait(cgroup, child_fn, NULL); in test_cgkill_simple()
73 if (cg_wait_for_proc_count(cgroup, 100)) in test_cgkill_simple()
76 if (cg_read_strcmp(cgroup, "cgroup.events", "populated 1\n")) in test_cgkill_simple()
79 if (cg_kill_wait(cgroup)) in test_cgkill_simple()
89 cg_read_strcmp(cgroup, "cgroup.events", "populated 0\n")) in test_cgkill_simple()
92 if (cgroup) in test_cgkill_simple()
93 cg_destroy(cgroup); in test_cgkill_simple()
94 free(cgroup); in test_cgkill_simple()
116 char *cgroup[10] = {0}; in test_cgkill_tree() local
120 cgroup[0] = cg_name(root, "cg_test_tree_A"); in test_cgkill_tree()
121 if (!cgroup[0]) in test_cgkill_tree()
124 cgroup[1] = cg_name(cgroup[0], "B"); in test_cgkill_tree()
125 if (!cgroup[1]) in test_cgkill_tree()
128 cgroup[2] = cg_name(cgroup[1], "C"); in test_cgkill_tree()
129 if (!cgroup[2]) in test_cgkill_tree()
132 cgroup[3] = cg_name(cgroup[1], "D"); in test_cgkill_tree()
133 if (!cgroup[3]) in test_cgkill_tree()
136 cgroup[4] = cg_name(cgroup[0], "E"); in test_cgkill_tree()
137 if (!cgroup[4]) in test_cgkill_tree()
140 cgroup[5] = cg_name(cgroup[4], "F"); in test_cgkill_tree()
141 if (!cgroup[5]) in test_cgkill_tree()
144 cgroup[6] = cg_name(cgroup[5], "G"); in test_cgkill_tree()
145 if (!cgroup[6]) in test_cgkill_tree()
148 cgroup[7] = cg_name(cgroup[6], "H"); in test_cgkill_tree()
149 if (!cgroup[7]) in test_cgkill_tree()
152 cgroup[8] = cg_name(cgroup[0], "I"); in test_cgkill_tree()
153 if (!cgroup[8]) in test_cgkill_tree()
156 cgroup[9] = cg_name(cgroup[0], "K"); in test_cgkill_tree()
157 if (!cgroup[9]) in test_cgkill_tree()
161 if (cg_create(cgroup[i])) in test_cgkill_tree()
164 pids[0] = cg_run_nowait(cgroup[2], child_fn, NULL); in test_cgkill_tree()
165 pids[1] = cg_run_nowait(cgroup[7], child_fn, NULL); in test_cgkill_tree()
166 pids[2] = cg_run_nowait(cgroup[9], child_fn, NULL); in test_cgkill_tree()
167 pids[3] = cg_run_nowait(cgroup[9], child_fn, NULL); in test_cgkill_tree()
168 pids[4] = cg_run_nowait(cgroup[9], child_fn, NULL); in test_cgkill_tree()
175 if (cg_wait_for_proc_count(cgroup[2], 1) || in test_cgkill_tree()
176 cg_wait_for_proc_count(cgroup[7], 1) || in test_cgkill_tree()
177 cg_wait_for_proc_count(cgroup[9], 3)) in test_cgkill_tree()
183 if (cg_kill_wait(cgroup[0])) in test_cgkill_tree()
193 cg_read_strcmp(cgroup[0], "cgroup.events", "populated 0\n")) in test_cgkill_tree()
196 for (i = 9; i >= 0 && cgroup[i]; i--) { in test_cgkill_tree()
197 cg_destroy(cgroup[i]); in test_cgkill_tree()
198 free(cgroup[i]); in test_cgkill_tree()
204 static int forkbomb_fn(const char *cgroup, void *arg) in forkbomb_fn() argument
225 char *cgroup = NULL; in test_cgkill_forkbomb() local
228 cgroup = cg_name(root, "cg_forkbomb_test"); in test_cgkill_forkbomb()
229 if (!cgroup) in test_cgkill_forkbomb()
232 if (cg_create(cgroup)) in test_cgkill_forkbomb()
235 pid = cg_run_nowait(cgroup, forkbomb_fn, NULL); in test_cgkill_forkbomb()
241 if (cg_kill_wait(cgroup)) in test_cgkill_forkbomb()
244 if (cg_wait_for_proc_count(cgroup, 0)) in test_cgkill_forkbomb()
254 cg_read_strcmp(cgroup, "cgroup.events", "populated 0\n")) in test_cgkill_forkbomb()
257 if (cgroup) in test_cgkill_forkbomb()
258 cg_destroy(cgroup); in test_cgkill_forkbomb()
259 free(cgroup); in test_cgkill_forkbomb()