ms-runner/starter/starter.h

54 lines
1.1 KiB
C
Raw Normal View History

2025-01-07 16:56:21 +00:00
#define _GNU_SOURCE
#include <stddef.h>
#include <stdint.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/prctl.h>
#include <unistd.h>
#include <linux/limits.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sched.h>
#include <sys/syscall.h>
#include <linux/sched.h>
#include <stdarg.h>
#include <time.h>
#include <sys/time.h>
#include <limits.h>
#include <signal.h>
#include <stdbool.h>
#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);