diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2013-03-08 16:42:03 +0100 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2013-03-08 16:51:15 +0100 |
commit | 3e2d86693f6e8920c97fe296491e7741e31f922c (patch) | |
tree | 1c755422fd27c7f192243e8eb7f7811193efa1f6 /server/privsep-server.c | |
parent | e0cabd6295204fe8a6b54edfc9141302943fdbfb (diff) | |
download | privsep-master.tar.bz2 privsep-master.tar.xz |
This allows you load various modules into a server lua state and give
a performance boost when calling the privileged functions
Diffstat (limited to 'server/privsep-server.c')
-rw-r--r-- | server/privsep-server.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/server/privsep-server.c b/server/privsep-server.c new file mode 100644 index 0000000..76d3f4c --- /dev/null +++ b/server/privsep-server.c @@ -0,0 +1,35 @@ + +#include <sys/stat.h> +#include <stdio.h> +#include <ev.h> + +#ifndef DEFAULT_SOCKET_PATH +#define DEFAULT_SOCKET_PATH "/var/run/privsep/root.sock" +#endif + +static void sigint_cb(struct ev_loop *loop, ev_signal *w, int revents) +{ + ev_break(loop, EVBREAK_ALL); +} + +int main(int argc, char *argv[]) +{ + int c; + const char *socket_path = DEFAULT_SOCKET_PATH; + static struct ev_loop *loop; + static struct ev_signal signal_watcher; + + loop = ev_default_loop(0); + + if (conn_init(loop, socket_path) < 0) + return 1; + + ev_signal_init(&signal_watcher, sigint_cb, SIGINT); + ev_signal_start(loop, &signal_watcher); + + ev_run(loop, 0); + printf("%s\n", "Shutting down."); + ev_loop_destroy(loop); + return 0; +} + |