[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] tools/xenstored: get own domid in stubdom case



commit a3e37f7024b0fb25c648315b2edf3583aa140b32
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Mon Feb 5 11:49:54 2024 +0100
Commit:     Julien Grall <jgrall@xxxxxxxxxx>
CommitDate: Mon Feb 5 19:26:32 2024 +0000

    tools/xenstored: get own domid in stubdom case
    
    Obtain own domid when running as stubdom.
    
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Reviewed-by: Jason Andryuk <jandryuk@xxxxxxxxx>
    Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>
---
 tools/xenstored/core.c   | 1 +
 tools/xenstored/core.h   | 1 +
 tools/xenstored/minios.c | 4 ++++
 3 files changed, 6 insertions(+)

diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index c045a6e5db..9eb3cdf446 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -2557,6 +2557,7 @@ static struct option options[] = {
 int dom0_domid = 0;
 int dom0_event = 0;
 int priv_domid = 0;
+domid_t stub_domid = DOMID_INVALID;
 
 static unsigned int get_optval_uint(const char *arg)
 {
diff --git a/tools/xenstored/core.h b/tools/xenstored/core.h
index 6180ec8b5c..f6af086f01 100644
--- a/tools/xenstored/core.h
+++ b/tools/xenstored/core.h
@@ -361,6 +361,7 @@ do {                                                \
 extern int dom0_domid;
 extern int dom0_event;
 extern int priv_domid;
+extern domid_t stub_domid;
 extern bool keep_orphans;
 
 extern struct pollfd *poll_fds;
diff --git a/tools/xenstored/minios.c b/tools/xenstored/minios.c
index 6d0c11423c..22ac8defbd 100644
--- a/tools/xenstored/minios.c
+++ b/tools/xenstored/minios.c
@@ -20,6 +20,7 @@
 #include "core.h"
 #include "utils.h"
 #include <xen/grant_table.h>
+#include <mini-os/lib.h>
 
 void finish_daemonize(void)
 {
@@ -48,6 +49,9 @@ void unmap_xenbus(void *interface)
 
 void early_init(bool live_update, bool dofork, const char *pidfile)
 {
+       stub_domid = get_domid();
+       if (stub_domid == DOMID_INVALID)
+               barf("could not get own domid");
 }
 
 void late_init(bool live_update)
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.