From: Anil Madhavapeddy <anil@recoil.org>
Date: Sat, 3 Aug 2013 20:20:55 +0100
Subject: Add Unix.O_CLOEXEC flag to Lwt_unix

Origin: https://github.com/ocsigen/lwt/pull/2.patch
Signed-off-by: Stephane Glondu <steph@glondu.net>
---
 src/unix/lwt_unix.ml  | 3 +++
 src/unix/lwt_unix.mli | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/src/unix/lwt_unix.ml b/src/unix/lwt_unix.ml
index 58c2c25..cc3cdba 100644
--- a/src/unix/lwt_unix.ml
+++ b/src/unix/lwt_unix.ml
@@ -596,6 +596,9 @@ type open_flag =
 #if ocaml_version >= (3, 13)
   | O_SHARE_DELETE
 #endif
+#if ocaml_version >= (4, 01)
+  | O_CLOEXEC
+#endif
 
 #if windows
 
diff --git a/src/unix/lwt_unix.mli b/src/unix/lwt_unix.mli
index c59e8c5..3874fc2 100644
--- a/src/unix/lwt_unix.mli
+++ b/src/unix/lwt_unix.mli
@@ -315,6 +315,9 @@ type open_flag =
 #if ocaml_version >= (3, 13)
   | O_SHARE_DELETE
 #endif
+#if ocaml_version >= (4, 01)
+  | O_CLOEXEC
+#endif
 
 val openfile : string -> open_flag list -> file_perm -> file_descr Lwt.t
   (** Wrapper for [Unix.openfile]. *)
-- 
