diff options
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/afb-api-dbus.c | 7 | ||||
-rw-r--r-- | src/afb-export.c | 21 | ||||
-rw-r--r-- | src/afb-fdev.c | 4 | ||||
-rw-r--r-- | src/afb-hsrv.c | 4 | ||||
-rw-r--r-- | src/afb-socket.c | 5 | ||||
-rw-r--r-- | src/afb-ws-json1.c | 3 | ||||
-rw-r--r-- | src/systemd.c (renamed from src/afb-systemd.c) | 14 | ||||
-rw-r--r-- | src/systemd.h (renamed from src/afb-systemd.h) | 10 |
9 files changed, 36 insertions, 34 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 086a2aa1..3c9763d3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -56,7 +56,6 @@ SET(AFB_LIB_SOURCES afb-session.c afb-socket.c afb-stub-ws.c - afb-systemd.c afb-trace.c afb-websock.c afb-ws-client.c @@ -74,6 +73,7 @@ SET(AFB_LIB_SOURCES process-name.c sig-monitor.c subpath.c + systemd.c verbose.c watchdog.c websock.c diff --git a/src/afb-api-dbus.c b/src/afb-api-dbus.c index f4132946..8c55ed01 100644 --- a/src/afb-api-dbus.c +++ b/src/afb-api-dbus.c @@ -33,8 +33,6 @@ #include <afb/afb-event-x2.h> -#include "afb-systemd.h" - #include "afb-session.h" #include "afb-msg-json.h" #include "afb-api.h" @@ -44,8 +42,9 @@ #include "afb-cred.h" #include "afb-evt.h" #include "afb-xreq.h" -#include "verbose.h" +#include "verbose.h" +#include "systemd.h" static const char DEFAULT_PATH_PREFIX[] = "/org/agl/afb/api/"; @@ -130,7 +129,7 @@ static struct api_dbus *make_api_dbus_3(int system, const char *path, size_t pat } /* choose the bus */ - sdbus = (system ? afb_systemd_get_system_bus : afb_systemd_get_user_bus)(); + sdbus = (system ? systemd_get_system_bus : systemd_get_user_bus)(); if (sdbus == NULL) goto error2; diff --git a/src/afb-export.c b/src/afb-export.c index 0023f71e..b5a4b9e3 100644 --- a/src/afb-export.c +++ b/src/afb-export.c @@ -39,7 +39,6 @@ #include "afb-api-so-v2.h" #include "afb-api-v3.h" #include "afb-common.h" -#include "afb-systemd.h" #include "afb-cred.h" #include "afb-evt.h" #include "afb-export.h" @@ -48,6 +47,8 @@ #include "afb-session.h" #include "afb-xreq.h" #include "afb-calls.h" + +#include "systemd.h" #include "jobs.h" #include "verbose.h" #include "globset.h" @@ -450,21 +451,21 @@ static int hooked_event_broadcast_cb(struct afb_api_x3 *closure, const char *nam 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 = afb_systemd_get_event_loop(); + struct sd_event *r = systemd_get_event_loop(); return afb_hook_api_get_event_loop(export, r); } 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 = afb_systemd_get_user_bus(); + struct sd_bus *r = systemd_get_user_bus(); return afb_hook_api_get_user_bus(export, r); } 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 = afb_systemd_get_system_bus(); + struct sd_bus *r = systemd_get_system_bus(); return afb_hook_api_get_system_bus(export, r); } @@ -536,9 +537,9 @@ static const struct afb_daemon_itf_x1 daemon_itf = { .vverbose_v2 = vverbose_cb, .event_make = legacy_event_x1_make_cb, .event_broadcast = event_broadcast_cb, - .get_event_loop = afb_systemd_get_event_loop, - .get_user_bus = afb_systemd_get_user_bus, - .get_system_bus = afb_systemd_get_system_bus, + .get_event_loop = systemd_get_event_loop, + .get_user_bus = systemd_get_user_bus, + .get_system_bus = systemd_get_system_bus, .rootdir_get_fd = afb_common_rootdir_get_fd, .rootdir_open_locale = rootdir_open_locale_cb, .queue_job = queue_job_cb, @@ -1051,9 +1052,9 @@ static const struct afb_api_x3_itf api_x3_itf = { .vverbose = (void*)vverbose_cb, - .get_event_loop = afb_systemd_get_event_loop, - .get_user_bus = afb_systemd_get_user_bus, - .get_system_bus = afb_systemd_get_system_bus, + .get_event_loop = systemd_get_event_loop, + .get_user_bus = systemd_get_user_bus, + .get_system_bus = systemd_get_system_bus, .rootdir_get_fd = afb_common_rootdir_get_fd, .rootdir_open_locale = rootdir_open_locale_cb, .queue_job = queue_job_cb, diff --git a/src/afb-fdev.c b/src/afb-fdev.c index 42436373..fa1a402f 100644 --- a/src/afb-fdev.c +++ b/src/afb-fdev.c @@ -17,10 +17,10 @@ #include "fdev.h" -#include "afb-systemd.h" +#include "systemd.h" #include "fdev-systemd.h" struct fdev *afb_fdev_create(int fd) { - return fdev_systemd_create(afb_systemd_get_event_loop(), fd); + return fdev_systemd_create(systemd_get_event_loop(), fd); } diff --git a/src/afb-hsrv.c b/src/afb-hsrv.c index ba1dac12..ed0adeeb 100644 --- a/src/afb-hsrv.c +++ b/src/afb-hsrv.c @@ -42,11 +42,11 @@ #include "afb-hsrv.h" #include "afb-fdev.h" #include "afb-socket.h" + #include "fdev.h" #include "verbose.h" #include "locale-root.h" - -#include "afb-systemd.h" +#include "systemd.h" #include "jobs.h" #define JSON_CONTENT "application/json" diff --git a/src/afb-socket.c b/src/afb-socket.c index 9f2be989..cf788de6 100644 --- a/src/afb-socket.c +++ b/src/afb-socket.c @@ -31,7 +31,8 @@ #include "afb-fdev.h" #include "afb-socket.h" -#include "afb-systemd.h" + +#include "systemd.h" #include "fdev.h" #include "verbose.h" @@ -228,7 +229,7 @@ static int open_systemd(const char *spec) errno = EAFNOSUPPORT; return -1; #else - return afb_systemd_fds_for(spec); + return systemd_fds_for(spec); #endif } diff --git a/src/afb-ws-json1.c b/src/afb-ws-json1.c index 3bd1472b..197d0c86 100644 --- a/src/afb-ws-json1.c +++ b/src/afb-ws-json1.c @@ -27,7 +27,6 @@ #include "afb-wsj1.h" #include "afb-ws-json1.h" -#include "afb-systemd.h" #include "afb-msg-json.h" #include "afb-session.h" #include "afb-cred.h" @@ -35,6 +34,8 @@ #include "afb-xreq.h" #include "afb-context.h" #include "afb-evt.h" + +#include "systemd.h" #include "verbose.h" #include "fdev.h" diff --git a/src/afb-systemd.c b/src/systemd.c index 3fcf7612..1adb75ab 100644 --- a/src/afb-systemd.c +++ b/src/systemd.c @@ -24,7 +24,7 @@ #include <systemd/sd-bus.h> #include <systemd/sd-daemon.h> -#include "afb-systemd.h" +#include "systemd.h" #include "jobs.h" static struct sd_bus *sdbusopen(struct sd_bus **p, int (*f)(struct sd_bus **)) @@ -35,7 +35,7 @@ static struct sd_bus *sdbusopen(struct sd_bus **p, int (*f)(struct sd_bus **)) errno = -rc; *p = NULL; } else { - rc = sd_bus_attach_event(*p, afb_systemd_get_event_loop(), 0); + rc = sd_bus_attach_event(*p, systemd_get_event_loop(), 0); if (rc < 0) { sd_bus_unref(*p); errno = -rc; @@ -46,18 +46,18 @@ static struct sd_bus *sdbusopen(struct sd_bus **p, int (*f)(struct sd_bus **)) return *p; } -struct sd_event *afb_systemd_get_event_loop() +struct sd_event *systemd_get_event_loop() { return jobs_get_sd_event(); } -struct sd_bus *afb_systemd_get_user_bus() +struct sd_bus *systemd_get_user_bus() { static struct sd_bus *result = NULL; return sdbusopen((void*)&result, (void*)sd_bus_open_user); } -struct sd_bus *afb_systemd_get_system_bus() +struct sd_bus *systemd_get_system_bus() { static struct sd_bus *result = NULL; return sdbusopen((void*)&result, (void*)sd_bus_open_system); @@ -80,14 +80,14 @@ static char **fds_names() return names; } -int afb_systemd_fds_init() +int systemd_fds_init() { errno = 0; fds_names(); return -!!errno; } -int afb_systemd_fds_for(const char *name) +int systemd_fds_for(const char *name) { int idx; char **names; diff --git a/src/afb-systemd.h b/src/systemd.h index c7b56968..d9efa352 100644 --- a/src/afb-systemd.h +++ b/src/systemd.h @@ -20,11 +20,11 @@ struct sd_event; struct sd_bus; -extern struct sd_event *afb_systemd_get_event_loop(); -extern struct sd_bus *afb_systemd_get_user_bus(); -extern struct sd_bus *afb_systemd_get_system_bus(); +extern struct sd_event *systemd_get_event_loop(); +extern struct sd_bus *systemd_get_user_bus(); +extern struct sd_bus *systemd_get_system_bus(); -extern int afb_systemd_fds_init(); -extern int afb_systemd_fds_for(const char *name); +extern int systemd_fds_init(); +extern int systemd_fds_for(const char *name); |