On Wed, Feb 04, 2009 at 09:41:40 -0800, Judah Jacobson wrote: > I ran into this yesterday, and tracked it down to a bug when mmaping > empty files. I discussed this with Don Stewart over email and sent > him a fix (attached) against > http://code.haskell.org/~dons/code/bytestring-mmap/
Interesting: I suppose this is what our internal version caught (by
coindicence) with the l < mmap_limit test below?
mmap :: FilePath -> IO (ForeignPtr Word8, Int)
mmap f = do
h <- openBinaryFile f ReadMode
l <- fromIntegral `fmap` hFileSize h
-- Don't bother mmaping small files because each mmapped file takes up
-- at least one full VM block.
if l < mmap_limit
then do thefp <- BI.mallocByteString l
debugForeignPtr thefp $ "mmap short file "++f
withForeignPtr thefp $ \p-> hGetBuf h p l
hClose h
return (thefp, l)
--
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
signature.asc
Description: Digital signature
_______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
