ghc-base.git
16 years agoFIX #1689 (openTempFile returns wrong filename) 2007-09-13
Tim Chevalier [Thu, 13 Sep 2007 05:20:25 +0000 (05:20 +0000)]
FIX #1689 (openTempFile returns wrong filename)

16 years agoTAG ghc-6.8 branched 2007-09-03
Ian Lynagh [Mon, 3 Sep 2007 15:55:41 +0000 (15:55 +0000)]
TAG ghc-6.8 branched 2007-09-03

16 years agoRemove some incorrect rules; fixes #1658: CSE [of Doubles] changes semantics
Ian Lynagh [Tue, 4 Sep 2007 13:41:40 +0000 (13:41 +0000)]
Remove some incorrect rules; fixes #1658: CSE [of Doubles] changes semantics

16 years agomake hWaitForInput/hReady not fail with "invalid argument" on Windows
Simon Marlow [Thu, 30 Aug 2007 13:11:15 +0000 (13:11 +0000)]
make hWaitForInput/hReady not fail with "invalid argument" on Windows
See #1198.  This doesn't fully fix it, because hReady still always
returns False on file handles.  I'm not really sure how to fix that.

16 years agoFix haddock docs in Hashtable
Ian Lynagh [Thu, 30 Aug 2007 15:41:31 +0000 (15:41 +0000)]
Fix haddock docs in Hashtable

16 years agoFix building HashTable: Use ord rather than fromEnum
Ian Lynagh [Thu, 30 Aug 2007 15:02:14 +0000 (15:02 +0000)]
Fix building HashTable: Use ord rather than fromEnum

16 years agoBetter hash functions for Data.HashTable, from Jan-Willem Maessen
Ian Lynagh [Thu, 30 Aug 2007 14:28:44 +0000 (14:28 +0000)]
Better hash functions for Data.HashTable, from Jan-Willem Maessen

16 years agoRemove redundant include/Makefile
Ian Lynagh [Tue, 28 Aug 2007 20:56:59 +0000 (20:56 +0000)]
Remove redundant include/Makefile

16 years agoMake arrays safer (e.g. trac #1046)
Ian Lynagh [Fri, 10 Aug 2007 16:34:05 +0000 (16:34 +0000)]
Make arrays safer (e.g. trac #1046)

16 years agodelete configure droppings in setup clean
Simon Marlow [Fri, 24 Aug 2007 10:41:00 +0000 (10:41 +0000)]
delete configure droppings in setup clean

16 years agoFIX #1282: 64-bit unchecked shifts are not exported from base
Simon Marlow [Thu, 23 Aug 2007 13:50:33 +0000 (13:50 +0000)]
FIX #1282: 64-bit unchecked shifts are not exported from base
I've exported these functions from GHC.Exts.  They are still
implemented using the FFI underneath, though.

To avoid conditional exports, on a 64-bit build:

  uncheckedShiftL64# = uncheckShiftL#

(etc.) which has a different type than the 32-bit version of
uncheckedShiftL64#, but at least GHC.Exts exports the same names.

16 years agoFix hashInt
Ian Lynagh [Tue, 21 Aug 2007 14:07:06 +0000 (14:07 +0000)]
Fix hashInt
As pointed out in
http://www.haskell.org/pipermail/glasgow-haskell-bugs/2007-August/009545.html
the old behaviour was
Prelude Data.HashTable> map hashInt [0..10]
[0,-1,-1,-2,-2,-2,-3,-3,-4,-4,-4]

Fixed according to the "Fibonacci Hashing" algorithm described in
http://www.brpreiss.com/books/opus4/html/page213.html
http://www.brpreiss.com/books/opus4/html/page214.html

16 years agotest impl(ghc) instead of IsGHC
Ross Paterson [Sun, 19 Aug 2007 23:35:00 +0000 (23:35 +0000)]
test impl(ghc) instead of IsGHC

16 years agofpstring.h has moved to bytestring
Ross Paterson [Sun, 19 Aug 2007 23:38:15 +0000 (23:38 +0000)]
fpstring.h has moved to bytestring

16 years agoremove now-unused SIG constants
Ross Paterson [Sun, 19 Aug 2007 23:37:45 +0000 (23:37 +0000)]
remove now-unused SIG constants

16 years agoinclude Win32 extra-libraries for non-GHC's too
Ross Paterson [Sun, 19 Aug 2007 23:36:11 +0000 (23:36 +0000)]
include Win32 extra-libraries for non-GHC's too

16 years agoDon't import Distribution.Setup in Setup.hs as we no longer need it
Ian Lynagh [Thu, 16 Aug 2007 15:16:43 +0000 (15:16 +0000)]
Don't import Distribution.Setup in Setup.hs as we no longer need it

16 years agoCorrect the swapMVar haddock doc
Ian Lynagh [Tue, 14 Aug 2007 14:50:28 +0000 (14:50 +0000)]
Correct the swapMVar haddock doc

16 years agoinstall Typeable.h for use by other packages
Malcolm.Wallace@cs.york.ac.uk [Mon, 13 Aug 2007 11:28:55 +0000 (11:28 +0000)]
install Typeable.h for use by other packages

16 years agoDon't try to build modules no longer living in base.
Malcolm.Wallace@cs.york.ac.uk [Mon, 13 Aug 2007 11:28:03 +0000 (11:28 +0000)]
Don't try to build modules no longer living in base.

16 years agoMove Data.{Foldable,Traversable} back to base
Ian Lynagh [Sun, 12 Aug 2007 16:56:54 +0000 (16:56 +0000)]
Move Data.{Foldable,Traversable} back to base
The Array instances are now in Data.Array.

16 years agoRemove bits left over from the old build system
Ian Lynagh [Sat, 11 Aug 2007 13:50:19 +0000 (13:50 +0000)]
Remove bits left over from the old build system

16 years agoMove the datamap001 (our only test) to the containers package
Ian Lynagh [Fri, 3 Aug 2007 18:09:32 +0000 (18:09 +0000)]
Move the datamap001 (our only test) to the containers package

16 years agoData.Array* and Data.PackedString have now moved to their own packages
Ian Lynagh [Wed, 1 Aug 2007 23:55:42 +0000 (23:55 +0000)]
Data.Array* and Data.PackedString have now moved to their own packages

16 years agoRemove a number of modules now in a "containers" package
Ian Lynagh [Wed, 1 Aug 2007 22:38:58 +0000 (22:38 +0000)]
Remove a number of modules now in a "containers" package

16 years agoRemove System.Posix.Signals (moving to unix)
Ian Lynagh [Sun, 29 Jul 2007 21:52:13 +0000 (21:52 +0000)]
Remove System.Posix.Signals (moving to unix)

16 years agobytestring is now in its own package
Ian Lynagh [Sun, 29 Jul 2007 13:22:15 +0000 (13:22 +0000)]
bytestring is now in its own package

16 years agoExport throwErrnoPath* functions
Ian Lynagh [Sun, 22 Jul 2007 00:29:23 +0000 (00:29 +0000)]
Export throwErrnoPath* functions

16 years agoAdd simple haddock docs for throwErrnoPath* functions
Ian Lynagh [Sun, 22 Jul 2007 00:28:17 +0000 (00:28 +0000)]
Add simple haddock docs for throwErrnoPath* functions

16 years agoMove throwErrnoPath* functions from unix:System.Posix.Error
Ian Lynagh [Sun, 22 Jul 2007 00:27:46 +0000 (00:27 +0000)]
Move throwErrnoPath* functions from unix:System.Posix.Error

16 years agoClarify the swapMVar haddock doc
Ian Lynagh [Tue, 7 Aug 2007 18:55:57 +0000 (18:55 +0000)]
Clarify the swapMVar haddock doc

16 years agofix Haddock markup
Simon Marlow [Thu, 2 Aug 2007 08:17:17 +0000 (08:17 +0000)]
fix Haddock markup

16 years agoTemporarily fix breakage for nhc98.
Malcolm.Wallace@cs.york.ac.uk [Wed, 1 Aug 2007 16:37:50 +0000 (16:37 +0000)]
Temporarily fix breakage for nhc98.
A recent patch to System.IO introduced a cyclic dependency on Foreign.C.Error,
and also inadvertently dragged along System.Posix.Internals which has
non-H'98 layout, causing many build problems.  The solution for now
is to #ifndef __NHC__ all of the recent the openTempFile additions,
and mark them non-portable once again.  (I also took the opportunity
to note a number of other non-portable functions in their Haddock
comments.)

16 years agoGeneralise the type of synthesize, as suggested by Trac #1571
simonpj@microsoft [Wed, 1 Aug 2007 12:52:08 +0000 (12:52 +0000)]
Generalise the type of synthesize, as suggested by Trac #1571

I have not looked at the details, but the type checker is happy with the
more general type, and more general types are usually a Good Thing.

16 years agoFix fdToHandle on Windows
Ian Lynagh [Mon, 30 Jul 2007 13:31:39 +0000 (13:31 +0000)]
Fix fdToHandle on Windows
The old setmode code was throwing an exception, and I'm not sure it is
meant to do what we need anyway. For now we assume that all FDs are
both readable and writable.

16 years agoCorrect Windows OS name in cabal configuration
Ian Lynagh [Sun, 29 Jul 2007 16:17:39 +0000 (16:17 +0000)]
Correct Windows OS name in cabal configuration

16 years agoUse cabal configurations rather than Setup hacks
Ian Lynagh [Sun, 29 Jul 2007 13:21:57 +0000 (13:21 +0000)]
Use cabal configurations rather than Setup hacks

16 years agoHandle buffers should be allocated with newPinnedByteArray# always
Simon Marlow [Wed, 25 Jul 2007 09:55:50 +0000 (09:55 +0000)]
Handle buffers should be allocated with newPinnedByteArray# always
Not just on Windows.  This change is required because we now use safe
foreign calls for I/O on blocking file descriptors with the threaded
RTS.  Exposed by concio001.thr on MacOS X: MacOS apparently uses
smaller buffers by default, so they weren't being allocated as large
objects.

16 years agofix Hugs implementation of openTempFile
Ross Paterson [Tue, 24 Jul 2007 11:40:03 +0000 (11:40 +0000)]
fix Hugs implementation of openTempFile

16 years agoHugs only: avoid dependency cycle
Ross Paterson [Tue, 24 Jul 2007 11:38:52 +0000 (11:38 +0000)]
Hugs only: avoid dependency cycle

16 years agoopen(Binary)TempFile is now portable
Ian Lynagh [Sun, 22 Jul 2007 15:27:52 +0000 (15:27 +0000)]
open(Binary)TempFile is now portable

16 years agoTweak temporary file filename chooser
Ian Lynagh [Sun, 22 Jul 2007 10:54:45 +0000 (10:54 +0000)]
Tweak temporary file filename chooser

16 years agoMove open(Binary)TempFile to System.IO
Ian Lynagh [Sun, 22 Jul 2007 01:02:05 +0000 (01:02 +0000)]
Move open(Binary)TempFile to System.IO

16 years agoRename openFd to fdToHandle'
Ian Lynagh [Sat, 21 Jul 2007 23:55:38 +0000 (23:55 +0000)]
Rename openFd to fdToHandle'
The name collision with System.Posix.IO.openFd made my brain hurt.

16 years agoAdd a test for Data.Map, for a bug on the libraries@ list
Ian Lynagh [Sat, 21 Jul 2007 00:21:19 +0000 (00:21 +0000)]
Add a test for Data.Map, for a bug on the libraries@ list

16 years agofix Data.Map.updateAt
Bertram Felgenhauer [Wed, 18 Jul 2007 15:03:40 +0000 (15:03 +0000)]
fix Data.Map.updateAt
See http://haskell.org/pipermail/libraries/2007-July/007785.html for a piece
of code triggering the bug. updateAt threw away parts of the tree making up
the map.

16 years agoin hClose, free the handle buffer by replacing it with an empty one
Simon Marlow [Thu, 19 Jul 2007 16:14:19 +0000 (16:14 +0000)]
in hClose, free the handle buffer by replacing it with an empty one
This helps reduce the memory requirements for a closed but unfinalised
Handle.

16 years agoImplement GHC.Environment.getFullArgs
Ian Lynagh [Tue, 17 Jul 2007 14:19:18 +0000 (14:19 +0000)]
Implement GHC.Environment.getFullArgs
This returns all the arguments, including those normally eaten by the
RTS (+RTS ... -RTS).
This is mainly for ghc-inplace, where we need to pass /all/ the
arguments on to the real ghc. e.g. ioref001(ghci) was failing because
the +RTS -K32m -RTS wasn't getting passed on.

16 years agoDefine stripPrefix; fixes trac #1464
Ian Lynagh [Sat, 14 Jul 2007 23:52:04 +0000 (23:52 +0000)]
Define stripPrefix; fixes trac #1464

16 years agono need to hide Maybe
Malcolm.Wallace@cs.york.ac.uk [Tue, 10 Jul 2007 15:40:58 +0000 (15:40 +0000)]
no need to hide Maybe

16 years agoAdd a more efficient Data.List.foldl' for GHC (from GHC's utils/Util.lhs)
Ian Lynagh [Fri, 6 Jul 2007 20:55:26 +0000 (20:55 +0000)]
Add a more efficient Data.List.foldl' for GHC (from GHC's utils/Util.lhs)

16 years agoRemove include-dirs ../../includes and ../../rts
Ian Lynagh [Thu, 5 Jul 2007 20:53:56 +0000 (20:53 +0000)]
Remove include-dirs ../../includes and ../../rts
We get these by virtue of depending on the rts package.

16 years agoFIX #1131 (newArray_ allocates an array full of garbage)
Simon Marlow [Wed, 4 Jul 2007 10:20:20 +0000 (10:20 +0000)]
FIX #1131 (newArray_ allocates an array full of garbage)
Now newArray_ returns a deterministic result in the ST monad, and
behaves as before in other contexts.  The current newArray_ is renamed
to unsafeNewArray_; the MArray class therefore has one more method
than before.

16 years agochange nhc98 option from -prelude to --prelude
Malcolm.Wallace@cs.york.ac.uk [Mon, 2 Jul 2007 15:03:55 +0000 (15:03 +0000)]
change nhc98 option from -prelude to --prelude

16 years agoWord is a type synonym in nhc98 - so class instance not permitted.
Malcolm.Wallace@cs.york.ac.uk [Fri, 29 Jun 2007 12:20:35 +0000 (12:20 +0000)]
Word is a type synonym in nhc98 - so class instance not permitted.

16 years agofix bug in writes to blocking FDs in the non-threaded RTS
Simon Marlow [Thu, 28 Jun 2007 13:43:20 +0000 (13:43 +0000)]
fix bug in writes to blocking FDs in the non-threaded RTS

16 years agoModernize printf.
lennart.augustsson@credit-suisse.com [Thu, 28 Jun 2007 08:38:52 +0000 (08:38 +0000)]
Modernize printf.

Add instances for Int8, Int16, Int32, Int64, Word, Word8, Word16, Word32, and
Word64.
Handle + flag.
Handle X, E, and G formatting characters.
Rewrite internals to make it simpler.

16 years agoSpeed up number printing and remove the need for Array by using the standard 'intToDi...
John Meacham [Fri, 8 Jun 2007 18:23:53 +0000 (18:23 +0000)]
Speed up number printing and remove the need for Array by using the standard 'intToDigit' routine

16 years agoUse "-- //" (2 spaces) rather than "-- //" (1) to avoid tripping haddock up
Ian Lynagh [Wed, 27 Jun 2007 01:09:30 +0000 (01:09 +0000)]
Use "--  //" (2 spaces) rather than "-- //" (1) to avoid tripping haddock up
Are we nearly there yet?

16 years agoUse a combination of Haskell/C comments to ensure robustness.
Malcolm.Wallace@cs.york.ac.uk [Tue, 26 Jun 2007 09:52:22 +0000 (09:52 +0000)]
Use a combination of Haskell/C comments to ensure robustness.
e.g. -- // ensures that _no_ preprocessor will try to tokenise the
rest of the line.

16 years agoChange C-style comments to Haskell-style.
Malcolm.Wallace@cs.york.ac.uk [Mon, 25 Jun 2007 09:45:15 +0000 (09:45 +0000)]
Change C-style comments to Haskell-style.
These two headers are only ever used for pre-processing Haskell code,
and are never seen by any C tools except cpp.  Using the Haskell comment
convention means that cpphs no longer needs to be given the --strip
option to remove C comments from open code.  This is a Good Thing,
because all of /* */ and // are valid Haskell operator names, and there
is no compelling reason to forbid using them in files which also happen
to have C-preprocessor directives.

16 years agomakefileHook needs to generate PrimopWrappers.hs too
Simon Marlow [Fri, 22 Jun 2007 07:34:24 +0000 (07:34 +0000)]
makefileHook needs to generate PrimopWrappers.hs too

16 years agoHugs now gets MonadFix(mfix) from its prelude
Ross Paterson [Wed, 20 Jun 2007 00:03:43 +0000 (00:03 +0000)]
Hugs now gets MonadFix(mfix) from its prelude

16 years agoTypo (consUtils.hs -> consUtils.h)
Ian Lynagh [Tue, 19 Jun 2007 12:41:40 +0000 (12:41 +0000)]
Typo (consUtils.hs -> consUtils.h)

16 years agoinstall dependent include files and Typeable.h
Bertram Felgenhauer [Wed, 13 Jun 2007 04:17:34 +0000 (04:17 +0000)]
install dependent include files and Typeable.h

16 years agoupdate prototype following inputReady->fdReady change
Simon Marlow [Thu, 14 Jun 2007 09:53:09 +0000 (09:53 +0000)]
update prototype following inputReady->fdReady change

16 years agoFIX hGetBuf001: cut-and-pasto in readRawBufferNoBlock
Simon Marlow [Thu, 14 Jun 2007 09:42:22 +0000 (09:42 +0000)]
FIX hGetBuf001: cut-and-pasto in readRawBufferNoBlock

16 years agofix description of CWStringLen
Ross Paterson [Tue, 5 Jun 2007 22:33:45 +0000 (22:33 +0000)]
fix description of CWStringLen

16 years agoRemove unsafeCoerce-importing kludgery in favor of Unsafe.Coerce
Isaac Dupree [Fri, 1 Jun 2007 20:36:25 +0000 (20:36 +0000)]
Remove unsafeCoerce-importing kludgery in favor of Unsafe.Coerce

16 years ago--configure-option and --ghc-option are now provided by Cabal
Ross Paterson [Mon, 4 Jun 2007 11:52:33 +0000 (11:52 +0000)]
--configure-option and --ghc-option are now provided by Cabal

16 years agoData.PackedString: Data.Generics is GHC-only
Ross Paterson [Tue, 29 May 2007 23:24:27 +0000 (23:24 +0000)]
Data.PackedString: Data.Generics is GHC-only

16 years agoAdd Data instance for PackedString; patch from greenrd in trac #1263
Ian Lynagh [Tue, 29 May 2007 20:54:20 +0000 (20:54 +0000)]
Add Data instance for PackedString; patch from greenrd in trac #1263

16 years agoControl.Concurrent documentation fix
shae@ScannedInAvian.com [Thu, 24 May 2007 16:33:25 +0000 (16:33 +0000)]
Control.Concurrent documentation fix

16 years agoadd nhc98-options: field to .cabal file
Malcolm.Wallace@cs.york.ac.uk [Mon, 28 May 2007 12:26:26 +0000 (12:26 +0000)]
add nhc98-options: field to .cabal file

16 years agoadd a dummy implementation of System.Timeout.timeout for nhc98
Malcolm.Wallace@cs.york.ac.uk [Mon, 28 May 2007 11:03:09 +0000 (11:03 +0000)]
add a dummy implementation of System.Timeout.timeout for nhc98

16 years agoAdd System.Timeout to base.cabal
Ian Lynagh [Sun, 27 May 2007 12:33:14 +0000 (12:33 +0000)]
Add System.Timeout to base.cabal
Filtered out for non-GHC by Setup.hs.

16 years agoadd module Data.Fixed to nhc98 build
Malcolm.Wallace@cs.york.ac.uk [Fri, 25 May 2007 14:10:21 +0000 (14:10 +0000)]
add module Data.Fixed to nhc98 build

16 years agoDIRS now lives in package Makefile, not script/pkgdirlist
Malcolm.Wallace@cs.york.ac.uk [Fri, 25 May 2007 11:17:49 +0000 (11:17 +0000)]
DIRS now lives in package Makefile, not script/pkgdirlist

16 years agodelete unused constants
Ross Paterson [Fri, 25 May 2007 00:17:41 +0000 (00:17 +0000)]
delete unused constants

16 years agoremove System.Cmd and System.Time too
Malcolm.Wallace@cs.york.ac.uk [Thu, 24 May 2007 16:32:00 +0000 (16:32 +0000)]
remove System.Cmd and System.Time too

16 years agoremove locale as well
Malcolm.Wallace@cs.york.ac.uk [Thu, 24 May 2007 16:19:43 +0000 (16:19 +0000)]
remove locale as well

16 years agonhc98 version of instance Show (a->b) copied from Prelude
Malcolm.Wallace@cs.york.ac.uk [Thu, 24 May 2007 16:06:15 +0000 (16:06 +0000)]
nhc98 version of instance Show (a->b) copied from Prelude

16 years agoremove directory, pretty, and random bits from base for nhc98
Malcolm.Wallace@cs.york.ac.uk [Thu, 24 May 2007 16:06:08 +0000 (16:06 +0000)]
remove directory, pretty, and random bits from base for nhc98

16 years agoRemove Makefile and package.conf.in (used in the old build system)
Ian Lynagh [Thu, 24 May 2007 14:25:45 +0000 (14:25 +0000)]
Remove Makefile and package.conf.in (used in the old build system)

16 years agoSplit off process package
Ian Lynagh [Wed, 23 May 2007 21:05:23 +0000 (21:05 +0000)]
Split off process package

16 years agoFix comment: maperrno is in Win32Utils.c, not runProcess.c
Ian Lynagh [Wed, 23 May 2007 18:13:31 +0000 (18:13 +0000)]
Fix comment: maperrno is in Win32Utils.c, not runProcess.c

16 years agoSystem.Locale is now split out
Ian Lynagh [Sat, 19 May 2007 13:26:38 +0000 (13:26 +0000)]
System.Locale is now split out

16 years agoSplit off directory, random and old-time packages
Ian Lynagh [Sat, 19 May 2007 12:06:42 +0000 (12:06 +0000)]
Split off directory, random and old-time packages

16 years agoRemove Control.Parallel*, now in package parallel
Ian Lynagh [Fri, 18 May 2007 16:54:31 +0000 (16:54 +0000)]
Remove Control.Parallel*, now in package parallel

16 years agoRemove the pretty-printing modules (now in package pretty(
Ian Lynagh [Fri, 18 May 2007 16:25:21 +0000 (16:25 +0000)]
Remove the pretty-printing modules (now in package pretty(

16 years agoadd install-includes: field
Simon Marlow [Thu, 17 May 2007 09:49:48 +0000 (09:49 +0000)]
add install-includes: field

16 years agocorrect the documentation for newForeignPtr
Simon Marlow [Wed, 16 May 2007 08:20:19 +0000 (08:20 +0000)]
correct the documentation for newForeignPtr

16 years agoWhen doing safe writes, handle EAGAIN rather than raising an exception
Simon Marlow [Tue, 15 May 2007 11:46:15 +0000 (11:46 +0000)]
When doing safe writes, handle EAGAIN rather than raising an exception
It might be that stdin was set to O_NONBLOCK by someone else, and we
should handle this case.  (this happens with GHCi, I'm not quite sure why)

16 years agoUse FilePath to make paths when building GHC/Prim.hs and GHC/PrimopWrappers.hs
Ian Lynagh [Mon, 14 May 2007 11:04:09 +0000 (11:04 +0000)]
Use FilePath to make paths when building GHC/Prim.hs and GHC/PrimopWrappers.hs

16 years agoBuild GHC/Prim.hs and GHC/PrimopWrappers.hs from Cabal
Ian Lynagh [Wed, 9 May 2007 14:26:55 +0000 (14:26 +0000)]
Build GHC/Prim.hs and GHC/PrimopWrappers.hs from Cabal

16 years agofix imports for non-GHC
Ross Paterson [Sun, 13 May 2007 00:11:38 +0000 (00:11 +0000)]
fix imports for non-GHC

16 years agoGive an example of how intersection takes elements from the first set
Ian Lynagh [Sat, 12 May 2007 16:02:53 +0000 (16:02 +0000)]
Give an example of how intersection takes elements from the first set

16 years agofurther clarify the docs for 'evaluate'
Malcolm.Wallace@cs.york.ac.uk [Tue, 8 May 2007 10:11:24 +0000 (10:11 +0000)]
further clarify the docs for 'evaluate'

16 years agoimprove documentation for evaluate
Simon Marlow [Tue, 8 May 2007 08:17:12 +0000 (08:17 +0000)]
improve documentation for evaluate

16 years agoFIX: #724 (tee complains if used in a process started by ghc)
Simon Marlow [Mon, 7 May 2007 12:35:37 +0000 (12:35 +0000)]
FIX: #724 (tee complains if used in a process started by ghc)

Now, we only set O_NONBLOCK on file descriptors that we create
ourselves.  File descriptors that we inherit (stdin, stdout, stderr)
are kept in blocking mode.  The way we deal with this differs between
the threaded and non-threaded runtimes:

 - with -threaded, we just make a safe foreign call to read(), which
   may block, but this is ok.

 - without -threaded, we test the descriptor with select() before
   attempting any I/O.  This isn't completely safe - someone else
   might read the data between the select() and the read() - but it's
   a reasonable compromise and doesn't seem to measurably affect
   performance.