12 Jan
2005
12 Jan
'05
9:52 p.m.
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@gclements.plus.com>