+/*************************************************************************************/
+
+/**
+ * initialize the supervisor
+ */
+static int init_supervisor(afb_api_t api)
+{
+ event_add_pid = afb_api_make_event(api, "add-pid");
+ if (!afb_event_is_valid(event_add_pid)) {
+ ERROR("Can't create added event");
+ return -1;
+ }
+
+ event_del_pid = afb_api_make_event(api, "del-pid");
+ if (!afb_event_is_valid(event_del_pid)) {
+ ERROR("Can't create deleted event");
+ return -1;
+ }
+
+ /* create an empty set for superviseds */
+ empty_apiset = afb_apiset_create(supervision_apiname, 0);
+ if (!empty_apiset) {
+ ERROR("Can't create supervision apiset");
+ return -1;
+ }
+
+ /* create the supervision socket */
+ supervision_fdev = afb_socket_open_fdev(supervision_socket_path, 1);
+ if (!supervision_fdev)
+ return -1;
+
+ fdev_set_events(supervision_fdev, EPOLLIN);
+ fdev_set_callback(supervision_fdev, listening,
+ (void*)(intptr_t)fdev_fd(supervision_fdev));
+
+ return 0;
+}
+
+/*************************************************************************************/
+
+static const struct afb_auth _afb_auths_v2_supervisor[] = {