[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] tools/xenstored: move systemd handling to posix.c
commit 511cc30cf8bbf083f2788cf4eee91edec0b85ac0 Author: Juergen Gross <jgross@xxxxxxxx> AuthorDate: Mon Feb 5 11:49:51 2024 +0100 Commit: Julien Grall <jgrall@xxxxxxxxxx> CommitDate: Mon Feb 5 19:26:32 2024 +0000 tools/xenstored: move systemd handling to posix.c Move systemd handling to a new late_init() function in posix.c. This prepares a future removal of the NO_SOCKETS macro. Signed-off-by: Juergen Gross <jgross@xxxxxxxx> Reviewed-by: Jason Andryuk <jandryuk@xxxxxxxxx> Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx> --- tools/xenstored/core.c | 17 +---------------- tools/xenstored/core.h | 1 + tools/xenstored/minios.c | 4 ++++ tools/xenstored/posix.c | 13 +++++++++++++ 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c index eba7744fde..7b5e1d0c0f 100644 --- a/tools/xenstored/core.c +++ b/tools/xenstored/core.c @@ -54,16 +54,6 @@ #include "control.h" #include "lu.h" -#ifndef NO_SOCKETS -#if defined(HAVE_SYSTEMD) -#define XEN_SYSTEMD_ENABLED 1 -#endif -#endif - -#if defined(XEN_SYSTEMD_ENABLED) -#include <systemd/sd-daemon.h> -#endif - extern xenevtchn_handle *xce_handle; /* in domain.c */ static int xce_pollfd_idx = -1; static struct pollfd *fds; @@ -2938,12 +2928,7 @@ int main(int argc, char *argv[]) /* Get ready to listen to the tools. */ initialize_fds(&sock_pollfd_idx, &timeout); -#if defined(XEN_SYSTEMD_ENABLED) - if (!live_update) { - sd_notify(1, "READY=1"); - fprintf(stderr, SD_NOTICE "xenstored is ready\n"); - } -#endif + late_init(live_update); /* Main loop. */ for (;;) { diff --git a/tools/xenstored/core.h b/tools/xenstored/core.h index 72173f1684..0de2d8a26e 100644 --- a/tools/xenstored/core.h +++ b/tools/xenstored/core.h @@ -385,6 +385,7 @@ static inline bool domain_is_unprivileged(const struct connection *conn) /* Return the event channel used by xenbus. */ evtchn_port_t get_xenbus_evtchn(void); void early_init(bool live_update, bool dofork, const char *pidfile); +void late_init(bool live_update); void init_sockets(void); extern int reopen_log_pipe[2]; diff --git a/tools/xenstored/minios.c b/tools/xenstored/minios.c index 4f48f63083..45bb0440be 100644 --- a/tools/xenstored/minios.c +++ b/tools/xenstored/minios.c @@ -49,3 +49,7 @@ void unmap_xenbus(void *interface) void early_init(bool live_update, bool dofork, const char *pidfile) { } + +void late_init(bool live_update) +{ +} diff --git a/tools/xenstored/posix.c b/tools/xenstored/posix.c index 9463ef5c8d..97c8dcaba3 100644 --- a/tools/xenstored/posix.c +++ b/tools/xenstored/posix.c @@ -24,6 +24,9 @@ #include <stdlib.h> #include <syslog.h> #include <sys/mman.h> +#if defined(HAVE_SYSTEMD) +#include <systemd/sd-daemon.h> +#endif #include <xen-tools/xenstore-common.h> #include "utils.h" @@ -184,3 +187,13 @@ void early_init(bool live_update, bool dofork, const char *pidfile) if (!live_update) init_sockets(); } + +void late_init(bool live_update) +{ +#if defined(HAVE_SYSTEMD) + if (!live_update) { + sd_notify(1, "READY=1"); + fprintf(stderr, SD_NOTICE "xenstored is ready\n"); + } +#endif +} -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |