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:
Juergen Gross authored and Julien Grall committed 2024-02-05 19:26:32 +00:00
1 parent e767a98f04
commit 511cc30cf8
4 files changed
+19 -16

No files matched your search

+1 -16
View File
@@ -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 (;;) {
+1
View File
@@ -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];
+4
View File
@@ -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)
{
}
+13
View File
@@ -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
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.