diff -Naur ocaml-unix-3.09.3/LICENSE ocaml-unix-3.10.2/LICENSE
--- ocaml-unix-3.09.3/LICENSE   2004-08-20 19:04:34.000000000 +0200
+++ ocaml-unix-3.10.2/LICENSE   2007-01-30 11:01:25.000000000 +0100
@@ -30,7 +30,7 @@
 Public License.  By "a publicly distributed version of the Library",
 we mean either the unmodified Library as distributed by INRIA, or a
 modified version of the Library that is distributed under the
-conditions defined in clause 3 of the GNU Library General Public
+conditions defined in clause 2 of the GNU Library General Public
 License.  This exception does not however invalidate any other reasons
 why the executable file might be covered by the GNU Library General
 Public License.
diff -Naur ocaml-unix-3.09.3/otherlibs/unix/access.c ocaml-unix-3.10.2/otherlibs/unix/access.c
--- ocaml-unix-3.09.3/otherlibs/unix/access.c   2005-03-24 18:20:53.000000000 +0100
+++ ocaml-unix-3.10.2/otherlibs/unix/access.c   2007-10-09 16:30:29.000000000 +0200
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: access.c,v 1.11 2005/03/24 17:20:53 doligez Exp $ */
+/* $Id: access.c,v 1.11.12.1 2007/10/09 14:30:29 xleroy Exp $ */

 #include <mlvalues.h>
 #include <alloc.h>
@@ -31,7 +31,7 @@
 # else
 #  define R_OK    4/* test for read permission */
 #  define W_OK    2/* test for write permission */
-#  define X_OK    1/* test for execute (search) permission */
+#  define X_OK    4/* test for execute permission - not implemented in Win32 */
 #  define F_OK    0/* test for presence of file */
 # endif
 #endif
diff -Naur ocaml-unix-3.09.3/otherlibs/unix/.depend ocaml-unix-3.10.2/otherlibs/unix/.depend
--- ocaml-unix-3.09.3/otherlibs/unix/.depend    2005-07-29 17:54:25.000000000 +0200
+++ ocaml-unix-3.10.2/otherlibs/unix/.depend    2007-03-02 23:47:05.000000000 +0100
@@ -1,371 +1,788 @@
 accept.o: accept.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/alloc.h ../../byterun/fail.h \
-  ../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \
-  ../../byterun/freelist.h ../../byterun/minor_gc.h \
-  ../../byterun/signals.h unixsupport.h socketaddr.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/alloc.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/signals.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h socketaddr.h
 access.o: access.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/alloc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/alloc.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 addrofstr.o: addrofstr.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/fail.h \
-  unixsupport.h socketaddr.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/fail.h ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h socketaddr.h
 alarm.o: alarm.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 bind.o: bind.c ../../byterun/fail.h ../../byterun/compatibility.h \
-  ../../byterun/misc.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/mlvalues.h unixsupport.h socketaddr.h
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/mlvalues.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/misc.h unixsupport.h socketaddr.h
 chdir.o: chdir.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 chmod.o: chmod.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 chown.o: chown.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 chroot.o: chroot.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 close.o: close.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 closedir.o: closedir.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h unixsupport.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h unixsupport.h
 connect.o: connect.c ../../byterun/fail.h ../../byterun/compatibility.h \
-  ../../byterun/misc.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/mlvalues.h ../../byterun/signals.h \
-  unixsupport.h socketaddr.h
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/mlvalues.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/misc.h ../../byterun/signals.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h socketaddr.h
 cst2constr.o: cst2constr.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/fail.h cst2constr.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/fail.h ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h cst2constr.h
 cstringv.o: cstringv.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/memory.h \
-  ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \
-  ../../byterun/minor_gc.h unixsupport.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/memory.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/gc.h ../../byterun/mlvalues.h \
+  ../../byterun/major_gc.h ../../byterun/freelist.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/misc.h ../../byterun/minor_gc.h \
+  ../../byterun/misc.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  unixsupport.h
 dup.o: dup.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 dup2.o: dup2.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 envir.o: envir.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/alloc.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/alloc.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h
 errmsg.o: errmsg.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/alloc.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/alloc.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h
 execv.o: execv.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/memory.h ../../byterun/gc.h \
-  ../../byterun/major_gc.h ../../byterun/freelist.h \
-  ../../byterun/minor_gc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h unixsupport.h
 execve.o: execve.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/memory.h ../../byterun/gc.h \
-  ../../byterun/major_gc.h ../../byterun/freelist.h \
-  ../../byterun/minor_gc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h unixsupport.h
 execvp.o: execvp.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/memory.h ../../byterun/gc.h \
-  ../../byterun/major_gc.h ../../byterun/freelist.h \
-  ../../byterun/minor_gc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h unixsupport.h
 exit.o: exit.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 fchmod.o: fchmod.c ../../byterun/fail.h ../../byterun/compatibility.h \
-  ../../byterun/misc.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/mlvalues.h unixsupport.h
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/mlvalues.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/misc.h unixsupport.h
 fchown.o: fchown.c ../../byterun/fail.h ../../byterun/compatibility.h \
-  ../../byterun/misc.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/mlvalues.h unixsupport.h
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/mlvalues.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/misc.h unixsupport.h
 fcntl.o: fcntl.c ../../byterun/fail.h ../../byterun/compatibility.h \
-  ../../byterun/misc.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/mlvalues.h unixsupport.h
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/mlvalues.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/misc.h unixsupport.h
 fork.o: fork.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 ftruncate.o: ftruncate.c ../../byterun/fail.h \
   ../../byterun/compatibility.h ../../byterun/misc.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/mlvalues.h ../../byterun/io.h unixsupport.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/mlvalues.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/misc.h ../../byterun/io.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 getaddrinfo.o: getaddrinfo.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/alloc.h \
-  ../../byterun/fail.h ../../byterun/memory.h ../../byterun/gc.h \
-  ../../byterun/major_gc.h ../../byterun/freelist.h \
-  ../../byterun/minor_gc.h ../../byterun/signals.h unixsupport.h \
-  cst2constr.h socketaddr.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/alloc.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/signals.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h cst2constr.h socketaddr.h
 getcwd.o: getcwd.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/alloc.h ../../byterun/fail.h \
-  unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/alloc.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 getegid.o: getegid.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h unixsupport.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h unixsupport.h
 geteuid.o: geteuid.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h unixsupport.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h unixsupport.h
 getgid.o: getgid.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 getgr.o: getgr.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/fail.h ../../byterun/alloc.h \
-  ../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \
-  ../../byterun/freelist.h ../../byterun/minor_gc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/alloc.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h unixsupport.h
 getgroups.o: getgroups.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/alloc.h \
-  ../../byterun/fail.h unixsupport.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/alloc.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 gethost.o: gethost.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/alloc.h \
-  ../../byterun/fail.h ../../byterun/memory.h ../../byterun/gc.h \
-  ../../byterun/major_gc.h ../../byterun/freelist.h \
-  ../../byterun/minor_gc.h ../../byterun/signals.h unixsupport.h \
-  socketaddr.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/alloc.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/signals.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h socketaddr.h
 gethostname.o: gethostname.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/alloc.h \
-  ../../byterun/fail.h unixsupport.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/alloc.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 getlogin.o: getlogin.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/alloc.h \
-  unixsupport.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/alloc.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h unixsupport.h
 getnameinfo.o: getnameinfo.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/alloc.h \
-  ../../byterun/fail.h ../../byterun/memory.h ../../byterun/gc.h \
-  ../../byterun/major_gc.h ../../byterun/freelist.h \
-  ../../byterun/minor_gc.h ../../byterun/signals.h unixsupport.h \
-  socketaddr.h
-getpeername.o: getpeername.c ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/alloc.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/signals.h \
   ../../byterun/compatibility.h ../../byterun/misc.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
   ../../byterun/mlvalues.h unixsupport.h socketaddr.h
+getpeername.o: getpeername.c ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/mlvalues.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/misc.h unixsupport.h socketaddr.h
 getpid.o: getpid.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 getppid.o: getppid.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h unixsupport.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h unixsupport.h
 getproto.o: getproto.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/alloc.h \
-  ../../byterun/fail.h ../../byterun/memory.h ../../byterun/gc.h \
-  ../../byterun/major_gc.h ../../byterun/freelist.h \
-  ../../byterun/minor_gc.h unixsupport.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/alloc.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h unixsupport.h
 getpw.o: getpw.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/alloc.h ../../byterun/memory.h \
-  ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \
-  ../../byterun/minor_gc.h ../../byterun/fail.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/alloc.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 getserv.o: getserv.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/alloc.h \
-  ../../byterun/fail.h ../../byterun/memory.h ../../byterun/gc.h \
-  ../../byterun/major_gc.h ../../byterun/freelist.h \
-  ../../byterun/minor_gc.h unixsupport.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/alloc.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h unixsupport.h
 getsockname.o: getsockname.c ../../byterun/fail.h \
   ../../byterun/compatibility.h ../../byterun/misc.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/mlvalues.h unixsupport.h socketaddr.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/mlvalues.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/misc.h unixsupport.h socketaddr.h
 gettimeofday.o: gettimeofday.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/alloc.h \
-  ../../byterun/fail.h unixsupport.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/alloc.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 getuid.o: getuid.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 gmtime.o: gmtime.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/alloc.h ../../byterun/fail.h \
-  ../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \
-  ../../byterun/freelist.h ../../byterun/minor_gc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/alloc.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h unixsupport.h
+isatty.o: isatty.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 itimer.o: itimer.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/alloc.h ../../byterun/fail.h \
-  ../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \
-  ../../byterun/freelist.h ../../byterun/minor_gc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/alloc.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h unixsupport.h
 kill.o: kill.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/fail.h unixsupport.h \
-  ../../byterun/signals.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h ../../byterun/signals.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h
 link.o: link.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 listen.o: listen.c ../../byterun/fail.h ../../byterun/compatibility.h \
-  ../../byterun/misc.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/mlvalues.h unixsupport.h
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/mlvalues.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/misc.h unixsupport.h
 lockf.o: lockf.c ../../byterun/fail.h ../../byterun/compatibility.h \
-  ../../byterun/misc.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/mlvalues.h ../../byterun/signals.h \
-  unixsupport.h
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/mlvalues.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/misc.h ../../byterun/signals.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 lseek.o: lseek.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/alloc.h ../../byterun/io.h \
-  unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/alloc.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/io.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 mkdir.o: mkdir.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 mkfifo.o: mkfifo.c ../../byterun/fail.h ../../byterun/compatibility.h \
-  ../../byterun/misc.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/mlvalues.h unixsupport.h
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/mlvalues.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/misc.h unixsupport.h
 nice.o: nice.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 open.o: open.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/alloc.h ../../byterun/memory.h \
-  ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \
-  ../../byterun/minor_gc.h ../../byterun/signals.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/alloc.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/signals.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 opendir.o: opendir.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/alloc.h \
-  unixsupport.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/alloc.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h unixsupport.h
 pipe.o: pipe.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/alloc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/alloc.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 putenv.o: putenv.c ../../byterun/fail.h ../../byterun/compatibility.h \
-  ../../byterun/misc.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/mlvalues.h ../../byterun/memory.h \
-  ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \
-  ../../byterun/minor_gc.h unixsupport.h
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/mlvalues.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/misc.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h unixsupport.h
 read.o: read.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/memory.h ../../byterun/gc.h \
-  ../../byterun/major_gc.h ../../byterun/freelist.h \
-  ../../byterun/minor_gc.h ../../byterun/signals.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/signals.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 readdir.o: readdir.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/fail.h \
-  ../../byterun/alloc.h unixsupport.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/fail.h ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/alloc.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 readlink.o: readlink.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/alloc.h \
-  ../../byterun/fail.h unixsupport.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/alloc.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 rename.o: rename.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 rewinddir.o: rewinddir.c ../../byterun/fail.h \
   ../../byterun/compatibility.h ../../byterun/misc.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/mlvalues.h unixsupport.h
-rmdir.o: rmdir.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/mlvalues.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
   ../../byterun/misc.h unixsupport.h
+rmdir.o: rmdir.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 select.o: select.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/alloc.h ../../byterun/fail.h \
-  ../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \
-  ../../byterun/freelist.h ../../byterun/minor_gc.h \
-  ../../byterun/signals.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/alloc.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/signals.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 sendrecv.o: sendrecv.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/alloc.h \
-  ../../byterun/fail.h ../../byterun/memory.h ../../byterun/gc.h \
-  ../../byterun/major_gc.h ../../byterun/freelist.h \
-  ../../byterun/minor_gc.h ../../byterun/signals.h unixsupport.h \
-  socketaddr.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/alloc.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/signals.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h socketaddr.h
 setgid.o: setgid.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 setsid.o: setsid.c ../../byterun/fail.h ../../byterun/compatibility.h \
-  ../../byterun/misc.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/mlvalues.h unixsupport.h
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/mlvalues.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/misc.h unixsupport.h
 setuid.o: setuid.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 shutdown.o: shutdown.c ../../byterun/fail.h ../../byterun/compatibility.h \
-  ../../byterun/misc.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/mlvalues.h unixsupport.h
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/mlvalues.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/misc.h unixsupport.h
 signals.o: signals.c ../../byterun/alloc.h ../../byterun/compatibility.h \
-  ../../byterun/misc.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/mlvalues.h ../../byterun/fail.h \
-  ../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \
-  ../../byterun/freelist.h ../../byterun/minor_gc.h \
-  ../../byterun/signals.h unixsupport.h
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/mlvalues.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/misc.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/signals.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 sleep.o: sleep.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/signals.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/signals.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 socket.o: socket.c ../../byterun/fail.h ../../byterun/compatibility.h \
-  ../../byterun/misc.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/mlvalues.h unixsupport.h
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/mlvalues.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/misc.h unixsupport.h
 socketaddr.o: socketaddr.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/alloc.h \
-  ../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \
-  ../../byterun/freelist.h ../../byterun/minor_gc.h unixsupport.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/alloc.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h unixsupport.h \
   socketaddr.h
 socketpair.o: socketpair.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/alloc.h \
-  ../../byterun/fail.h unixsupport.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/alloc.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 sockopt.o: sockopt.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/alloc.h \
-  ../../byterun/fail.h unixsupport.h socketaddr.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/alloc.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h socketaddr.h
 stat.o: stat.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/memory.h ../../byterun/gc.h \
-  ../../byterun/major_gc.h ../../byterun/freelist.h \
-  ../../byterun/minor_gc.h ../../byterun/alloc.h unixsupport.h \
-  cst2constr.h ../../byterun/io.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/alloc.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h cst2constr.h ../../byterun/io.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h
 strofaddr.o: strofaddr.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/alloc.h \
-  ../../byterun/fail.h unixsupport.h socketaddr.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/alloc.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h socketaddr.h
 symlink.o: symlink.c ../../byterun/fail.h ../../byterun/compatibility.h \
-  ../../byterun/misc.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/mlvalues.h unixsupport.h
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/mlvalues.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/misc.h unixsupport.h
 termios.o: termios.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/alloc.h \
-  ../../byterun/fail.h unixsupport.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/alloc.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 time.o: time.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/alloc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/alloc.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 times.o: times.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/alloc.h ../../byterun/memory.h \
-  ../../byterun/gc.h ../../byterun/major_gc.h ../../byterun/freelist.h \
-  ../../byterun/minor_gc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/alloc.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h unixsupport.h
 truncate.o: truncate.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/fail.h \
-  ../../byterun/io.h unixsupport.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/fail.h ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/io.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 umask.o: umask.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 unixsupport.o: unixsupport.c ../../byterun/mlvalues.h \
-  ../../byterun/compatibility.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/misc.h ../../byterun/alloc.h \
-  ../../byterun/callback.h ../../byterun/memory.h ../../byterun/gc.h \
-  ../../byterun/major_gc.h ../../byterun/freelist.h \
-  ../../byterun/minor_gc.h ../../byterun/fail.h unixsupport.h \
-  cst2constr.h
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/../config/m.h ../../byterun/../config/s.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/compatibility.h ../../byterun/config.h \
+  ../../byterun/alloc.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/callback.h \
+  ../../byterun/compatibility.h ../../byterun/mlvalues.h \
+  ../../byterun/memory.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/gc.h ../../byterun/mlvalues.h \
+  ../../byterun/major_gc.h ../../byterun/freelist.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/misc.h ../../byterun/minor_gc.h \
+  ../../byterun/misc.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/fail.h ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h cst2constr.h
 unlink.o: unlink.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h unixsupport.h
 utimes.o: utimes.c ../../byterun/fail.h ../../byterun/compatibility.h \
-  ../../byterun/misc.h ../../byterun/config.h ../../config/m.h \
-  ../../config/s.h ../../byterun/mlvalues.h unixsupport.h
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/mlvalues.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/misc.h unixsupport.h
 wait.o: wait.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/alloc.h ../../byterun/fail.h \
-  ../../byterun/memory.h ../../byterun/gc.h ../../byterun/major_gc.h \
-  ../../byterun/freelist.h ../../byterun/minor_gc.h \
-  ../../byterun/signals.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/alloc.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/fail.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/signals.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 write.o: write.c ../../byterun/mlvalues.h ../../byterun/compatibility.h \
-  ../../byterun/config.h ../../config/m.h ../../config/s.h \
-  ../../byterun/misc.h ../../byterun/memory.h ../../byterun/gc.h \
-  ../../byterun/major_gc.h ../../byterun/freelist.h \
-  ../../byterun/minor_gc.h ../../byterun/signals.h unixsupport.h
+  ../../byterun/config.h ../../byterun/../config/m.h \
+  ../../byterun/../config/s.h ../../byterun/compatibility.h \
+  ../../byterun/misc.h ../../byterun/compatibility.h \
+  ../../byterun/config.h ../../byterun/memory.h \
+  ../../byterun/compatibility.h ../../byterun/config.h ../../byterun/gc.h \
+  ../../byterun/mlvalues.h ../../byterun/major_gc.h \
+  ../../byterun/freelist.h ../../byterun/misc.h ../../byterun/mlvalues.h \
+  ../../byterun/misc.h ../../byterun/minor_gc.h ../../byterun/misc.h \
+  ../../byterun/misc.h ../../byterun/mlvalues.h ../../byterun/signals.h \
+  ../../byterun/compatibility.h ../../byterun/misc.h \
+  ../../byterun/mlvalues.h unixsupport.h
 unixLabels.cmi: unix.cmi
 unix.cmo: unix.cmi
 unix.cmx: unix.cmi
diff -Naur ocaml-unix-3.09.3/otherlibs/unix/ftruncate.c ocaml-unix-3.10.2/otherlibs/unix/ftruncate.c
--- ocaml-unix-3.09.3/otherlibs/unix/ftruncate.c        2005-03-24 18:20:53.000000000 +0100
+++ ocaml-unix-3.10.2/otherlibs/unix/ftruncate.c        2007-02-09 14:31:15.000000000 +0100
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: ftruncate.c,v 1.10 2005/03/24 17:20:53 doligez Exp $ */
+/* $Id: ftruncate.c,v 1.11 2007/02/09 13:31:15 doligez Exp $ */

 #include <sys/types.h>
 #include <fail.h>
@@ -43,4 +43,7 @@
 CAMLprim value unix_ftruncate(value fd, value len)
 { invalid_argument("ftruncate not implemented"); }

+CAMLprim value unix_ftruncate_64(value fd, value len)
+{ invalid_argument("ftruncate not implemented"); }
+
 #endif
diff -Naur ocaml-unix-3.09.3/otherlibs/unix/gethost.c ocaml-unix-3.10.2/otherlibs/unix/gethost.c
--- ocaml-unix-3.09.3/otherlibs/unix/gethost.c  2006-06-10 11:10:41.000000000 +0200
+++ ocaml-unix-3.10.2/otherlibs/unix/gethost.c  2006-09-20 13:14:37.000000000 +0200
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: gethost.c,v 1.26.2.1 2006/06/10 09:10:41 xleroy Exp $ */
+/* $Id: gethost.c,v 1.27 2006/09/20 11:14:37 doligez Exp $ */

 #include <string.h>
 #include <mlvalues.h>
diff -Naur ocaml-unix-3.09.3/otherlibs/unix/isatty.c ocaml-unix-3.10.2/otherlibs/unix/isatty.c
--- ocaml-unix-3.09.3/otherlibs/unix/isatty.c   1970-01-01 01:00:00.000000000 +0100
+++ ocaml-unix-3.10.2/otherlibs/unix/isatty.c   2006-09-21 15:54:26.000000000 +0200
@@ -0,0 +1,22 @@
+/***********************************************************************/
+/*                                                                     */
+/*                           Objective Caml                            */
+/*                                                                     */
+/*            Xavier Leroy, projet Gallium, INRIA Rocquencourt         */
+/*                                                                     */
+/*  Copyright 2006 Institut National de Recherche en Informatique et   */
+/*  en Automatique.  All rights reserved.  This file is distributed    */
+/*  under the terms of the GNU Library General Public License, with    */
+/*  the special exception on linking described in file ../../LICENSE.  */
+/*                                                                     */
+/***********************************************************************/
+
+/* $Id: isatty.c,v 1.1 2006/09/21 13:54:26 xleroy Exp $ */
+
+#include <mlvalues.h>
+#include "unixsupport.h"
+
+CAMLprim value unix_isatty(value fd)
+{
+  return (Val_bool(isatty(Int_val(fd))));
+}
diff -Naur ocaml-unix-3.09.3/otherlibs/unix/libunix.clib ocaml-unix-3.10.2/otherlibs/unix/libunix.clib
--- ocaml-unix-3.09.3/otherlibs/unix/libunix.clib       1970-01-01 01:00:00.000000000 +0100
+++ ocaml-unix-3.10.2/otherlibs/unix/libunix.clib       2007-02-07 10:52:28.000000000 +0100
@@ -0,0 +1,16 @@
+accept.o access.o addrofstr.o alarm.o bind.o chdir.o chmod.o
+chown.o chroot.o close.o closedir.o connect.o cst2constr.o cstringv.o
+dup.o dup2.o envir.o errmsg.o execv.o execve.o execvp.o exit.o
+fchmod.o fchown.o fcntl.o fork.o ftruncate.o
+getaddrinfo.o getcwd.o getegid.o geteuid.o getgid.o
+getgr.o getgroups.o gethost.o gethostname.o getlogin.o
+getnameinfo.o getpeername.o getpid.o getppid.o getproto.o getpw.o
+gettimeofday.o getserv.o getsockname.o getuid.o
+gmtime.o isatty.o itimer.o kill.o link.o listen.o lockf.o lseek.o mkdir.o
+mkfifo.o nice.o open.o opendir.o pipe.o putenv.o read.o
+readdir.o readlink.o rename.o rewinddir.o rmdir.o select.o sendrecv.o
+setgid.o setsid.o setuid.o shutdown.o signals.o
+sleep.o socket.o socketaddr.o
+socketpair.o sockopt.o stat.o strofaddr.o symlink.o termios.o
+time.o times.o truncate.o umask.o unixsupport.o unlink.o
+utimes.o wait.o write.o
diff -Naur ocaml-unix-3.09.3/otherlibs/unix/Makefile ocaml-unix-3.10.2/otherlibs/unix/Makefile
--- ocaml-unix-3.09.3/otherlibs/unix/Makefile   2004-11-29 15:53:32.000000000 +0100
+++ ocaml-unix-3.10.2/otherlibs/unix/Makefile   2007-02-07 16:49:11.000000000 +0100
@@ -11,7 +11,7 @@
 #                                                                       #
 #########################################################################

-# $Id: Makefile,v 1.41 2004/11/29 14:53:32 doligez Exp $
+# $Id: Makefile,v 1.45 2007/02/07 15:49:11 doligez Exp $

 # Makefile for the Unix interface library

@@ -23,7 +23,7 @@
 CAMLC=../../ocamlcomp.sh
 CAMLOPT=../../ocamlcompopt.sh
 MKLIB=../../boot/ocamlrun ../../tools/ocamlmklib
-COMPFLAGS=-warn-error A
+COMPFLAGS=-warn-error A -g

 OBJS=accept.o access.o addrofstr.o alarm.o bind.o chdir.o chmod.o \
   chown.o chroot.o close.o closedir.o connect.o cst2constr.o cstringv.o \
@@ -33,7 +33,7 @@
   getgr.o getgroups.o gethost.o gethostname.o getlogin.o \
   getnameinfo.o getpeername.o getpid.o getppid.o getproto.o getpw.o \
   gettimeofday.o getserv.o getsockname.o getuid.o \
-  gmtime.o itimer.o kill.o link.o listen.o lockf.o lseek.o mkdir.o \
+  gmtime.o isatty.o itimer.o kill.o link.o listen.o lockf.o lseek.o mkdir.o \
   mkfifo.o nice.o open.o opendir.o pipe.o putenv.o read.o \
   readdir.o readlink.o rename.o rewinddir.o rmdir.o select.o sendrecv.o \
   setgid.o setsid.o setuid.o shutdown.o signals.o \
@@ -70,6 +70,7 @@
        cp libunix.a $(LIBDIR)/libunix.a
        cd $(LIBDIR); $(RANLIB) libunix.a
        cp unix.cma $(MLOBJS:.cmo=.cmi) $(MLOBJS:.cmo=.mli) $(LIBDIR)
+       cp unixsupport.h $(LIBDIR)/caml

 installopt:
        cp $(MLOBJS:.cmo=.cmx) unix.cmxa unix.a $(LIBDIR)
diff -Naur ocaml-unix-3.09.3/otherlibs/unix/signals.c ocaml-unix-3.10.2/otherlibs/unix/signals.c
--- ocaml-unix-3.09.3/otherlibs/unix/signals.c  2005-03-24 18:20:53.000000000 +0100
+++ ocaml-unix-3.10.2/otherlibs/unix/signals.c  2007-11-01 17:42:29.000000000 +0100
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: signals.c,v 1.10 2005/03/24 17:20:53 doligez Exp $ */
+/* $Id: signals.c,v 1.10.12.1 2007/11/01 16:42:29 xleroy Exp $ */

 #include <errno.h>
 #include <signal.h>
@@ -24,7 +24,7 @@
 #include "unixsupport.h"

 #ifndef NSIG
-#define NSIG 32
+#define NSIG 64
 #endif

 #ifdef POSIX_SIGNALS
@@ -33,7 +33,7 @@
 {
   sigemptyset(set);
   while (vset != Val_int(0)) {
-    int sig = convert_signal_number(Int_val(Field(vset, 0)));
+    int sig = caml_convert_signal_number(Int_val(Field(vset, 0)));
     sigaddset(set, sig);
     vset = Field(vset, 1);
   }
@@ -46,9 +46,9 @@

   Begin_root(res)
     for (i = 1; i < NSIG; i++)
-      if (sigismember(set, i)) {
+      if (sigismember(set, i) > 0) {
         value newcons = alloc_small(2, 0);
-        Field(newcons, 0) = Val_int(i);
+        Field(newcons, 0) = Val_int(caml_rev_convert_signal_number(i));
         Field(newcons, 1) = res;
         res = newcons;
       }
diff -Naur ocaml-unix-3.09.3/otherlibs/unix/times.c ocaml-unix-3.10.2/otherlibs/unix/times.c
--- ocaml-unix-3.09.3/otherlibs/unix/times.c    2006-01-24 14:44:08.000000000 +0100
+++ ocaml-unix-3.10.2/otherlibs/unix/times.c    2006-04-17 01:28:21.000000000 +0200
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: times.c,v 1.15.4.1 2006/01/24 13:44:08 doligez Exp $ */
+/* $Id: times.c,v 1.16 2006/04/16 23:28:21 doligez Exp $ */

 #include <mlvalues.h>
 #include <alloc.h>
diff -Naur ocaml-unix-3.09.3/otherlibs/unix/truncate.c ocaml-unix-3.10.2/otherlibs/unix/truncate.c
--- ocaml-unix-3.09.3/otherlibs/unix/truncate.c 2005-03-24 18:20:53.000000000 +0100
+++ ocaml-unix-3.10.2/otherlibs/unix/truncate.c 2007-02-09 14:31:15.000000000 +0100
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: truncate.c,v 1.10 2005/03/24 17:20:53 doligez Exp $ */
+/* $Id: truncate.c,v 1.11 2007/02/09 13:31:15 doligez Exp $ */

 #include <sys/types.h>
 #include <mlvalues.h>
@@ -43,4 +43,7 @@
 CAMLprim value unix_truncate(value path, value len)
 { invalid_argument("truncate not implemented"); }

+CAMLprim value unix_truncate_64(value path, value len)
+{ invalid_argument("truncate not implemented"); }
+
 #endif
diff -Naur ocaml-unix-3.09.3/otherlibs/unix/unixLabels.mli ocaml-unix-3.10.2/otherlibs/unix/unixLabels.mli
--- ocaml-unix-3.09.3/otherlibs/unix/unixLabels.mli     2004-07-13 14:25:14.000000000 +0200
+++ ocaml-unix-3.10.2/otherlibs/unix/unixLabels.mli     2007-11-19 22:27:56.000000000 +0100
@@ -11,7 +11,7 @@
 (*                                                                     *)
 (***********************************************************************)

-(* $Id: unixLabels.mli,v 1.13 2004/07/13 12:25:14 xleroy Exp $ *)
+(* $Id: unixLabels.mli,v 1.15.4.1 2007/11/19 21:27:56 doligez Exp $ *)

 (** Interface to the Unix system.
    To use as replacement to default {!Unix} module,
@@ -20,82 +20,81 @@

 (** {6 Error report} *)

-type error =
-  Unix.error =
-      E2BIG               (** Argument list too long *)
-    | EACCES              (** Permission denied *)
-    | EAGAIN              (** Resource temporarily unavailable; try again *)
-    | EBADF               (** Bad file descriptor *)
-    | EBUSY               (** Resource unavailable *)
-    | ECHILD              (** No child process *)
-    | EDEADLK             (** Resource deadlock would occur *)
-    | EDOM                (** Domain error for math functions, etc. *)
-    | EEXIST              (** File exists *)
-    | EFAULT              (** Bad address *)
-    | EFBIG               (** File too large *)
-    | EINTR               (** Function interrupted by signal *)
-    | EINVAL              (** Invalid argument *)
-    | EIO                 (** Hardware I/O error *)
-    | EISDIR              (** Is a directory *)
-    | EMFILE              (** Too many open files by the process *)
-    | EMLINK              (** Too many links *)
-    | ENAMETOOLONG        (** Filename too long *)
-    | ENFILE              (** Too many open files in the system *)
-    | ENODEV              (** No such device *)
-    | ENOENT              (** No such file or directory *)
-    | ENOEXEC             (** Not an executable file *)
-    | ENOLCK              (** No locks available *)
-    | ENOMEM              (** Not enough memory *)
-    | ENOSPC              (** No space left on device *)
-    | ENOSYS              (** Function not supported *)
-    | ENOTDIR             (** Not a directory *)
-    | ENOTEMPTY           (** Directory not empty *)
-    | ENOTTY              (** Inappropriate I/O control operation *)
-    | ENXIO               (** No such device or address *)
-    | EPERM               (** Operation not permitted *)
-    | EPIPE               (** Broken pipe *)
-    | ERANGE              (** Result too large *)
-    | EROFS               (** Read-only file system *)
-    | ESPIPE              (** Invalid seek e.g. on a pipe *)
-    | ESRCH               (** No such process *)
-    | EXDEV               (** Invalid link *)
-
-    | EWOULDBLOCK         (** Operation would block *)
-    | EINPROGRESS         (** Operation now in progress *)
-    | EALREADY            (** Operation already in progress *)
-    | ENOTSOCK            (** Socket operation on non-socket *)
-    | EDESTADDRREQ        (** Destination address required *)
-    | EMSGSIZE            (** Message too long *)
-    | EPROTOTYPE          (** Protocol wrong type for socket *)
-    | ENOPROTOOPT         (** Protocol not available *)
-    | EPROTONOSUPPORT     (** Protocol not supported *)
-    | ESOCKTNOSUPPORT     (** Socket type not supported *)
-    | EOPNOTSUPP          (** Operation not supported on socket *)
-    | EPFNOSUPPORT        (** Protocol family not supported *)
-    | EAFNOSUPPORT        (** Address family not supported by protocol family *)
-    | EADDRINUSE          (** Address already in use *)
-    | EADDRNOTAVAIL       (** Can't assign requested address *)
-    | ENETDOWN            (** Network is down *)
-    | ENETUNREACH         (** Network is unreachable *)
-    | ENETRESET           (** Network dropped connection on reset *)
-    | ECONNABORTED        (** Software caused connection abort *)
-    | ECONNRESET          (** Connection reset by peer *)
-    | ENOBUFS             (** No buffer space available *)
-    | EISCONN             (** Socket is already connected *)
-    | ENOTCONN            (** Socket is not connected *)
-    | ESHUTDOWN           (** Can't send after socket shutdown *)
-    | ETOOMANYREFS        (** Too many references: can't splice *)
-    | ETIMEDOUT           (** Connection timed out *)
-    | ECONNREFUSED        (** Connection refused *)
-    | EHOSTDOWN           (** Host is down *)
-    | EHOSTUNREACH        (** No route to host *)
-    | ELOOP               (** Too many levels of symbolic links *)
-    | EOVERFLOW           (** File size or position not representable *)

-    | EUNKNOWNERR of int  (** Unknown error *)
-(** The type of error codes. 
+type error = Unix.error =
+    E2BIG               (** Argument list too long *)
+  | EACCES              (** Permission denied *)
+  | EAGAIN              (** Resource temporarily unavailable; try again *)
+  | EBADF               (** Bad file descriptor *)
+  | EBUSY               (** Resource unavailable *)
+  | ECHILD              (** No child process *)
+  | EDEADLK             (** Resource deadlock would occur *)
+  | EDOM                (** Domain error for math functions, etc. *)
+  | EEXIST              (** File exists *)
+  | EFAULT              (** Bad address *)
+  | EFBIG               (** File too large *)
+  | EINTR               (** Function interrupted by signal *)
+  | EINVAL              (** Invalid argument *)
+  | EIO                 (** Hardware I/O error *)
+  | EISDIR              (** Is a directory *)
+  | EMFILE              (** Too many open files by the process *)
+  | EMLINK              (** Too many links *)
+  | ENAMETOOLONG        (** Filename too long *)
+  | ENFILE              (** Too many open files in the system *)
+  | ENODEV              (** No such device *)
+  | ENOENT              (** No such file or directory *)
+  | ENOEXEC             (** Not an executable file *)
+  | ENOLCK              (** No locks available *)
+  | ENOMEM              (** Not enough memory *)
+  | ENOSPC              (** No space left on device *)
+  | ENOSYS              (** Function not supported *)
+  | ENOTDIR             (** Not a directory *)
+  | ENOTEMPTY           (** Directory not empty *)
+  | ENOTTY              (** Inappropriate I/O control operation *)
+  | ENXIO               (** No such device or address *)
+  | EPERM               (** Operation not permitted *)
+  | EPIPE               (** Broken pipe *)
+  | ERANGE              (** Result too large *)
+  | EROFS               (** Read-only file system *)
+  | ESPIPE              (** Invalid seek e.g. on a pipe *)
+  | ESRCH               (** No such process *)
+  | EXDEV               (** Invalid link *)
+  | EWOULDBLOCK         (** Operation would block *)
+  | EINPROGRESS         (** Operation now in progress *)
+  | EALREADY            (** Operation already in progress *)
+  | ENOTSOCK            (** Socket operation on non-socket *)
+  | EDESTADDRREQ        (** Destination address required *)
+  | EMSGSIZE            (** Message too long *)
+  | EPROTOTYPE          (** Protocol wrong type for socket *)
+  | ENOPROTOOPT         (** Protocol not available *)
+  | EPROTONOSUPPORT     (** Protocol not supported *)
+  | ESOCKTNOSUPPORT     (** Socket type not supported *)
+  | EOPNOTSUPP          (** Operation not supported on socket *)
+  | EPFNOSUPPORT        (** Protocol family not supported *)
+  | EAFNOSUPPORT        (** Address family not supported by protocol family *)
+  | EADDRINUSE          (** Address already in use *)
+  | EADDRNOTAVAIL       (** Can't assign requested address *)
+  | ENETDOWN            (** Network is down *)
+  | ENETUNREACH         (** Network is unreachable *)
+  | ENETRESET           (** Network dropped connection on reset *)
+  | ECONNABORTED        (** Software caused connection abort *)
+  | ECONNRESET          (** Connection reset by peer *)
+  | ENOBUFS             (** No buffer space available *)
+  | EISCONN             (** Socket is already connected *)
+  | ENOTCONN            (** Socket is not connected *)
+  | ESHUTDOWN           (** Can't send after socket shutdown *)
+  | ETOOMANYREFS        (** Too many references: can't splice *)
+  | ETIMEDOUT           (** Connection timed out *)
+  | ECONNREFUSED        (** Connection refused *)
+  | EHOSTDOWN           (** Host is down *)
+  | EHOSTUNREACH        (** No route to host *)
+  | ELOOP               (** Too many levels of symbolic links *)
+  | EOVERFLOW           (** File size or position not representable *)
+
+  | EUNKNOWNERR of int  (** Unknown error *)
+(** The type of error codes.
    Errors defined in the POSIX standard
-   and additional errors, mostly BSD.
+   and additional errors from UNIX98 and BSD.
    All other errors are mapped to EUNKNOWNERR.
 *)

@@ -133,34 +132,34 @@
    [name] is the name of the environment variable,
    and [value] its new associated value. *)

+
 (** {6 Process handling} *)

-type process_status =
-  Unix.process_status =
-      WEXITED of int
-        (** The process terminated normally by [exit]; 
+
+type process_status = Unix.process_status =
+    WEXITED of int
+        (** The process terminated normally by [exit];
            the argument is the return code. *)
-    | WSIGNALED of int
+  | WSIGNALED of int
         (** The process was killed by a signal;
            the argument is the signal number. *)
-    | WSTOPPED of int
+  | WSTOPPED of int
         (** The process was stopped by a signal; the argument is the
            signal number. *)
 (** The termination status of a process. *)

-type wait_flag =
-  Unix.wait_flag =
-      WNOHANG   (** do not block if no child has
-                    died yet, but immediately return with a pid equal to 0.*)
-    | WUNTRACED (** report also the children that receive stop signals. *)
-(** Flags for {!UnixLabels.waitpid}. *)

+type wait_flag = Unix.wait_flag =
+    WNOHANG (** do not block if no child has
+               died yet, but immediately return with a pid equal to 0.*)
+  | WUNTRACED (** report also the children that receive stop signals. *)
+(** Flags for {!Unix.waitpid}. *)

 val execv : prog:string -> args:string array -> 'a
 (** [execv prog args] execute the program in file [prog], with
-   the arguments [args], and the current process environment. 
-   These [execv*] functions never return: on success, the current 
-   program is replaced by the new one; 
+   the arguments [args], and the current process environment.
+   These [execv*] functions never return: on success, the current
+   program is replaced by the new one;
    on failure, a {!UnixLabels.Unix_error} exception is raised. *)

 val execve : prog:string -> args:string array -> env:string array -> 'a
@@ -224,27 +223,27 @@
 (** File descriptor for standard output.*)

 val stderr : file_descr
-(** File descriptor for standard standard error. *)
+(** File descriptor for standard error. *)

-type open_flag =
-  Unix.open_flag =
-      O_RDONLY                            (** Open for reading *)
-    | O_WRONLY                            (** Open for writing *)
-    | O_RDWR                              (** Open for reading and writing *)
-    | O_NONBLOCK                          (** Open in non-blocking mode *)
-    | O_APPEND                            (** Open for append *)
-    | O_CREAT                             (** Create if nonexistent *)
-    | O_TRUNC                             (** Truncate to 0 length if existing *)
-    | O_EXCL                              (** Fail if existing *)
-    | O_NOCTTY                            (** Don't make this dev a controlling tty *)
-    | O_DSYNC                             (** Writes complete as `Synchronised I/O data integrity completion' *)
-    | O_SYNC                              (** Writes complete as `Synchronised I/O file integrity completion' *)
-    | O_RSYNC                             (** Reads complete as writes (depending on O_SYNC/O_DSYNC) *)
+type open_flag = Unix.open_flag =
+    O_RDONLY                    (** Open for reading *)
+  | O_WRONLY                    (** Open for writing *)
+  | O_RDWR                      (** Open for reading and writing *)
+  | O_NONBLOCK                  (** Open in non-blocking mode *)
+  | O_APPEND                    (** Open for append *)
+  | O_CREAT                     (** Create if nonexistent *)
+  | O_TRUNC                     (** Truncate to 0 length if existing *)
+  | O_EXCL                      (** Fail if existing *)
+  | O_NOCTTY                    (** Don't make this dev a controlling tty *)
+  | O_DSYNC                     (** Writes complete as `Synchronised I/O data integrity completion' *)
+  | O_SYNC                      (** Writes complete as `Synchronised I/O file integrity completion' *)
+  | O_RSYNC                     (** Reads complete as writes (depending on O_SYNC/O_DSYNC) *)
 (** The flags to {!UnixLabels.openfile}. *)


 type file_perm = int
-(** The type of file access rights. *)
+(** The type of file access rights, e.g. [0o640] is read and write for user,
+    read for group, none for others *)

 val openfile : string -> mode:open_flag list -> perm:file_perm -> file_descr
 (** Open the named file with the given flags. Third argument is
@@ -263,20 +262,18 @@
 (** [write fd buff ofs len] writes [len] characters to descriptor
    [fd], taking them from string [buff], starting at position [ofs]
    in string [buff]. Return the number of characters actually
-   written.
-
-   When an error is reported some characters might have already been
-   written.  Use [single_write] instead to ensure that this is not the
-   case. *)
+   written.  [write] repeats the writing operation until all characters
+   have been written or an error occurs.  *)

 val single_write : file_descr -> buf:string -> pos:int -> len:int -> int
-(** Same as [write] but ensures that all errors are reported and
-   that no character has ever been written when an error is reported. *)
-
+(** Same as [write], but attempts to write only once.
+   Thus, if an error occurs, [single_write] guarantees that no data
+   has been written. *)

 (** {6 Interfacing with the standard input/output library} *)


+
 val in_channel_of_descr : file_descr -> in_channel
 (** Create an input channel reading from the given descriptor.
    The channel is initially in binary mode; use
@@ -294,16 +291,16 @@
 (** Return the descriptor corresponding to an output channel. *)


-
 (** {6 Seeking and truncating} *)

-type seek_command =
-  Unix.seek_command =
-      SEEK_SET (** indicates positions relative to the beginning of the file *)
-    | SEEK_CUR (** indicates positions relative to the current position *)
-    | SEEK_END (** indicates positions relative to the end of the file *)
+
+type seek_command = Unix.seek_command =
+    SEEK_SET (** indicates positions relative to the beginning of the file *)
+  | SEEK_CUR (** indicates positions relative to the current position *)
+  | SEEK_END (** indicates positions relative to the end of the file *)
 (** Positioning modes for {!UnixLabels.lseek}. *)

+
 val lseek : file_descr -> int -> mode:seek_command -> int
 (** Set the current position for a file descriptor *)

@@ -315,37 +312,34 @@
    to the given size. *)


+(** {6 File status} *)

-(** {6 File statistics} *)

-type file_kind =
-  Unix.file_kind =
-      S_REG                   (** Regular file *)
-    | S_DIR                   (** Directory *)
-    | S_CHR                   (** Character device *)
-    | S_BLK                   (** Block device *)
-    | S_LNK                   (** Symbolic link *)
-    | S_FIFO                  (** Named pipe *)
-    | S_SOCK                  (** Socket *)
-
-type stats =
-  Unix.stats =
-    { st_dev : int;                       (** Device number *)
-      st_ino : int;                       (** Inode number *)
-      st_kind : file_kind;                (** Kind of the file *)
-      st_perm : file_perm;                (** Access rights *)
-      st_nlink : int;                     (** Number of links *)
-      st_uid : int;                       (** User id of the owner *)
-      st_gid : int;                       (** Group ID of the file's group *)
-      st_rdev : int;                      (** Device minor number *)
-      st_size : int;                      (** Size in bytes *)
-      st_atime : float;                   (** Last access time *)
-      st_mtime : float;                   (** Last modification time *)
-      st_ctime : float                    (** Last status change time *)
-    }
+type file_kind = Unix.file_kind =
+    S_REG                       (** Regular file *)
+  | S_DIR                       (** Directory *)
+  | S_CHR                       (** Character device *)
+  | S_BLK                       (** Block device *)
+  | S_LNK                       (** Symbolic link *)
+  | S_FIFO                      (** Named pipe *)
+  | S_SOCK                      (** Socket *)
+
+type stats = Unix.stats =
+  { st_dev : int;               (** Device number *)
+    st_ino : int;               (** Inode number *)
+    st_kind : file_kind;        (** Kind of the file *)
+    st_perm : file_perm;        (** Access rights *)
+    st_nlink : int;             (** Number of links *)
+    st_uid : int;               (** User id of the owner *)
+    st_gid : int;               (** Group ID of the file's group *)
+    st_rdev : int;              (** Device minor number *)
+    st_size : int;              (** Size in bytes *)
+    st_atime : float;           (** Last access time *)
+    st_mtime : float;           (** Last modification time *)
+    st_ctime : float;           (** Last status change time *)
+  }
 (** The informations returned by the {!UnixLabels.stat} calls. *)

-
 val stat : string -> stats
 (** Return the information for the named file. *)

@@ -357,8 +351,11 @@
 (** Return the information for the file associated with the given
    descriptor. *)

-(** {6 Seeking, truncating and statistics on large files} *)
+val isatty : file_descr -> bool
+(** Return [true] if the given file descriptor refers to a terminal or
+   console window, [false] otherwise. *)

+(** {6 File operations on large files} *)

 module LargeFile :
   sig
@@ -377,15 +374,16 @@
         st_size : int64;            (** Size in bytes *)
         st_atime : float;           (** Last access time *)
         st_mtime : float;           (** Last modification time *)
-        st_ctime : float;           (** Last status change time *) 
+        st_ctime : float;           (** Last status change time *)
       }
     val stat : string -> stats
     val lstat : string -> stats
     val fstat : file_descr -> stats
   end
-(** This sub-module provides 64-bit variants of the functions
+(** File operations on large files.
+  This sub-module provides 64-bit variants of the functions
   {!UnixLabels.lseek} (for positioning a file descriptor),
-  {!UnixLabels.truncate} and {!UnixLabels.ftruncate} 
+  {!UnixLabels.truncate} and {!UnixLabels.ftruncate}
   (for changing the size of a file),
   and {!UnixLabels.stat}, {!UnixLabels.lstat} and {!UnixLabels.fstat}
   (for obtaining information on files).  These alternate functions represent
@@ -405,19 +403,17 @@

 val link : src:string -> dst:string -> unit
 (** [link source dest] creates a hard link named [dest] to the file
-   named [new]. *)
-
+   named [source]. *)


 (** {6 File permissions and ownership} *)


-type access_permission =
-  Unix.access_permission =
-      R_OK                 (** Read permission *)
-    | W_OK                 (** Write permission *)
-    | X_OK                 (** Execution permission *)
-    | F_OK                 (** File exists *)
+type access_permission = Unix.access_permission =
+    R_OK                        (** Read permission *)
+  | W_OK                        (** Write permission *)
+  | X_OK                        (** Execution permission *)
+  | F_OK                        (** File exists *)
 (** Flags for the {!UnixLabels.access} call. *)


@@ -434,14 +430,14 @@
 (** Change the owner uid and owner gid of an opened file. *)

 val umask : int -> int
-(** Set the process creation mask, and return the previous mask. *)
+(** Set the process's file mode creation mask, and return the previous
+    mask. *)

 val access : string -> perm:access_permission list -> unit
 (** Check that the process has the given permissions over the named
    file. Raise [Unix_error] otherwise. *)


-
 (** {6 Operations on file descriptors} *)


@@ -542,10 +538,7 @@
    and causes the new process to have the same standard output
    as the current process.
    The executable file [prog] is searched in the path.
-   The new process has the same environment as the current process.
-   All file descriptors of the current process are closed in the
-   new process, except those redirected to standard input and
-   outputs. *)
+   The new process has the same environment as the current process. *)

 val create_process_env :
   prog:string -> args:string array -> env:string array -> stdin:file_descr ->
@@ -554,47 +547,53 @@
    works as {!UnixLabels.create_process}, except that the extra argument
    [env] specifies the environment passed to the program. *)

+
 val open_process_in : string -> in_channel
-(** High-level pipe and process management. These functions
-   (with {!UnixLabels.open_process_out} and {!UnixLabels.open_process})
-   run the given command in parallel with the program,
-   and return channels connected to the standard input and/or
-   the standard output of the command. The command is interpreted
-   by the shell [/bin/sh] (cf. [system]). Warning: writes on channels
-   are buffered, hence be careful to call {!Pervasives.flush} at the right times
-   to ensure correct synchronization. *)
+(** High-level pipe and process management. This function
+   runs the given command in parallel with the program.
+   The standard output of the command is redirected to a pipe,
+   which can be read via the returned input channel.
+   The command is interpreted by the shell [/bin/sh] (cf. [system]). *)

 val open_process_out : string -> out_channel
-(** See {!UnixLabels.open_process_in}. *)
+(** Same as {!UnixLabels.open_process_in}, but redirect the standard input of
+   the command to a pipe.  Data written to the returned output channel
+   is sent to the standard input of the command.
+   Warning: writes on output channels are buffered, hence be careful
+   to call {!Pervasives.flush} at the right times to ensure
+   correct synchronization. *)

 val open_process : string -> in_channel * out_channel
-(** See {!UnixLabels.open_process_in}. *)
+(** Same as {!UnixLabels.open_process_out}, but redirects both the standard
+   input and standard output of the command to pipes connected to the two
+   returned channels.  The input channel is connected to the output
+   of the command, and the output channel to the input of the command. *)

 val open_process_full :
   string -> env:string array -> in_channel * out_channel * in_channel
 (** Similar to {!UnixLabels.open_process}, but the second argument specifies
    the environment passed to the command.  The result is a triple
-   of channels connected to the standard output, standard input,
+   of channels connected respectively to the standard output, standard input,
    and standard error of the command. *)

 val close_process_in : in_channel -> process_status
-(** Close channels opened by {!UnixLabels.open_process_in}, 
+(** Close channels opened by {!UnixLabels.open_process_in},
    wait for the associated command to terminate,
    and return its termination status. *)

 val close_process_out : out_channel -> process_status
-(** Close channels opened by {!UnixLabels.open_process_out}, 
+(** Close channels opened by {!UnixLabels.open_process_out},
    wait for the associated command to terminate,
    and return its termination status. *)

 val close_process : in_channel * out_channel -> process_status
-(** Close channels opened by {!UnixLabels.open_process}, 
+(** Close channels opened by {!UnixLabels.open_process},
    wait for the associated command to terminate,
    and return its termination status. *)

 val close_process_full :
   in_channel * out_channel * in_channel -> process_status
-(** Close channels opened by {!UnixLabels.open_process_full}, 
+(** Close channels opened by {!UnixLabels.open_process_full},
    wait for the associated command to terminate,
    and return its termination status. *)

@@ -610,7 +609,6 @@
 (** Read the contents of a link. *)


-
 (** {6 Polling} *)


@@ -628,17 +626,16 @@
    and over which an exceptional condition is pending (third
    component). *)

-
 (** {6 Locking} *)

-type lock_command =
-  Unix.lock_command =
-      F_ULOCK  (** Unlock a region *)
-    | F_LOCK   (** Lock a region for writing, and block if already locked *)
-    | F_TLOCK  (** Lock a region for writing, or fail if already locked *)
-    | F_TEST   (** Test a region for other process locks *)
-    | F_RLOCK  (** Lock a region for reading, and block if already locked *)
-    | F_TRLOCK (** Lock a region for reading, or fail if already locked *)
+
+type lock_command = Unix.lock_command =
+    F_ULOCK       (** Unlock a region *)
+  | F_LOCK        (** Lock a region for writing, and block if already locked *)
+  | F_TLOCK       (** Lock a region for writing, or fail if already locked *)
+  | F_TEST        (** Test a region for other process locks *)
+  | F_RLOCK       (** Lock a region for reading, and block if already locked *)
+  | F_TRLOCK      (** Lock a region for reading, or fail if already locked *)
 (** Commands for {!UnixLabels.lockf}. *)

 val lockf : file_descr -> mode:lock_command -> len:int -> unit
@@ -647,16 +644,30 @@
    [fd] (as set by {!UnixLabels.lseek}), and extends [size] bytes forward if
    [size] is positive, [size] bytes backwards if [size] is negative,
    or to the end of the file if [size] is zero.
-   A write lock (set with [F_LOCK] or [F_TLOCK]) prevents any other
+   A write lock prevents any other
    process from acquiring a read or write lock on the region.
-   A read lock (set with [F_RLOCK] or [F_TRLOCK]) prevents any other
+   A read lock prevents any other
    process from acquiring a write lock on the region, but lets
-   other processes acquire read locks on it. *)
+   other processes acquire read locks on it.
+
+   The [F_LOCK] and [F_TLOCK] commands attempts to put a write lock
+   on the specified region.
+   The [F_RLOCK] and [F_TRLOCK] commands attempts to put a read lock
+   on the specified region.
+   If one or several locks put by another process prevent the current process
+   from acquiring the lock, [F_LOCK] and [F_RLOCK] block until these locks
+   are removed, while [F_TLOCK] and [F_TRLOCK] fail immediately with an
+   exception.
+   The [F_ULOCK] removes whatever locks the current process has on
+   the specified region.
+   Finally, the [F_TEST] command tests whether a write lock can be
+   acquired on the specified region, without actually putting a lock.
+   It returns immediately if successful, or fails otherwise. *)


 (** {6 Signals}
    Note: installation of signal handlers is performed via
-   the functions {!Sys.signal} and {!Sys.set_signal}. 
+   the functions {!Sys.signal} and {!Sys.set_signal}.
 *)


@@ -664,9 +675,7 @@
 (** [kill pid sig] sends signal number [sig] to the process
    with id [pid]. *)

-
-type sigprocmask_command =
-  Unix.sigprocmask_command = 
+type sigprocmask_command = Unix.sigprocmask_command =
     SIG_SETMASK
   | SIG_BLOCK
   | SIG_UNBLOCK
@@ -685,7 +694,7 @@
 (** Return the set of blocked signals that are currently pending. *)

 val sigsuspend : int list -> unit
-(** [sigsuspend sigs] atomically sets the blocked signals to [sig]
+(** [sigsuspend sigs] atomically sets the blocked signals to [sigs]
    and waits for a non-ignored, non-blocked signal to be delivered.
    On return, the blocked signals are reset to their initial value. *)

@@ -695,29 +704,29 @@

 (** {6 Time functions} *)

-type process_times =
-  Unix.process_times =
-    { tms_utime : float;          (** User time for the process *)
-      tms_stime : float;          (** System time for the process *)
-      tms_cutime : float;         (** User time for the children processes *)
-      tms_cstime : float;         (** System time for the children processes *) 
-    }
+
+type process_times = Unix.process_times =
+  { tms_utime : float;  (** User time for the process *)
+    tms_stime : float;  (** System time for the process *)
+    tms_cutime : float; (** User time for the children processes *)
+    tms_cstime : float; (** System time for the children processes *)
+  }
 (** The execution times (CPU times) of a process. *)

-type tm =
-  Unix.tm =
-    { tm_sec : int;                       (** Seconds 0..59 *)
-      tm_min : int;                       (** Minutes 0..59 *)
-      tm_hour : int;                      (** Hours 0..23 *)
-      tm_mday : int;                      (** Day of month 1..31 *)
-      tm_mon : int;                       (** Month of year 0..11 *)
-      tm_year : int;                      (** Year - 1900 *)
-      tm_wday : int;                      (** Day of week (Sunday is 0) *)
-      tm_yday : int;                      (** Day of year 0..365 *)
-      tm_isdst : bool;                    (** Daylight time savings in effect *) 
-    }
+type tm = Unix.tm =
+  { tm_sec : int;               (** Seconds 0..60 *)
+    tm_min : int;               (** Minutes 0..59 *)
+    tm_hour : int;              (** Hours 0..23 *)
+    tm_mday : int;              (** Day of month 1..31 *)
+    tm_mon : int;               (** Month of year 0..11 *)
+    tm_year : int;              (** Year - 1900 *)
+    tm_wday : int;              (** Day of week (Sunday is 0) *)
+    tm_yday : int;              (** Day of year 0..365 *)
+    tm_isdst : bool;            (** Daylight time savings in effect *)
+  }
 (** The type representing wallclock time and calendar date. *)

+
 val time : unit -> float
 (** Return the current time since 00:00:00 GMT, Jan. 1, 1970,
    in seconds. *)
@@ -726,19 +735,22 @@
 (** Same as {!UnixLabels.time}, but with resolution better than 1 second. *)

 val gmtime : float -> tm
-(** Convert a time in seconds, as returned by {!UnixLabels.time}, into a date and
-   a time. Assumes Greenwich meridian time zone, also known as UTC. *)
+(** Convert a time in seconds, as returned by {!UnixLabels.time}, into a date
+   and a time. Assumes UTC (Coordinated Universal Time), also known as GMT. *)

 val localtime : float -> tm
-(** Convert a time in seconds, as returned by {!UnixLabels.time}, into a date and
-   a time. Assumes the local time zone. *)
+(** Convert a time in seconds, as returned by {!UnixLabels.time}, into a date
+   and a time. Assumes the local time zone. *)

 val mktime : tm -> float * tm
 (** Convert a date and time, specified by the [tm] argument, into
-   a time in seconds, as returned by {!UnixLabels.time}. Also return a normalized
-   copy of the given [tm] record, with the [tm_wday], [tm_yday],
-   and [tm_isdst] fields recomputed from the other fields.
-   The [tm] argument is interpreted in the local time zone. *)
+   a time in seconds, as returned by {!UnixLabels.time}.  The [tm_isdst],
+   [tm_wday] and [tm_yday] fields of [tm] are ignored.  Also return a
+   normalized copy of the given [tm] record, with the [tm_wday],
+   [tm_yday], and [tm_isdst] fields recomputed from the other fields,
+   and the other fields normalized (so that, e.g., 40 October is
+   changed into 9 November).  The [tm] argument is interpreted in the
+   local time zone. *)

 val alarm : int -> int
 (** Schedule a [SIGALRM] signal after the given number of seconds. *)
@@ -754,24 +766,21 @@
    (third arg) for a file. Times are expressed in seconds from
    00:00:00 GMT, Jan. 1, 1970. *)

-type interval_timer =
-  Unix.interval_timer =
-      ITIMER_REAL 
+type interval_timer = Unix.interval_timer =
+    ITIMER_REAL
       (** decrements in real time, and sends the signal [SIGALRM] when expired.*)
-    | ITIMER_VIRTUAL
+  | ITIMER_VIRTUAL
       (**  decrements in process virtual time, and sends [SIGVTALRM] when expired. *)
-    | ITIMER_PROF
+  | ITIMER_PROF
       (** (for profiling) decrements both when the process
          is running and when the system is running on behalf of the
          process; it sends [SIGPROF] when expired. *)
 (** The three kinds of interval timers. *)

-
-type interval_timer_status =
-  Unix.interval_timer_status =
-    { it_interval : float;          (** Period *)
-      it_value : float;             (** Current value of the timer *) 
-    }
+type interval_timer_status = Unix.interval_timer_status =
+  { it_interval : float;         (** Period *)
+    it_value : float;            (** Current value of the timer *)
+  }
 (** The type describing the status of an interval timer *)

 val getitimer : interval_timer -> interval_timer_status
@@ -814,28 +823,25 @@
 (** Return the list of groups to which the user executing the process
    belongs. *)

-type passwd_entry =
-  Unix.passwd_entry =
-    { pw_name : string;
-      pw_passwd : string;
-      pw_uid : int;
-      pw_gid : int;
-      pw_gecos : string;
-      pw_dir : string;
-      pw_shell : string 
-    }
+type passwd_entry = Unix.passwd_entry =
+  { pw_name : string;
+    pw_passwd : string;
+    pw_uid : int;
+    pw_gid : int;
+    pw_gecos : string;
+    pw_dir : string;
+    pw_shell : string
+  }
 (** Structure of entries in the [passwd] database. *)

-type group_entry =
-  Unix.group_entry =
-    { gr_name : string;
-      gr_passwd : string;
-      gr_gid : int;
-      gr_mem : string array 
-    }
+type group_entry = Unix.group_entry =
+  { gr_name : string;
+    gr_passwd : string;
+    gr_gid : int;
+    gr_mem : string array
+  }
 (** Structure of entries in the [groups] database. *)

-
 val getlogin : unit -> string
 (** Return the login name of the user executing the process. *)

@@ -856,7 +862,6 @@
    [Not_found]. *)


-
 (** {6 Internet addresses} *)


@@ -894,24 +899,21 @@
 (** {6 Sockets} *)


-type socket_domain =
-  Unix.socket_domain =
-      PF_UNIX                             (** Unix domain *)
-    | PF_INET                             (** Internet domain *)
-    | PF_INET6                            (** Internet domain (IPv6) *)
+type socket_domain = Unix.socket_domain =
+    PF_UNIX                     (** Unix domain *)
+  | PF_INET                     (** Internet domain (IPv4) *)
+  | PF_INET6                    (** Internet domain (IPv6) *)
 (** The type of socket domains. *)

-type socket_type =
-  Unix.socket_type =
-      SOCK_STREAM                         (** Stream socket *)
-    | SOCK_DGRAM                          (** Datagram socket *)
-    | SOCK_RAW                            (** Raw socket *)
-    | SOCK_SEQPACKET                      (** Sequenced packets socket *)
+type socket_type = Unix.socket_type =
+    SOCK_STREAM                 (** Stream socket *)
+  | SOCK_DGRAM                  (** Datagram socket *)
+  | SOCK_RAW                    (** Raw socket *)
+  | SOCK_SEQPACKET              (** Sequenced packets socket *)
 (** The type of socket kinds, specifying the semantics of
    communications. *)

-type sockaddr =
-  Unix.sockaddr = 
+type sockaddr = Unix.sockaddr =
     ADDR_UNIX of string
   | ADDR_INET of inet_addr * int
 (** The type of socket addresses. [ADDR_UNIX name] is a socket
@@ -920,15 +922,15 @@
    domain; [addr] is the Internet address of the machine, and
    [port] is the port number. *)

-val domain_of_sockaddr: sockaddr -> socket_domain
-(** Return the socket domain adequate for the given socket address. *)
-
 val socket :
   domain:socket_domain -> kind:socket_type -> protocol:int -> file_descr
 (** Create a new socket in the given domain, and with the
    given kind. The third argument is the protocol type; 0 selects
    the default protocol for that kind of sockets. *)

+val domain_of_sockaddr: sockaddr -> socket_domain
+(** Return the socket domain adequate for the given socket address. *)
+
 val socketpair :
   domain:socket_domain -> kind:socket_type -> protocol:int ->
     file_descr * file_descr
@@ -949,11 +951,10 @@
 (** Set up a socket for receiving connection requests. The integer
    argument is the maximal number of pending requests. *)

-type shutdown_command =
-  Unix.shutdown_command =
-      SHUTDOWN_RECEIVE                    (** Close for receiving *)
-    | SHUTDOWN_SEND                       (** Close for sending *)
-    | SHUTDOWN_ALL                        (** Close both *)
+type shutdown_command = Unix.shutdown_command =
+    SHUTDOWN_RECEIVE            (** Close for receiving *)
+  | SHUTDOWN_SEND               (** Close for sending *)
+  | SHUTDOWN_ALL                (** Close both *)
 (** The type of commands for [shutdown]. *)


@@ -970,16 +971,16 @@
 val getpeername : file_descr -> sockaddr
 (** Return the address of the host connected to the given socket. *)

-type msg_flag = Unix.msg_flag = 
+type msg_flag = Unix.msg_flag =
     MSG_OOB
   | MSG_DONTROUTE
   | MSG_PEEK
-(** The flags for {!UnixLabels.recv},  {!UnixLabels.recvfrom}, 
+(** The flags for {!UnixLabels.recv},  {!UnixLabels.recvfrom},
    {!UnixLabels.send} and {!UnixLabels.sendto}. *)

 val recv :
   file_descr -> buf:string -> pos:int -> len:int -> mode:msg_flag list -> int
-(** Receive data from an unconnected socket. *)
+(** Receive data from a connected socket. *)

 val recvfrom :
   file_descr -> buf:string -> pos:int -> len:int -> mode:msg_flag list ->
@@ -988,7 +989,7 @@

 val send :
   file_descr -> buf:string -> pos:int -> len:int -> mode:msg_flag list -> int
-(** Send data over an unconnected socket. *)
+(** Send data over a connected socket. *)

 val sendto :
   file_descr -> buf:string -> pos:int -> len:int -> mode:msg_flag list ->
@@ -996,49 +997,49 @@
 (** Send data over an unconnected socket. *)


+
 (** {6 Socket options} *)


 type socket_bool_option =
-    SO_DEBUG               (** Record debugging information *)
-  | SO_BROADCAST           (** Permit sending of broadcast messages *)
-  | SO_REUSEADDR           (** Allow reuse of local addresses for bind *)
-  | SO_KEEPALIVE           (** Keep connection active *)
-  | SO_DONTROUTE           (** Bypass the standard routing algorithms *)
-  | SO_OOBINLINE           (** Leave out-of-band data in line *)
-  | SO_ACCEPTCONN          (** Report whether socket listening is enabled *)
+    SO_DEBUG       (** Record debugging information *)
+  | SO_BROADCAST   (** Permit sending of broadcast messages *)
+  | SO_REUSEADDR   (** Allow reuse of local addresses for bind *)
+  | SO_KEEPALIVE   (** Keep connection active *)
+  | SO_DONTROUTE   (** Bypass the standard routing algorithms *)
+  | SO_OOBINLINE   (** Leave out-of-band data in line *)
+  | SO_ACCEPTCONN  (** Report whether socket listening is enabled *)
 (** The socket options that can be consulted with {!UnixLabels.getsockopt}
    and modified with {!UnixLabels.setsockopt}.  These options have a boolean
    ([true]/[false]) value. *)

 type socket_int_option =
-    SO_SNDBUF              (** Size of send buffer *)
-  | SO_RCVBUF              (** Size of received buffer *)
-  | SO_ERROR               (** Report the error status and clear it *)
-  | SO_TYPE                (** Report the socket type *)
-  | SO_RCVLOWAT            (** Minimum number of bytes to process for input operations *)
-  | SO_SNDLOWAT            (** Minimum number of bytes to process for output operations *)
+    SO_SNDBUF      (** Size of send buffer *)
+  | SO_RCVBUF      (** Size of received buffer *)
+  | SO_ERROR       (** Report the error status and clear it *)
+  | SO_TYPE        (** Report the socket type *)
+  | SO_RCVLOWAT    (** Minimum number of bytes to process for input operations *)
+  | SO_SNDLOWAT    (** Minimum number of bytes to process for output operations *)
 (** The socket options that can be consulted with {!UnixLabels.getsockopt_int}
    and modified with {!UnixLabels.setsockopt_int}.  These options have an
    integer value. *)

 type socket_optint_option =
-    SO_LINGER              (** Whether to linger on closed connections
-                              that have data present, and for how long
-                              (in seconds) *)
-(** The socket options that can be consulted with {!UnixLabels.getsockopt_optint}
-   and modified with {!UnixLabels.setsockopt_optint}.  These options have a
+  SO_LINGER      (** Whether to linger on closed connections
+                    that have data present, and for how long
+                    (in seconds) *)
+(** The socket options that can be consulted with {!Unix.getsockopt_optint}
+   and modified with {!Unix.setsockopt_optint}.  These options have a
    value of type [int option], with [None] meaning ``disabled''. *)
-                  
+
 type socket_float_option =
-    SO_RCVTIMEO            (** Timeout for input operations *)
-  | SO_SNDTIMEO            (** Timeout for output operations *)
+    SO_RCVTIMEO    (** Timeout for input operations *)
+  | SO_SNDTIMEO    (** Timeout for output operations *)
 (** The socket options that can be consulted with {!UnixLabels.getsockopt_float}
    and modified with {!UnixLabels.setsockopt_float}.  These options have a
    floating-point value representing a time in seconds.
    The value 0 means infinite timeout. *)

-
 val getsockopt : file_descr -> socket_bool_option -> bool
 (** Return the current status of a boolean-valued option
    in the given socket. *)
@@ -1078,8 +1079,8 @@
 val open_connection : sockaddr -> in_channel * out_channel
 (** Connect to a server at the given address.
    Return a pair of buffered channels connected to the server.
-   Remember to call {!Pervasives.flush} on the output channel at the right times
-   to ensure correct synchronization. *)
+   Remember to call {!Pervasives.flush} on the output channel at the right
+   times to ensure correct synchronization. *)

 val shutdown_connection : in_channel -> unit
 (** ``Shut down'' a connection established with {!UnixLabels.open_connection};
@@ -1098,31 +1099,27 @@
 (** {6 Host and protocol databases} *)


-type host_entry =
-  Unix.host_entry =
-    { h_name : string;
-      h_aliases : string array;
-      h_addrtype : socket_domain;
-      h_addr_list : inet_addr array 
-    }
+type host_entry = Unix.host_entry =
+  { h_name : string;
+    h_aliases : string array;
+    h_addrtype : socket_domain;
+    h_addr_list : inet_addr array
+  }
 (** Structure of entries in the [hosts] database. *)

-type protocol_entry =
-  Unix.protocol_entry =
-    { p_name : string;
-      p_aliases : string array;
-      p_proto : int 
-    }
+type protocol_entry = Unix.protocol_entry =
+  { p_name : string;
+    p_aliases : string array;
+    p_proto : int
+  }
 (** Structure of entries in the [protocols] database. *)

-
-type service_entry =
-  Unix.service_entry =
-    { s_name : string;
-      s_aliases : string array;
-      s_port : int;
-      s_proto : string 
-    }
+type service_entry = Unix.service_entry =
+  { s_name : string;
+    s_aliases : string array;
+    s_port : int;
+    s_proto : string
+  }
 (** Structure of entries in the [services] database. *)

 val gethostname : unit -> string
@@ -1165,7 +1162,7 @@
     AI_FAMILY of socket_domain          (** Impose the given socket domain *)
   | AI_SOCKTYPE of socket_type          (** Impose the given socket type *)
   | AI_PROTOCOL of int                  (** Impose the given protocol  *)
-  | AI_NUMERICHOST                      (** Do not call name resolver, 
+  | AI_NUMERICHOST                      (** Do not call name resolver,
                                             expect numeric IP address *)
   | AI_CANONNAME                        (** Fill the [ai_canonname] field
                                             of the result *)
@@ -1173,7 +1170,7 @@
                                             for use with {!Unix.bind} *)
 (** Options to {!Unix.getaddrinfo}. *)

-val getaddrinfo: 
+val getaddrinfo:
   string -> string -> getaddrinfo_option list -> addr_info list
 (** [getaddrinfo host service opts] returns a list of {!Unix.addr_info}
     records describing socket parameters and addresses suitable for
@@ -1189,7 +1186,7 @@
     a port number.  [service] can be given as the empty string;
     in this case, the port field of the returned addresses is set to 0.
     [opts] is a possibly empty list of options that allows the caller
-    to force a particular socket domain (e.g. IPv6 only, or IPv4 only)
+    to force a particular socket domain (e.g. IPv6 only or IPv4 only)
     or a particular socket type (e.g. TCP only or UDP only). *)

 type name_info =
@@ -1212,69 +1209,69 @@
     empty list of options that governs how these names are obtained.
     Raise [Not_found] if an error occurs. *)

+
 (** {6 Terminal interface} *)

+
 (** The following functions implement the POSIX standard terminal
    interface. They provide control over asynchronous communication ports
    and pseudo-terminals. Refer to the [termios] man page for a
    complete description. *)

-type terminal_io =
-  Unix.terminal_io =
-    { 
-      (* Input modes: *)
-      mutable c_ignbrk : bool;  (** Ignore the break condition. *)
-      mutable c_brkint : bool;  (** Signal interrupt on break condition. *)
-      mutable c_ignpar : bool;  (** Ignore characters with parity errors. *)
-      mutable c_parmrk : bool;  (** Mark parity errors. *)
-      mutable c_inpck : bool;   (** Enable parity check on input. *)
-      mutable c_istrip : bool;  (** Strip 8th bit on input characters. *)
-      mutable c_inlcr : bool;   (** Map NL to CR on input. *)
-      mutable c_igncr : bool;   (** Ignore CR on input. *)
-      mutable c_icrnl : bool;   (** Map CR to NL on input. *)
-      mutable c_ixon : bool;    (** Recognize XON/XOFF characters on input. *)
-      mutable c_ixoff : bool;   (** Emit XON/XOFF chars to control input flow. *)
-      (* Output modes: *)
-      mutable c_opost : bool;   (** Enable output processing. *)
-      (* Control modes: *)
-      mutable c_obaud : int;    (** Output baud rate (0 means close connection).*)
-      mutable c_ibaud : int;    (** Input baud rate. *)
-      mutable c_csize : int;    (** Number of bits per character (5-8). *)
-      mutable c_cstopb : int;   (** Number of stop bits (1-2). *)
-      mutable c_cread : bool;   (** Reception is enabled. *)
-      mutable c_parenb : bool;  (** Enable parity generation and detection. *)
-      mutable c_parodd : bool;  (** Specify odd parity instead of even. *)
-      mutable c_hupcl : bool;   (** Hang up on last close. *)
-      mutable c_clocal : bool;  (** Ignore modem status lines. *)
-      (* Local modes: *)
-      mutable c_isig : bool;    (** Generate signal on INTR, QUIT, SUSP. *)
-      mutable c_icanon : bool;  (** Enable canonical processing
-                                   (line buffering and editing) *)
-      mutable c_noflsh : bool;  (** Disable flush after INTR, QUIT, SUSP. *)
-      mutable c_echo : bool;    (** Echo input characters. *)
-      mutable c_echoe : bool;   (** Echo ERASE (to erase previous character). *)
-      mutable c_echok : bool;   (** Echo KILL (to erase the current line). *)
-      mutable c_echonl : bool;  (** Echo NL even if c_echo is not set. *)
-      (* Control characters: *)
-      mutable c_vintr : char;   (** Interrupt character (usually ctrl-C). *)
-      mutable c_vquit : char;   (** Quit character (usually ctrl-\). *)
-      mutable c_verase : char;  (** Erase character (usually DEL or ctrl-H). *)
-      mutable c_vkill : char;   (** Kill line character (usually ctrl-U). *)
-      mutable c_veof : char;    (** End-of-file character (usually ctrl-D). *)
-      mutable c_veol : char;    (** Alternate end-of-line char. (usually none). *)
-      mutable c_vmin : int;     (** Minimum number of characters to read
-                                   before the read request is satisfied. *)
-      mutable c_vtime : int;    (** Maximum read wait (in 0.1s units). *)
-      mutable c_vstart : char;  (** Start character (usually ctrl-Q). *)
-      mutable c_vstop : char;   (** Stop character (usually ctrl-S). *) 
-    }
+type terminal_io = Unix.terminal_io =
+  {
+    (* input modes *)
+    mutable c_ignbrk : bool;  (** Ignore the break condition. *)
+    mutable c_brkint : bool;  (** Signal interrupt on break condition. *)
+    mutable c_ignpar : bool;  (** Ignore characters with parity errors. *)
+    mutable c_parmrk : bool;  (** Mark parity errors. *)
+    mutable c_inpck : bool;   (** Enable parity check on input. *)
+    mutable c_istrip : bool;  (** Strip 8th bit on input characters. *)
+    mutable c_inlcr : bool;   (** Map NL to CR on input. *)
+    mutable c_igncr : bool;   (** Ignore CR on input. *)
+    mutable c_icrnl : bool;   (** Map CR to NL on input. *)
+    mutable c_ixon : bool;    (** Recognize XON/XOFF characters on input. *)
+    mutable c_ixoff : bool;   (** Emit XON/XOFF chars to control input flow. *)
+    (* Output modes: *)
+    mutable c_opost : bool;   (** Enable output processing. *)
+    (* Control modes: *)
+    mutable c_obaud : int;    (** Output baud rate (0 means close connection).*)
+    mutable c_ibaud : int;    (** Input baud rate. *)
+    mutable c_csize : int;    (** Number of bits per character (5-8). *)
+    mutable c_cstopb : int;   (** Number of stop bits (1-2). *)
+    mutable c_cread : bool;   (** Reception is enabled. *)
+    mutable c_parenb : bool;  (** Enable parity generation and detection. *)
+    mutable c_parodd : bool;  (** Specify odd parity instead of even. *)
+    mutable c_hupcl : bool;   (** Hang up on last close. *)
+    mutable c_clocal : bool;  (** Ignore modem status lines. *)
+    (* Local modes: *)
+    mutable c_isig : bool;    (** Generate signal on INTR, QUIT, SUSP. *)
+    mutable c_icanon : bool;  (** Enable canonical processing
+                                 (line buffering and editing) *)
+    mutable c_noflsh : bool;  (** Disable flush after INTR, QUIT, SUSP. *)
+    mutable c_echo : bool;    (** Echo input characters. *)
+    mutable c_echoe : bool;   (** Echo ERASE (to erase previous character). *)
+    mutable c_echok : bool;   (** Echo KILL (to erase the current line). *)
+    mutable c_echonl : bool;  (** Echo NL even if c_echo is not set. *)
+    (* Control characters: *)
+    mutable c_vintr : char;   (** Interrupt character (usually ctrl-C). *)
+    mutable c_vquit : char;   (** Quit character (usually ctrl-\). *)
+    mutable c_verase : char;  (** Erase character (usually DEL or ctrl-H). *)
+    mutable c_vkill : char;   (** Kill line character (usually ctrl-U). *)
+    mutable c_veof : char;    (** End-of-file character (usually ctrl-D). *)
+    mutable c_veol : char;    (** Alternate end-of-line char. (usually none). *)
+    mutable c_vmin : int;     (** Minimum number of characters to read
+                                 before the read request is satisfied. *)
+    mutable c_vtime : int;    (** Maximum read wait (in 0.1s units). *)
+    mutable c_vstart : char;  (** Start character (usually ctrl-Q). *)
+    mutable c_vstop : char;   (** Stop character (usually ctrl-S). *)
+  }

 val tcgetattr : file_descr -> terminal_io
 (** Return the status of the terminal referred to by the given
    file descriptor. *)

-type setattr_when = 
-  Unix.setattr_when = 
+type setattr_when = Unix.setattr_when =
     TCSANOW
   | TCSADRAIN
   | TCSAFLUSH
@@ -1298,8 +1295,7 @@
 (** Waits until all output written on the given file descriptor
    has been transmitted. *)

-type flush_queue = 
-    Unix.flush_queue = 
+type flush_queue = Unix.flush_queue =
     TCIFLUSH
   | TCOFLUSH
   | TCIOFLUSH
@@ -1311,8 +1307,7 @@
    [TCOFLUSH] flushes data written but not transmitted, and
    [TCIOFLUSH] flushes both. *)

-type flow_action = 
-    Unix.flow_action = 
+type flow_action = Unix.flow_action =
     TCOOFF
   | TCOON
   | TCIOFF
diff -Naur ocaml-unix-3.09.3/otherlibs/unix/unix.ml ocaml-unix-3.10.2/otherlibs/unix/unix.ml
--- ocaml-unix-3.09.3/otherlibs/unix/unix.ml    2005-10-12 16:55:40.000000000 +0200
+++ ocaml-unix-3.10.2/otherlibs/unix/unix.ml    2006-09-21 15:54:26.000000000 +0200
@@ -11,7 +11,7 @@
 (*                                                                     *)
 (***********************************************************************)

-(* $Id: unix.ml,v 1.65 2005/10/12 14:55:40 xleroy Exp $ *)
+(* $Id: unix.ml,v 1.66 2006/09/21 13:54:26 xleroy Exp $ *)

 type error =
     E2BIG
@@ -223,6 +223,7 @@
 external stat : string -> stats = "unix_stat"
 external lstat : string -> stats = "unix_lstat"
 external fstat : file_descr -> stats = "unix_fstat"
+external isatty : file_descr -> bool = "unix_isatty"
 external unlink : string -> unit = "unix_unlink"
 external rename : string -> string -> unit = "unix_rename"
 external link : string -> string -> unit = "unix_link"
diff -Naur ocaml-unix-3.09.3/otherlibs/unix/unix.mli ocaml-unix-3.10.2/otherlibs/unix/unix.mli
--- ocaml-unix-3.09.3/otherlibs/unix/unix.mli   2006-03-21 16:50:29.000000000 +0100
+++ ocaml-unix-3.10.2/otherlibs/unix/unix.mli   2007-11-10 13:43:13.000000000 +0100
@@ -11,7 +11,7 @@
 (*                                                                     *)
 (***********************************************************************)

-(* $Id: unix.mli,v 1.81.4.2 2006/03/21 15:50:29 doligez Exp $ *)
+(* $Id: unix.mli,v 1.85.4.1 2007/11/10 12:43:13 xleroy Exp $ *)

 (** Interface to the Unix system *)

@@ -339,16 +339,19 @@
 (** The informations returned by the {!Unix.stat} calls. *)

 val stat : string -> stats
-(** Return the informations for the named file. *)
+(** Return the information for the named file. *)

 val lstat : string -> stats
 (** Same as {!Unix.stat}, but in case the file is a symbolic link,
-   return the informations for the link itself. *)
+   return the information for the link itself. *)

 val fstat : file_descr -> stats
-(** Return the informations for the file associated with the given
+(** Return the information for the file associated with the given
    descriptor. *)

+val isatty : file_descr -> bool
+(** Return [true] if the given file descriptor refers to a terminal or
+   console window, [false] otherwise. *)

 (** {6 File operations on large files} *)

@@ -755,7 +758,8 @@
 val utimes : string -> float -> float -> unit
 (** Set the last access time (second arg) and last modification time
    (third arg) for a file. Times are expressed in seconds from
-   00:00:00 GMT, Jan. 1, 1970. *)
+   00:00:00 GMT, Jan. 1, 1970.  A time of [0.0] is interpreted as the
+   current time. *)

 type interval_timer =
     ITIMER_REAL
diff -Naur ocaml-unix-3.09.3/otherlibs/unix/unix.mllib ocaml-unix-3.10.2/otherlibs/unix/unix.mllib
--- ocaml-unix-3.09.3/otherlibs/unix/unix.mllib 1970-01-01 01:00:00.000000000 +0100
+++ ocaml-unix-3.10.2/otherlibs/unix/unix.mllib 2007-02-07 10:52:28.000000000 +0100
@@ -0,0 +1 @@
+Unix UnixLabels
diff -Naur ocaml-unix-3.09.3/otherlibs/win32unix/accept.c ocaml-unix-3.10.2/otherlibs/win32unix/accept.c
--- ocaml-unix-3.09.3/otherlibs/win32unix/accept.c      2005-03-24 18:20:53.000000000 +0100
+++ ocaml-unix-3.10.2/otherlibs/win32unix/accept.c      2006-10-18 10:26:54.000000000 +0200
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: accept.c,v 1.19 2005/03/24 17:20:53 doligez Exp $ */
+/* $Id: accept.c,v 1.21 2006/10/18 08:26:54 xleroy Exp $ */

 #include <mlvalues.h>
 #include <alloc.h>
@@ -29,7 +29,7 @@
   int oldvalue, oldvaluelen, newvalue, retcode;
   union sock_addr_union addr;
   socklen_param_type addr_len;
-  int errcode = 0;
+  DWORD err = 0;

   oldvaluelen = sizeof(oldvalue);
   retcode = getsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
@@ -43,16 +43,15 @@
   addr_len = sizeof(sock_addr);
   enter_blocking_section();
   snew = accept(sconn, &addr.s_gen, &addr_len);
+  if (snew == INVALID_SOCKET) err = WSAGetLastError ();
   leave_blocking_section();
-  if( snew == INVALID_SOCKET )
-    errcode = WSAGetLastError ();
   if (retcode == 0) {
     /* Restore initial mode */
     setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE,
                (char *) &oldvalue, oldvaluelen);
   }
   if (snew == INVALID_SOCKET) {
-    win32_maperr(errcode);
+    win32_maperr(err);
     uerror("accept", Nothing);
   }
   Begin_roots2 (fd, adr)
diff -Naur ocaml-unix-3.09.3/otherlibs/win32unix/channels.c ocaml-unix-3.10.2/otherlibs/win32unix/channels.c
--- ocaml-unix-3.09.3/otherlibs/win32unix/channels.c    2003-01-06 15:52:57.000000000 +0100
+++ ocaml-unix-3.10.2/otherlibs/win32unix/channels.c    2006-09-21 11:41:04.000000000 +0200
@@ -11,27 +11,72 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: channels.c,v 1.10 2003/01/06 14:52:57 xleroy Exp $ */
+/* $Id: channels.c,v 1.12 2006/09/21 09:41:04 xleroy Exp $ */

 #include <mlvalues.h>
 #include <alloc.h>
+#include <io.h>
+#include <memory.h>
 #include "unixsupport.h"
 #include <fcntl.h>

 extern long _get_osfhandle(int);
 extern int _open_osfhandle(long, int);

-CAMLprim value win_fd_handle(value handle)
+int win_CRT_fd_of_filedescr(value handle)
 {
-  int fd;
   if (CRT_fd_val(handle) != NO_CRT_FD) {
-    fd = CRT_fd_val(handle);
+    return CRT_fd_val(handle);
   } else {
-    fd = _open_osfhandle((long) Handle_val(handle), O_BINARY);
+    int fd = _open_osfhandle((long) Handle_val(handle), O_BINARY);
     if (fd == -1) uerror("channel_of_descr", Nothing);
-    CRT_fd_val(handle) = fd;
+    return fd;
   }
-  return Val_int(fd);
+}
+
+CAMLprim value win_inchannel_of_filedescr(value handle)
+{
+  CAMLparam1(handle);
+  CAMLlocal1(vchan);
+  struct channel * chan;
+
+  chan = caml_open_descriptor_in(win_CRT_fd_of_filedescr(handle));
+  if (Descr_kind_val(handle) == KIND_SOCKET)
+    chan->flags |= CHANNEL_FLAG_FROM_SOCKET;
+  vchan = caml_alloc_channel(chan);
+  CAMLreturn(vchan); 
+}
+
+CAMLprim value win_outchannel_of_filedescr(value handle)
+{
+  CAMLparam1(handle);
+  CAMLlocal1(vchan);
+  int fd;
+  struct channel * chan;
+
+  chan = caml_open_descriptor_out(win_CRT_fd_of_filedescr(handle));
+  if (Descr_kind_val(handle) == KIND_SOCKET)
+    chan->flags |= CHANNEL_FLAG_FROM_SOCKET;
+  vchan = caml_alloc_channel(chan);
+  CAMLreturn(vchan); 
+}
+
+CAMLprim value win_filedescr_of_channel(value vchan)
+{
+  CAMLparam1(vchan);
+  CAMLlocal1(fd);
+  struct channel * chan;
+  HANDLE h;
+
+  chan = Channel(vchan);
+  if (chan->fd == -1) uerror("descr_of_channel", Nothing);
+  h = (HANDLE) _get_osfhandle(chan->fd);
+  if (chan->flags & CHANNEL_FLAG_FROM_SOCKET)
+    fd = win_alloc_socket((SOCKET) h);
+  else
+    fd = win_alloc_handle(h);
+  CRT_fd_val(fd) = chan->fd;
+  CAMLreturn(fd);
 }

 CAMLprim value win_handle_fd(value vfd)
diff -Naur ocaml-unix-3.09.3/otherlibs/win32unix/connect.c ocaml-unix-3.10.2/otherlibs/win32unix/connect.c
--- ocaml-unix-3.09.3/otherlibs/win32unix/connect.c     2002-06-07 11:49:41.000000000 +0200
+++ ocaml-unix-3.10.2/otherlibs/win32unix/connect.c     2006-10-18 10:26:54.000000000 +0200
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: connect.c,v 1.11 2002/06/07 09:49:41 xleroy Exp $ */
+/* $Id: connect.c,v 1.13 2006/10/18 08:26:54 xleroy Exp $ */

 #include <mlvalues.h>
 #include <signals.h>
@@ -22,16 +22,17 @@
      value socket, address;
 {
   SOCKET s = Socket_val(socket);
-  int retcode;
   union sock_addr_union addr;
   socklen_param_type addr_len;
+  DWORD err = 0;

   get_sockaddr(address, &addr, &addr_len);
   enter_blocking_section();
-  retcode = connect(s, &addr.s_gen, addr_len);
+  if (connect(s, &addr.s_gen, addr_len) == -1)
+    err = WSAGetLastError();
   leave_blocking_section();
-  if (retcode == -1) {
-    win32_maperr(WSAGetLastError());
+  if (err) {
+    win32_maperr(err);
     uerror("connect", Nothing);
   }
   return Val_unit;
diff -Naur ocaml-unix-3.09.3/otherlibs/win32unix/createprocess.c ocaml-unix-3.10.2/otherlibs/win32unix/createprocess.c
--- ocaml-unix-3.09.3/otherlibs/win32unix/createprocess.c       2001-12-07 14:40:43.000000000 +0100
+++ ocaml-unix-3.10.2/otherlibs/win32unix/createprocess.c       2007-10-25 10:32:42.000000000 +0200
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: createprocess.c,v 1.13 2001/12/07 13:40:43 xleroy Exp $ */
+/* $Id: createprocess.c,v 1.13.20.1 2007/10/25 08:32:42 xleroy Exp $ */

 #include <windows.h>
 #include <mlvalues.h>
@@ -62,7 +62,7 @@
   CloseHandle(pi.hThread);
   /* Return the process handle as pseudo-PID
      (this is consistent with the wait() emulation in the MSVC C library */
-  return Val_int(pi.hProcess);
+  return Val_long(pi.hProcess);
 }

 CAMLprim value win_create_process(value * argv, int argn)
diff -Naur ocaml-unix-3.09.3/otherlibs/win32unix/dllunix.dlib ocaml-unix-3.10.2/otherlibs/win32unix/dllunix.dlib
--- ocaml-unix-3.09.3/otherlibs/win32unix/dllunix.dlib  1970-01-01 01:00:00.000000000 +0100
+++ ocaml-unix-3.10.2/otherlibs/win32unix/dllunix.dlib  2007-02-07 10:52:28.000000000 +0100
@@ -0,0 +1,16 @@
+# Files in this directory
+accept.d.o bind.d.o channels.d.o close.d.o
+close_on.d.o connect.d.o createprocess.d.o dup.d.o dup2.d.o errmsg.d.o
+getpeername.d.o getpid.d.o getsockname.d.o gettimeofday.d.o
+link.d.o listen.d.o lockf.d.o lseek.d.o nonblock.d.o
+mkdir.d.o open.d.o pipe.d.o read.d.o rename.d.o
+select.d.o sendrecv.d.o
+shutdown.d.o sleep.d.o socket.d.o sockopt.d.o startup.d.o stat.d.o
+system.d.o unixsupport.d.o windir.d.o winwait.d.o write.d.o
+
+# Files from the ../unix directory
+access.d.o addrofstr.d.o chdir.d.o chmod.d.o cst2constr.d.o
+cstringv.d.o envir.d.o execv.d.o execve.d.o execvp.d.o
+exit.d.o getcwd.d.o gethost.d.o gethostname.d.o getproto.d.o
+getserv.d.o gmtime.d.o putenv.d.o rmdir.d.o
+socketaddr.d.o strofaddr.d.o time.d.o unlink.d.o utimes.d.o
diff -Naur ocaml-unix-3.09.3/otherlibs/win32unix/dup2.c ocaml-unix-3.10.2/otherlibs/win32unix/dup2.c
--- ocaml-unix-3.09.3/otherlibs/win32unix/dup2.c        2003-01-06 15:52:57.000000000 +0100
+++ ocaml-unix-3.10.2/otherlibs/win32unix/dup2.c        2006-09-21 11:43:58.000000000 +0200
@@ -11,12 +11,11 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: dup2.c,v 1.7 2003/01/06 14:52:57 xleroy Exp $ */
+/* $Id: dup2.c,v 1.9 2006/09/21 09:43:58 xleroy Exp $ */

 #include <mlvalues.h>
 #include "unixsupport.h"

-extern value win_fd_handle(value);
 extern int _dup2(int, int);

 CAMLprim value unix_dup2(value fd1, value fd2)
@@ -38,6 +37,6 @@
   Descr_kind_val(fd2) = Descr_kind_val(fd1);
   /* Reflect the dup2 on the CRT fds, if any */
   if (CRT_fd_val(fd1) != NO_CRT_FD || CRT_fd_val(fd2) != NO_CRT_FD)
-    _dup2(Int_val(win_fd_handle(fd1)), Int_val(win_fd_handle(fd2)));
+    _dup2(win_CRT_fd_of_filedescr(fd1), win_CRT_fd_of_filedescr(fd2));
   return Val_unit;
 }
diff -Naur ocaml-unix-3.09.3/otherlibs/win32unix/gettimeofday.c ocaml-unix-3.10.2/otherlibs/win32unix/gettimeofday.c
--- ocaml-unix-3.09.3/otherlibs/win32unix/gettimeofday.c        2001-12-07 14:40:44.000000000 +0100
+++ ocaml-unix-3.10.2/otherlibs/win32unix/gettimeofday.c        2007-03-01 14:51:24.000000000 +0100
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: gettimeofday.c,v 1.6 2001/12/07 13:40:44 xleroy Exp $ */
+/* $Id: gettimeofday.c,v 1.7 2007/03/01 13:51:24 xleroy Exp $ */

 #include <mlvalues.h>
 #include <alloc.h>
@@ -24,12 +24,13 @@

 CAMLprim value unix_gettimeofday(value unit)
 {
-  if (initial_time == 0) {
-    initial_tickcount = GetTickCount();
+  DWORD tickcount = GetTickCount();
+  if (initial_time == 0 || tickcount < initial_tickcount) {
+    initial_tickcount = tickcount;
     initial_time = time(NULL);
     return copy_double((double) initial_time);
   } else {
-    return copy_double(initial_time +
-                       (GetTickCount() - initial_tickcount) * 1e-3);
+    return copy_double((double) initial_time +
+                      (double) (tickcount - initial_tickcount) * 1e-3);
   }
 }
diff -Naur ocaml-unix-3.09.3/otherlibs/win32unix/libunix.clib ocaml-unix-3.10.2/otherlibs/win32unix/libunix.clib
--- ocaml-unix-3.09.3/otherlibs/win32unix/libunix.clib  1970-01-01 01:00:00.000000000 +0100
+++ ocaml-unix-3.10.2/otherlibs/win32unix/libunix.clib  2007-02-07 10:52:28.000000000 +0100
@@ -0,0 +1,16 @@
+# Files in this directory
+accept.o bind.o channels.o close.o
+close_on.o connect.o createprocess.o dup.o dup2.o errmsg.o
+getpeername.o getpid.o getsockname.o gettimeofday.o
+link.o listen.o lockf.o lseek.o nonblock.o
+mkdir.o open.o pipe.o read.o rename.o
+select.o sendrecv.o
+shutdown.o sleep.o socket.o sockopt.o startup.o stat.o
+system.o unixsupport.o windir.o winwait.o write.o
+
+# Files from the ../unix directory
+access.o addrofstr.o chdir.o chmod.o cst2constr.o
+cstringv.o envir.o execv.o execve.o execvp.o
+exit.o getcwd.o gethost.o gethostname.o getproto.o
+getserv.o gmtime.o putenv.o rmdir.o
+socketaddr.o strofaddr.o time.o unlink.o utimes.o
diff -Naur ocaml-unix-3.09.3/otherlibs/win32unix/Makefile.nt ocaml-unix-3.10.2/otherlibs/win32unix/Makefile.nt
--- ocaml-unix-3.09.3/otherlibs/win32unix/Makefile.nt   2004-05-30 10:17:06.000000000 +0200
+++ ocaml-unix-3.10.2/otherlibs/win32unix/Makefile.nt   2007-02-07 16:49:11.000000000 +0100
@@ -11,7 +11,7 @@
 #                                                                       #
 #########################################################################

-# $Id: Makefile.nt,v 1.32 2004/05/30 08:17:06 xleroy Exp $
+# $Id: Makefile.nt,v 1.35 2007/02/07 15:49:11 doligez Exp $

 include ../../config/Makefile

@@ -20,7 +20,7 @@
 CFLAGS=-I../../byterun -I../unix
 CAMLC=../../boot/ocamlrun ../../ocamlc -I ../../stdlib
 CAMLOPT=../../boot/ocamlrun ../../ocamlopt -I ../../stdlib
-COMPFLAGS=-warn-error A
+COMPFLAGS=-warn-error A -g

 # Files in this directory
 WIN_FILES = accept.c bind.c channels.c close.c \
@@ -83,6 +83,7 @@
        cp dllunix.dll $(STUBLIBDIR)/dllunix.dll
        cp libunix.$(A) $(LIBDIR)/libunix.$(A)
        cp $(CAML_OBJS:.cmo=.cmi) unix.cma $(CAML_OBJS:.cmo=.mli) $(LIBDIR)
+       cp unixsupport.h $(LIBDIR)/caml

 installopt:
        cp unix.cmxa $(CAML_OBJS:.cmo=.cmx) unix.$(A) $(LIBDIR)
diff -Naur ocaml-unix-3.09.3/otherlibs/win32unix/open.c ocaml-unix-3.10.2/otherlibs/win32unix/open.c
--- ocaml-unix-3.09.3/otherlibs/win32unix/open.c        2001-12-07 14:40:45.000000000 +0100
+++ ocaml-unix-3.10.2/otherlibs/win32unix/open.c        2007-10-25 09:42:48.000000000 +0200
@@ -11,19 +11,20 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: open.c,v 1.9 2001/12/07 13:40:45 xleroy Exp $ */
+/* $Id: open.c,v 1.9.20.1 2007/10/25 07:42:48 xleroy Exp $ */

 #include <mlvalues.h>
 #include <alloc.h>
 #include "unixsupport.h"
 #include <fcntl.h>

-static int open_access_flags[8] = {
-  GENERIC_READ, GENERIC_WRITE, GENERIC_READ|GENERIC_WRITE, 0, 0, 0, 0, 0,
+static int open_access_flags[12] = {
+  GENERIC_READ, GENERIC_WRITE, GENERIC_READ|GENERIC_WRITE,
+  0, 0, 0, 0, 0, 0, 0, 0, 0
 };

-static int open_create_flags[8] = {
-  0, 0, 0, 0, 0, O_CREAT, O_TRUNC, O_EXCL
+static int open_create_flags[12] = {
+  0, 0, 0, 0, 0, O_CREAT, O_TRUNC, O_EXCL, 0, 0, 0, 0
 };

 CAMLprim value unix_open(value path, value flags, value perm)
diff -Naur ocaml-unix-3.09.3/otherlibs/win32unix/read.c ocaml-unix-3.10.2/otherlibs/win32unix/read.c
--- ocaml-unix-3.09.3/otherlibs/win32unix/read.c        2002-07-23 16:12:01.000000000 +0200
+++ ocaml-unix-3.10.2/otherlibs/win32unix/read.c        2006-10-18 10:26:54.000000000 +0200
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: read.c,v 1.7 2002/07/23 14:12:01 doligez Exp $ */
+/* $Id: read.c,v 1.9 2006/10/18 08:26:54 xleroy Exp $ */

 #include <string.h>
 #include <mlvalues.h>
@@ -19,35 +19,34 @@
 #include <signals.h>
 #include "unixsupport.h"

-CAMLprim value unix_read(value fd, value buf, value ofs, value len)
+CAMLprim value unix_read(value fd, value buf, value ofs, value vlen)
 {
+  intnat len;
   DWORD numbytes, numread;
   char iobuf[UNIX_BUFFER_SIZE];
+  DWORD err = 0;

   Begin_root (buf);
-    numbytes = Long_val(len);
-    if (numbytes > UNIX_BUFFER_SIZE) numbytes = UNIX_BUFFER_SIZE;
+    len = Long_val(vlen);
+    numbytes = len > UNIX_BUFFER_SIZE ? UNIX_BUFFER_SIZE : len;
     if (Descr_kind_val(fd) == KIND_SOCKET) {
       int ret;
       SOCKET s = Socket_val(fd);
       enter_blocking_section();
       ret = recv(s, iobuf, numbytes, 0);
+      if (ret == SOCKET_ERROR) err = WSAGetLastError();
       leave_blocking_section();
-      if (ret == SOCKET_ERROR) {
-        win32_maperr(WSAGetLastError());
-        uerror("read", Nothing);
-      }
       numread = ret;
     } else {
-      BOOL ret;
       HANDLE h = Handle_val(fd);
       enter_blocking_section();
-      ret = ReadFile(h, iobuf, numbytes, &numread, NULL);
+      if (! ReadFile(h, iobuf, numbytes, &numread, NULL))
+        err = GetLastError();
       leave_blocking_section();
-      if (! ret) {
-        win32_maperr(GetLastError());
-        uerror("read", Nothing);
-      }
+    }
+    if (err) {
+      win32_maperr(err);
+      uerror("read", Nothing);
     }
     memmove (&Byte(buf, Long_val(ofs)), iobuf, numread);
   End_roots();
diff -Naur ocaml-unix-3.09.3/otherlibs/win32unix/select.c ocaml-unix-3.10.2/otherlibs/win32unix/select.c
--- ocaml-unix-3.09.3/otherlibs/win32unix/select.c      2003-01-07 17:16:44.000000000 +0100
+++ ocaml-unix-3.10.2/otherlibs/win32unix/select.c      2006-10-18 10:26:54.000000000 +0200
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: select.c,v 1.10 2003/01/07 16:16:44 xleroy Exp $ */
+/* $Id: select.c,v 1.12 2006/10/18 08:26:54 xleroy Exp $ */

 #include <mlvalues.h>
 #include <alloc.h>
@@ -54,6 +54,7 @@
   int retcode;
   value res;
   value read_list = Val_unit, write_list = Val_unit, except_list = Val_unit;
+  DWORD err = 0;

   Begin_roots3 (readfds, writefds, exceptfds)
   Begin_roots3 (read_list, write_list, except_list)
@@ -79,10 +80,11 @@
        tvp = &tv;
       }
       enter_blocking_section();
-      retcode = select(FD_SETSIZE, &read, &write, &except, tvp);
+      if (select(FD_SETSIZE, &read, &write, &except, tvp) == -1)
+        err = WSAGetLastError();
       leave_blocking_section();
-      if (retcode == -1) {
-       win32_maperr(WSAGetLastError());
+      if (err) {
+       win32_maperr(err);
        uerror("select", Nothing);
       }
       read_list = fdset_to_fdlist(readfds, &read);
diff -Naur ocaml-unix-3.09.3/otherlibs/win32unix/sendrecv.c ocaml-unix-3.10.2/otherlibs/win32unix/sendrecv.c
--- ocaml-unix-3.09.3/otherlibs/win32unix/sendrecv.c    2005-09-22 16:21:50.000000000 +0200
+++ ocaml-unix-3.10.2/otherlibs/win32unix/sendrecv.c    2006-10-18 10:26:54.000000000 +0200
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: sendrecv.c,v 1.18 2005/09/22 14:21:50 xleroy Exp $ */
+/* $Id: sendrecv.c,v 1.21 2006/10/18 08:26:54 xleroy Exp $ */

 #include <mlvalues.h>
 #include <alloc.h>
@@ -26,19 +26,22 @@

 CAMLprim value unix_recv(value sock, value buff, value ofs, value len, value flags)
 {
+  SOCKET s = Socket_val(sock);
+  int flg = convert_flag_list(flags, msg_flag_table);
   int ret;
   intnat numbytes;
   char iobuf[UNIX_BUFFER_SIZE];
+  DWORD err = 0;

   Begin_root (buff);
     numbytes = Long_val(len);
     if (numbytes > UNIX_BUFFER_SIZE) numbytes = UNIX_BUFFER_SIZE;
     enter_blocking_section();
-    ret = recv(Socket_val(sock), iobuf, (int) numbytes,
-               convert_flag_list(flags, msg_flag_table));
+    ret = recv(s, iobuf, (int) numbytes, flg);
+    if (ret == -1) err = WSAGetLastError();
     leave_blocking_section();
     if (ret == -1) {
-      win32_maperr(WSAGetLastError());
+      win32_maperr(err);
       uerror("recv", Nothing);
     }
     memmove (&Byte(buff, Long_val(ofs)), iobuf, ret);
@@ -48,6 +51,8 @@

 CAMLprim value unix_recvfrom(value sock, value buff, value ofs, value len, value flags)
 {
+  SOCKET s = Socket_val(sock);
+  int flg = convert_flag_list(flags, msg_flag_table);
   int ret;
   intnat numbytes;
   char iobuf[UNIX_BUFFER_SIZE];
@@ -55,19 +60,18 @@
   value adr = Val_unit;
   union sock_addr_union addr;
   socklen_param_type addr_len;
+  DWORD err = 0;

   Begin_roots2 (buff, adr);
     numbytes = Long_val(len);
     if (numbytes > UNIX_BUFFER_SIZE) numbytes = UNIX_BUFFER_SIZE;
     addr_len = sizeof(sock_addr);
     enter_blocking_section();
-    ret = recvfrom(Socket_val(sock),
-                   iobuf, (int) numbytes,
-                   convert_flag_list(flags, msg_flag_table),
-                   &addr.s_gen, &addr_len);
+    ret = recvfrom(s, iobuf, (int) numbytes, flg, &addr.s_gen, &addr_len);
+    if (ret == -1) err = WSAGetLastError();
     leave_blocking_section();
     if (ret == -1) {
-      win32_maperr(WSAGetLastError());
+      win32_maperr(err);
       uerror("recvfrom", Nothing);
     }
     memmove (&Byte(buff, Long_val(ofs)), iobuf, ret);
@@ -81,19 +85,22 @@

 CAMLprim value unix_send(value sock, value buff, value ofs, value len, value flags)
 {
+  SOCKET s = Socket_val(sock);
+  int flg = convert_flag_list(flags, msg_flag_table);
   int ret;
   intnat numbytes;
   char iobuf[UNIX_BUFFER_SIZE];
+  DWORD err = 0;

   numbytes = Long_val(len);
   if (numbytes > UNIX_BUFFER_SIZE) numbytes = UNIX_BUFFER_SIZE;
   memmove (iobuf, &Byte(buff, Long_val(ofs)), numbytes);
   enter_blocking_section();
-  ret = send(Socket_val(sock), iobuf, (int) numbytes,
-             convert_flag_list(flags, msg_flag_table));
+  ret = send(s, iobuf, (int) numbytes, flg);
+  if (ret == -1) err = WSAGetLastError();
   leave_blocking_section();
   if (ret == -1) {
-    win32_maperr(WSAGetLastError());
+    win32_maperr(err);
     uerror("send", Nothing);
   }
   return Val_int(ret);
@@ -101,24 +108,25 @@

 value unix_sendto_native(value sock, value buff, value ofs, value len, value flags, value dest)
 {
+  SOCKET s = Socket_val(sock);
+  int flg = convert_flag_list(flags, msg_flag_table);
   int ret;
   intnat numbytes;
   char iobuf[UNIX_BUFFER_SIZE];
   union sock_addr_union addr;
   socklen_param_type addr_len;
+  DWORD err = 0;

   get_sockaddr(dest, &addr, &addr_len);
   numbytes = Long_val(len);
   if (numbytes > UNIX_BUFFER_SIZE) numbytes = UNIX_BUFFER_SIZE;
   memmove (iobuf, &Byte(buff, Long_val(ofs)), numbytes);
   enter_blocking_section();
-  ret = sendto(Socket_val(sock),
-               iobuf, (int) numbytes,
-               convert_flag_list(flags, msg_flag_table),
-               &addr.s_gen, addr_len);
+  ret = sendto(s, iobuf, (int) numbytes, flg, &addr.s_gen, addr_len);
+  if (ret == -1) err = WSAGetLastError();
   leave_blocking_section();
   if (ret == -1) {
-    win32_maperr(WSAGetLastError());
+    win32_maperr(err);
     uerror("sendto", Nothing);
   }
   return Val_int(ret);
diff -Naur ocaml-unix-3.09.3/otherlibs/win32unix/stat.c ocaml-unix-3.10.2/otherlibs/win32unix/stat.c
--- ocaml-unix-3.09.3/otherlibs/win32unix/stat.c        2006-04-06 15:26:58.000000000 +0200
+++ ocaml-unix-3.10.2/otherlibs/win32unix/stat.c        2006-09-21 15:57:34.000000000 +0200
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: stat.c,v 1.1.14.1 2006/04/06 13:26:58 doligez Exp $ */
+/* $Id: stat.c,v 1.3 2006/09/21 13:57:34 xleroy Exp $ */

 #include <errno.h>
 #include <mlvalues.h>
@@ -86,3 +86,30 @@
   return stat_aux(1, &buf);
 }

+CAMLprim value unix_fstat(value handle)
+{
+  int ret;
+  struct _stati64 buf;
+
+  ret = _fstati64(win_CRT_fd_of_filedescr(handle), &buf);
+  if (ret == -1) uerror("fstat", Nothing);
+  if (buf.st_size > Max_long) {
+    win32_maperr(ERROR_ARITHMETIC_OVERFLOW);
+    uerror("fstat", Nothing);
+  }
+  return stat_aux(0, &buf);
+}
+
+CAMLprim value unix_fstat_64(value handle)
+{
+  int ret;
+  struct _stati64 buf;
+
+  ret = _fstati64(win_CRT_fd_of_filedescr(handle), &buf);
+  if (ret == -1) uerror("fstat", Nothing);
+  if (buf.st_size > Max_long) {
+    win32_maperr(ERROR_ARITHMETIC_OVERFLOW);
+    uerror("fstat", Nothing);
+  }
+  return stat_aux(1, &buf);
+}
diff -Naur ocaml-unix-3.09.3/otherlibs/win32unix/system.c ocaml-unix-3.10.2/otherlibs/win32unix/system.c
--- ocaml-unix-3.09.3/otherlibs/win32unix/system.c      2002-06-07 11:49:41.000000000 +0200
+++ ocaml-unix-3.10.2/otherlibs/win32unix/system.c      2006-09-21 10:03:56.000000000 +0200
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: system.c,v 1.8 2002/06/07 09:49:41 xleroy Exp $ */
+/* $Id: system.c,v 1.9 2006/09/21 08:03:56 xleroy Exp $ */

 #include <mlvalues.h>
 #include <memory.h>
@@ -26,11 +26,17 @@
 {
   int ret;
   value st;
+  char *buf;
+  intnat len;

+  len = caml_string_length (cmd);
+  buf = caml_stat_alloc (len + 1);
+  memmove (buf, String_val (cmd), len + 1);
   enter_blocking_section();
   _flushall();
-  ret = system(String_val(cmd));;
+  ret = system(buf);
   leave_blocking_section();
+  caml_stat_free(buf);
   if (ret == -1) uerror("system", Nothing);
   st = alloc_small(1, 0); /* Tag 0: Exited */
   Field(st, 0) = Val_int(ret);
diff -Naur ocaml-unix-3.09.3/otherlibs/win32unix/unix.ml ocaml-unix-3.10.2/otherlibs/win32unix/unix.ml
--- ocaml-unix-3.09.3/otherlibs/win32unix/unix.ml       2004-11-30 18:06:19.000000000 +0100
+++ ocaml-unix-3.10.2/otherlibs/win32unix/unix.ml       2007-02-25 15:38:11.000000000 +0100
@@ -11,7 +11,7 @@
 (*                                                                     *)
 (***********************************************************************)

-(* $Id: unix.ml,v 1.43 2004/11/30 17:06:19 xleroy Exp $ *)
+(* $Id: unix.ml,v 1.46 2007/02/25 14:38:11 xleroy Exp $ *)

 (* Initialization *)

@@ -198,23 +198,10 @@

 (* Interfacing with the standard input/output library *)

-external open_read_descriptor : int -> in_channel = "caml_ml_open_descriptor_in"
-external open_write_descriptor : int -> out_channel
-                               = "caml_ml_open_descriptor_out"
-external fd_of_in_channel : in_channel -> int = "caml_channel_descriptor"
-external fd_of_out_channel : out_channel -> int = "caml_channel_descriptor"
-
-external open_handle : file_descr -> int = "win_fd_handle"
-
-let in_channel_of_descr handle =
-  open_read_descriptor(open_handle handle)
-let out_channel_of_descr handle =
-  open_write_descriptor(open_handle handle)
-
-let descr_of_in_channel inchan =
-  filedescr_of_fd(fd_of_in_channel inchan)
-let descr_of_out_channel outchan =
-  filedescr_of_fd(fd_of_out_channel outchan)
+external in_channel_of_descr: file_descr -> in_channel = "win_inchannel_of_filedescr"
+external out_channel_of_descr: file_descr -> out_channel = "win_outchannel_of_filedescr"
+external descr_of_in_channel : in_channel -> file_descr = "win_filedescr_of_channel"
+external descr_of_out_channel : out_channel -> file_descr = "win_filedescr_of_channel"

 (* Seeking and truncating *)

@@ -255,7 +242,9 @@

 external stat : string -> stats = "unix_stat"
 let lstat = stat
-let fstat fd = invalid_arg "Unix.fstat not implemented"
+external fstat : file_descr -> stats = "unix_fstat"
+let isatty fd =
+  match (fstat fd).st_kind with S_CHR -> true | _ -> false

 (* Operations on file names *)

@@ -286,7 +275,7 @@
       }
     external stat : string -> stats = "unix_stat_64"
     let lstat = stat
-    let fstat fd = invalid_arg "Unix.LargeFile.fstat not implemented"
+    external fstat : file_descr -> stats = "unix_fstat_64"
   end

 (* File permissions and ownership *)
@@ -337,7 +326,7 @@

 let opendir dirname =
   try
-    let (first_entry, handle) = findfirst (dirname ^ "\\*.*") in
+    let (first_entry, handle) = findfirst (Filename.concat dirname "*.*") in
     { dirname = dirname; handle = handle; entry_read = Dir_read first_entry }
   with End_of_file ->
     { dirname = dirname; handle = 0; entry_read = Dir_empty }
diff -Naur ocaml-unix-3.09.3/otherlibs/win32unix/unixsupport.c ocaml-unix-3.10.2/otherlibs/win32unix/unixsupport.c
--- ocaml-unix-3.09.3/otherlibs/win32unix/unixsupport.c 2005-09-22 16:21:50.000000000 +0200
+++ ocaml-unix-3.10.2/otherlibs/win32unix/unixsupport.c 2007-02-07 15:45:46.000000000 +0100
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: unixsupport.c,v 1.20 2005/09/22 14:21:50 xleroy Exp $ */
+/* $Id: unixsupport.c,v 1.21 2007/02/07 14:45:46 doligez Exp $ */

 #include <stddef.h>
 #include <mlvalues.h>
@@ -221,6 +221,22 @@

 static value * unix_error_exn = NULL;

+value unix_error_of_code (int errcode)
+{
+  int errconstr;
+  value err;
+
+  errconstr =
+      cst_to_constr(errcode, error_table, sizeof(error_table)/sizeof(int), -1);
+  if (errconstr == Val_int(-1)) {
+    err = alloc_small(1, 0);
+    Field(err, 0) = Val_int(errcode);
+  } else {
+    err = errconstr;
+  }
+  return err;
+}
+
 void unix_error(int errcode, char *cmdname, value cmdarg)
 {
   value res;
@@ -230,14 +246,7 @@
   Begin_roots3 (name, err, arg);
     arg = cmdarg == Nothing ? copy_string("") : cmdarg;
     name = copy_string(cmdname);
-    errconstr =
-      cst_to_constr(errcode, error_table, sizeof(error_table)/sizeof(int), -1);
-    if (errconstr == Val_int(-1)) {
-      err = alloc_small(1, 0);
-      Field(err, 0) = Val_int(errcode);
-    } else {
-      err = errconstr;
-    }
+    err = unix_error_of_code (errcode);
     if (unix_error_exn == NULL) {
       unix_error_exn = caml_named_value("Unix.Unix_error");
       if (unix_error_exn == NULL)
diff -Naur ocaml-unix-3.09.3/otherlibs/win32unix/unixsupport.h ocaml-unix-3.10.2/otherlibs/win32unix/unixsupport.h
--- ocaml-unix-3.09.3/otherlibs/win32unix/unixsupport.h 2005-09-22 16:21:50.000000000 +0200
+++ ocaml-unix-3.10.2/otherlibs/win32unix/unixsupport.h 2007-02-07 15:45:46.000000000 +0100
@@ -11,15 +11,12 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: unixsupport.h,v 1.16 2005/09/22 14:21:50 xleroy Exp $ */
+/* $Id: unixsupport.h,v 1.19 2007/02/07 14:45:46 doligez Exp $ */

 #define WIN32_LEAN_AND_MEAN
 #include <wtypes.h>
 #include <winbase.h>
 #include <stdlib.h>
-/* Include io.h in current dir, which is a copy of the system's io.h,
-   not io.h from ../../byterun */
-/*#include "io.h"*/
 #include <direct.h>
 #include <process.h>
 #include <sys/types.h>
@@ -42,11 +39,13 @@
 extern value win_alloc_handle_or_socket(HANDLE);
 extern value win_alloc_handle(HANDLE);
 extern value win_alloc_socket(SOCKET);
+extern int win_CRT_fd_of_filedescr(value handle);

 #define NO_CRT_FD (-1)
 #define Nothing ((value) 0)

 extern void win32_maperr(DWORD errcode);
+extern value unix_error_of_code (int errcode);
 extern void unix_error (int errcode, char * cmdname, value arg);
 extern void uerror (char * cmdname, value arg);
 extern value unix_freeze_buffer (value);
diff -Naur ocaml-unix-3.09.3/otherlibs/win32unix/winwait.c ocaml-unix-3.10.2/otherlibs/win32unix/winwait.c
--- ocaml-unix-3.09.3/otherlibs/win32unix/winwait.c     2005-09-22 16:21:50.000000000 +0200
+++ ocaml-unix-3.10.2/otherlibs/win32unix/winwait.c     2007-10-25 10:31:58.000000000 +0200
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: winwait.c,v 1.15 2005/09/22 14:21:50 xleroy Exp $ */
+/* $Id: winwait.c,v 1.18.6.1 2007/10/25 08:31:58 xleroy Exp $ */

 #include <windows.h>
 #include <mlvalues.h>
@@ -41,13 +41,18 @@
 CAMLprim value win_waitpid(value vflags, value vpid_req)
 {
   int flags;
-  DWORD status;
+  DWORD status, retcode;
   HANDLE pid_req = (HANDLE) Long_val(vpid_req);
+  DWORD err = 0;

   flags = convert_flag_list(vflags, wait_flag_table);
   if ((flags & CAML_WNOHANG) == 0) {
-    if (WaitForSingleObject(pid_req, INFINITE) == WAIT_FAILED) {
-      win32_maperr(GetLastError());
+    enter_blocking_section();
+    retcode = WaitForSingleObject(pid_req, INFINITE);
+    if (retcode == WAIT_FAILED) err = GetLastError();
+    leave_blocking_section();
+    if (err) {
+      win32_maperr(err);
       uerror("waitpid", Nothing);
     }
   }
@@ -57,6 +62,8 @@
   }
   if (status == STILL_ACTIVE)
     return alloc_process_status((HANDLE) 0, 0);
-  else
+  else {
+    CloseHandle(pid_req);
     return alloc_process_status(pid_req, status);
+  }
 }
diff -Naur ocaml-unix-3.09.3/otherlibs/win32unix/write.c ocaml-unix-3.10.2/otherlibs/win32unix/write.c
--- ocaml-unix-3.09.3/otherlibs/win32unix/write.c       2005-09-22 16:21:50.000000000 +0200
+++ ocaml-unix-3.10.2/otherlibs/win32unix/write.c       2006-10-18 10:26:54.000000000 +0200
@@ -11,7 +11,7 @@
 /*                                                                     */
 /***********************************************************************/

-/* $Id: write.c,v 1.9 2005/09/22 14:21:50 xleroy Exp $ */
+/* $Id: write.c,v 1.11 2006/10/18 08:26:54 xleroy Exp $ */

 #include <errno.h>
 #include <string.h>
@@ -25,6 +25,7 @@
   intnat ofs, len, written;
   DWORD numbytes, numwritten;
   char iobuf[UNIX_BUFFER_SIZE];
+  DWORD err = 0;

   Begin_root (buf);
     ofs = Long_val(vofs);
@@ -38,22 +39,19 @@
         SOCKET s = Socket_val(fd);
         enter_blocking_section();
         ret = send(s, iobuf, numbytes, 0);
+        if (ret == SOCKET_ERROR) err = WSAGetLastError();
         leave_blocking_section();
-        if (ret == SOCKET_ERROR) {
-          win32_maperr(WSAGetLastError());
-          uerror("write", Nothing);
-        }
         numwritten = ret;
       } else {
-        BOOL ret;
         HANDLE h = Handle_val(fd);
         enter_blocking_section();
-        ret = WriteFile(h, iobuf, numbytes, &numwritten, NULL);
+        if (! WriteFile(h, iobuf, numbytes, &numwritten, NULL))
+          err = GetLastError();
         leave_blocking_section();
-        if (! ret) {
-          win32_maperr(GetLastError());
-          uerror("write", Nothing);
-        }
+      }
+      if (err) {
+        win32_maperr(err);
+        uerror("write", Nothing);
       }
       written += numwritten;
       ofs += numwritten;
@@ -68,6 +66,7 @@
   intnat ofs, len, written;
   DWORD numbytes, numwritten;
   char iobuf[UNIX_BUFFER_SIZE];
+  DWORD err;

   Begin_root (buf);
     ofs = Long_val(vofs);
@@ -81,22 +80,19 @@
         SOCKET s = Socket_val(fd);
         enter_blocking_section();
         ret = send(s, iobuf, numbytes, 0);
+        if (ret == SOCKET_ERROR) err = WSAGetLastError();
         leave_blocking_section();
-        if (ret == SOCKET_ERROR) {
-          win32_maperr(WSAGetLastError());
-          uerror("single_write", Nothing);
-        }
         numwritten = ret;
       } else {
-        BOOL ret;
         HANDLE h = Handle_val(fd);
         enter_blocking_section();
-        ret = WriteFile(h, iobuf, numbytes, &numwritten, NULL);
+        if (! WriteFile(h, iobuf, numbytes, &numwritten, NULL))
+          err = GetLastError();
         leave_blocking_section();
-        if (! ret) {
-          win32_maperr(GetLastError());
-          uerror("single_write", Nothing);
-        }
+      }
+      if (err) {
+        win32_maperr(err);
+        uerror("single_write", Nothing);
       }
       written = numwritten;
     }