Bug in IO libraries when sending data through a pipe?

Volker Wysk post at volker-wysk.de
Tue Mar 19 14:24:12 EST 2002


On Die, 2002-03-19 at 14:32, Simon Marlow wrote:
> > The mmap system call provides this, on Unix systems. The man page says
> > it's POSIX.1b standard, so it might even be supported by Windows 2000.
> 
> I don't think mmap() provides exactly the right behaviour.  It lets you
> specify that modifications made by the current process aren't committed
> to the file, but what we want is to snapshot the file so that subsequent
> modifications by *other* processes aren't seen by the local process.

The Linux manpage isn't very explicit, so I've tried it. When making a
private mapping (MAP_PRIVATE), it makes a snapshot which is private to
the process, and isn't affected by other processes. It's exactly what's
needed. (see attachment)

> > This strategy won't work for general IO streams (pipes, 
> > sockets...), of
> > course. If the spec would require all stream contents to behave like
> > pure values, this would limit lazy streams to files. So you could no
> > longer handle general streams and files the same way...
> 
> These kinds of streams are immutable, so the problem is less severe.  We
> don't have to worry about the interaction with other processes.

Well, several processes might read from/write to the same stream.


bye,
Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: text/x-makefile
Size: 47 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/glasgow-haskell-bugs/attachments/20020319/c29121ec/Makefile.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.c
Type: text/x-c
Size: 512 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/glasgow-haskell-bugs/attachments/20020319/c29121ec/test.bin


More information about the Glasgow-haskell-bugs mailing list