[MLton-commit] r7287

Wesley Terpstra wesley at mlton.org
Sat Oct 17 15:04:23 PDT 2009


I know I said hurd seemed like it would be hard work, but ...
Pretty much all that needed to be done was add it to the OS datatype!
If you find this patch too intrusive, revert it.

However, the regressions mostly all pass (no mlprof) and it is a debian 
architecture so I'd like to build it. A broken port is better than no port.

To be frank, the biggest problem with running the regressions is that the
hurd kernel keeps crashing! ... not the regressions. ;p


----------------------------------------------------------------------

U   mlton/trunk/basis-library/Makefile
U   mlton/trunk/basis-library/mlton/platform.sig
U   mlton/trunk/basis-library/mlton/platform.sml
U   mlton/trunk/basis-library/primitive/prim-mlton.sml
U   mlton/trunk/basis-library/sml-nj/sml-nj.sml
U   mlton/trunk/bin/add-cross
U   mlton/trunk/bin/platform
U   mlton/trunk/man/mlton.1
U   mlton/trunk/mlnlffigen/control.sml
U   mlton/trunk/runtime/cenv.h
A   mlton/trunk/runtime/platform/hurd.c
A   mlton/trunk/runtime/platform/hurd.h

----------------------------------------------------------------------

Modified: mlton/trunk/basis-library/Makefile
===================================================================
--- mlton/trunk/basis-library/Makefile	2009-10-17 21:51:54 UTC (rev 7286)
+++ mlton/trunk/basis-library/Makefile	2009-10-17 22:04:20 UTC (rev 7287)
@@ -24,7 +24,7 @@
 HEADER_MAPS = header-word32.map header-word64.map
 SEQINDEX_MAPS = seqindex-int32.map seqindex-int64.map 
 TARGET_ARCH = amd64 hppa powerpc sparc x86
-TARGET_OS = cygwin darwin freebsd hpux linux mingw netbsd openbsd solaris 
+TARGET_OS = cygwin darwin freebsd hurd hpux linux mingw netbsd openbsd solaris 
 DEFAULT_CHAR = char8
 DEFAULT_INT = int32 int64 intinf
 DEFAULT_REAL = real32 real64

Modified: mlton/trunk/basis-library/mlton/platform.sig
===================================================================
--- mlton/trunk/basis-library/mlton/platform.sig	2009-10-17 21:51:54 UTC (rev 7286)
+++ mlton/trunk/basis-library/mlton/platform.sig	2009-10-17 22:04:20 UTC (rev 7287)
@@ -28,7 +28,7 @@
 
       structure OS:
          sig
-            datatype t = AIX | Cygwin | Darwin | FreeBSD | HPUX
+            datatype t = AIX | Cygwin | Darwin | FreeBSD | Hurd | HPUX
                        | Linux | MinGW | NetBSD | OpenBSD | Solaris
 
             val fromString: string -> t option

Modified: mlton/trunk/basis-library/mlton/platform.sml
===================================================================
--- mlton/trunk/basis-library/mlton/platform.sml	2009-10-17 21:51:54 UTC (rev 7286)
+++ mlton/trunk/basis-library/mlton/platform.sml	2009-10-17 22:04:20 UTC (rev 7287)
@@ -69,6 +69,7 @@
                 (Cygwin, "Cygwin"),
                 (Darwin, "Darwin"),
                 (FreeBSD, "FreeBSD"),
+                (Hurd, "Hurd"),
                 (HPUX, "HPUX"),
                 (Linux, "Linux"),
                 (MinGW, "MinGW"),

Modified: mlton/trunk/basis-library/primitive/prim-mlton.sml
===================================================================
--- mlton/trunk/basis-library/primitive/prim-mlton.sml	2009-10-17 21:51:54 UTC (rev 7286)
+++ mlton/trunk/basis-library/primitive/prim-mlton.sml	2009-10-17 22:04:20 UTC (rev 7287)
@@ -202,6 +202,7 @@
              | Cygwin
              | Darwin
              | FreeBSD
+             | Hurd
              | HPUX
              | Linux
              | MinGW
@@ -215,6 +216,7 @@
                 | "cygwin" => Cygwin
                 | "darwin" => Darwin
                 | "freebsd" => FreeBSD
+                | "hurd" => Hurd
                 | "hpux" => HPUX
                 | "linux" => Linux
                 | "mingw" => MinGW

Modified: mlton/trunk/basis-library/sml-nj/sml-nj.sml
===================================================================
--- mlton/trunk/basis-library/sml-nj/sml-nj.sml	2009-10-17 21:51:54 UTC (rev 7286)
+++ mlton/trunk/basis-library/sml-nj/sml-nj.sml	2009-10-17 22:04:20 UTC (rev 7287)
@@ -35,6 +35,7 @@
                    | Cygwin => UNIX
                    | Darwin => MACOS
                    | FreeBSD => UNIX
+                   | Hurd => UNIX
                    | HPUX => UNIX
                    | Linux => UNIX
                    | MinGW => WIN32

Modified: mlton/trunk/bin/add-cross
===================================================================
--- mlton/trunk/bin/add-cross	2009-10-17 21:51:54 UTC (rev 7286)
+++ mlton/trunk/bin/add-cross	2009-10-17 22:04:20 UTC (rev 7287)
@@ -137,6 +137,9 @@
 freebsd)
         osOpts='-I/usr/local/include -L/usr/local/lib/'
 ;;
+hurd)
+        osOpts=''
+;;
 hpux)
         osOpts=''
 ;;

Modified: mlton/trunk/bin/platform
===================================================================
--- mlton/trunk/bin/platform	2009-10-17 21:51:54 UTC (rev 7286)
+++ mlton/trunk/bin/platform	2009-10-17 22:04:20 UTC (rev 7287)
@@ -43,6 +43,9 @@
 *FreeBSD*)
         HOST_OS='freebsd'
 ;;
+GNU)
+        HOST_OS='hurd'
+;;
 HP-UX)
 	HOST_OS='hpux'
 ;;
@@ -127,7 +130,7 @@
 sun*)
         HOST_ARCH=sparc
 ;;
-i?86)
+i?86*)
         HOST_ARCH=x86
 ;;
 *)

Modified: mlton/trunk/man/mlton.1
===================================================================
--- mlton/trunk/man/mlton.1	2009-10-17 21:51:54 UTC (rev 7286)
+++ mlton/trunk/man/mlton.1	2009-10-17 22:04:20 UTC (rev 7287)
@@ -258,7 +258,7 @@
 Valid values for \fItarget\fP are:
 \fBalpha\fP, \fBamd64\fP, \fBarm,\fP, \fBhppa\fP, \fBia64\fP, \fBm68k\fP,
 \fBmips\fP, \fBpowerpc\fP, \fBpowerpc64\fP, \fBs390\fP, \fBsparc\fP, \fBx86\fP,
-\fBaix\fP, \fBcygwin\fP, \fBdarwin\fP, \fBfreebsd\fP, \fBhpux\fP, 
+\fBaix\fP, \fBcygwin\fP, \fBdarwin\fP, \fBfreebsd\fP, \fBhurd\fP, \fBhpux\fP, 
 \fBlinux\fP, \fBmingw\fP, \fBnetbsd\fP, \fBopenbsd\fP, \fBsolaris\fP.
 
 .TP

Modified: mlton/trunk/mlnlffigen/control.sml
===================================================================
--- mlton/trunk/mlnlffigen/control.sml	2009-10-17 21:51:54 UTC (rev 7286)
+++ mlton/trunk/mlnlffigen/control.sml	2009-10-17 22:04:20 UTC (rev 7287)
@@ -103,6 +103,8 @@
                                 endianShift = EndianLittle.shift}
           | (HPPA, _) => SOME {name = toString t, sizes = SizesHPPA.sizes,
                                endianShift = EndianBig.shift}
+          | (IA64, Hurd) => SOME {name = toString t, sizes = SizesIA64.sizes,
+                                  endianShift = EndianBig.shift}
           | (IA64, HPUX) => SOME {name = toString t, sizes = SizesIA64.sizes,
                                   endianShift = EndianBig.shift}
           | (IA64, Linux) => SOME {name = toString t, sizes = SizesIA64.sizes,

Modified: mlton/trunk/runtime/cenv.h
===================================================================
--- mlton/trunk/runtime/cenv.h	2009-10-17 21:51:54 UTC (rev 7286)
+++ mlton/trunk/runtime/cenv.h	2009-10-17 22:04:20 UTC (rev 7287)
@@ -16,7 +16,7 @@
 /* Only enable _POSIX_C_SOURCE on platforms that don't have broken
  * system headers.
  */
-#if (defined (__linux__))
+#if (defined (__linux__) || defined(__GNU__))
 #define _POSIX_C_SOURCE 200112L
 #endif
 #define _FILE_OFFSET_BITS 64
@@ -75,6 +75,8 @@
 #include "platform/freebsd.h"
 #elif (defined (__hpux__))
 #include "platform/hpux.h"
+#elif (defined (__GNU__))
+#include "platform/hurd.h"
 #elif (defined (__linux__))
 #include "platform/linux.h"
 #elif (defined (__MINGW32__))

Added: mlton/trunk/runtime/platform/hurd.c
===================================================================
--- mlton/trunk/runtime/platform/hurd.c	2009-10-17 21:51:54 UTC (rev 7286)
+++ mlton/trunk/runtime/platform/hurd.c	2009-10-17 22:04:20 UTC (rev 7287)
@@ -0,0 +1,20 @@
+#define _GNU_SOURCE
+
+#include "platform.h"
+
+#include "diskBack.unix.c"
+#include "mkdir2.c"
+#include "displayMem.linux.c"
+#include "mmap-protect.c"
+#include "nonwin.c"
+#include "use-mmap.c"
+#include "sysconf.c"
+#include "mremap.c"
+
+void* GC_extendHead (void *base, size_t length) {
+        return mmapAnon (base, length);
+}
+
+void* GC_extendTail (void *base, size_t length) {
+        return mmapAnon (base, length);
+}

Added: mlton/trunk/runtime/platform/hurd.h
===================================================================
--- mlton/trunk/runtime/platform/hurd.h	2009-10-17 21:51:54 UTC (rev 7286)
+++ mlton/trunk/runtime/platform/hurd.h	2009-10-17 22:04:20 UTC (rev 7287)
@@ -0,0 +1,44 @@
+#include <inttypes.h>
+#include <stdint.h>
+#include <fenv.h>
+
+#include <unistd.h>
+
+#include <dirent.h>
+#include <fcntl.h>
+#include <grp.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <poll.h>
+#include <pwd.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/resource.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/times.h>
+#include <sys/un.h>
+#include <sys/utsname.h>
+#include <sys/wait.h>
+#include <sys/sysinfo.h>
+#include <syslog.h>
+#include <termios.h>
+#include <utime.h>
+
+#define HAS_FEROUND TRUE
+#define HAS_FPCLASSIFY TRUE
+#define HAS_MSG_DONTWAIT TRUE
+#define HAS_REMAP TRUE
+#define HAS_SIGALTSTACK TRUE
+#define HAS_SIGNBIT TRUE
+#define HAS_SPAWN FALSE
+#define HAS_TIME_PROFILING FALSE
+
+#define MLton_Platform_OS_host "hurd"
+
+// environ is already defined if _GNU_SOURCE is.
+#ifndef _GNU_SOURCE
+extern char **environ; /* for Posix_ProcEnv_environ */
+#endif




More information about the MLton-commit mailing list