[Haskell-cafe] Re: I/O interface

Glynn Clements glynn at gclements.plus.com
Wed Jan 12 08:52:11 EST 2005


Ferenc Wagner wrote:

> dup()-ed filehandles share a common file position.

They also share the file status flags (O_NONBLOCK, O_APPEND etc). So,
enabling or disabling non-blocking I/O will affect all descriptors
obtained by duplication (either by dup/dup2 or by fork).

OTOH, each descriptor has its own set of descriptor flags (i.e. the
close-on-exec flag).

A related issue is that device state (e.g. terminal settings) is a
property of the device itself, and so is shared amongst all
descriptors which refer to the device regardless of whether they were
created by dup/dup2 or a separate open() call.

For this reason, hSetBuffering shouldn't be modifying the ICANON flag,
IMHO.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the Haskell-Cafe mailing list