cgroup_helpers.h 539 B

123456789101112131415161718
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __CGROUP_HELPERS_H
  3. #define __CGROUP_HELPERS_H
  4. #include <errno.h>
  5. #include <string.h>
  6. #define clean_errno() (errno == 0 ? "None" : strerror(errno))
  7. #define log_err(MSG, ...) fprintf(stderr, "(%s:%d: errno: %s) " MSG "\n", \
  8. __FILE__, __LINE__, clean_errno(), ##__VA_ARGS__)
  9. int create_and_get_cgroup(const char *path);
  10. int join_cgroup(const char *path);
  11. int setup_cgroup_environment(void);
  12. void cleanup_cgroup_environment(void);
  13. unsigned long long get_cgroup_id(const char *path);
  14. #endif