source: trunk/jrun/jrun.h @ 1184

Revision 852, 1.5 KB checked in by cdleonard@…, 4 years ago (diff)

svn:eol-style native in trunk. Also svn:executable on all scripts

  • Property svn:eol-style set to native
Line 
1/*
2 *  JRUN header file.
3 *  There is a separate tables.h with syscalls etc, but everything you need is
4 *  right here.
5 */
6
7#ifndef __JRUN_H__
8#define __JRUN_H__
9
10#include <stdio.h>
11#include <stdlib.h>
12#include <string.h>
13
14#include <sys/time.h>
15#include <sys/types.h>
16#include <sys/resource.h>
17#include <sys/ptrace.h>
18#include <sys/syscall.h>
19#include <time.h>
20#include <unistd.h>
21#include <errno.h>
22#include <signal.h>
23#include <wait.h>
24
25#define JRUN_CHECK_INTERVAL 50
26#define JRUN_JIFFIE_DURATION 10
27
28// FIXME: hacks?
29#define MAX_SIGNAL 64
30#define MAX_SYSCALL 512
31
32// Signal/syscall names
33extern const char* signal_name[MAX_SIGNAL];
34extern const char* syscall_name[MAX_SYSCALL];
35
36typedef struct {
37    int uid;
38    int gid;
39    char dir[500];
40    char prog[500];
41
42    int time_limit;
43    int wall_time_limit;
44    int memory_limit;
45
46    int nice_val;
47    int ptrace;
48    int copy_libs;
49
50    int verbose;
51    int chroot;
52
53    int min_proc_update_interval;
54
55    // File to redirect program stdout to.
56    // Empty is /dev/null
57    char stdin_file[500];
58    char stdout_file[500];
59    char stderr_file[500];
60
61    // 0 or 1 if a syscall is blocked.
62    // Blocking means killing the process.
63    int syscall_block[MAX_SYSCALL];
64} jrun_options;
65
66// Global options struct.
67extern jrun_options jopt;
68
69// Parse options, receives params from main.
70void jrun_parse_options(int argc, char **argv);
71
72// Get syscall id from name.
73// Returns -1 if not found.
74int syscall_getid(char* name);
75
76#endif /* __JRUN_H__ */
Note: See TracBrowser for help on using the repository browser.