ocaml/otherlibs/win32unix
Jun FURUSE / 古瀬 淳 b22dccafa9 unix.mli is cvsignored
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4613 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2002-04-09 08:18:51 +00:00
..
.cvsignore unix.mli is cvsignored 2002-04-09 08:18:51 +00:00
.depend Win32: strict labels, and labltk dynload 2001-09-13 09:08:12 +00:00
Makefile.nt Ajout primitives LargeFile 2002-03-06 16:55:20 +00:00
README MAJ pour release 0.6 1997-11-10 18:20:48 +00:00
accept.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
bind.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
channels.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
close.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
close_on.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
connect.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
createprocess.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
dup.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
dup2.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
errmsg.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
getpeername.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
getpid.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
getsockname.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
gettimeofday.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
link.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
listen.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
lseek.c Ajout primitives LargeFile 2002-03-06 16:55:20 +00:00
mkdir.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
open.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
pipe.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
read.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
select.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
sendrecv.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
shutdown.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
sleep.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
socket.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
socketaddr.h MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
sockopt.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
startup.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
stat.c Ajout primitives LargeFile 2002-03-06 16:55:20 +00:00
system.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
unix.ml Ajout primitives LargeFile 2002-03-06 16:55:20 +00:00
unixsupport.c Ajout primitives LargeFile 2002-03-06 16:55:20 +00:00
unixsupport.h MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
windir.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
winwait.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00
write.c MAJ en-tetes pour mentionner la 'special exception' sur la LGPL 2001-12-07 13:41:02 +00:00

README

This is a partial port of the Unix system interface to Win32.
It was done as a summer project by Pascal Cuoq (ENS Lyon),
supervised by Xavier Leroy and Francois Rouaix (INRIA), then heavily
hacked by Xavier Leroy.

See the interface file unix.mli in this directory for more
documentation on the functions implemented.

Recompiling this library requires Microsoft Visual C++ 4.0.

We've had to modify and recompile the Visual C++ standard C library to
work around the following problems:

- There's a bug in the library function _pipe() that can result in a
  deadlock (the library function attempts to lock the wrong file descriptor).

- Windows 95 classifies socket handles as "unknown", while Windows NT
  classifies them as "pipes". Thus, opening a file descriptor on a
  socket handle fails under Windows 95. We've just removed the check
  on the handle type in the library.

The first problem no longer affects the Win32unix library.

The second problem makes it impossible, under Windows 95, to create an
in_channel or out_channel on a file descriptor opened on a socket,
using the in_channel_of_descr* and out_channel_of_descr*.

The diffs are included at the end of this file. They must be applied
against a local copy of the libc sources found on the Visual C++ CD-ROM
(in \msdev\crt\src). Then, rebuild the libraries and install them.

-----------------------------------------------------------------------
diff -c -r d:/msdev/crt/src/osfinfo.c crt/src/osfinfo.c
*** d:/msdev/crt/src/osfinfo.c	Fri Jul 21 17:05:06 1995
--- crt/src/osfinfo.c	Mon Jul 22 15:56:40 1996
***************
*** 23,28 ****
--- 23,29 ----
  #include <stdlib.h>
  #include <dbgint.h>
  
+ #include <winsock.h>
  
  /***
  *int _alloc_osfhnd() - get free _ioinfo struct
***************
*** 141,150 ****
                       * The first element of the newly allocated array of ioinfo
                       * structs, *(__pioinfo[i]), is our first free entry.
                       */
  #if defined (_MT) && !defined (DLL_FOR_WIN32S)
!                     _lock_fhandle( i );
  #endif  /* defined (_MT) && !defined (DLL_FOR_WIN32S) */
-                     fh = i * IOINFO_ARRAY_ELTS;
                  }
  
                  break;
--- 142,151 ----
                       * The first element of the newly allocated array of ioinfo
                       * structs, *(__pioinfo[i]), is our first free entry.
                       */
+                     fh = i * IOINFO_ARRAY_ELTS;
  #if defined (_MT) && !defined (DLL_FOR_WIN32S)
!                     _lock_fhandle( fh );
  #endif  /* defined (_MT) && !defined (DLL_FOR_WIN32S) */
                  }
  
                  break;
***************
*** 335,346 ****
          /* find out what type of file (file/device/pipe) */
  
          isdev = GetFileType((HANDLE)osfhandle);
          if (isdev == FILE_TYPE_UNKNOWN) {
!                 /* OS error */
!                 _dosmaperr( GetLastError() );   /* map error */
!                 return -1;
          }
  
          /* is isdev value to set flags */
          if (isdev == FILE_TYPE_CHAR)
                  fileflags |= FDEV;
--- 336,352 ----
          /* find out what type of file (file/device/pipe) */
  
          isdev = GetFileType((HANDLE)osfhandle);
+ #if 0
          if (isdev == FILE_TYPE_UNKNOWN) {
! 				/* OS error */
! 				_dosmaperr( GetLastError() );   /* map error */
! 				return -1;
          }
+ #else
+ 		/* Windows 95 lossage */
+         if (isdev == FILE_TYPE_UNKNOWN) isdev = FILE_TYPE_PIPE;
  
+ #endif
          /* is isdev value to set flags */
          if (isdev == FILE_TYPE_CHAR)
                  fileflags |= FDEV;