On 10.11.23 18:40, Julien Grall wrote:
Hi,

On 10/11/2023 11:34, Juergen Gross wrote:
Get the own domid via creation of a temporary event channel. There is
no "official" way to read the own domid in PV guests, so use the event
channel interface to get it:

- allocate an unbound event channel specifying DOMID_SELF for the
   other end

- read the event channel status which will contain the own domid in
   unbound.dom

- close the event channel

Signed-off-by: Juergen Gross <jgr...@suse.com
---
V2:
- new patch
Signed-off-by: Juergen Gross <jgr...@suse.com>
---
  events.c         | 32 ++++++++++++++++++++++++++++++++
  include/events.h |  2 ++
  2 files changed, 34 insertions(+)

diff --git a/events.c b/events.c
index cdae90f4..af9f9f9e 100644
--- a/events.c
+++ b/events.c
@@ -261,6 +261,38 @@ int evtchn_get_peercontext(evtchn_port_t local_port, char *ctx, int size)
      return rc;
  }
+domid_t evtchn_get_domid(void)
I think the function name should be generic so the caller doesn't need to be modified everytime the implementation is updated.

How about get_domid()?

Fine with me. And I think it should have a prototype in include/lib.h


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to