diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-03-02 18:38:49 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2016-03-02 18:38:49 +0900 |
commit | b256c1168408c16c543b611f617168f960aaa072 (patch) | |
tree | 4b37cf50f59432e79350c344f8026a8683737645 | |
parent | e23ace15d2a09b2fe74ffd9e0c715823e9569c42 (diff) | |
download | poe-b256c1168408c16c543b611f617168f960aaa072.tar.gz |
sandbox: move config to config.h
-rw-r--r-- | sandbox/Makefile | 4 | ||||
-rw-r--r-- | sandbox/config.h | 11 | ||||
-rw-r--r-- | sandbox/sandbox.h | 17 |
3 files changed, 20 insertions, 12 deletions
diff --git a/sandbox/Makefile b/sandbox/Makefile index 27cf3f6..25d8e73 100644 --- a/sandbox/Makefile +++ b/sandbox/Makefile @@ -1,9 +1,9 @@ CFLAGS ?= -std=c11 -g -O3 -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 -fPIE -fstack-protector-all \ -Wall -Wextra -Wpedantic -Wshadow -Wmissing-declarations -Wpointer-arith -Wunused-macros -LDFLAGS ?= -pie -Wl,-z,relro,-z,now -lseccomp -lsystemd -ljansson +LDFLAGS ?= -pie -Wl,-z,relro,-z,now -lseccomp -lsystemd OBJS := main.o playground.o seccomp.o systemd.o -DEPS := config.h +DEPS := sandbox.h config.h %.o: %.c $(DEPS) $(CC) -c -o $@ $< $(CFLAGS) diff --git a/sandbox/config.h b/sandbox/config.h new file mode 100644 index 0000000..9a405ed --- /dev/null +++ b/sandbox/config.h @@ -0,0 +1,11 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#define POE_TEMPORARY_BASE "/tmp/poe" +#define POE_USERNAME "nobody" +#define POE_HOSTNAME "poe-sandbox" +#define POE_MEMORY_LIMIT (1024ULL * 1024ULL * 128ULL) +#define POE_TASKS_LIMIT 32ULL +#define POE_TIME_LIMIT (1000ULL * 1000ULL * 5ULL) // us + +#endif diff --git a/sandbox/sandbox.h b/sandbox/sandbox.h index daf8b59..b1047ad 100644 --- a/sandbox/sandbox.h +++ b/sandbox/sandbox.h @@ -1,7 +1,12 @@ +#ifndef SANDBOX_H +#define SANDBOX_H + #ifndef __x86_64__ # error unsupported #endif +#include "config.h" + #include <stdio.h> #include <stdlib.h> #include <stdarg.h> @@ -33,16 +38,6 @@ #include <systemd/sd-daemon.h> #include <systemd/sd-event.h> -#include <jansson.h> - -#define POE_TEMPORARY_BASE "/tmp/poe" - -#define POE_USERNAME "nobody" -#define POE_HOSTNAME "poe-sandbox" -#define POE_MEMORY_LIMIT (1024ULL * 1024ULL * 128ULL) -#define POE_TASKS_LIMIT 32ULL -#define POE_TIME_LIMIT (2ULL * 1000ULL * 1000ULL) // us - #define NONNEGATIVE(s) do if ((s) < 0) ERROR("CRITICAL: %s:%d %s", __FILE__, __LINE__, #s); while (0) #define NONNULL(s) do if (!(s)) ERROR("CRITICAL: %s:%d %s", __FILE__, __LINE__, #s); while (0) @@ -78,3 +73,5 @@ print_backtrace(void) backtrace_symbols_fd(trace, n, 1); } */ + +#endif |