summaryrefslogtreecommitdiffstats
path: root/otherlibs/win32unix/channels.c
diff options
context:
space:
mode:
Diffstat (limited to 'otherlibs/win32unix/channels.c')
-rw-r--r--otherlibs/win32unix/channels.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/otherlibs/win32unix/channels.c b/otherlibs/win32unix/channels.c
new file mode 100644
index 000000000..d8160c1fc
--- /dev/null
+++ b/otherlibs/win32unix/channels.c
@@ -0,0 +1,31 @@
+/***********************************************************************/
+/* */
+/* Objective Caml */
+/* */
+/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
+/* */
+/* Copyright 1996 Institut National de Recherche en Informatique et */
+/* Automatique. Distributed only by permission. */
+/* */
+/***********************************************************************/
+
+/* $Id$ */
+
+#include <mlvalues.h>
+#include "unixsupport.h"
+#include <fcntl.h>
+
+static int open_descr_flags[10] = {
+ 0, 0, 0, 0, O_APPEND, 0, 0, 0, O_BINARY, O_TEXT
+};
+
+value win_fd_handle(value handle, value flags) /* ML */
+{
+ return Val_int(_open_osfhandle(Handle_val(handle),
+ convert_flag_list(open_descr_flags, flags)));
+}
+
+value win_handle_fd(value fd) /* ML */
+{
+ return win_alloc_handle((HANDLE) _get_osfhandle(Int_val(fd)));
+}