- return (struct afb_event_sender){ .itf = &event_sender_itf, .closure = desc };
-}
-
-static const struct afb_daemon_itf daemon_itf = {
- .get_event_sender = (void*)afb_api_so_get_event_sender,
- .get_event_loop = (void*)afb_common_get_event_loop,
- .get_user_bus = (void*)afb_common_get_user_bus,
- .get_system_bus = (void*)afb_common_get_system_bus
-};
-
-struct monitoring {
- struct afb_req req;
- void (*action)(struct afb_req);
-};
-
-static void monitored_call(int signum, struct monitoring *data)
-{
- if (signum != 0)
- afb_req_fail_f(data->req, "aborted", "signal %s(%d) caught", strsignal(signum), signum);
- else
- data->action(data->req);
-}
-
-static void call_check(struct afb_req req, struct afb_context *context, const struct AFB_verb_desc_v1 *verb)
-{
- struct monitoring data;
-
- int stag = (int)(verb->session & AFB_SESSION_MASK);
-
- if (stag != AFB_SESSION_NONE) {
- if (!afb_context_check(context)) {
- afb_context_close(context);
- afb_req_fail(req, "failed", "invalid token's identity");
- return;
- }
- }
-
- if ((stag & AFB_SESSION_CREATE) != 0) {
- if (!afb_context_create(context)) {
- afb_context_close(context);
- afb_req_fail(req, "failed", "invalid creation state");
- return;
- }
+ struct safe_dlopen *sd = closure;
+ if (!sig)
+ sd->handle = dlopen(sd->path, sd->flags);
+ else {
+ ERROR("dlopen of %s raised signal %s", sd->path, strsignal(sig));
+ sd->handle = NULL;