summaryrefslogtreecommitdiff
path: root/samples/bpf/cgroup_helpers.h
blob: 78c55207b6bdb7a32895e77a86c3200c3f059ed8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#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