Lines Matching refs:cgroup
78 char *cg_control(const char *cgroup, const char *control) in cg_control() argument
80 size_t len = strlen(cgroup) + strlen(control) + 2; in cg_control()
83 snprintf(ret, len, "%s/%s", cgroup, control); in cg_control()
88 int cg_read(const char *cgroup, const char *control, char *buf, size_t len) in cg_read() argument
92 snprintf(path, sizeof(path), "%s/%s", cgroup, control); in cg_read()
100 int cg_read_strcmp(const char *cgroup, const char *control, in cg_read_strcmp() argument
117 if (cg_read(cgroup, control, buf, size)) { in cg_read_strcmp()
127 int cg_read_strstr(const char *cgroup, const char *control, const char *needle) in cg_read_strstr() argument
131 if (cg_read(cgroup, control, buf, sizeof(buf))) in cg_read_strstr()
137 long cg_read_long(const char *cgroup, const char *control) in cg_read_long() argument
141 if (cg_read(cgroup, control, buf, sizeof(buf))) in cg_read_long()
147 long cg_read_key_long(const char *cgroup, const char *control, const char *key) in cg_read_key_long() argument
152 if (cg_read(cgroup, control, buf, sizeof(buf))) in cg_read_key_long()
162 long cg_read_lc(const char *cgroup, const char *control) in cg_read_lc() argument
169 if (cg_read(cgroup, control, buf, sizeof(buf))) in cg_read_lc()
178 int cg_write(const char *cgroup, const char *control, char *buf) in cg_write() argument
183 snprintf(path, sizeof(path), "%s/%s", cgroup, control); in cg_write()
220 int cg_create(const char *cgroup) in cg_create() argument
222 return mkdir(cgroup, 0644); in cg_create()
225 int cg_wait_for_proc_count(const char *cgroup, int count) in cg_wait_for_proc_count() argument
234 if (cg_read(cgroup, "cgroup.procs", buf, sizeof(buf))) in cg_wait_for_proc_count()
250 int cg_killall(const char *cgroup) in cg_killall() argument
255 if (cg_read(cgroup, "cgroup.procs", buf, sizeof(buf))) in cg_killall()
274 int cg_destroy(const char *cgroup) in cg_destroy() argument
279 ret = rmdir(cgroup); in cg_destroy()
281 cg_killall(cgroup); in cg_destroy()
292 int cg_enter(const char *cgroup, int pid) in cg_enter() argument
297 return cg_write(cgroup, "cgroup.procs", pidbuf); in cg_enter()
300 int cg_enter_current(const char *cgroup) in cg_enter_current() argument
302 return cg_write(cgroup, "cgroup.procs", "0"); in cg_enter_current()
305 int cg_enter_current_thread(const char *cgroup) in cg_enter_current_thread() argument
307 return cg_write(cgroup, "cgroup.threads", "0"); in cg_enter_current_thread()
310 int cg_run(const char *cgroup, in cg_run() argument
311 int (*fn)(const char *cgroup, void *arg), in cg_run() argument
323 if (cg_write(cgroup, "cgroup.procs", buf)) in cg_run()
325 exit(fn(cgroup, arg)); in cg_run()
343 .cgroup = cgroup_fd, in clone_into_cgroup()
408 static int clone_into_cgroup_run_nowait(const char *cgroup, in clone_into_cgroup_run_nowait() argument
409 int (*fn)(const char *cgroup, void *arg), in clone_into_cgroup_run_nowait() argument
415 cgroup_fd = dirfd_open_opath(cgroup); in clone_into_cgroup_run_nowait()
422 exit(fn(cgroup, arg)); in clone_into_cgroup_run_nowait()
427 int cg_run_nowait(const char *cgroup, in cg_run_nowait() argument
428 int (*fn)(const char *cgroup, void *arg), in cg_run_nowait() argument
433 pid = clone_into_cgroup_run_nowait(cgroup, fn, arg); in cg_run_nowait()
446 if (cg_write(cgroup, "cgroup.procs", buf)) in cg_run_nowait()
448 exit(fn(cgroup, arg)); in cg_run_nowait()
482 int alloc_anon(const char *cgroup, void *arg) in alloc_anon() argument
555 int clone_into_cgroup_run_wait(const char *cgroup) in clone_into_cgroup_run_wait() argument
560 cgroup_fd = dirfd_open_opath(cgroup); in clone_into_cgroup_run_wait()