aboutsummaryrefslogtreecommitdiffstats
path: root/src/afb-export.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/afb-export.c')
-rw-r--r--src/afb-export.c20
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);
}