mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
1a922fee66
This patch modifies test_current_task_under_cgroup_user. The test has several helpers around creating a temporary environment for cgroup testing, and moving the current task around cgroups. This set of helpers can then be used in other tests. Signed-off-by: Sargun Dhillon <sargun@sargun.me> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
16 lines
436 B
C
16 lines
436 B
C
#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 create_and_get_cgroup(char *path);
|
|
int join_cgroup(char *path);
|
|
int setup_cgroup_environment(void);
|
|
void cleanup_cgroup_environment(void);
|
|
|
|
#endif
|