[project @ 1996-07-19 18:36:04 by partain]
[ghc-hetmet.git] / ghc / runtime / storage / mprotect.lc
index 8c50a6e..96bd44b 100644 (file)
@@ -10,7 +10,6 @@
 Is @mprotect@ POSIX now?
 
 \begin{code}
-
 #if STACK_CHECK_BY_PAGE_FAULT
 
 /* #define STK_CHK_DEBUG */
@@ -36,13 +35,23 @@ Is @mprotect@ POSIX now?
 #  if defined(HAVE_GETPAGESIZE)
 #   define GETPAGESIZE()    getpagesize()
 #  else
-#   error getpagesize
+#   if defined(linux_TARGET_OS) || defined(linuxaout_TARGET_OS)
+#    /* it has it, but it is in BSD land; easier to just say so */
+#    define GETPAGESIZE()   getpagesize()
+#   else 
+#    error getpagesize
+#   endif
 #  endif
 # endif
 
 #if defined(sunos4_TARGET_OS)
-extern int getpagesize PROTO((void));
-extern int mprotect PROTO((caddr_t, size_t, int));
+int getpagesize PROTO((void));
+int mprotect PROTO((caddr_t, size_t, int));
+#endif
+
+/* Needed for FreeBSD (SDM, 96/03) */
+#ifndef PROT_NONE
+#define PROT_NONE 0
 #endif
 
 void 
@@ -65,7 +74,7 @@ int size;
     }
     if (mprotect(middle, pagesize, PROT_NONE) == -1) {
        perror("mprotect");
-       exit(1);
+       EXIT(EXIT_FAILURE);
     }
     if (install_segv_handler()) {
        fprintf(stderr, "Can't install SIGSEGV handler for stack overflow check.\n");
@@ -74,5 +83,4 @@ int size;
 }
 
 #endif /* STACK_CHECK_BY_PAGE_FAULT */
-
 \end{code}