From fc350dba63da7eefbaa2793fe9fe99f8571b75c0 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 23 Jul 2021 05:11:59 +0000 Subject: Make `PosixSource.h` installed and under `rts/` is used outside of the rts so we do this rather than just fish it out of the repo in ad-hoc way, in order to make packages in this repo more self-contained. --- docs/coding-style.html | 2 +- includes/rts/PosixSource.h | 38 ++++++++++++++++++++++++++++++++++++ libraries/base/cbits/inputReady.c | 2 +- libraries/libiserv/cbits/iservmain.c | 6 +++--- rts/Arena.c | 2 +- rts/Capability.c | 2 +- rts/CheckUnload.c | 2 +- rts/ClosureFlags.c | 2 +- rts/Disassembler.c | 2 +- rts/FileLock.c | 2 +- rts/Globals.c | 2 +- rts/Hash.c | 2 +- rts/Hpc.c | 2 +- rts/HsFFI.c | 2 +- rts/IPE.c | 2 +- rts/Inlines.c | 2 +- rts/Interpreter.c | 2 +- rts/LdvProfile.c | 2 +- rts/Linker.c | 2 +- rts/OldARMAtomic.c | 2 +- rts/Pool.c | 2 +- rts/PosixSource.h | 38 ------------------------------------ rts/Printer.c | 2 +- rts/ProfHeap.c | 2 +- rts/ProfilerReport.c | 2 +- rts/ProfilerReportJson.c | 2 +- rts/Profiling.c | 2 +- rts/Proftimer.c | 2 +- rts/RaiseAsync.c | 2 +- rts/RetainerProfile.c | 2 +- rts/RetainerSet.c | 2 +- rts/RtsAPI.c | 2 +- rts/RtsDllMain.c | 2 +- rts/RtsFlags.c | 2 +- rts/RtsMain.c | 2 +- rts/RtsMessages.c | 2 +- rts/RtsUtils.c | 2 +- rts/STM.c | 2 +- rts/Schedule.c | 2 +- rts/Sparks.c | 2 +- rts/SpinLock.c | 2 +- rts/StableName.c | 2 +- rts/StablePtr.c | 2 +- rts/Stats.c | 2 +- rts/StgCRun.c | 2 +- rts/StgPrimFloat.c | 2 +- rts/Task.c | 2 +- rts/ThreadLabels.c | 2 +- rts/ThreadPaused.c | 2 +- rts/Threads.c | 2 +- rts/Ticky.c | 2 +- rts/Timer.c | 2 +- rts/TraverseHeap.c | 2 +- rts/TraverseHeapTest.c | 2 +- rts/WSDeque.c | 2 +- rts/Weak.c | 2 +- rts/adjustor/LibffiAdjustor.c | 2 +- rts/adjustor/NativeAlpha.c | 2 +- rts/adjustor/NativeAmd64.c | 2 +- rts/adjustor/NativeIA64.c | 2 +- rts/adjustor/NativePowerPC.c | 2 +- rts/adjustor/NativeSparc.c | 2 +- rts/adjustor/Nativei386.c | 2 +- rts/eventlog/EventLog.c | 2 +- rts/eventlog/EventLogWriter.c | 2 +- rts/hooks/FlagDefaults.c | 2 +- rts/hooks/LongGCSync.c | 2 +- rts/hooks/MallocFail.c | 2 +- rts/hooks/OnExit.c | 2 +- rts/hooks/OutOfHeap.c | 2 +- rts/hooks/StackOverflow.c | 2 +- rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 2 +- rts/posix/OSThreads.c | 6 +++--- rts/posix/Select.c | 2 +- rts/posix/Signals.c | 2 +- rts/posix/TTY.c | 2 +- rts/posix/Ticker.c | 6 +++--- rts/posix/ticker/Pthread.c | 6 +++--- rts/posix/ticker/Setitimer.c | 2 +- rts/posix/ticker/TimerCreate.c | 2 +- rts/sm/BlockAlloc.c | 2 +- rts/sm/CNF.c | 2 +- rts/sm/Compact.c | 2 +- rts/sm/Evac.c | 2 +- rts/sm/GC.c | 2 +- rts/sm/GCAux.c | 2 +- rts/sm/GCUtils.c | 2 +- rts/sm/MBlock.c | 2 +- rts/sm/MarkWeak.c | 2 +- rts/sm/Sanity.c | 2 +- rts/sm/Scav.c | 2 +- rts/sm/Storage.c | 6 +++--- rts/sm/Sweep.c | 2 +- utils/iserv/cbits/iservmain.c | 17 +++++++++++++--- 95 files changed, 154 insertions(+), 143 deletions(-) create mode 100644 includes/rts/PosixSource.h delete mode 100644 rts/PosixSource.h diff --git a/docs/coding-style.html b/docs/coding-style.html index c94913eac8..5c84b3a27e 100644 --- a/docs/coding-style.html +++ b/docs/coding-style.html @@ -104,7 +104,7 @@ Std 1003.1) interfaces and APIs. We used to define POSIX_SOURCE by default, but found that this caused more problems than it solved, so now we require any code that is POSIX-compliant to explicitly say so by having #include -"PosixSource.h" at the top. Try to do this whenever possible. +"rts/PosixSource.h" at the top. Try to do this whenever possible.

  • Some architectures have memory alignment constraints. Others don't have any constraints but go faster if you align things. These diff --git a/includes/rts/PosixSource.h b/includes/rts/PosixSource.h new file mode 100644 index 0000000000..13fd7b0ff5 --- /dev/null +++ b/includes/rts/PosixSource.h @@ -0,0 +1,38 @@ +/* ----------------------------------------------------------------------------- + * + * (c) The GHC Team, 1998-2005 + * + * Include this file into sources which should not need any non-Posix services. + * That includes most RTS C sources. + * ---------------------------------------------------------------------------*/ + +#pragma once + +#include + +/* We aim for C99 so we need to define following two defines in a consistent way + with what POSIX/XOPEN provide for C99. Some OSes are particularly picky about + the right versions defined here, e.g. Solaris + We also settle on lowest version of POSIX/XOPEN needed for proper C99 support + here which is POSIX.1-2001 compilation and Open Group Technical Standard, + Issue 6 (XPG6). XPG6 itself is a result of the merge of X/Open and POSIX + specification. It is also referred as IEEE Std. 1003.1-2001 or ISO/IEC + 9945:2002 or UNIX 03 and SUSv3. + Please also see trac ticket #11757 for more information about switch + to C99/C11. + + However, the use of `strnlen`, which is strictly speaking only available in + IEEE Std 1003.1-2008 (XPG7), requires lifting the bounds, to be able to + compile ghc on systems that are strict about enforcing the standard, e.g. + Apples mobile platforms. + + Oracle's Solaris 11 supports only up to XPG6, hence the ifdef. + */ + +#if defined(solaris2_HOST_OS) +#define _POSIX_C_SOURCE 200112L +#define _XOPEN_SOURCE 600 +#else +#define _POSIX_C_SOURCE 200809L +#define _XOPEN_SOURCE 700 +#endif diff --git a/libraries/base/cbits/inputReady.c b/libraries/base/cbits/inputReady.c index 7a281d6d90..44e6dfc605 100644 --- a/libraries/base/cbits/inputReady.c +++ b/libraries/base/cbits/inputReady.c @@ -21,7 +21,7 @@ #endif /* select and supporting types is not Posix */ -/* #include "PosixSource.h" */ +/* #include "rts/PosixSource.h" */ #include "Rts.h" #include #include diff --git a/libraries/libiserv/cbits/iservmain.c b/libraries/libiserv/cbits/iservmain.c index daefd35251..5c88018d6b 100644 --- a/libraries/libiserv/cbits/iservmain.c +++ b/libraries/libiserv/cbits/iservmain.c @@ -1,7 +1,7 @@ -#include "../rts/PosixSource.h" -#include "Rts.h" +#include +#include -#include "HsFFI.h" +#include int main (int argc, char *argv[]) { diff --git a/rts/Arena.c b/rts/Arena.c index 1d6dac623c..8129475332 100644 --- a/rts/Arena.c +++ b/rts/Arena.c @@ -18,7 +18,7 @@ which most allocations are small. -------------------------------------------------------------------------- */ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/Capability.c b/rts/Capability.c index 7a83821e00..374dfe8de7 100644 --- a/rts/Capability.c +++ b/rts/Capability.c @@ -16,7 +16,7 @@ * * --------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Capability.h" diff --git a/rts/CheckUnload.c b/rts/CheckUnload.c index 345a17cfec..03cbdb5b2e 100644 --- a/rts/CheckUnload.c +++ b/rts/CheckUnload.c @@ -8,7 +8,7 @@ * * --------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/ClosureFlags.c b/rts/ClosureFlags.c index f8dba8f326..da66b34d9a 100644 --- a/rts/ClosureFlags.c +++ b/rts/ClosureFlags.c @@ -6,7 +6,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" StgWord16 closure_flags[] = { diff --git a/rts/Disassembler.c b/rts/Disassembler.c index 451521d57e..2abb4e1b8d 100644 --- a/rts/Disassembler.c +++ b/rts/Disassembler.c @@ -10,7 +10,7 @@ #if defined(DEBUG) -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsAPI.h" #include "rts/Bytecodes.h" diff --git a/rts/FileLock.c b/rts/FileLock.c index 4509de1a42..2ab608dcac 100644 --- a/rts/FileLock.c +++ b/rts/FileLock.c @@ -6,7 +6,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "FileLock.h" diff --git a/rts/Globals.c b/rts/Globals.c index 848581e4d2..b7ed814752 100644 --- a/rts/Globals.c +++ b/rts/Globals.c @@ -17,7 +17,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Globals.h" diff --git a/rts/Hash.c b/rts/Hash.c index 39c5360f56..0b408c7af1 100644 --- a/rts/Hash.c +++ b/rts/Hash.c @@ -8,7 +8,7 @@ * pp. 446 -- 457. * -------------------------------------------------------------------------- */ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Hash.h" diff --git a/rts/Hpc.c b/rts/Hpc.c index 0c297fc60a..7a9e42caed 100644 --- a/rts/Hpc.c +++ b/rts/Hpc.c @@ -2,7 +2,7 @@ * (c)2006 Galois Connections, Inc. */ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Trace.h" diff --git a/rts/HsFFI.c b/rts/HsFFI.c index e482932193..58651b81e9 100644 --- a/rts/HsFFI.c +++ b/rts/HsFFI.c @@ -6,7 +6,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "HsFFI.h" #include "Rts.h" diff --git a/rts/IPE.c b/rts/IPE.c index d881682e7d..122331e066 100644 --- a/rts/IPE.c +++ b/rts/IPE.c @@ -7,7 +7,7 @@ * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/Inlines.c b/rts/Inlines.c index a3eb956d0c..94699e9c4d 100644 --- a/rts/Inlines.c +++ b/rts/Inlines.c @@ -2,7 +2,7 @@ // compiled for real here, just in case the definition was not inlined // at some call site: #define KEEP_INLINES -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Schedule.h" #include "Capability.h" diff --git a/rts/Interpreter.c b/rts/Interpreter.c index a5705f8fb2..bcda08018a 100644 --- a/rts/Interpreter.c +++ b/rts/Interpreter.c @@ -5,7 +5,7 @@ * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsAPI.h" #include "rts/Bytecodes.h" diff --git a/rts/LdvProfile.c b/rts/LdvProfile.c index 71064ddbce..aef1703c4a 100644 --- a/rts/LdvProfile.c +++ b/rts/LdvProfile.c @@ -9,7 +9,7 @@ #if defined(PROFILING) -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Profiling.h" diff --git a/rts/Linker.c b/rts/Linker.c index 6a294ffb8b..2641a677be 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -7,7 +7,7 @@ * ---------------------------------------------------------------------------*/ #if 0 -#include "PosixSource.h" +#include "rts/PosixSource.h" #endif #include "Rts.h" diff --git a/rts/OldARMAtomic.c b/rts/OldARMAtomic.c index e76f4c6354..deac848eba 100644 --- a/rts/OldARMAtomic.c +++ b/rts/OldARMAtomic.c @@ -13,7 +13,7 @@ * * -------------------------------------------------------------------------- */ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #if defined(HAVE_SCHED_H) diff --git a/rts/Pool.c b/rts/Pool.c index d6ea0d492f..7fb32acc62 100644 --- a/rts/Pool.c +++ b/rts/Pool.c @@ -6,7 +6,7 @@ * * --------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" #include "Pool.h" diff --git a/rts/PosixSource.h b/rts/PosixSource.h deleted file mode 100644 index 13fd7b0ff5..0000000000 --- a/rts/PosixSource.h +++ /dev/null @@ -1,38 +0,0 @@ -/* ----------------------------------------------------------------------------- - * - * (c) The GHC Team, 1998-2005 - * - * Include this file into sources which should not need any non-Posix services. - * That includes most RTS C sources. - * ---------------------------------------------------------------------------*/ - -#pragma once - -#include - -/* We aim for C99 so we need to define following two defines in a consistent way - with what POSIX/XOPEN provide for C99. Some OSes are particularly picky about - the right versions defined here, e.g. Solaris - We also settle on lowest version of POSIX/XOPEN needed for proper C99 support - here which is POSIX.1-2001 compilation and Open Group Technical Standard, - Issue 6 (XPG6). XPG6 itself is a result of the merge of X/Open and POSIX - specification. It is also referred as IEEE Std. 1003.1-2001 or ISO/IEC - 9945:2002 or UNIX 03 and SUSv3. - Please also see trac ticket #11757 for more information about switch - to C99/C11. - - However, the use of `strnlen`, which is strictly speaking only available in - IEEE Std 1003.1-2008 (XPG7), requires lifting the bounds, to be able to - compile ghc on systems that are strict about enforcing the standard, e.g. - Apples mobile platforms. - - Oracle's Solaris 11 supports only up to XPG6, hence the ifdef. - */ - -#if defined(solaris2_HOST_OS) -#define _POSIX_C_SOURCE 200112L -#define _XOPEN_SOURCE 600 -#else -#define _POSIX_C_SOURCE 200809L -#define _XOPEN_SOURCE 700 -#endif diff --git a/rts/Printer.c b/rts/Printer.c index 7d9614cfd7..90a40f2626 100644 --- a/rts/Printer.c +++ b/rts/Printer.c @@ -7,7 +7,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "ghcconfig.h" #include "Rts.h" diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index b05c34d80f..e9d9dd364e 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -6,7 +6,7 @@ * * --------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Capability.h" diff --git a/rts/ProfilerReport.c b/rts/ProfilerReport.c index 60c90a72da..436667066c 100644 --- a/rts/ProfilerReport.c +++ b/rts/ProfilerReport.c @@ -8,7 +8,7 @@ #if defined(PROFILING) -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/ProfilerReportJson.c b/rts/ProfilerReportJson.c index 5a3890c85e..71a557b8de 100644 --- a/rts/ProfilerReportJson.c +++ b/rts/ProfilerReportJson.c @@ -8,7 +8,7 @@ #if defined(PROFILING) -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/Profiling.c b/rts/Profiling.c index e96f6b2b93..c04cb3ae6b 100644 --- a/rts/Profiling.c +++ b/rts/Profiling.c @@ -8,7 +8,7 @@ #if defined(PROFILING) -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/Proftimer.c b/rts/Proftimer.c index 29abb62a8e..7bc5e865b4 100644 --- a/rts/Proftimer.c +++ b/rts/Proftimer.c @@ -6,7 +6,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Profiling.h" diff --git a/rts/RaiseAsync.c b/rts/RaiseAsync.c index 822bf2875e..022999acdc 100644 --- a/rts/RaiseAsync.c +++ b/rts/RaiseAsync.c @@ -6,7 +6,7 @@ * * --------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "sm/Storage.h" diff --git a/rts/RetainerProfile.c b/rts/RetainerProfile.c index 0db1cd2a18..68e412c9c7 100644 --- a/rts/RetainerProfile.c +++ b/rts/RetainerProfile.c @@ -9,7 +9,7 @@ #if defined(PROFILING) -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RetainerProfile.h" diff --git a/rts/RetainerSet.c b/rts/RetainerSet.c index 556bcc0eab..d668376cb4 100644 --- a/rts/RetainerSet.c +++ b/rts/RetainerSet.c @@ -9,7 +9,7 @@ #if defined(PROFILING) -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Stats.h" diff --git a/rts/RtsAPI.c b/rts/RtsAPI.c index d334a05dfb..469f4c52f6 100644 --- a/rts/RtsAPI.c +++ b/rts/RtsAPI.c @@ -6,7 +6,7 @@ * * --------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsAPI.h" #include "HsFFI.h" diff --git a/rts/RtsDllMain.c b/rts/RtsDllMain.c index c844e6e65d..641f1fb7dc 100644 --- a/rts/RtsDllMain.c +++ b/rts/RtsDllMain.c @@ -6,7 +6,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsAPI.h" #include "RtsDllMain.h" diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 149a2859ff..778f49c13b 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -7,7 +7,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/RtsMain.c b/rts/RtsMain.c index 21b8577cca..d2fd460ee2 100644 --- a/rts/RtsMain.c +++ b/rts/RtsMain.c @@ -8,7 +8,7 @@ #define COMPILING_RTS_MAIN -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsAPI.h" diff --git a/rts/RtsMessages.c b/rts/RtsMessages.c index c816322a63..9b165faea7 100644 --- a/rts/RtsMessages.c +++ b/rts/RtsMessages.c @@ -6,7 +6,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index ca01bdb6e0..3878a40697 100644 --- a/rts/RtsUtils.c +++ b/rts/RtsUtils.c @@ -6,7 +6,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsAPI.h" diff --git a/rts/STM.c b/rts/STM.c index 16dd029aea..d3555cdb37 100644 --- a/rts/STM.c +++ b/rts/STM.c @@ -83,7 +83,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/Schedule.c b/rts/Schedule.c index 85d66ab030..4a4b2d494a 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -6,7 +6,7 @@ * * --------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #define KEEP_LOCKCLOSURE #include "Rts.h" diff --git a/rts/Sparks.c b/rts/Sparks.c index 47cf310188..65e598f669 100644 --- a/rts/Sparks.c +++ b/rts/Sparks.c @@ -6,7 +6,7 @@ * -------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Schedule.h" diff --git a/rts/SpinLock.c b/rts/SpinLock.c index b362d89838..1e86860f11 100644 --- a/rts/SpinLock.c +++ b/rts/SpinLock.c @@ -19,7 +19,7 @@ * * -------------------------------------------------------------------------- */ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #if defined(THREADED_RTS) diff --git a/rts/StableName.c b/rts/StableName.c index 4b26fee396..5d4f2002ad 100644 --- a/rts/StableName.c +++ b/rts/StableName.c @@ -8,7 +8,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsAPI.h" diff --git a/rts/StablePtr.c b/rts/StablePtr.c index 469a17a5b9..8f860d480c 100644 --- a/rts/StablePtr.c +++ b/rts/StablePtr.c @@ -8,7 +8,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsAPI.h" diff --git a/rts/Stats.c b/rts/Stats.c index 55e05974f5..9aa3f9566f 100644 --- a/rts/Stats.c +++ b/rts/Stats.c @@ -6,7 +6,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsFlags.h" diff --git a/rts/StgCRun.c b/rts/StgCRun.c index f1148139e2..b439b7e36a 100644 --- a/rts/StgCRun.c +++ b/rts/StgCRun.c @@ -26,7 +26,7 @@ * * -------------------------------------------------------------------------- */ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "ghcconfig.h" // Enable DWARF Call-Frame Information (used for stack unwinding) on Linux. diff --git a/rts/StgPrimFloat.c b/rts/StgPrimFloat.c index b7b0f10332..a8c266ae78 100644 --- a/rts/StgPrimFloat.c +++ b/rts/StgPrimFloat.c @@ -7,7 +7,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "StgPrimFloat.h" diff --git a/rts/Task.c b/rts/Task.c index 28a1f2c314..3cfe6e1769 100644 --- a/rts/Task.c +++ b/rts/Task.c @@ -8,7 +8,7 @@ * * -------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/ThreadLabels.c b/rts/ThreadLabels.c index b982c7995c..ad72141dce 100644 --- a/rts/ThreadLabels.c +++ b/rts/ThreadLabels.c @@ -7,7 +7,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "ThreadLabels.h" diff --git a/rts/ThreadPaused.c b/rts/ThreadPaused.c index 9f41fa1ab3..c94b95afab 100644 --- a/rts/ThreadPaused.c +++ b/rts/ThreadPaused.c @@ -6,7 +6,7 @@ * * ---------------------------------------------------------------------------*/ -// #include "PosixSource.h" +// #include "rts/PosixSource.h" #include "Rts.h" #include "ThreadPaused.h" diff --git a/rts/Threads.c b/rts/Threads.c index 130d451640..6a3894ccda 100644 --- a/rts/Threads.c +++ b/rts/Threads.c @@ -6,7 +6,7 @@ * * --------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Capability.h" diff --git a/rts/Ticky.c b/rts/Ticky.c index 83ba70887c..c045f43f56 100644 --- a/rts/Ticky.c +++ b/rts/Ticky.c @@ -7,7 +7,7 @@ *-------------------------------------------------------------------------- */ #define TICKY_C /* define those variables */ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "eventlog/EventLog.h" diff --git a/rts/Timer.c b/rts/Timer.c index d60d09e726..ec3dff0a5c 100644 --- a/rts/Timer.c +++ b/rts/Timer.c @@ -15,7 +15,7 @@ * */ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Timer.h" diff --git a/rts/TraverseHeap.c b/rts/TraverseHeap.c index 40e51a3ca8..2285a93b6f 100644 --- a/rts/TraverseHeap.c +++ b/rts/TraverseHeap.c @@ -10,7 +10,7 @@ #if defined(PROFILING) #include -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "sm/Storage.h" diff --git a/rts/TraverseHeapTest.c b/rts/TraverseHeapTest.c index 9a71242e55..fe92bbdc5b 100644 --- a/rts/TraverseHeapTest.c +++ b/rts/TraverseHeapTest.c @@ -1,7 +1,7 @@ #if defined(PROFILING) && defined(DEBUG) -#include "PosixSource.h" +#include "rts/PosixSource.h" #include #include #include diff --git a/rts/WSDeque.c b/rts/WSDeque.c index 4974dfa7a7..7d002afbe5 100644 --- a/rts/WSDeque.c +++ b/rts/WSDeque.c @@ -46,7 +46,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/Weak.c b/rts/Weak.c index 0adf5a8b92..ef588a14b7 100644 --- a/rts/Weak.c +++ b/rts/Weak.c @@ -6,7 +6,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsAPI.h" diff --git a/rts/adjustor/LibffiAdjustor.c b/rts/adjustor/LibffiAdjustor.c index 4b843c1b82..b74059b8ce 100644 --- a/rts/adjustor/LibffiAdjustor.c +++ b/rts/adjustor/LibffiAdjustor.c @@ -2,7 +2,7 @@ * libffi-based adjustor thunk logic. * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/adjustor/NativeAlpha.c b/rts/adjustor/NativeAlpha.c index 46fe4c090d..0e1e257983 100644 --- a/rts/adjustor/NativeAlpha.c +++ b/rts/adjustor/NativeAlpha.c @@ -2,7 +2,7 @@ * Alpha architecture adjustor thunk logic. * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/adjustor/NativeAmd64.c b/rts/adjustor/NativeAmd64.c index 67efe7aa31..391661539f 100644 --- a/rts/adjustor/NativeAmd64.c +++ b/rts/adjustor/NativeAmd64.c @@ -2,7 +2,7 @@ * AMD64 architecture adjustor thunk logic. * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/adjustor/NativeIA64.c b/rts/adjustor/NativeIA64.c index 9fd1991c0a..229b1322d6 100644 --- a/rts/adjustor/NativeIA64.c +++ b/rts/adjustor/NativeIA64.c @@ -2,7 +2,7 @@ * IA64 architecture adjustor thunk logic. * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/adjustor/NativePowerPC.c b/rts/adjustor/NativePowerPC.c index 2e5d60549a..31d89ee510 100644 --- a/rts/adjustor/NativePowerPC.c +++ b/rts/adjustor/NativePowerPC.c @@ -2,7 +2,7 @@ * PowerPC architecture adjustor thunk logic. * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/adjustor/NativeSparc.c b/rts/adjustor/NativeSparc.c index 059455d050..52e023dcbe 100644 --- a/rts/adjustor/NativeSparc.c +++ b/rts/adjustor/NativeSparc.c @@ -2,7 +2,7 @@ * SPARC architecture adjustor thunk logic. * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/adjustor/Nativei386.c b/rts/adjustor/Nativei386.c index af6d842be8..2cf69bd800 100644 --- a/rts/adjustor/Nativei386.c +++ b/rts/adjustor/Nativei386.c @@ -2,7 +2,7 @@ * i386 architecture adjustor thunk logic. * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c index b8a80a0d4d..dff1d153fa 100644 --- a/rts/eventlog/EventLog.c +++ b/rts/eventlog/EventLog.c @@ -6,7 +6,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #if defined(TRACING) diff --git a/rts/eventlog/EventLogWriter.c b/rts/eventlog/EventLogWriter.c index 047c211db4..06aad2841e 100644 --- a/rts/eventlog/EventLogWriter.c +++ b/rts/eventlog/EventLogWriter.c @@ -6,7 +6,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/hooks/FlagDefaults.c b/rts/hooks/FlagDefaults.c index 1307fa0239..741745524f 100644 --- a/rts/hooks/FlagDefaults.c +++ b/rts/hooks/FlagDefaults.c @@ -4,7 +4,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Hooks.h" diff --git a/rts/hooks/LongGCSync.c b/rts/hooks/LongGCSync.c index 58ee52fa3d..af56d0cb62 100644 --- a/rts/hooks/LongGCSync.c +++ b/rts/hooks/LongGCSync.c @@ -4,7 +4,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "sm/GC.h" #include "sm/GCThread.h" diff --git a/rts/hooks/MallocFail.c b/rts/hooks/MallocFail.c index 42606b6f34..2948429a50 100644 --- a/rts/hooks/MallocFail.c +++ b/rts/hooks/MallocFail.c @@ -4,7 +4,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Hooks.h" diff --git a/rts/hooks/OnExit.c b/rts/hooks/OnExit.c index e5e85f5dd3..e571af1853 100644 --- a/rts/hooks/OnExit.c +++ b/rts/hooks/OnExit.c @@ -4,7 +4,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Hooks.h" diff --git a/rts/hooks/OutOfHeap.c b/rts/hooks/OutOfHeap.c index 20d9809024..8e3ba7dede 100644 --- a/rts/hooks/OutOfHeap.c +++ b/rts/hooks/OutOfHeap.c @@ -4,7 +4,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Hooks.h" #include "RtsFlags.h" diff --git a/rts/hooks/StackOverflow.c b/rts/hooks/StackOverflow.c index e1a90097e9..34dd9f64ab 100644 --- a/rts/hooks/StackOverflow.c +++ b/rts/hooks/StackOverflow.c @@ -4,7 +4,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Hooks.h" #include "RtsFlags.h" diff --git a/rts/posix/GetTime.c b/rts/posix/GetTime.c index fa6f70f73c..b2e522facc 100644 --- a/rts/posix/GetTime.c +++ b/rts/posix/GetTime.c @@ -7,7 +7,7 @@ * ---------------------------------------------------------------------------*/ // Not POSIX, due to use of ru_majflt in getPageFaults() -// #include "PosixSource.h" +// #include "rts/PosixSource.h" #include "Rts.h" #include "GetTime.h" diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c index f27e5ee0d2..db388414d9 100644 --- a/rts/posix/OSMem.c +++ b/rts/posix/OSMem.c @@ -7,7 +7,7 @@ * ---------------------------------------------------------------------------*/ // This is non-posix compliant. -// #include "PosixSource.h" +// #include "rts/PosixSource.h" #include "Rts.h" diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c index b05d5cbd03..862e6007a6 100644 --- a/rts/posix/OSThreads.c +++ b/rts/posix/OSThreads.c @@ -7,9 +7,9 @@ * * --------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" -/* We've defined _POSIX_SOURCE via "PosixSource.h", and yet still use +/* We've defined _POSIX_SOURCE via "rts/PosixSource.h", and yet still use some non-POSIX features. With _POSIX_SOURCE defined, visibility of non-POSIX extension prototypes requires _DARWIN_C_SOURCE on Mac OS X, __BSD_VISIBLE on FreeBSD and DragonflyBSD, and _NETBSD_SOURCE on @@ -19,7 +19,7 @@ system headers are included via "Rts.h". An alternative approach could be to write portable wrappers or stubs for all - the non-posix functions in a C-module that does not include "PosixSource.h", + the non-posix functions in a C-module that does not include "rts/PosixSource.h", and then use only POSIX features and the portable wrapper functions in all other C-modules. */ #include "ghcconfig.h" diff --git a/rts/posix/Select.c b/rts/posix/Select.c index 9cd8e4e010..b342b0c109 100644 --- a/rts/posix/Select.c +++ b/rts/posix/Select.c @@ -9,7 +9,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Signals.h" diff --git a/rts/posix/Signals.c b/rts/posix/Signals.c index 185c69eee3..2441f52016 100644 --- a/rts/posix/Signals.c +++ b/rts/posix/Signals.c @@ -6,7 +6,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Schedule.h" diff --git a/rts/posix/TTY.c b/rts/posix/TTY.c index 88fca28306..52ade92374 100644 --- a/rts/posix/TTY.c +++ b/rts/posix/TTY.c @@ -6,7 +6,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" // __hscore_get/set prototypes diff --git a/rts/posix/Ticker.c b/rts/posix/Ticker.c index 0b2dd25bbd..35387cdff4 100644 --- a/rts/posix/Ticker.c +++ b/rts/posix/Ticker.c @@ -20,9 +20,9 @@ * Ticker.c for consistency. */ -#include "PosixSource.h" +#include "rts/PosixSource.h" -/* We've defined _POSIX_SOURCE via "PosixSource.h", and yet still use +/* We've defined _POSIX_SOURCE via "rts/PosixSource.h", and yet still use some non-POSIX features. With _POSIX_SOURCE defined, visibility of non-POSIX extension prototypes requires _DARWIN_C_SOURCE on Mac OS X, __BSD_VISIBLE on FreeBSD and DragonflyBSD, and _NetBSD_SOURCE on @@ -32,7 +32,7 @@ system headers are included via "Rts.h". An alternative approach could be to write portable wrappers or stubs for all - the non-posix functions in a C-module that does not include "PosixSource.h", + the non-posix functions in a C-module that does not include "rts/PosixSource.h", and then use only POSIX features and the portable wrapper functions in all other C-modules. */ #include "ghcconfig.h" diff --git a/rts/posix/ticker/Pthread.c b/rts/posix/ticker/Pthread.c index 3cc7b2b801..796cf5eb24 100644 --- a/rts/posix/ticker/Pthread.c +++ b/rts/posix/ticker/Pthread.c @@ -35,7 +35,7 @@ * etc.). */ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Ticker.h" @@ -187,8 +187,8 @@ initTicker (Time interval, TickProc handle_tick) * On FreeBSD 12.2 pthread_set_name_np() is unconditionally declared in * , while pthread_setname_np() is conditionally declared in * when _POSIX_SOURCE is not defined, but we're including - * , so must use pthread_set_name_np() instead. See similar - * code in "rts/posix/OSThreads.c". + * , so must use pthread_set_name_np() instead. See + * similar code in "rts/posix/OSThreads.c". * * Create the thread with all blockable signals blocked, leaving signal * handling to the main and/or other threads. This is especially useful in diff --git a/rts/posix/ticker/Setitimer.c b/rts/posix/ticker/Setitimer.c index 1221a72a83..816d603db3 100644 --- a/rts/posix/ticker/Setitimer.c +++ b/rts/posix/ticker/Setitimer.c @@ -6,7 +6,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Ticker.h" diff --git a/rts/posix/ticker/TimerCreate.c b/rts/posix/ticker/TimerCreate.c index 43081d8a30..3abf1c6c7f 100644 --- a/rts/posix/ticker/TimerCreate.c +++ b/rts/posix/ticker/TimerCreate.c @@ -6,7 +6,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Ticker.h" diff --git a/rts/sm/BlockAlloc.c b/rts/sm/BlockAlloc.c index 6e67f2cc8d..180a06f33e 100644 --- a/rts/sm/BlockAlloc.c +++ b/rts/sm/BlockAlloc.c @@ -15,7 +15,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Storage.h" diff --git a/rts/sm/CNF.c b/rts/sm/CNF.c index bfe6493cfa..25c50adcc3 100644 --- a/rts/sm/CNF.c +++ b/rts/sm/CNF.c @@ -10,7 +10,7 @@ #define _GNU_SOURCE -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/sm/Compact.c b/rts/sm/Compact.c index b1250b77e0..43867343fc 100644 --- a/rts/sm/Compact.c +++ b/rts/sm/Compact.c @@ -11,7 +11,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "GCThread.h" diff --git a/rts/sm/Evac.c b/rts/sm/Evac.c index ea40563499..0e0e887b1e 100644 --- a/rts/sm/Evac.c +++ b/rts/sm/Evac.c @@ -11,7 +11,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Evac.h" diff --git a/rts/sm/GC.c b/rts/sm/GC.c index 21b7b17f0d..90a5164414 100644 --- a/rts/sm/GC.c +++ b/rts/sm/GC.c @@ -11,7 +11,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "HsFFI.h" diff --git a/rts/sm/GCAux.c b/rts/sm/GCAux.c index 55b4f99596..f0e18a5ca5 100644 --- a/rts/sm/GCAux.c +++ b/rts/sm/GCAux.c @@ -7,7 +7,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "GC.h" diff --git a/rts/sm/GCUtils.c b/rts/sm/GCUtils.c index 52ea27f263..627c95fb42 100644 --- a/rts/sm/GCUtils.c +++ b/rts/sm/GCUtils.c @@ -11,7 +11,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "BlockAlloc.h" diff --git a/rts/sm/MBlock.c b/rts/sm/MBlock.c index 344bd3f0e9..ffd4f41266 100644 --- a/rts/sm/MBlock.c +++ b/rts/sm/MBlock.c @@ -8,7 +8,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "RtsUtils.h" diff --git a/rts/sm/MarkWeak.c b/rts/sm/MarkWeak.c index 379e3aaa80..2d4482501a 100644 --- a/rts/sm/MarkWeak.c +++ b/rts/sm/MarkWeak.c @@ -11,7 +11,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "MarkWeak.h" diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c index ceb71c59ec..63ef9732dd 100644 --- a/rts/sm/Sanity.c +++ b/rts/sm/Sanity.c @@ -13,7 +13,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #if defined(DEBUG) /* whole file */ diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c index fe6dc4be54..b82eadd9cd 100644 --- a/rts/sm/Scav.c +++ b/rts/sm/Scav.c @@ -42,7 +42,7 @@ - scavenge_one() scavenges only stack frame SRTs ------------------------------------------------------------------------- */ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Storage.h" diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index 7d450a8931..5241494365 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -15,15 +15,15 @@ #if RTS_LINKER_USE_MMAP /* * On FreeBSD and Darwin, when _XOPEN_SOURCE is defined, MAP_ANONYMOUS is not - * exposed from . Include before "PosixSource.h". + * exposed from . Include before "rts/PosixSource.h". * - * Alternatively, we could drop "PosixSource.h" from this file, but for just + * Alternatively, we could drop "rts/PosixSource.h" from this file, but for just * one non-POSIX macro, that seems a needless price to pay. */ #include #endif -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "Storage.h" diff --git a/rts/sm/Sweep.c b/rts/sm/Sweep.c index d6634dcb16..2278e57f40 100644 --- a/rts/sm/Sweep.c +++ b/rts/sm/Sweep.c @@ -11,7 +11,7 @@ * * ---------------------------------------------------------------------------*/ -#include "PosixSource.h" +#include "rts/PosixSource.h" #include "Rts.h" #include "BlockAlloc.h" diff --git a/utils/iserv/cbits/iservmain.c b/utils/iserv/cbits/iservmain.c index daefd35251..d88d14e0d6 100644 --- a/utils/iserv/cbits/iservmain.c +++ b/utils/iserv/cbits/iservmain.c @@ -1,7 +1,18 @@ -#include "../rts/PosixSource.h" -#include "Rts.h" +#if GHC_STAGE > 1 +# include +#else // PosixSource.h not yet exposed, hacky inline for now. +# include +# if defined(solaris2_HOST_OS) +# define _POSIX_C_SOURCE 200112L +# define _XOPEN_SOURCE 600 +# else +# define _POSIX_C_SOURCE 200809L +# define _XOPEN_SOURCE 700 +# endif +#endif +#include -#include "HsFFI.h" +#include int main (int argc, char *argv[]) { -- cgit v1.2.1