| 
    
 [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl: Introduce libxl__fd_set_cloexec
 # HG changeset patch
# User Anthony PERARD <anthony.perard@xxxxxxxxxx>
# Date 1317308762 -3600
# Node ID cf2ba5720151ac950ed9312bebef2741e9429e86
# Parent  cd60c87d34963bcbd7e5ea6450a8afae3ffbc757
libxl: Introduce libxl__fd_set_cloexec
Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
diff -r cd60c87d3496 -r cf2ba5720151 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c      Thu Sep 29 15:40:34 2011 +0100
+++ b/tools/libxl/libxl_internal.c      Thu Sep 29 16:06:02 2011 +0100
@@ -242,3 +242,16 @@
 
        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 -r cd60c87d3496 -r cf2ba5720151 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Thu Sep 29 15:40:34 2011 +0100
+++ b/tools/libxl/libxl_internal.h      Thu Sep 29 16:06:02 2011 +0100
@@ -384,6 +384,7 @@
 
 _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);
 
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
  | 
  
![]()  | 
            
         Lists.xenproject.org is hosted with RackSpace, monitoring our  |