diff options
author | Jose Bollo <jose.bollo@iot.bzh> | 2019-02-19 09:13:26 +0100 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2019-03-22 12:21:54 +0100 |
commit | ba693048ce1a2b629bfed11fceacabe7edc18a78 (patch) | |
tree | 7cad463bf3186fbe7a70ebf1fcbb740681ff9011 /src/afb-export.c | |
parent | 8538d642f01c8ee185cb356eba2c2f19cf4cea58 (diff) |
Allow to remove systemd library
This change allows to compile a binder
that doesn't use libsystemd.
The restriction implied is that the neither
the systemd event loop nor the systemd dbus
facilities are availables. Consequently,
the dbus transparancy of APIs isn't available.
Also the work isn't fully complete because
afb-ws-client doesn't handle the removal of
libsystemd.
A more general work still have to be made to
allow the binder to run as library using an
external event loop.
Change-Id: I27a80862868b9c5a0453011a1d8aa3ce75cb5f6e
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/afb-export.c')
-rw-r--r-- | src/afb-export.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/afb-export.c b/src/afb-export.c index 8ebe8e06..202a73f6 100644 --- a/src/afb-export.c +++ b/src/afb-export.c @@ -50,7 +50,9 @@ #include "afb-xreq.h" #include "afb-calls.h" +#if WITH_SYSTEMD #include "systemd.h" +#endif #include "jobs.h" #include "verbose.h" #include "globset.h" @@ -312,20 +314,35 @@ static int event_broadcast_cb(struct afb_api_x3 *closure, const char *name, stru static struct sd_event *get_event_loop(struct afb_api_x3 *closure) { +#if WITH_SYSTEMD jobs_acquire_event_manager(); return systemd_get_event_loop(); +#else + errno = ENOTSUP; + return NULL; +#endif } static struct sd_bus *get_user_bus(struct afb_api_x3 *closure) { +#if WITH_SYSTEMD jobs_acquire_event_manager(); return systemd_get_user_bus(); +#else + errno = ENOTSUP; + return NULL; +#endif } static struct sd_bus *get_system_bus(struct afb_api_x3 *closure) { +#if WITH_SYSTEMD jobs_acquire_event_manager(); return systemd_get_system_bus(); +#else + errno = ENOTSUP; + return NULL; +#endif } static int rootdir_open_locale_cb(struct afb_api_x3 *closure, const char *filename, int flags, const char *locale) @@ -481,7 +498,6 @@ static struct sd_event *hooked_get_event_loop(struct afb_api_x3 *closure) struct afb_export *export = from_api_x3(closure); struct sd_event *r; - jobs_acquire_event_manager(); r = get_event_loop(closure); return afb_hook_api_get_event_loop(export, r); } @@ -491,7 +507,6 @@ static struct sd_bus *hooked_get_user_bus(struct afb_api_x3 *closure) struct afb_export *export = from_api_x3(closure); struct sd_bus *r; - jobs_acquire_event_manager(); r = get_user_bus(closure); return afb_hook_api_get_user_bus(export, r); } @@ -501,7 +516,6 @@ static struct sd_bus *hooked_get_system_bus(struct afb_api_x3 *closure) struct afb_export *export = from_api_x3(closure); struct sd_bus *r; - jobs_acquire_event_manager(); r = get_system_bus(closure); return afb_hook_api_get_system_bus(export, r); } |