aboutsummaryrefslogtreecommitdiff
path: root/src/jail.c
diff options
context:
space:
mode:
authorlns <matzeton@googlemail.com>2018-04-22 12:02:19 +0200
committerlns <matzeton@googlemail.com>2018-04-22 12:02:19 +0200
commitaaa10f05c673ae2f5893bf54db5660d474b9759c (patch)
tree76de70b492e2dffe327be0435b972becd3d18315 /src/jail.c
parenteec5b667ca019f7a334475f58c37ebcd1ea6078c (diff)
POTD skeleton #22.
Signed-off-by: lns <matzeton@googlemail.com>
Diffstat (limited to 'src/jail.c')
-rw-r--r--src/jail.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/jail.c b/src/jail.c
new file mode 100644
index 0000000..cd8189a
--- /dev/null
+++ b/src/jail.c
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include "jail.h"
+
+
+int jail_init(jail_ctx **ctx, size_t stacksize)
+{
+ assert(ctx);
+ if (stacksize > BUFSIZ)
+ stacksize = BUFSIZ;
+ if (!*ctx)
+ *ctx = calloc(1, sizeof(**ctx));
+ assert(*ctx);
+
+ (*ctx)->stacksize = stacksize;
+ (*ctx)->stack_ptr =
+ (unsigned char *) calloc(1, (*ctx)->stacksize)
+ + (*ctx)->stacksize;
+
+ return 0;
+}
+
+void jail_free(jail_ctx **ctx)
+{
+}
+
+int jail_fork(jail_ctx *ctx)
+{
+ return 0;
+}