aboutsummaryrefslogtreecommitdiffstats
path: root/src/afs-supervisor.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2018-02-22 13:22:48 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2018-02-22 13:22:48 +0100
commitca820c65c2b03a24e8936218171c6c1d138fd1f7 (patch)
treef7e31ea8e63d3321af64226e360a78c504a09bb3 /src/afs-supervisor.c
parentf15ea770dd9b13a20331853a026091316984f9ca (diff)
fdev: Introduce fdev for file event handling
This is an effort to keep cutting dependency to systemd. Change-Id: I9a0c032a1095e297c7f3ac5b67827fda3658b8d9 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afs-supervisor.c')
-rw-r--r--src/afs-supervisor.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/afs-supervisor.c b/src/afs-supervisor.c
index be0cdbf5..1e92b9f3 100644
--- a/src/afs-supervisor.c
+++ b/src/afs-supervisor.c
@@ -45,6 +45,7 @@
#include "afb-api-so-v2.h"
#include "afb-api-ws.h"
#include "afb-apiset.h"
+#include "afb-fdev.h"
#include "jobs.h"
#include "verbose.h"
#include "wrap-json.h"
@@ -193,13 +194,20 @@ static void on_supervised_hangup(struct afb_stub_ws *stub)
static int make_supervised(int fd, struct afb_cred *cred)
{
struct supervised *s;
+ struct fdev *fdev;
s = malloc(sizeof *s);
if (!s)
return -1;
+ fdev = afb_fdev_create(fd);
+ if (!fdev) {
+ free(s);
+ return -1;
+ }
+
s->cred = cred;
- s->stub = afb_stub_ws_create_client(fd, supervision_apiname, empty_apiset);
+ s->stub = afb_stub_ws_create_client(fdev, supervision_apiname, empty_apiset);
if (!s->stub) {
free(s);
return -1;