mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
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@suse.com> Reviewed-by: Jason Andryuk <jandryuk@gmail.com> Reviewed-by: Julien Grall <jgrall@amazon.com>
This commit is contained in:
1 parent
e767a98f04
commit
511cc30cf8
4 files changed
+19
-16
No files matched your search
+1
-16
@@ -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
|
||||
}
|
||||