Change the story about POSIX headers in C compilation.
Until now, all C code in the RTS and library cbits has by default been
compiled with settings for POSIXness enabled, that is:
#define _POSIX_SOURCE 1
#define _POSIX_C_SOURCE 199309L
#define _ISOC9X_SOURCE
If you wanted to negate this, you'd have to define NON_POSIX_SOURCE
before including headers.
This scheme has some bad effects:
* It means that ccall-unfoldings exported via interfaces from a
module compiled with -DNON_POSIX_SOURCE may not compile when
imported into a module which does not -DNON_POSIX_SOURCE.
* It overlaps with the feature tests we do with autoconf.
* It seems to have caused borkage in the Solaris builds for some
considerable period of time.
The New Way is:
* The default changes to not-being-in-Posix mode.
* If you want to force a C file into Posix mode, #include as
the **first** include the new file ghc/includes/PosixSource.h.
Most of the RTS C sources have this include now.
* NON_POSIX_SOURCE is almost totally expunged. Unfortunately
we have to retain some vestiges of it in ghc/compiler so that
modules compiled via C on Solaris using older compilers don't
break.
AC_HEADER_STDC
dnl ** check for specific header (.h) files that we are interested in
-AC_CHECK_HEADERS(Files.h arpa/inet.h assert.h console.h ctype.h dirent.h errno.h fcntl.h float.h ftw.h grp.h ieee754.h inttypes.h malloc.h memory.h nlist.h pascal.h pwd.h sgtty.h siginfo.h signal.h stat.h stdint.h stdlib.h stdarg.h string.h sys/fault.h sys/file.h sys/ioctl.h sys/limits.h sys/mman.h sys/param.h sys/procfs.h sys/resource.h sys/signal.h sys/socket.h netdb.h netinet/in.h netinet/tcp.h sys/stat.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/types.h sys/un.h sys/utsname.h sys/vadvise.h sys/wait.h termio.h termios.h time.h types.h unistd.h utime.h values.h vfork.h bfd.h winsock.h)
+AC_CHECK_HEADERS(Files.h arpa/inet.h assert.h console.h ctype.h dirent.h errno.h fcntl.h float.h ftw.h grp.h ieee754.h inttypes.h limits.h malloc.h memory.h nlist.h pascal.h pwd.h sgtty.h siginfo.h signal.h stat.h stdint.h stdlib.h stdarg.h string.h sys/fault.h sys/file.h sys/ioctl.h sys/limits.h sys/mman.h sys/param.h sys/procfs.h sys/resource.h sys/signal.h sys/socket.h netdb.h netinet/in.h netinet/tcp.h sys/stat.h sys/syscall.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/types.h sys/un.h sys/utsname.h sys/vadvise.h sys/wait.h termio.h termios.h time.h types.h unistd.h utime.h values.h vfork.h bfd.h winsock.h)
AC_CHECK_HEADER(readline/readline.h, HaveReadlineReadlineH=YES, HaveReadlineReadlineH=NO)
AC_CHECK_HEADER(readline/history.h, HaveReadlineHistoryH=YES, HaveReadlineHistoryH=NO)
\section[ByteCodeItbls]{Generate infotables for interpreter-made bytecodes}
\begin{code}
+
+{-# OPTIONS -optc-DNON_POSIX_SOURCE #-}
+
module ByteCodeItbls ( ItblEnv, ItblPtr, mkITbls ) where
#include "HsVersions.h"
\section[ByteCodeLink]{Bytecode assembler and linker}
\begin{code}
+
+{-# OPTIONS -optc-DNON_POSIX_SOURCE #-}
+
module ByteCodeLink ( UnlinkedBCO, UnlinkedBCOExpr, assembleBCO,
ClosureEnv, HValue, filterNameMap,
linkIModules, linkIExpr,
-----------------------------------------------------------------------------
--- $Id: DriverState.hs,v 1.53 2001/08/13 15:49:38 simonmar Exp $
+-- $Id: DriverState.hs,v 1.54 2001/08/14 13:40:08 sewardj Exp $
--
-- Settings for the driver
--
GLOBAL_VAR(v_MaxSimplifierIterations, 4, Int)
GLOBAL_VAR(v_StgStats, False, Bool)
GLOBAL_VAR(v_UsageSPInf, False, Bool) -- Off by default
-GLOBAL_VAR(v_Strictness, True, Bool)
+GLOBAL_VAR(v_Strictness, False{-True-}, Bool)
GLOBAL_VAR(v_CPR, True, Bool)
GLOBAL_VAR(v_CSE, True, Bool)
-{-# OPTIONS -fno-warn-incomplete-patterns #-}
+{-# OPTIONS -fno-warn-incomplete-patterns -optc-DNON_POSIX_SOURCE #-}
+
-----------------------------------------------------------------------------
--- $Id: Main.hs,v 1.86 2001/08/13 15:49:38 simonmar Exp $
+-- $Id: Main.hs,v 1.87 2001/08/14 13:40:08 sewardj Exp $
--
-- GHC Driver program
--
(i1 + i2) only if it results in a valid Float.
\begin{code}
+
+{-# OPTIONS -optc-DNON_POSIX_SOURCE #-}
+
module PrelRules ( primOpRule, builtinRules ) where
#include "HsVersions.h"
subsystem, mostly.
\begin{code}
-{-# OPTIONS -fvia-C -monly-3-regs #-}
+{-# OPTIONS -monly-3-regs -optc-DNON_POSIX_SOURCE #-}
module PrimPacked
(
strLength, -- :: _Addr -> Int
\begin{code}
-{-# OPTIONS -fvia-C #-}
+{-# OPTIONS -optc-DNON_POSIX_SOURCE #-}
module StringBuffer
(
--- /dev/null
+/* -----------------------------------------------------------------------------
+ * $Id: PosixSource.h,v 1.1 2001/08/14 13:40:08 sewardj Exp $
+ *
+ * (c) The GHC Team, 1998-2001
+ *
+ * Include this file into sources which should not need any non-Posix services.
+ * That includes most RTS C sources.
+ * ---------------------------------------------------------------------------*/
+
+#ifndef POSIXSOURCE_H
+#define POSIXSOURCE_H
+
+#define _POSIX_SOURCE 1
+#define _POSIX_C_SOURCE 199309L
+#define _ISOC9X_SOURCE
+
+/* Let's be ISO C9X too... */
+
+#endif
/* -----------------------------------------------------------------------------
- * $Id: Stg.h,v 1.36 2001/03/01 12:25:32 rrt Exp $
+ * $Id: Stg.h,v 1.37 2001/08/14 13:40:08 sewardj Exp $
*
* (c) The GHC Team, 1998-1999
*
#ifndef STG_H
#define STG_H
-#ifndef NON_POSIX_SOURCE
-#define _POSIX_SOURCE 1
-#define _POSIX_C_SOURCE 199309L
-#define _ISOC9X_SOURCE
-#endif
-
-/* Let's be ISO C9X too... */
/* If we include "Stg.h" directly, we're in STG code, and we therefore
* get all the global register variables, macros etc. that go along
-{-# OPTIONS -fno-implicit-prelude -optc-DNON_POSIX_SOURCE #-}
+{-# OPTIONS -fno-implicit-prelude #-}
-- ---------------------------------------------------------------------------
--- $Id: PrelPosix.hsc,v 1.10 2001/08/10 11:02:00 simonmar Exp $
+-- $Id: PrelPosix.hsc,v 1.11 2001/08/14 13:40:08 sewardj Exp $
--
-- POSIX support layer for the standard libraries
--
--- NON_POSIX_SOURCE needed for the following features:
+-- Non-posix compliant in order to support the following features:
-- * S_ISSOCK (no sockets in POSIX)
module PrelPosix where
+-- See above comment for non-Posixness reasons.
+-- #include "PosixSource.h"
+
#include "HsStd.h"
import PrelBase
-{-# OPTIONS -optc-DNON_POSIX_SOURCE #-}
--- JRS 010117: we had to say NON_POSIX_SOURCE to get the resulting .hc
--- to compile on sparc-solaris. Blargh.
-- -----------------------------------------------------------------------------
--- $Id: Time.hsc,v 1.19 2001/07/24 05:53:27 ken Exp $
+-- $Id: Time.hsc,v 1.20 2001/08/14 13:40:08 sewardj Exp $
--
-- (c) The University of Glasgow, 1995-2001
--
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
- * $Id: inputReady.c,v 1.8 2001/07/09 16:30:50 sof Exp $
+ * $Id: inputReady.c,v 1.9 2001/08/14 13:40:08 sewardj Exp $
*
* hReady Runtime Support
*/
-/* select and supporting types is not */
-#ifndef _AIX
-#define NON_POSIX_SOURCE
-#endif
-
+/* select and supporting types is not Posix */
+/* #include "PosixSource.h" */
#include "HsStd.h"
/*
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
- * $Id: system.c,v 1.17 2001/08/07 08:18:15 rrt Exp $
+ * $Id: system.c,v 1.18 2001/08/14 13:40:08 sewardj Exp $
*
* system Runtime Support
*/
/* The itimer stuff in this module is non-posix */
-#define NON_POSIX_SOURCE
+/* #include "PosixSource.h" */
#include "HsStd.h"
Haskell side.
*/
+#include "PosixSource.h"
#include "Rts.h"
#include "RtsUtils.h"
#include "RtsFlags.h"
/* -----------------------------------------------------------------------------
- * $Id: BlockAlloc.c,v 1.9 2001/07/23 17:23:19 simonmar Exp $
+ * $Id: BlockAlloc.c,v 1.10 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team 1998-2000
*
*
* ---------------------------------------------------------------------------*/
+#include "PosixSource.h"
#include "Rts.h"
#include "RtsFlags.h"
#include "RtsUtils.h"
/* -----------------------------------------------------------------------------
- * $Id: ClosureFlags.c,v 1.10 2001/07/23 17:23:19 simonmar Exp $
+ * $Id: ClosureFlags.c,v 1.11 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team 1998-1999
*
*
* ---------------------------------------------------------------------------*/
+#include "PosixSource.h"
#include "Rts.h"
StgWord16 closure_flags[] = {
* Copyright (c) 1994-1998.
*
* $RCSfile: Disassembler.c,v $
- * $Revision: 1.23 $
- * $Date: 2001/08/09 11:19:16 $
+ * $Revision: 1.24 $
+ * $Date: 2001/08/14 13:40:09 $
* ---------------------------------------------------------------------------*/
#ifdef DEBUG
+#include "PosixSource.h"
#include "Rts.h"
#include "RtsAPI.h"
#include "RtsUtils.h"
/* -----------------------------------------------------------------------------
- * $Id: FrontPanel.c,v 1.4 2001/01/19 11:08:05 simonmar Exp $
+ * $Id: FrontPanel.c,v 1.5 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team 2000
*
#ifdef RTS_GTK_FRONTPANEL
-#define NON_POSIX_SOURCE
+/* Alas, not Posix. */
+/* #include "PosixSource.h" */
#include "Rts.h"
#include "RtsUtils.h"
/* -----------------------------------------------------------------------------
- * $Id: GC.c,v 1.119 2001/08/10 10:52:12 simonmar Exp $
+ * $Id: GC.c,v 1.120 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team 1998-1999
*
*
* ---------------------------------------------------------------------------*/
+#include "PosixSource.h"
#include "Rts.h"
#include "RtsFlags.h"
#include "RtsUtils.h"
/* -----------------------------------------------------------------------------
- * $Id: GCCompact.c,v 1.8 2001/08/10 09:40:11 simonmar Exp $
+ * $Id: GCCompact.c,v 1.9 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team 2001
*
*
* ---------------------------------------------------------------------------*/
+#include "PosixSource.h"
#include "Rts.h"
#include "RtsUtils.h"
#include "RtsFlags.h"
/*-----------------------------------------------------------------------------
- * $Id: Hash.c,v 1.5 2001/06/27 11:29:10 sewardj Exp $
+ * $Id: Hash.c,v 1.6 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The AQUA Project, Glasgow University, 1995-1998
* (c) The GHC Team, 1999
* pp. 446 -- 457.
* -------------------------------------------------------------------------- */
+#include "PosixSource.h"
#include "Rts.h"
#include "Hash.h"
#include "RtsUtils.h"
* Copyright (c) 1994-2000.
*
* $RCSfile: Interpreter.c,v $
- * $Revision: 1.29 $
- * $Date: 2001/08/09 11:23:19 $
+ * $Revision: 1.30 $
+ * $Date: 2001/08/14 13:40:09 $
* ---------------------------------------------------------------------------*/
+#include "PosixSource.h"
#include "Rts.h"
#include "RtsAPI.h"
#include "RtsUtils.h"
/* -----------------------------------------------------------------------------
- * $Id: Itimer.c,v 1.22 2001/03/02 10:52:15 simonmar Exp $
+ * $Id: Itimer.c,v 1.23 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1995-1999
*
* to support. So much for standards.
*/
-#if !defined(_AIX)
-# define NON_POSIX_SOURCE
-#endif
+/* This is not posix compliant. */
+/* #include "PosixSource.h" */
#include "Rts.h"
#include "RtsFlags.h"
/* -----------------------------------------------------------------------------
- * $Id: Linker.c,v 1.56 2001/08/13 14:34:40 simonmar Exp $
+ * $Id: Linker.c,v 1.57 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 2000
*
*
* ---------------------------------------------------------------------------*/
+#include "PosixSource.h"
#include "Rts.h"
#include "RtsFlags.h"
#include "HsFFI.h"
/* -----------------------------------------------------------------------------
- * $Id: LinkerBasic.c,v 1.2 2001/02/12 13:03:17 sewardj Exp $
+ * $Id: LinkerBasic.c,v 1.3 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 2000
*
*
* ---------------------------------------------------------------------------*/
+#include "PosixSource.h"
#include "Rts.h"
#include "Hash.h"
#include "StoragePriv.h"
/* -----------------------------------------------------------------------------
- * $Id: MBlock.c,v 1.22 2001/07/24 06:31:36 ken Exp $
+ * $Id: MBlock.c,v 1.23 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team 1998-1999
*
*
* ---------------------------------------------------------------------------*/
-#define NON_POSIX_SOURCE
+/* This is non-posix compliant. */
+/* #include "PosixSource.h" */
#include "Rts.h"
#include "RtsUtils.h"
/* -----------------------------------------------------------------------------
- * $Id: Main.c,v 1.29 2001/08/07 20:10:30 ken Exp $
+ * $Id: Main.c,v 1.30 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team 1998-2000
*
#define COMPILING_RTS_MAIN
+#include "PosixSource.h"
#include "Rts.h"
#include "RtsAPI.h"
#include "SchedAPI.h"
/* -----------------------------------------------------------------------------
- * $Id: Printer.c,v 1.44 2001/08/09 11:19:16 sewardj Exp $
+ * $Id: Printer.c,v 1.45 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1994-2000.
*
*
* ---------------------------------------------------------------------------*/
+#include "PosixSource.h"
#include "Rts.h"
#include "Printer.h"
/* -----------------------------------------------------------------------------
- * $Id: ProfHeap.c,v 1.24 2001/08/07 19:34:01 ken Exp $
+ * $Id: ProfHeap.c,v 1.25 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-2000
*
#if defined(PROFILING) || defined(DEBUG_HEAP_PROF)
+#include "PosixSource.h"
#include "Rts.h"
#include "RtsUtils.h"
#include "RtsFlags.h"
/* -----------------------------------------------------------------------------
- * $Id: Profiling.c,v 1.21 2001/07/23 23:37:35 andy Exp $
+ * $Id: Profiling.c,v 1.22 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-2000
*
#ifdef PROFILING
+#include "PosixSource.h"
#include "Rts.h"
#include "RtsUtils.h"
#include "RtsFlags.h"
/* -----------------------------------------------------------------------------
- * $Id: Proftimer.c,v 1.6 2000/04/03 15:54:49 simonmar Exp $
+ * $Id: Proftimer.c,v 1.7 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-1999
*
#if defined (PROFILING)
+#include "PosixSource.h"
#include "Rts.h"
#include "Profiling.h"
#include "Itimer.h"
/* ----------------------------------------------------------------------------
- * $Id: RtsAPI.c,v 1.27 2001/08/03 16:30:13 sof Exp $
+ * $Id: RtsAPI.c,v 1.28 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-2001
*
*
* --------------------------------------------------------------------------*/
+#include "PosixSource.h"
#include "Rts.h"
#include "Storage.h"
#include "RtsAPI.h"
/* ----------------------------------------------------------------------------
- * $Id: RtsAPIDeprec.c,v 1.1 2001/01/11 17:25:56 simonmar Exp $
+ * $Id: RtsAPIDeprec.c,v 1.2 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-2001
*
*
* --------------------------------------------------------------------------*/
+#include "PosixSource.h"
#include "Rts.h"
#include "RtsUtils.h"
#include "Storage.h"
/* -----------------------------------------------------------------------------
- * $Id: RtsDllMain.c,v 1.2 2000/04/26 17:27:00 rrt Exp $
+ * $Id: RtsDllMain.c,v 1.3 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team 1999-2000
*
*
* ---------------------------------------------------------------------------*/
+#include "PosixSource.h"
#include "Rts.h"
#include "RtsAPI.h"
/* -----------------------------------------------------------------------------
- * $Id: RtsFlags.c,v 1.48 2001/08/13 12:34:37 simonmar Exp $
+ * $Id: RtsFlags.c,v 1.49 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The AQUA Project, Glasgow University, 1994-1997
* (c) The GHC Team, 1998-1999
//@node Includes, Constants
//@subsection Includes
+#include "PosixSource.h"
#include "Rts.h"
#include "RtsFlags.h"
#include "RtsUtils.h"
/* -----------------------------------------------------------------------------
- * $Id: RtsStartup.c,v 1.51 2001/05/25 18:33:46 sof Exp $
+ * $Id: RtsStartup.c,v 1.52 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-2000
*
*
* ---------------------------------------------------------------------------*/
+#include "PosixSource.h"
#include "Rts.h"
#include "RtsAPI.h"
#include "RtsUtils.h"
/* -----------------------------------------------------------------------------
- * $Id: RtsUtils.c,v 1.19 2001/07/24 06:31:36 ken Exp $
+ * $Id: RtsUtils.c,v 1.20 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-1999
*
* ---------------------------------------------------------------------------*/
/* gettimeofday isn't POSIX */
-#define NON_POSIX_SOURCE
+/* #include "PosixSource.h" */
#include "Rts.h"
#include "RtsTypes.h"
/* -----------------------------------------------------------------------------
- * $Id: Sanity.c,v 1.29 2001/07/24 05:04:59 ken Exp $
+ * $Id: Sanity.c,v 1.30 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-2001
*
*
* ---------------------------------------------------------------------------*/
+#include "PosixSource.h"
#include "Rts.h"
#ifdef DEBUG /* whole file */
/* ---------------------------------------------------------------------------
- * $Id: Schedule.c,v 1.99 2001/07/30 09:47:13 simonmar Exp $
+ * $Id: Schedule.c,v 1.100 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-2000
*
//@node Includes, Variables and Data structures, Main scheduling code, Main scheduling code
//@subsection Includes
+#include "PosixSource.h"
#include "Rts.h"
#include "SchedAPI.h"
#include "RtsUtils.h"
/* -----------------------------------------------------------------------------
- * $Id: Select.c,v 1.16 2001/02/28 14:23:55 sewardj Exp $
+ * $Id: Select.c,v 1.17 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team 1995-1999
*
* ---------------------------------------------------------------------------*/
/* we're outside the realms of POSIX here... */
-#define NON_POSIX_SOURCE
+/* #include "PosixSource.h" */
#include "Rts.h"
#include "Schedule.h"
/* -----------------------------------------------------------------------------
- * $Id: Signals.c,v 1.20 2001/07/26 03:24:01 ken Exp $
+ * $Id: Signals.c,v 1.21 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-1999
*
*
* ---------------------------------------------------------------------------*/
-#define NON_POSIX_SOURCE
-
+/* This is non=Posix compliant.
+ #include "PosixSource.h"
+*/
#include "Rts.h"
#include "SchedAPI.h"
#include "Schedule.h"
/* ---------------------------------------------------------------------------
- * $Id: Sparks.c,v 1.3 2001/03/22 03:51:10 hwloidl Exp $
+ * $Id: Sparks.c,v 1.4 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 2000
*
//@node Includes, GUM code, Spark Management Routines, Spark Management Routines
//@subsection Includes
+#include "PosixSource.h"
#include "Rts.h"
#include "Schedule.h"
#include "SchedAPI.h"
/* -----------------------------------------------------------------------------
- * $Id: Stable.c,v 1.16 2001/08/08 16:03:47 simonmar Exp $
+ * $Id: Stable.c,v 1.17 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-1999
*
*
* ---------------------------------------------------------------------------*/
+#include "PosixSource.h"
#include "Rts.h"
#include "Hash.h"
#include "StablePriv.h"
/* -----------------------------------------------------------------------------
- * $Id: Stats.c,v 1.31 2001/07/23 17:23:20 simonmar Exp $
+ * $Id: Stats.c,v 1.32 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-1999
*
*
* ---------------------------------------------------------------------------*/
-#define NON_POSIX_SOURCE
+/* Alas, no. This source is non-posix.
+ #include "PosixSource.h"
+*/
#include "Rts.h"
#include "RtsFlags.h"
/* -----------------------------------------------------------------------------
- * $Id: StgCRun.c,v 1.25 2001/08/07 20:06:41 ken Exp $
+ * $Id: StgCRun.c,v 1.26 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-2000
*
*
* -------------------------------------------------------------------------- */
+#include "PosixSource.h"
+
/*
* We define the following (unused) global register variables, because for
any architecture (using miniinterpreter)
-------------------------------------------------------------------------- */
-/* The static @jmp_environment@ variable allows @miniInterpret@ to
- * communicate with @StgReturn@.
- *
- * Because @StgRun@ may be used recursively, we carefully
- * save and restore the whole of @jmp_environment@.
- */
-#include <setjmp.h>
-#include <string.h> /* for memcpy */
-
-static jmp_buf jmp_environment;
-
-#if 1
-
extern StgThreadReturnCode StgRun(StgFunPtr f, StgRegTable *basereg)
{
while (f) {
return 0;
}
-#else
-
-#define CHECK_STACK 0
-#define STACK_DETAILS 0
-
-static int enters = 0;
-
-static void scanStackSeg ( W_* ptr, int nwords )
-{
- W_ w;
-#if CHECK_STACK
- int nwords0 = nwords;
-#if STACK_DETAILS
- while (nwords > 0) {
- w = *ptr;
- if (IS_ARG_TAG(w)) {
- fprintf ( stderr, "%d",w ); nwords--; ptr++;
- while (w) { fprintf(stderr, "_"); w--; nwords--; ptr++; }
- }
- else {
- fprintf(stderr, "p");
- nwords--; ptr++;
- }
- }
- if (nwords < 0) fprintf(stderr, "erk: nwords < 0\n");
-#endif
- checkStackChunk ( ptr, ptr-nwords0 );
-#endif
-}
-
-extern StgFunPtr stg_enterStackTop;
-extern StgThreadReturnCode StgRun(StgFunPtr f, StgRegTable *basereg)
-{
- char* nm;
- while (1) {
-
-#if CHECK_STACK
- {
- int i;
- StgTSO* tso = basereg->rCurrentTSO;
- StgWord* sb = tso->stack + tso->stack_size;
- StgWord* sp;
- StgWord* su;
- int ws;
-
- if (f == &stg_enterStackTop) {
- sp = tso->sp;
- su = tso->su;
- } else {
- sp = basereg->rSp;
- su = basereg->rSu;
- }
-
-#if STACK_DETAILS
- fprintf(stderr,
- "== SB = %p SP = %p(%p) SU = %p SpLim = %p(%p)\n",
- sb, sp, tso->sp, su, basereg->rSpLim, tso->stack + RESERVED_STACK_WORDS);
-#endif
-
- if (su >= sb) goto postloop;
- if (!sp || !su) goto postloop;
-
- printStack ( sp, sb, su);
-
- while (1) {
- ws = su - sp;
- switch (get_itbl((StgClosure*)su)->type) {
- case STOP_FRAME:
- scanStackSeg(sp,ws);
-#if STACK_DETAILS
- fprintf(stderr, "S%d ",ws);
- fprintf(stderr, "\n");
-#endif
- goto postloop;
- case UPDATE_FRAME:
- scanStackSeg(sp,ws);
-#if STACK_DETAILS
- fprintf(stderr,"U%d ",ws);
-#endif
- sp = su + sizeofW(StgUpdateFrame);
- su = ((StgUpdateFrame*)su)->link;
- break;
- case SEQ_FRAME:
- scanStackSeg(sp,ws);
-#if STACK_DETAILS
- fprintf(stderr,"Q%d ",ws);
-#endif
- sp = su + sizeofW(StgSeqFrame);
- su = ((StgSeqFrame*)su)->link;
- break;
- case CATCH_FRAME:
- scanStackSeg(sp,ws);
-#if STACK_DETAILS
- fprintf(stderr,"C%d ",ws);
-#endif
- sp = su + sizeofW(StgCatchFrame);
- su = ((StgCatchFrame*)su)->link;
- break;
- default:
- fprintf(stderr, "?\nweird record on stack\n");
- assert(0);
- goto postloop;
- }
- }
- postloop:
- }
-#endif
-#if STACK_DETAILS
- fprintf(stderr,"\n");
-#endif
-#if 1
- fprintf(stderr,"-- enter %p ", f);
- nm = nameFromOPtr ( f );
- if (nm) fprintf(stderr, "%s", nm); else
- printPtr((P_)f);
- fprintf ( stderr, "\n");
-#endif
-#if STACK_DETAILS
- fprintf(stderr,"\n");
-#endif
- zzz:
- if (enters % 1000 == 0) fprintf(stderr, "%d enters\n",enters);
- enters++;
- f = (StgFunPtr) (f)();
- if (!f) break;
- }
- fprintf (stderr, "miniInterpreter: bye!\n\n" );
- return (StgThreadReturnCode)R1.i;
-}
-
-EXTFUN(StgReturn)
-{
- return 0;
-}
-#endif
-
-
-
#else /* !USE_MINIINTERPRETER */
#ifdef LEADING_UNDERSCORE
/* -----------------------------------------------------------------------------
- * $Id: StgPrimFloat.c,v 1.7 2001/07/23 23:29:47 ken Exp $
+ * $Id: StgPrimFloat.c,v 1.8 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-2000
*
*
* ---------------------------------------------------------------------------*/
+#include "PosixSource.h"
#include "Rts.h"
/*
/* -----------------------------------------------------------------------------
- * $Id: Storage.c,v 1.48 2001/08/09 12:46:06 sewardj Exp $
+ * $Id: Storage.c,v 1.49 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-1999
*
*
* ---------------------------------------------------------------------------*/
+#include "PosixSource.h"
#include "Rts.h"
#include "RtsUtils.h"
#include "RtsFlags.h"
/* -----------------------------------------------------------------------------
- * $Id: StrHash.c,v 1.2 2000/08/07 23:37:23 qrczak Exp $
+ * $Id: StrHash.c,v 1.3 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1994-2000
*
*
* ---------------------------------------------------------------------------*/
+#include "PosixSource.h"
#include "Rts.h"
#include "StrHash.h"
/* -----------------------------------------------------------------------------
- * $Id: Ticky.c,v 1.12 1999/11/11 17:50:48 simonpj Exp $
+ * $Id: Ticky.c,v 1.13 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The AQUA project, Glasgow University, 1992-1997
* (c) The GHC Team, 1998-1999
#if defined(TICKY_TICKY)
#define TICKY_C /* define those variables */
+#include "PosixSource.h"
#include "Rts.h"
#include "RtsFlags.h"
#include "Ticky.h"
/* -----------------------------------------------------------------------------
- * $Id: VisCallbacks.c,v 1.1 2000/11/01 11:41:47 simonmar Exp $
+ * $Id: VisCallbacks.c,v 1.2 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team 2000
*
#ifdef RTS_GTK_FRONTPANEL
-#define NON_POSIX_SOURCE
-
#include "Rts.h"
#include <gtk/gtk.h>
/* -----------------------------------------------------------------------------
- * $Id: Weak.c,v 1.17 2000/12/04 12:31:22 simonmar Exp $
+ * $Id: Weak.c,v 1.18 2001/08/14 13:40:09 sewardj Exp $
*
* (c) The GHC Team, 1998-1999
*
*
* ---------------------------------------------------------------------------*/
+#include "PosixSource.h"
#include "Rts.h"
#include "RtsAPI.h"
#include "SchedAPI.h"
/* ----------------------------------------------------------------------------
* Time-stamp: <Wed Mar 21 2001 16:34:41 Stardate: [-30]6363.45 hwloidl>
- * $Id: HLComms.c,v 1.5 2001/05/28 07:13:54 sof Exp $
+ * $Id: HLComms.c,v 1.6 2001/08/14 13:40:10 sewardj Exp $
*
* High Level Communications Routines (HLComms.lc)
*
//@node Macros etc, Includes, High Level Communications Routines, High Level Communications Routines
//@subsection Macros etc
-# ifndef _AIX
-# define NON_POSIX_SOURCE /* so says Solaris */
-# endif
+/* Evidently not Posix */
+/* #include "PosixSource.h" */
//@node Includes, GUM Message Sending and Unpacking Functions, Macros etc, High Level Communications Routines
//@subsection Includes
/* ----------------------------------------------------------------------------
* Time-stamp: <Mon Mar 19 2001 22:10:38 Stardate: [-30]6354.62 hwloidl>
- * $Id: LLComms.c,v 1.4 2001/03/22 03:51:11 hwloidl Exp $
+ * $Id: LLComms.c,v 1.5 2001/08/14 13:40:10 sewardj Exp $
*
* GUM Low-Level Inter-Task Communication
*
//@node Macros etc, Includes, GUM Low-Level Inter-Task Communication, GUM Low-Level Inter-Task Communication
//@subsection Macros etc
-#define NON_POSIX_SOURCE /* so says Solaris */
+/* Evidently not Posix */
+/* #include "PosixSource.h" */
+
#define UNUSED /* nothing */
//@node Includes, Auxiliary functions, Macros etc, GUM Low-Level Inter-Task Communication
/* --------------------------------------------------------------------------
Time-stamp: <Wed Mar 21 2001 16:37:16 Stardate: [-30]6363.46 hwloidl>
- $Id: ParInit.c,v 1.4 2001/03/22 03:51:11 hwloidl Exp $
+ $Id: ParInit.c,v 1.5 2001/08/14 13:40:10 sewardj Exp $
Initialising the parallel RTS
#ifdef PAR /* whole file */
-#define NON_POSIX_SOURCE /* so says Solaris */
-
//@menu
//* Includes::
//* Global variables::
//@node Includes, Global variables
//@subsection Includes
+/* Evidently not Posix */
+/* #include "PosixSource.h" */
+
#include <setjmp.h>
#include "Rts.h"
#include "RtsFlags.h"
/* ----------------------------------------------------------------------------
Time-stamp: <Wed Mar 21 2001 17:16:28 Stardate: [-30]6363.59 hwloidl>
- $Id: SysMan.c,v 1.4 2001/03/22 03:51:12 hwloidl Exp $
+ $Id: SysMan.c,v 1.5 2001/08/14 13:40:10 sewardj Exp $
GUM System Manager Program
Handles startup, shutdown and global synchronisation of the parallel system.
//@node Includes, Macros etc, General docu, GUM System Manager Program
//@subsection Includes
+/* Evidently not Posix */
+/* #include "PosixSource.h" */
+
#include "Rts.h"
#include "ParTypes.h"
#include "LLC.h"
//@node Macros etc, Variables, Includes, GUM System Manager Program
//@subsection Macros etc
-#define NON_POSIX_SOURCE /* so says Solaris */
-
/* SysMan is put on top of the GHC routine that does the RtsFlags handling.
So, we cannot use the standard macros. For the time being we use a macro
that is fixed at compile time.
IF_PAR_DEBUG(verbose,
fprintf(stderr,
- "==== RFP: GdH enabled SysMan reporting for duty ($Revision: 1.4 $)\n"));
+ "==== RFP: GdH enabled SysMan reporting for duty ($Revision: 1.5 $)\n"));
if (argc > 1) {
if (*argv[1] == '-') {
-{-# OPTIONS -optc-DNON_POSIX_SOURCE #-}
-
--- The above option is required because 'erf' isn't a POSIX function, and we
--- need a prototype for it in order to compile the following code correctly.
--- Defining NON_POSIX_SOURCE tells the RTS not to define _POSIX_SOURCE.
module Main (main) where
/* Define if you have the <io.h> header file. */
#undef HAVE_IO_H
+/* Define if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
/* Define if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H