tools: xencall, xengnttab, xengntshr: Provide access to internal fds
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 4 May 2018 15:29:17 +0000 (16:29 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 6 Jul 2018 15:27:52 +0000 (16:27 +0100)
I want this to support my qemu depriv descriptor audit tool.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libs/call/core.c
tools/libs/call/include/xencall.h
tools/libs/call/libxencall.map
tools/libs/gnttab/gntshr_core.c
tools/libs/gnttab/gnttab_core.c
tools/libs/gnttab/include/xengnttab.h
tools/libs/gnttab/libxengnttab.map

index 46ca61529e946194b380b0c1cbbbc602eae2624c..57d3a33e6b2a4cf5196ff908274db338af3047e1 100644 (file)
@@ -91,6 +91,11 @@ int xencall_close(xencall_handle *xcall)
     return rc;
 }
 
+int xencall_fd(xencall_handle *xcall)
+{
+    return xcall->fd;
+}
+
 int xencall0(xencall_handle *xcall, unsigned int op)
 {
     privcmd_hypercall_t call = {
index 0d09bc8eae7a8938cd0f16509e3094faf2666f3c..2d0c42ad5ee449afd6b820aa1f3325540e685ac3 100644 (file)
@@ -73,6 +73,14 @@ xencall_handle *xencall_open(struct xentoollog_logger *logger,
  */
 int xencall_close(xencall_handle *xcall);
 
+/*
+ * Return the fd used internally by xencall.  selecting on it is not
+ * useful.  But it could be useful for unusual use cases; perhaps,
+ * passing to other programs, calling ioctls on directly, or maybe
+ * calling fcntl.
+ */
+int xencall_fd(xencall_handle *xcall);
+
 /*
  * Call hypercalls with varying numbers of arguments.
  *
index c482195b95ddd78e095b09fbf124792ced5c2ccd..feacee31461d136250ad47872681de5e7014b55d 100644 (file)
@@ -21,4 +21,5 @@ VERS_1.0 {
 VERS_1.1 {
        global:
                xencall_buffers_never_fault;
+               xencall_fd;
 } VERS_1.0;
index 7f6bf9de6a7d1275631ef8b8cc6e24c8ba22c83e..1117e29c91335eb50b0c848b7ead2449ab148df9 100644 (file)
@@ -64,6 +64,12 @@ int xengntshr_close(xengntshr_handle *xgs)
     free(xgs);
     return rc;
 }
+
+int xengntshr_fd(xengntshr_handle *xgs)
+{
+    return xgs->fd;
+}
+
 void *xengntshr_share_pages(xengntshr_handle *xcg, uint32_t domid,
                             int count, uint32_t *refs, int writable)
 {
index 98f1591e9da365da0f9b63f8c5d696f2cdb47357..bd075f818aa6d82f965067ef111f494fb4f8b5b2 100644 (file)
@@ -75,6 +75,11 @@ int xengnttab_close(xengnttab_handle *xgt)
     return rc;
 }
 
+int xengnttab_fd(xengnttab_handle *xgt)
+{
+    return xgt->fd;
+}
+
 int xengnttab_set_max_grants(xengnttab_handle *xgt, uint32_t count)
 {
     return osdep_gnttab_set_max_grants(xgt, count);
index 35be6c156786fa52fab0b211047e546c1be67ea5..91d4cd5bdd882f49b4c2c54fa635e8073a9cccc6 100644 (file)
@@ -149,6 +149,15 @@ xengnttab_handle *xengnttab_open(struct xentoollog_logger *logger,
  */
 int xengnttab_close(xengnttab_handle *xgt);
 
+
+/*
+ * Return the fd used internally by xengnttab.  selecting on it is not
+ * useful.  But it could be useful for unusual use cases; perhaps,
+ * passing to other programs, calling ioctls on directly, or maybe
+ * calling fcntl.
+ */
+int xengnttab_fd(xengnttab_handle *xgt);
+
 /**
  * Memory maps a grant reference from one domain to a local address range.
  * Mappings should be unmapped with xengnttab_unmap.  Logs errors.
@@ -334,6 +343,14 @@ xengntshr_handle *xengntshr_open(struct xentoollog_logger *logger,
  */
 int xengntshr_close(xengntshr_handle *xgs);
 
+/*
+ * Return the fd used internally by xengntshr.  selecting on it is not
+ * useful.  But it could be useful for unusual use cases; perhaps,
+ * passing to other programs, calling ioctls on directly, or maybe
+ * calling fcntl.
+ */
+int xengntshr_fd(xengntshr_handle *xgs);
+
 /**
  * Allocates and shares pages with another domain.
  *
index f78da229a5906a73cf926d300b6006ae5a0272f1..d5da388a0d8d63d080b6adf38e66df7b9cc64b7e 100644 (file)
@@ -26,3 +26,9 @@ VERS_1.1 {
     global:
         xengnttab_grant_copy;
 } VERS_1.0;
+
+VERS_1.2 {
+    global:
+               xengnttab_fd;
+               xengntshr_fd;
+} VERS_1.1;