summaryrefslogtreecommitdiffstats
path: root/server/privsep-server.c
diff options
context:
space:
mode:
Diffstat (limited to 'server/privsep-server.c')
-rw-r--r--server/privsep-server.c35
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;
+}
+