[MLton-commit] r4618

Ville Laurikari MLton@mlton.org
Sun, 28 May 2006 01:23:16 -0700


Updated to get runtime to build on HPPA/HP-UX.

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

U   mlton/branches/on-20050822-x86_64-branch/runtime/platform/hpux.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/platform/hpux.h

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

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform/hpux.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/hpux.c	2006-05-27 23:33:13 UTC (rev 4617)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/hpux.c	2006-05-28 08:23:14 UTC (rev 4618)
@@ -1,6 +1,5 @@
 #include "platform.h"
 
-
 #include <sys/mman.h>
 #include <sys/newsig.h>
 #include <sys/param.h>
@@ -16,19 +15,19 @@
 #include "use-mmap.c"
 
 extern unsigned char __text_start;
-extern unsigned_char etext;
+extern unsigned char etext;
 
-code_pointer getTextStart () {
+code_pointer GC_getTextStart (void) {
         return &__text_start;
 }
 
-code_pointer getTextEnd () {
+code_pointer GC_getTextEnd (void) {
         return &etext;
 }
 
 struct pstnames {
         int type;
-        char *name;
+        const char *name;
 };
 
 static struct pstnames pst_type_names[] =
@@ -64,31 +63,31 @@
 {
         static char fname[256];
 #ifdef PSTAT_FILEDETAILS
-        if (pstat_getpathname(fname, sizeof(fname), &vm.pst_fid) < 0)
+        if (pstat_getpathname (fname, sizeof (fname), &vm.pst_fid) < 0)
 #endif
-                strcpy(fname, "unknown");
+                strcpy (fname, "unknown");
         return fname;
 }
 
-void GC_displayMem () {
+void GC_displayMem (void) {
         int i;
         struct pst_vm_status buf;
-        size_t page_size = sysconf(_SC_PAGE_SIZE);
+        size_t page_size = sysconf (_SC_PAGE_SIZE);
 
         printf("va_start  va_end  perms   type   phys   filename\n");
         printf("--------+--------+-----+-------+------+-----------\n");
         for (i = 0;; i++) {
-                if (pstat_getprocvm (&buf, sizeof(buf), 0, i) < 0)
+                if (pstat_getprocvm (&buf, sizeof (buf), 0, i) < 0)
                         break;
                 printf("%p %p  %s%s%s  %-8s %4d   %s\n",
                        (void*)buf.pst_vaddr,
-                       (void*)buf.pst_vaddr + buf.pst_length * page_size - 1,
+                       (void*)(buf.pst_vaddr + buf.pst_length * page_size - 1),
                        (buf.pst_flags & PS_PROT_READ) ? "-" : "r",
                        (buf.pst_flags & PS_PROT_WRITE) ? "-" : "w",
                        (buf.pst_flags & PS_PROT_EXECUTE) ? "-" : "x",
-                       pst_type_name(buf.pst_type),
+                       pst_type_name (buf.pst_type),
                        buf.pst_phys_pages,
-                       pst_filename(buf));
+                       pst_filename (buf));
         }
 }
 
@@ -105,10 +104,10 @@
         sa->sa_sigaction = (void (*)(int, siginfo_t*, void*))catcher;
 }
 
-W32 GC_totalRam (GC_state s) {
+size_t GC_totalRam (void) {
         struct pst_static buf;
 
-        if (pstat_getstatic (&buf, sizeof(buf), 1, 0) < 0)
+        if (pstat_getstatic (&buf, sizeof (buf), 1, 0) < 0)
                 diee ("failed to get physical memory size");
         return buf.physical_memory * buf.page_size;
 }

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform/hpux.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/hpux.h	2006-05-27 23:33:13 UTC (rev 4617)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/hpux.h	2006-05-28 08:23:14 UTC (rev 4618)
@@ -2,25 +2,25 @@
 #define _XOPEN_SOURCE_EXTENDED
 #endif
 
+#include <fenv.h>
+#include <grp.h>
 #include <inttypes.h>
 #include <math.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <poll.h>
 #include <signal.h>
-#include <poll.h>
-#include <termios.h>
+#include <sys/poll.h>
+#include <sys/ptrace.h>
 #include <sys/resource.h>
-#include <sys/ptrace.h>
-#include <sys/poll.h>
 #include <sys/socket.h>
+#include <sys/times.h>
 #include <sys/un.h>
-#include <sys/times.h>
 #include <sys/utsname.h>
+#include <syslog.h>
 #include <termios.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <netdb.h>
-#include <grp.h>
-#include <fenv.h>
-#include <syslog.h>
+#include <termios.h>
 
 #include "setenv.h"
 
@@ -43,8 +43,28 @@
 
 #ifndef PF_INET6
 /* Old versions of HP-UX don't have IPv6 support. */
-struct sockaddr_in6 {};
+struct sockaddr_in6 { char dummy; };
+#define sockaddr_storage sockaddr_in
 #define PF_INET6 0
+#define AF_INET6 0
 #endif
 
-extern char **environ; /* for Posix_ProcEnv_environ */
+typedef long suseconds_t;
+
+/* These GCC builtins aren't defined in the system headers. */
+float modff(float x, float *iptr);
+float rintf(float x);
+float frexpf(float x, int *exp);
+float ldexpf(float x, int exp);
+
+#define PRIxPTR "lx"
+
+/* These are incorrectly defined in the system headers. */
+#undef PRIu32
+#define PRIu32 "u"
+#undef PRIx32
+#define PRIx32 "x"
+#undef PRId32
+#define PRId32 "d"
+
+#define SIZE_MAX ((size_t)SSIZE_MAX * 2 + 1)