blob: 1a6ebd7ee4df3447aa1a7db9fd829dfb14729043 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#ifndef POTD_JAIL_H
#define POTD_JAIL_H 1
#include <sys/types.h>
#include <unistd.h>
#include "socket.h"
#define MIN_STACKSIZE 2048
#define MAX_STACKSIZE BUFSIZ
typedef struct jail_ctx {
psocket sock;
char host_buf[NI_MAXHOST], service_buf[NI_MAXSERV];
size_t stacksize;
void *stack_ptr;
void *stack_beg;
} jail_ctx;
void jail_init_ctx(jail_ctx **ctx, size_t stacksize);
int jail_setup(jail_ctx *ctx,
const char *listen_addr, const char *listen_port);
int jail_validate_ctx(const jail_ctx *ctx);
int jail_setup_epoll(jail_ctx *ctx[], size_t siz);
pid_t jail_daemonize_epoll(int epoll_fd, jail_ctx *ctx[], size_t siz);
#endif
|