diff options
Diffstat (limited to '')
-rw-r--r-- | tools/testing/selftests/bpf/cgroup_helpers.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/cgroup_helpers.h b/tools/testing/selftests/bpf/cgroup_helpers.h new file mode 100644 index 000000000..5fe3d88e4 --- /dev/null +++ b/tools/testing/selftests/bpf/cgroup_helpers.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __CGROUP_HELPERS_H +#define __CGROUP_HELPERS_H +#include <errno.h> +#include <string.h> + +#define clean_errno() (errno == 0 ? "None" : strerror(errno)) +#define log_err(MSG, ...) fprintf(stderr, "(%s:%d: errno: %s) " MSG "\n", \ + __FILE__, __LINE__, clean_errno(), ##__VA_ARGS__) + + +int cgroup_setup_and_join(const char *path); +int create_and_get_cgroup(const char *path); +int join_cgroup(const char *path); +int setup_cgroup_environment(void); +void cleanup_cgroup_environment(void); +unsigned long long get_cgroup_id(const char *path); + +#endif |