cgroup_helpers.h (793B)
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef __CGROUP_HELPERS_H 3#define __CGROUP_HELPERS_H 4 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 12/* cgroupv2 related */ 13int cgroup_setup_and_join(const char *path); 14int create_and_get_cgroup(const char *path); 15unsigned long long get_cgroup_id(const char *path); 16 17int join_cgroup(const char *path); 18 19int setup_cgroup_environment(void); 20void cleanup_cgroup_environment(void); 21 22/* cgroupv1 related */ 23int set_classid(unsigned int id); 24int join_classid(void); 25 26int setup_classid_environment(void); 27void cleanup_classid_environment(void); 28 29#endif /* __CGROUP_HELPERS_H */