On 6/11/20 6:17 AM, Dr. David Alan Gilbert (git) wrote:
From: "Dr. David Alan Gilbert" <dgilb...@redhat.com>

The existing 'getfd' command imports an fd from the monitor via
SCM rights.
This command allows qemu to open the file for itself; this is convenient
primarily in testing, or with simple QMP clients.

Signed-off-by: Dr. David Alan Gilbert <dgilb...@redhat.com>
---
  monitor/misc.c | 48 ++++++++++++++++++++++++++++++++++++++----------
  qapi/misc.json | 23 ++++++++++++++++++++++-
  2 files changed, 60 insertions(+), 11 deletions(-)


+++ b/qapi/misc.json
@@ -952,7 +952,7 @@
  ##
  # @closefd:
  #
-# Close a file descriptor previously passed via SCM rights
+# Close a named file descriptor
  #
  # @fdname: file descriptor name
  #
@@ -968,6 +968,27 @@
  ##
  { 'command': 'closefd', 'data': {'fdname': 'str'} }
+##
+# @openfd:
+#
+# Open a file descriptor.  The file is opened read-write.

Should this mention that this is shorthand for opening the file externally then using getfd on that fd? And if we add that cross-reference, should we add the reverse reference in the docs for getfd?

+#
+# @fdname: file descriptor name
+# @filename: file name
+#
+# Returns: Nothing on success
+#
+# Since: 5.1
+#
+# Example:
+#
+# -> { "execute": "openfd", "arguments": { "fdname": "null",
+#                                          "filename": "/dev/null" } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'openfd', 'data': {'fdname': 'str', 'filename': 'str'} }
+
  ##
  # @MemoryInfo:
  #


--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


Reply via email to