0001
0002 #ifndef __CGROUP_HELPERS_H
0003 #define __CGROUP_HELPERS_H
0004
0005 #include <errno.h>
0006 #include <string.h>
0007
0008 #define clean_errno() (errno == 0 ? "None" : strerror(errno))
0009 #define log_err(MSG, ...) fprintf(stderr, "(%s:%d: errno: %s) " MSG "\n", \
0010 __FILE__, __LINE__, clean_errno(), ##__VA_ARGS__)
0011
0012
0013 int cgroup_setup_and_join(const char *path);
0014 int create_and_get_cgroup(const char *path);
0015 unsigned long long get_cgroup_id(const char *path);
0016
0017 int join_cgroup(const char *path);
0018
0019 int setup_cgroup_environment(void);
0020 void cleanup_cgroup_environment(void);
0021
0022
0023 int set_classid(unsigned int id);
0024 int join_classid(void);
0025
0026 int setup_classid_environment(void);
0027 void cleanup_classid_environment(void);
0028
0029 #endif