blob: 20a4a5dcd469019907341562c799b42a3bd95ddf [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Sargun Dhillon1a922fe2016-12-02 02:42:18 -08002#ifndef __CGROUP_HELPERS_H
3#define __CGROUP_HELPERS_H
4#include <errno.h>
5#include <string.h>
6
7#define clean_errno() (errno == 0 ? "None" : strerror(errno))
8#define log_err(MSG, ...) fprintf(stderr, "(%s:%d: errno: %s) " MSG "\n", \
9 __FILE__, __LINE__, clean_errno(), ##__VA_ARGS__)
10
11
12int create_and_get_cgroup(char *path);
13int join_cgroup(char *path);
14int setup_cgroup_environment(void);
15void cleanup_cgroup_environment(void);
Yonghong Songf2690992018-06-03 15:59:43 -070016unsigned long long get_cgroup_id(char *path);
Sargun Dhillon1a922fe2016-12-02 02:42:18 -080017
18#endif