Skip to contentSkip to conversation

Introduce a QMP client

PATCH In review Anthony PERARD 3 participants 11 messages Sep 29, 2011

lore
Share & tools
lore
#0 lore raw

v9 cover Introduce a QMP client

Only the last patch have changed on this series since the v8. Replace of SOCK_NONBLOCK by a call to fcntl in qmp_open(). The rest of the patch have been acked-by Ian Campbell.

Anthony PERARD (7):
libxl: Rename libxl.idl to libxl_types.idl.
libxl: Add get/set_default_namespace in libxltypes.py.
libxl: Introduce libxl_internal_types.idl.
libxl: Introduce libxl__realloc.
libxl: Intruduce libxl__strndup.
libxl: Introduce JSON parsing stuff.
libxl: Introduce a QMP client

 README                                     |    1 +
 tools/libxl/Makefile                       |   21 +-
 tools/libxl/gentypes.py                    |    9 +-
 tools/libxl/libxl.c                        |    2 +
 tools/libxl/libxl_create.c                 |    4 +
 tools/libxl/libxl_dm.c                     |   10 +
 tools/libxl/libxl_internal.c               |   34 ++
 tools/libxl/libxl_internal.h               |  122 ++++++
 tools/libxl/libxl_json.c                   |  560 ++++++++++++++++++++++++++
 tools/libxl/libxl_qmp.c                    |  595 ++++++++++++++++++++++++++++
 tools/libxl/{libxl.idl => libxl_types.idl} |    2 +
 tools/libxl/libxl_types_internal.idl       |    9 +
 tools/libxl/libxltypes.py                  |   18 +-
 tools/ocaml/libs/xl/Makefile               |    4 +-
 tools/python/Makefile                      |    4 +-
 15 files changed, 1377 insertions(+), 18 deletions(-)
 create mode 100644 tools/libxl/libxl_json.c
 create mode 100644 tools/libxl/libxl_qmp.c
 rename tools/libxl/{libxl.idl => libxl_types.idl} (99%)
 create mode 100644 tools/libxl/libxl_types_internal.idl
Signature · 1 line
Anthony PERARD
#1 lore raw

PATCH v9 1/7 libxl: Rename libxl.idl to libxl_types.idl.

---
 tools/libxl/Makefile                       |   12 ++++++------
 tools/libxl/{libxl.idl => libxl_types.idl} |    0
 tools/ocaml/libs/xl/Makefile               |    4 ++--
 tools/python/Makefile                      |    4 ++--
 4 files changed, 10 insertions(+), 10 deletions(-)
 rename tools/libxl/{libxl.idl => libxl_types.idl} (100%)
tools/libxl/Makefile +6 -6
index 3eeb26f..330ee6e 100644
@@ -52,8 +52,8 @@ $(XL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxenlight)
 
 testidl.o: CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenlight)
-testidl.c: libxl.idl gentest.py libxl.h
-	$(PYTHON) gentest.py libxl.idl testidl.c.new
+testidl.c: libxl_types.idl gentest.py libxl.h
+	$(PYTHON) gentest.py libxl_types.idl testidl.c.new
 	mv testidl.c.new testidl.c
 
 .PHONY: all
@@ -84,10 +84,10 @@ libxl.h: _libxl_types.h
 
 $(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS): libxl.h
 
-_libxl_%.h _libxl_%.c: libxl.idl gen%.py libxl%.py
-	$(PYTHON) gen$*.py libxl.idl __libxl_$*.h __libxl_$*.c
-	$(call move-if-changed,__libxl_$*.h,_libxl_$*.h)
-	$(call move-if-changed,__libxl_$*.c,_libxl_$*.c)
+_libxl_type%.h _libxl_type%.c: libxl_type%.idl gentypes.py libxltypes.py
+	$(PYTHON) gentypes.py libxl_type$*.idl __libxl_type$*.h __libxl_type$*.c
+	$(call move-if-changed,__libxl_type$*.h,_libxl_type$*.h)
+	$(call move-if-changed,__libxl_type$*.c,_libxl_type$*.c)
 
 libxenlight.so: libxenlight.so.$(MAJOR)
 	ln -sf $< $@
tools/libxl/libxl_types.idl renamed from tools/libxl/libxl.idl +0 -0
similarity index 100%
rename from tools/libxl/libxl.idl
rename to tools/libxl/libxl_types.idl
tools/ocaml/libs/xl/Makefile +2 -2
index 342dc35..a1e79a5 100644
@@ -45,10 +45,10 @@ xl.mli: xl.mli.in _libxl_types.mli.in
 	  < xl.mli.in > xl.mli.tmp
 	$(Q)mv xl.mli.tmp xl.mli
 
-_libxl_types.ml.in _libxl_types.mli.in _libxl_types.inc: genwrap.py $(XEN_ROOT)/tools/libxl/libxl.idl \
+_libxl_types.ml.in _libxl_types.mli.in _libxl_types.inc: genwrap.py $(XEN_ROOT)/tools/libxl/libxl_types.idl \
                 $(XEN_ROOT)/tools/libxl/libxltypes.py
 	PYTHONPATH=$(XEN_ROOT)/tools/libxl $(PYTHON) genwrap.py \
-		$(XEN_ROOT)/tools/libxl/libxl.idl \
+		$(XEN_ROOT)/tools/libxl/libxl_types.idl \
 		_libxl_types.mli.in _libxl_types.ml.in _libxl_types.inc
 
 libs: $(LIBS)
tools/python/Makefile +2 -2
index de44178..b7bc501 100644
@@ -10,10 +10,10 @@ genpath-target = $(call buildmakevars2file,$(XENPATH))
 $(eval $(genpath-target))
 
 .PHONY: build
-build: genpath genwrap.py $(XEN_ROOT)/tools/libxl/libxl.idl \
+build: genpath genwrap.py $(XEN_ROOT)/tools/libxl/libxl_types.idl \
 		$(XEN_ROOT)/tools/libxl/libxltypes.py
 	PYTHONPATH=$(XEN_ROOT)/tools/libxl $(PYTHON) genwrap.py \
-		$(XEN_ROOT)/tools/libxl/libxl.idl \
+		$(XEN_ROOT)/tools/libxl/libxl_types.idl \
 		xen/lowlevel/xl/_pyxl_types.h \
 		xen/lowlevel/xl/_pyxl_types.c
 	CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py build
Signature · 1 line
Anthony PERARD
#2 lore raw

PATCH v9 2/7 libxl: Add get/set_default_namespace in libxltypes.py.

In reply to Anthony PERARD
---
 tools/libxl/libxl_types.idl |    2 ++
 tools/libxl/libxltypes.py   |   18 ++++++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)
tools/libxl/libxl_types.idl +2 -0
index 5b7e731..0d28283 100644
@@ -3,6 +3,8 @@
 # Builtin libxl types
 #
 
+namespace("libxl_")
+
 libxl_domid = Builtin("domid")
 libxl_uuid = Builtin("uuid", passby=PASS_BY_REFERENCE)
 libxl_mac = Builtin("mac", passby=PASS_BY_REFERENCE)
tools/libxl/libxltypes.py +16 -2
index f1a4dcf..86ab4b9 100644
@@ -8,10 +8,23 @@ DIR_IN   = 1
 DIR_OUT  = 2
 DIR_BOTH = 3
 
+_default_namespace = ""
+def namespace(s):
+    if type(s) != str:
+        raise TypeError, "Require a string for the default namespace."
+    global _default_namespace
+    _default_namespace = s
+
+def _get_default_namespace():
+    global _default_namespace
+    return _default_namespace
+
+
 class Type(object):
     def __init__(self, typename, **kwargs):
         self.comment = kwargs.setdefault('comment', None)
-        self.namespace = kwargs.setdefault('namespace', "libxl_")
+        self.namespace = kwargs.setdefault('namespace',
+                _get_default_namespace())
         self.dir = kwargs.setdefault('dir', DIR_BOTH)
         if self.dir not in [DIR_NONE, DIR_IN, DIR_OUT, DIR_BOTH]:
             raise ValueError
@@ -256,7 +269,8 @@ def parse(f):
         elif isinstance(t,type(object)) and issubclass(t, Type):
             globs[n] = t
         elif n in ['PASS_BY_REFERENCE', 'PASS_BY_VALUE',
-                   'DIR_NONE', 'DIR_IN', 'DIR_OUT', 'DIR_BOTH']:
+                   'DIR_NONE', 'DIR_IN', 'DIR_OUT', 'DIR_BOTH',
+                   'namespace']:
             globs[n] = t
 
     try:
Signature · 1 line
Anthony PERARD
#3 lore raw

PATCH v9 3/7 libxl: Introduce libxl_internal_types.idl.

In reply to Anthony PERARD
---
 tools/libxl/Makefile                 |    4 +++-
 tools/libxl/gentypes.py              |    9 +++++----
 tools/libxl/libxl_internal.h         |    1 +
 tools/libxl/libxl_types_internal.idl |    9 +++++++++
 4 files changed, 18 insertions(+), 5 deletions(-)
 create mode 100644 tools/libxl/libxl_types_internal.idl
tools/libxl/Makefile +3 -1
index 330ee6e..1f6b418 100644
@@ -35,7 +35,7 @@ LIBXL_OBJS-$(CONFIG_IA64) += libxl_nocpuid.o
 LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
 			libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o \
 			libxl_internal.o libxl_utils.o libxl_uuid.o $(LIBXL_OBJS-y)
-LIBXL_OBJS += _libxl_types.o libxl_flask.o
+LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 
 $(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl)
 
@@ -81,8 +81,10 @@ _libxl_paths.h: genpath
 libxl_paths.c: _libxl_paths.h
 
 libxl.h: _libxl_types.h
+libxl_internal.h: _libxl_types_internal.h
 
 $(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS): libxl.h
+$(LIBXL_OBJS): libxl_internal.h
 
 _libxl_type%.h _libxl_type%.c: libxl_type%.idl gentypes.py libxltypes.py
 	$(PYTHON) gentypes.py libxl_type$*.idl __libxl_type$*.h __libxl_type$*.c
tools/libxl/gentypes.py +5 -4
index c66a33c..ecf5f15 100644
@@ -150,8 +150,9 @@ if __name__ == '__main__':
 
     f = open(header, "w")
 
-    f.write("""#ifndef __LIBXL_TYPES_H
-#define __LIBXL_TYPES_H
+    header_define = header.upper().replace('.','_')
+    f.write("""#ifndef %s
+#define %s
 
 /*
  * DO NOT EDIT.
@@ -160,7 +161,7 @@ if __name__ == '__main__':
  * "%s"
  */
 
-""" % " ".join(sys.argv))
+""" % (header_define, header_define, " ".join(sys.argv)))
 
     for ty in types:
         f.write(libxl_C_type_define(ty) + ";\n")
@@ -172,7 +173,7 @@ if __name__ == '__main__':
             f.write("extern libxl_enum_string_table %s_string_table[];\n" % (ty.typename))
         f.write("\n")
 
-    f.write("""#endif /* __LIBXL_TYPES_H */\n""")
+    f.write("""#endif /* %s */\n""" % (header_define))
     f.close()
 
     print "outputting libxl type implementations to %s" % impl
tools/libxl/libxl_internal.h +1 -0
index b431632..29cdba4 100644
@@ -35,6 +35,7 @@
 
 #include "flexarray.h"
 #include "libxl_utils.h"
+#include "_libxl_types_internal.h"
 
 #define LIBXL_DESTROY_TIMEOUT 10
 #define LIBXL_DEVICE_MODEL_START_TIMEOUT 10
tools/libxl/libxl_types_internal.idl new file +9 -0
new file mode 100644
index 0000000..20236a6
@@ -0,0 +1,9 @@
+namespace("libxl__")
+
+libxl__qmp_message_type  = Enumeration("qmp_message_type", [
+    (1, "QMP"),
+    (2, "return"),
+    (3, "error"),
+    (4, "event"),
+    (5, "invalid"),
+    ])
Signature · 1 line
Anthony PERARD
#4 lore raw

PATCH v9 4/7 libxl: Introduce libxl__realloc.

In reply to Anthony PERARD
---
 tools/libxl/libxl_internal.c |   24 ++++++++++++++++++++++++
 tools/libxl/libxl_internal.h |    1 +
 2 files changed, 25 insertions(+), 0 deletions(-)
tools/libxl/libxl_internal.c +24 -0
index e259278..c4d54f9 100644
@@ -102,6 +102,30 @@ void *libxl__calloc(libxl__gc *gc, size_t nmemb, size_t size)
     return ptr;
 }
 
+void *libxl__realloc(libxl__gc *gc, void *ptr, size_t new_size)
+{
+    void *new_ptr = realloc(ptr, new_size);
+    int i = 0;
+
+    if (new_ptr == NULL && new_size != 0) {
+        return NULL;
+    }
+
+    if (ptr == NULL) {
+        libxl__ptr_add(gc, new_ptr);
+    } else if (new_ptr != ptr) {
+        for (i = 0; i < gc->alloc_maxsize; i++) {
+            if (gc->alloc_ptrs[i] == ptr) {
+                gc->alloc_ptrs[i] = new_ptr;
+                break;
+            }
+        }
+    }
+
+
+    return new_ptr;
+}
+
 char *libxl__sprintf(libxl__gc *gc, const char *fmt, ...)
 {
     char *s;
tools/libxl/libxl_internal.h +1 -0
index 29cdba4..343c11b 100644
@@ -145,6 +145,7 @@ _hidden int libxl__ptr_add(libxl__gc *gc, void *ptr);
 _hidden void libxl__free_all(libxl__gc *gc);
 _hidden void *libxl__zalloc(libxl__gc *gc, int bytes);
 _hidden void *libxl__calloc(libxl__gc *gc, size_t nmemb, size_t size);
+_hidden void *libxl__realloc(libxl__gc *gc, void *ptr, size_t new_size);
 _hidden char *libxl__sprintf(libxl__gc *gc, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3);
 _hidden char *libxl__strdup(libxl__gc *gc, const char *c);
 _hidden char *libxl__dirname(libxl__gc *gc, const char *s);
Signature · 1 line
Anthony PERARD
#5 lore raw

PATCH v9 5/7 libxl: Intruduce libxl__strndup.

In reply to Anthony PERARD
---
 tools/libxl/libxl_internal.c |   10 ++++++++++
 tools/libxl/libxl_internal.h |    1 +
 2 files changed, 11 insertions(+), 0 deletions(-)
tools/libxl/libxl_internal.c +10 -0
index c4d54f9..0fb2315 100644
@@ -159,6 +159,16 @@ char *libxl__strdup(libxl__gc *gc, const char *c)
     return s;
 }
 
+char *libxl__strndup(libxl__gc *gc, const char *c, size_t n)
+{
+    char *s = strndup(c, n);
+
+    if (s)
+        libxl__ptr_add(gc, s);
+
+    return s;
+}
+
 char *libxl__dirname(libxl__gc *gc, const char *s)
 {
     char *c;
tools/libxl/libxl_internal.h +1 -0
index 343c11b..6ec402e 100644
@@ -148,6 +148,7 @@ _hidden void *libxl__calloc(libxl__gc *gc, size_t nmemb, size_t size);
 _hidden void *libxl__realloc(libxl__gc *gc, void *ptr, size_t new_size);
 _hidden char *libxl__sprintf(libxl__gc *gc, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3);
 _hidden char *libxl__strdup(libxl__gc *gc, const char *c);
+_hidden char *libxl__strndup(libxl__gc *gc, const char *c, size_t n);
 _hidden char *libxl__dirname(libxl__gc *gc, const char *s);
 
 _hidden char **libxl__xs_kvs_of_flexarray(libxl__gc *gc, flexarray_t *array, int length);
Signature · 1 line
Anthony PERARD
#6 lore raw

PATCH v9 6/7 libxl: Introduce JSON parsing stuff.

In reply to Anthony PERARD

We use the yajl parser, but we need to make a tree from the parse result to use it outside the parser.

So this patch include json_object struct that is used to hold the JSON data.

---
 README                       |    1 +
 tools/libxl/Makefile         |    5 +-
 tools/libxl/libxl_internal.h |  100 ++++++++
 tools/libxl/libxl_json.c     |  560 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 665 insertions(+), 1 deletions(-)
 create mode 100644 tools/libxl/libxl_json.c
README +1 -0
index ff154b2..c9bf699 100644
@@ -47,6 +47,7 @@ provided by your OS distributor:
     * Development install of openssl (e.g., openssl-dev)
     * Development install of x11 (e.g. xorg-x11-dev)
     * Development install of uuid (e.g. uuid-dev)
+    * Development install of yajl (e.g. libyajl-dev)
     * bridge-utils package (/sbin/brctl)
     * iproute package (/sbin/ip)
     * hotplug or udev
tools/libxl/Makefile +4 -1
index 1f6b418..e50874e 100644
@@ -32,9 +32,12 @@ endif
 LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o
 LIBXL_OBJS-$(CONFIG_IA64) += libxl_nocpuid.o
 
+LIBXL_LIBS += -lyajl
+
 LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
 			libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o \
-			libxl_internal.o libxl_utils.o libxl_uuid.o $(LIBXL_OBJS-y)
+			libxl_internal.o libxl_utils.o libxl_uuid.o libxl_json.o \
+			$(LIBXL_OBJS-y)
 LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 
 $(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl)
tools/libxl/libxl_internal.h +100 -0

104 lines not on this page · raw message

tools/libxl/libxl_json.c new file +560 -0

560 lines not on this page · raw message

Signature · 1 line
Anthony PERARD
#7 lore raw

PATCH v9 7/7 libxl: Introduce a QMP client

In reply to Anthony PERARD

QMP stands for QEMU Monitor Protocol and it is used to query information from QEMU or to control QEMU.

This implementation will ask QEMU the list of chardevice and store the path to serial ports in xenstored. So we will be able to use xl console with QEMU upstream.

In order to connect to the QMP server, a socket file is created in /var/run/xen/qmp-libxl-$(domid).

---
 tools/libxl/Makefile         |    2 +-
 tools/libxl/libxl.c          |    2 +
 tools/libxl/libxl_create.c   |    4 +
 tools/libxl/libxl_dm.c       |   10 +
 tools/libxl/libxl_internal.h |   19 ++
 tools/libxl/libxl_qmp.c      |  595 ++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 631 insertions(+), 1 deletions(-)
 create mode 100644 tools/libxl/libxl_qmp.c
tools/libxl/Makefile +1 -1
index e50874e..f10c7e8 100644
@@ -37,7 +37,7 @@ LIBXL_LIBS += -lyajl
 LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
 			libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o \
 			libxl_internal.o libxl_utils.o libxl_uuid.o libxl_json.o \
-			$(LIBXL_OBJS-y)
+			libxl_qmp.o $(LIBXL_OBJS-y)
 LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 
 $(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl)
tools/libxl/libxl.c +2 -0
index ce76cff..0855f59 100644
@@ -762,6 +762,8 @@ int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid, int force)
     if (dm_present) {
         if (libxl__destroy_device_model(&gc, domid) < 0)
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "libxl__destroy_device_model failed for %d", domid);
+
+        libxl__qmp_cleanup(&gc, domid);
     }
     if (libxl__devices_destroy(&gc, domid, force) < 0)
         LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "libxl_destroy_devices failed for %d", domid);
tools/libxl/libxl_create.c +4 -0
index ce76729..c97819a 100644
@@ -573,6 +573,10 @@ static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
     }
 
     if (dm_starting) {
+        if (dm_info->device_model_version
+            == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
+            libxl__qmp_initializations(ctx, domid);
+        }
         ret = libxl__confirm_device_model_startup(gc, dm_starting);
         if (ret < 0) {
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
tools/libxl/libxl_dm.c +10 -0
index c575460..7e0616a 100644
@@ -248,6 +248,16 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
     flexarray_vappend(dm_args, dm,
                       "-xen-domid", libxl__sprintf(gc, "%d", info->domid), NULL);
 
+    flexarray_append(dm_args, "-chardev");
+    flexarray_append(dm_args,
+                     libxl__sprintf(gc, "socket,id=libxl-cmd,"
+                                    "path=%s/qmp-libxl-%d,server,nowait",
+                                    libxl_run_dir_path(),
+                                    info->domid));
+
+    flexarray_append(dm_args, "-mon");
+    flexarray_append(dm_args, "chardev=libxl-cmd,mode=control");
+
     if (info->type == LIBXL_DOMAIN_TYPE_PV) {
         flexarray_append(dm_args, "-xen-attach");
     }
tools/libxl/libxl_internal.h +19 -0
index 66f56f1..cef2036 100644
@@ -393,6 +393,25 @@ _hidden int libxl__e820_alloc(libxl_ctx *ctx, uint32_t domid, libxl_domain_confi
 #define STRINGIFY(x) #x
 #define TOSTRING(x) STRINGIFY(x)
 
+/* from libxl_qmp */
+typedef struct libxl__qmp_handler libxl__qmp_handler;
+
+/* Initialise and connect to the QMP socket.
+ *   Return an handler or NULL if there is an error
+ */
+_hidden libxl__qmp_handler *libxl__qmp_initialize(libxl_ctx *ctx,
+                                                  uint32_t domid);
+/* ask to QEMU the serial port information and store it in xenstore. */
+_hidden int libxl__qmp_query_serial(libxl__qmp_handler *qmp);
+/* close and free the QMP handler */
+_hidden void libxl__qmp_close(libxl__qmp_handler *qmp);
+/* remove the socket file, if the file has already been removed,
+ * nothing happen */
+_hidden void libxl__qmp_cleanup(libxl__gc *gc, uint32_t domid);
+
+/* this helper calls qmp_initialize, query_serial and qmp_close */
+_hidden int libxl__qmp_initializations(libxl_ctx *ctx, uint32_t domid);
+
 /* from libxl_json */
 #include <yajl/yajl_gen.h>
 
tools/libxl/libxl_qmp.c new file +595 -0

595 lines not on this page · raw message

Signature · 1 line
Anthony PERARD
#8 lore raw

Re: [PATCH V9 7/7] libxl: Introduce a QMP client

tools/libxl/libxl_qmp.c line 298

Quoted 5 lines · Anthony PERARD
tools/libxl/libxl_qmp.c new file +4 -0
+    qmp->qmp_fd = socket(AF_UNIX, SOCK_STREAM, 0);
+    if (qmp->qmp_fd < 0) {
+        return -1;
+    } 

Is SOCK_CLOEXEC standard enough to use? Probably not.

We should use FD_CLOEXEC though.

Ian.

#9 lore raw

Re: Re: [PATCH V9 7/7] libxl: Introduce a QMP client

Quoted 10 lines · Ian Campbell
Quoted 5 lines · Anthony PERARD

+    qmp->qmp_fd = socket(AF_UNIX, SOCK_STREAM, 0);
+    if (qmp->qmp_fd < 0) {
+        return -1;
+    }

Is SOCK_CLOEXEC standard enough to use? Probably not.

We should use FD_CLOEXEC though.

Ok, I will send a separate patch for this.

Signature · 1 line
Anthony PERARD
#10 lore raw
In reply to Anthony PERARD

Anthony PERARD writes ("[Xen-devel] [PATCH V9 0/7] Introduce a QMP client"):

Quoted 3 lines

Only the last patch have changed on this series since the v8. Replace of SOCK_NONBLOCK by a call to fcntl in qmp_open(). The rest of the patch have been acked-by Ian Campbell.

Thanks, I have applied this whole series.

Ian.