Anthony PERARD
2011-Sep-29 14:30 UTC
[Xen-devel] [PATCH 1/2] libxl: Introduce libxl__fd_set_cloexec.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
tools/libxl/libxl_internal.c | 13 +++++++++++++
tools/libxl/libxl_internal.h | 1 +
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c
index 0fb2315..56e6618 100644
--- a/tools/libxl/libxl_internal.c
+++ b/tools/libxl/libxl_internal.c
@@ -276,3 +276,16 @@ int libxl__file_reference_unmap(libxl_file_reference *f)
return ERROR_FAIL;
}
+
+int libxl__fd_set_cloexec(int fd)
+{
+ int flags = 0;
+
+ if ((flags = fcntl(fd, F_GETFD)) == -1) {
+ flags = 0;
+ }
+ if ((flags & FD_CLOEXEC)) {
+ return 0;
+ }
+ return fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
+}
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index cef2036..18a673e 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -387,6 +387,7 @@ _hidden int libxl__error_set(libxl__gc *gc, int code);
_hidden int libxl__file_reference_map(libxl_file_reference *f);
_hidden int libxl__file_reference_unmap(libxl_file_reference *f);
+_hidden int libxl__fd_set_cloexec(int fd);
_hidden int libxl__e820_alloc(libxl_ctx *ctx, uint32_t domid,
libxl_domain_config *d_config);
--
Anthony PERARD
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Anthony PERARD
2011-Sep-29 14:30 UTC
[Xen-devel] [PATCH 2/2] libxl_qmp: use of libxl__fd_set_cloexec.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
tools/libxl/libxl_qmp.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c
index 9e2b9e3..34db29f 100644
--- a/tools/libxl/libxl_qmp.c
+++ b/tools/libxl/libxl_qmp.c
@@ -302,6 +302,7 @@ static int qmp_open(libxl__qmp_handler *qmp, const char
*qmp_socket_path,
if (fcntl(qmp->qmp_fd, F_SETFL, flags | O_NONBLOCK) == -1) {
return -1;
}
+ libxl__fd_set_cloexec(qmp->qmp_fd);
memset(&qmp->addr, 0, sizeof (&qmp->addr));
qmp->addr.sun_family = AF_UNIX;
--
Anthony PERARD
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Ian Jackson
2011-Sep-29 15:06 UTC
Re: [Xen-devel] [PATCH 1/2] libxl: Introduce libxl__fd_set_cloexec.
Anthony PERARD writes ("[Xen-devel] [PATCH 1/2] libxl: Introduce
libxl__fd_set_cloexec."):> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Thanks.
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Ian Jackson
2011-Sep-29 15:08 UTC
Re: [Xen-devel] [PATCH 2/2] libxl_qmp: use of libxl__fd_set_cloexec.
Anthony PERARD writes ("[Xen-devel] [PATCH 2/2] libxl_qmp: use of
libxl__fd_set_cloexec."):> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
This patch depends on your qmp series and is indeed a fix to 7/7
"libxl: Introduce a QMP client", so I will try to stack it on the end
of those. In general this kind of thing should be mentioned although
in this case I''ve noticed for myself :-).
Thanks,
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Ian Jackson
2011-Sep-29 15:38 UTC
Re: [Xen-devel] [PATCH 2/2] libxl_qmp: use of libxl__fd_set_cloexec.
Anthony PERARD writes ("[Xen-devel] [PATCH 2/2] libxl_qmp: use of
libxl__fd_set_cloexec."):> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel