summaryrefslogtreecommitdiffstats
path: root/otherlibs/win32unix
diff options
context:
space:
mode:
Diffstat (limited to 'otherlibs/win32unix')
-rw-r--r--otherlibs/win32unix/Makefile.nt87
-rw-r--r--otherlibs/win32unix/accept.c1
-rw-r--r--otherlibs/win32unix/connect.c1
-rw-r--r--otherlibs/win32unix/lockf.c5
-rw-r--r--otherlibs/win32unix/lseek.c3
-rw-r--r--otherlibs/win32unix/sendrecv.c1
-rw-r--r--otherlibs/win32unix/sleep.c2
-rw-r--r--otherlibs/win32unix/sockopt.c1
-rw-r--r--otherlibs/win32unix/system.c1
-rw-r--r--otherlibs/win32unix/unix.ml4
-rw-r--r--otherlibs/win32unix/unixsupport.c1
-rw-r--r--otherlibs/win32unix/windir.c1
-rw-r--r--otherlibs/win32unix/winwait.c3
13 files changed, 64 insertions, 47 deletions
diff --git a/otherlibs/win32unix/Makefile.nt b/otherlibs/win32unix/Makefile.nt
index 95f9e1875..edb8edc14 100644
--- a/otherlibs/win32unix/Makefile.nt
+++ b/otherlibs/win32unix/Makefile.nt
@@ -13,85 +13,85 @@
# $Id$
-!include ../../config/Makefile.nt
+include ../../config/Makefile
# Compilation options
CC=$(BYTECC)
-CFLAGS=-I..\..\byterun -I..\unix
-CAMLC=..\..\boot\ocamlrun ..\..\ocamlc -I ..\..\stdlib
-CAMLOPT=..\..\boot\ocamlrun ..\..\ocamlopt -I ..\..\stdlib
+CFLAGS=-I../../byterun -I../unix
+CAMLC=../../boot/ocamlrun ../../ocamlc -I ../../stdlib
+CAMLOPT=../../boot/ocamlrun ../../ocamlopt -I ../../stdlib
COMPFLAGS=-warn-error A
# Files in this directory
-WIN_OBJS = accept.obj bind.obj channels.obj close.obj \
- close_on.obj connect.obj createprocess.obj dup.obj dup2.obj errmsg.obj \
- getpeername.obj getpid.obj getsockname.obj gettimeofday.obj \
- link.obj listen.obj lockf.obj lseek.obj \
- mkdir.obj open.obj pipe.obj read.obj rename.obj \
- select.obj sendrecv.obj \
- shutdown.obj sleep.obj socket.obj sockopt.obj startup.obj stat.obj \
- system.obj unixsupport.obj windir.obj winwait.obj write.obj
-
-# Files from the ..\unix directory
+WIN_FILES = accept.c bind.c channels.c close.c \
+ close_on.c connect.c createprocess.c dup.c dup2.c errmsg.c \
+ getpeername.c getpid.c getsockname.c gettimeofday.c \
+ link.c listen.c lockf.c lseek.c \
+ mkdir.c open.c pipe.c read.c rename.c \
+ select.c sendrecv.c \
+ shutdown.c sleep.c socket.c sockopt.c startup.c stat.c \
+ system.c unixsupport.c windir.c winwait.c write.c
+
+# Files from the ../unix directory
UNIX_FILES = access.c addrofstr.c chdir.c chmod.c cst2constr.c \
cstringv.c envir.c execv.c execve.c execvp.c \
exit.c getcwd.c gethost.c gethostname.c getproto.c \
getserv.c gmtime.c putenv.c rmdir.c \
socketaddr.c strofaddr.c time.c unlink.c utimes.c
-UNIX_OBJS = $(UNIX_FILES:.c=.obj)
+ALL_FILES=$(WIN_FILES) $(UNIX_FILES)
-C_OBJS=$(WIN_OBJS) $(UNIX_OBJS)
+DOBJS=$(ALL_FILES:.c=.$(DO))
+SOBJS=$(ALL_FILES:.c=.$(SO))
+
+LIBS=$(call SYSLIB,wsock32)
CAML_OBJS=unix.cmo unixLabels.cmo
CAMLOPT_OBJS=$(CAML_OBJS:.cmo=.cmx)
-all: dllunix.dll libunix.lib unix.cma
+all: dllunix.dll libunix.$(A) unix.cma
-allopt: libunix.lib unix.cmxa
+allopt: libunix.$(A) unix.cmxa
-dllunix.dll: copy_unix_files io.h $(C_OBJS:.obj=.dobj)
- link /nologo /dll /out:dllunix.dll /implib:tmp.lib \
- $(C_OBJS:.obj=.dobj) ..\..\byterun\ocamlrun.lib wsock32.lib
+dllunix.dll: io.h $(DOBJS)
+ $(call MKDLL,dllunix.dll,tmp.$(A),$(DOBJS) ../../byterun/ocamlrun.$(A) $(LIBS))
rm tmp.*
-libunix.lib: copy_unix_files io.h $(C_OBJS:.obj=.sobj)
- rm -f libunix.lib
- $(MKLIB)libunix.lib $(C_OBJS:.obj=.sobj)
+libunix.$(A): io.h $(SOBJS)
+ $(call MKLIB,libunix.$(A),$(SOBJS))
-copy_unix_files:
- @- cd ..\unix & cp -p -u -v $(UNIX_FILES) ../win32unix
-# This requires GNU cp
- @cp ../unix/unix.mli ../unix/unixLabels.ml* .
+#copy_unix_files:
+# @cd ../unix; cp -p -u $(UNIX_FILES) ../win32unix
+# @cp ../unix/unix.mli ../unix/unixLabels.ml* .
-io.h: "$(SYSTEM_INCLUDES)\io.h"
- copy "$(SYSTEM_INCLUDES)\io.h" io.h
+io.h: $(SYSTEM_INCLUDES)/io.h
+ cp "$(SYSTEM_INCLUDES)/io.h" io.h
-$(C_OBJS:.obj=.dobj) $(C_OBJS:.obj=.sobj): unixsupport.h
+$(DOBJS) $(SOBJS): unixsupport.h
unix.cma: $(CAML_OBJS)
$(CAMLC) -a -linkall -o unix.cma $(CAML_OBJS) \
- -dllib -lunix -cclib -lunix wsock32.lib
+ -dllib -lunix -cclib -lunix -cclib $(LIBS)
unix.cmxa: $(CAMLOPT_OBJS)
$(CAMLOPT) -a -linkall -o unix.cmxa $(CAMLOPT_OBJS) \
- -cclib -lunix wsock32.lib
+ -cclib -lunix -cclib $(LIBS)
partialclean:
rm -f *.cm*
clean: partialclean
- rm -f *.lib *.dll *.exp *.sobj *.dobj
+ rm -f *.$(A) *.dll *.$(O)
rm -f $(UNIX_FILES)
rm -f io.h
install:
cp dllunix.dll $(LIBDIR)/dllunix.dll
- cp libunix.lib $(LIBDIR)/libunix.lib
+ cp libunix.$(A) $(LIBDIR)/libunix.$(A)
cp unix.cmi unix.cma $(LIBDIR)
installopt:
- cp unix.cmxa unix.cmx unix.lib $(LIBDIR)
+ cp unix.cmxa unix.cmx unix.$(A) $(LIBDIR)
unixLabels.cmo: unixLabels.ml
$(CAMLC) -c $(COMPFLAGS) -nolabels unixLabels.ml
@@ -99,7 +99,10 @@ unixLabels.cmo: unixLabels.ml
unixLabels.cmx: unixLabels.ml
$(CAMLOPT) -c $(COMPFLAGS) -nolabels unixLabels.ml
-.SUFFIXES: .ml .mli .cmo .cmi .cmx .dobj .sobj
+$(UNIX_FILES): %.c: ../unix/%.c
+ cp ../unix/$*.c $*.c
+
+.SUFFIXES: .ml .mli .cmo .cmi .cmx .$(DO) .$(SO)
.mli.cmi:
$(CAMLC) -c $(COMPFLAGS) $<
@@ -110,14 +113,14 @@ unixLabels.cmx: unixLabels.ml
.ml.cmx:
$(CAMLOPT) -c $(COMPFLAGS) $<
-.c.dobj:
+.c.$(DO):
$(BYTECC) $(DLLCCCOMPOPTS) $(CFLAGS) -c $<
- mv $*.obj $*.dobj
+ mv $*.$(O) $*.$(DO)
-.c.sobj:
+.c.$(SO):
$(BYTECC) $(BYTECCCOMPOPTS) $(CFLAGS) -c $<
- mv $*.obj $*.sobj
+ mv $*.$(O) $*.$(SO)
depend:
-!include .depend
+include .depend
diff --git a/otherlibs/win32unix/accept.c b/otherlibs/win32unix/accept.c
index a85be024e..fdac3e5da 100644
--- a/otherlibs/win32unix/accept.c
+++ b/otherlibs/win32unix/accept.c
@@ -16,6 +16,7 @@
#include <mlvalues.h>
#include <alloc.h>
#include <memory.h>
+#include <signals.h>
#include "unixsupport.h"
#include "socketaddr.h"
diff --git a/otherlibs/win32unix/connect.c b/otherlibs/win32unix/connect.c
index 4d0f60a05..74e62252d 100644
--- a/otherlibs/win32unix/connect.c
+++ b/otherlibs/win32unix/connect.c
@@ -14,6 +14,7 @@
/* $Id$ */
#include <mlvalues.h>
+#include <signals.h>
#include "unixsupport.h"
#include "socketaddr.h"
diff --git a/otherlibs/win32unix/lockf.c b/otherlibs/win32unix/lockf.c
index 84ed2476e..c2c9c3507 100644
--- a/otherlibs/win32unix/lockf.c
+++ b/otherlibs/win32unix/lockf.c
@@ -17,6 +17,7 @@
#include <errno.h>
#include <fcntl.h>
#include <mlvalues.h>
+#include <fail.h>
#include "unixsupport.h"
#include <stdio.h>
@@ -82,12 +83,12 @@ CAMLprim value unix_lockf(value fd, value cmd, value span)
VersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if(GetVersionEx(&VersionInfo) == 0)
{
- return invalid_argument("lockf only supported on WIN32_NT platforms: could not determine current platform.");
+ invalid_argument("lockf only supported on WIN32_NT platforms: could not determine current platform.");
}
/* file locking only exists on NT versions */
if(VersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT)
{
- return invalid_argument("lockf only supported on WIN32_NT platforms");
+ invalid_argument("lockf only supported on WIN32_NT platforms");
}
h = Handle_val(fd);
diff --git a/otherlibs/win32unix/lseek.c b/otherlibs/win32unix/lseek.c
index 06f636fe3..acc7b1004 100644
--- a/otherlibs/win32unix/lseek.c
+++ b/otherlibs/win32unix/lseek.c
@@ -14,6 +14,7 @@
/* $Id$ */
#include <mlvalues.h>
+#include <alloc.h>
#include "unixsupport.h"
#ifdef HAS_UNISTD
@@ -71,5 +72,5 @@ CAMLprim value unix_lseek_64(value fd, value ofs, value cmd)
uerror("lseek", Nothing);
}
}
- return copy_int64(ofs_high << 32 | ret);
+ return copy_int64((int64) ofs_high << 32 | ret);
}
diff --git a/otherlibs/win32unix/sendrecv.c b/otherlibs/win32unix/sendrecv.c
index 065dd84eb..57ca0fdb2 100644
--- a/otherlibs/win32unix/sendrecv.c
+++ b/otherlibs/win32unix/sendrecv.c
@@ -16,6 +16,7 @@
#include <mlvalues.h>
#include <alloc.h>
#include <memory.h>
+#include <signals.h>
#include "unixsupport.h"
#include "socketaddr.h"
diff --git a/otherlibs/win32unix/sleep.c b/otherlibs/win32unix/sleep.c
index b86bfc5e4..421e5f902 100644
--- a/otherlibs/win32unix/sleep.c
+++ b/otherlibs/win32unix/sleep.c
@@ -14,8 +14,8 @@
/* $Id$ */
#include <mlvalues.h>
+#include <signals.h>
#include "unixsupport.h"
-#include <windows.h>
CAMLprim value unix_sleep(t)
value t;
diff --git a/otherlibs/win32unix/sockopt.c b/otherlibs/win32unix/sockopt.c
index 7e428bc07..a9572de79 100644
--- a/otherlibs/win32unix/sockopt.c
+++ b/otherlibs/win32unix/sockopt.c
@@ -14,6 +14,7 @@
/* $Id$ */
#include <mlvalues.h>
+#include <alloc.h>
#include "unixsupport.h"
static int sockopt_bool[] = {
diff --git a/otherlibs/win32unix/system.c b/otherlibs/win32unix/system.c
index b326e8900..725817c37 100644
--- a/otherlibs/win32unix/system.c
+++ b/otherlibs/win32unix/system.c
@@ -16,6 +16,7 @@
#include <mlvalues.h>
#include <memory.h>
#include <alloc.h>
+#include <signals.h>
#include "unixsupport.h"
#include <process.h>
#include <stdio.h>
diff --git a/otherlibs/win32unix/unix.ml b/otherlibs/win32unix/unix.ml
index cb5bcdd70..5231507e1 100644
--- a/otherlibs/win32unix/unix.ml
+++ b/otherlibs/win32unix/unix.ml
@@ -168,6 +168,10 @@ type open_flag =
| O_CREAT
| O_TRUNC
| O_EXCL
+ | O_NOCTTY
+ | O_DSYNC
+ | O_SYNC
+ | O_RSYNC
type file_perm = int
diff --git a/otherlibs/win32unix/unixsupport.c b/otherlibs/win32unix/unixsupport.c
index 97a9a3674..50c756f60 100644
--- a/otherlibs/win32unix/unixsupport.c
+++ b/otherlibs/win32unix/unixsupport.c
@@ -13,6 +13,7 @@
/* $Id$ */
+#include <stddef.h>
#include <mlvalues.h>
#include <callback.h>
#include <alloc.h>
diff --git a/otherlibs/win32unix/windir.c b/otherlibs/win32unix/windir.c
index 8d487bf64..cdd99d8e6 100644
--- a/otherlibs/win32unix/windir.c
+++ b/otherlibs/win32unix/windir.c
@@ -17,6 +17,7 @@
#include <memory.h>
#include <errno.h>
#include <alloc.h>
+#include <fail.h>
#include "unixsupport.h"
CAMLprim value win_findfirst(name)
diff --git a/otherlibs/win32unix/winwait.c b/otherlibs/win32unix/winwait.c
index c0a643a7e..db3a62dde 100644
--- a/otherlibs/win32unix/winwait.c
+++ b/otherlibs/win32unix/winwait.c
@@ -40,7 +40,8 @@ static int wait_flag_table[] = { CAML_WNOHANG, CAML_WUNTRACED };
CAMLprim value win_waitpid(value vflags, value vpid_req)
{
- int status, flags;
+ int flags;
+ DWORD status;
HANDLE pid_req = (HANDLE) Long_val(vpid_req);
flags = convert_flag_list(vflags, wait_flag_table);