Merge tag 'for-6.11-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
[linux-2.6-block.git] / tools / testing / selftests / bpf / cgroup_helpers.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1a922fee
SD
2#ifndef __CGROUP_HELPERS_H
3#define __CGROUP_HELPERS_H
d8079d80 4
1a922fee
SD
5#include <errno.h>
6#include <string.h>
7
8#define clean_errno() (errno == 0 ? "None" : strerror(errno))
9#define log_err(MSG, ...) fprintf(stderr, "(%s:%d: errno: %s) " MSG "\n", \
10 __FILE__, __LINE__, clean_errno(), ##__VA_ARGS__)
11
d8079d80 12/* cgroupv2 related */
434992bb
YA
13int enable_controllers(const char *relative_path, const char *controllers);
14int write_cgroup_file(const char *relative_path, const char *file,
15 const char *buf);
16int write_cgroup_file_parent(const char *relative_path, const char *file,
17 const char *buf);
18int cgroup_setup_and_join(const char *relative_path);
19int get_root_cgroup(void);
20int create_and_get_cgroup(const char *relative_path);
2a42461a 21void remove_cgroup(const char *relative_path);
434992bb 22unsigned long long get_cgroup_id(const char *relative_path);
bf47300b 23int get_cgroup1_hierarchy_id(const char *subsys_name);
434992bb
YA
24
25int join_cgroup(const char *relative_path);
539c7e67 26int join_root_cgroup(void);
434992bb 27int join_parent_cgroup(const char *relative_path);
d8079d80 28
1a922fee
SD
29int setup_cgroup_environment(void);
30void cleanup_cgroup_environment(void);
31
d8079d80 32/* cgroupv1 related */
f744d35e 33int set_classid(void);
d8079d80 34int join_classid(void);
c1dcc050 35unsigned long long get_classid_cgroup_id(void);
f4199271 36int open_classid(void);
d8079d80
DB
37
38int setup_classid_environment(void);
39void cleanup_classid_environment(void);
40
434992bb 41#endif /* __CGROUP_HELPERS_H */