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

[PATCH v3 26/33] tools/xenstored: get own domid in stubdom case



Obtain the own domid when running as stubdom.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
V2:
- replacement of V1 patch (Andrew Cooper)
V3:
- rename called function to get_domid() (Julien Grall)
- change stub_domid type to domid_t (Julien Grall)
---
 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 8ff1faccef..edb2ab97b8 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -2559,6 +2559,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 ddc345050c..a20c7ee3a0 100644
--- a/tools/xenstored/core.h
+++ b/tools/xenstored/core.h
@@ -363,6 +363,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 *fds;
diff --git a/tools/xenstored/minios.c b/tools/xenstored/minios.c
index 5d59cc90cc..38a51e671a 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)
-- 
2.35.3




 


Rackspace

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