@@ -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 (;;) {
@@ -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];
@@ -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)
+{
+}
@@ -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
+}