#define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define die(...) {fprintf(stderr,"file %s,line %d\n",__FILE__,__LINE__);die_func(__VA_ARGS__);exit(1);} void remove_cgroup(); struct params { char* shared_folder; int fd[2]; int out_fd; char **argv; }; struct limits { size_t memory; int core; int time; int processes; }; struct killparams{ int time; int pid; }; extern void prepare_cgroup(struct limits* limits); extern void add_to_cgroup(int pid); extern int check_mem(); extern void remove_cgroup(); extern void procfs_prepare(); extern void await_setup(int pipe); extern int nsrun(void* arg); extern void die_func(const char *fmt, ...); extern void write_file(char* path, char* line);