O_NONBLOCK (was: Re: Strange SUN behaviour.)

Maarten Litmaath maart at cs.vu.nl
Tue Oct 24 11:01:03 AEST 1989


yh87 at mrcu (Paul Johnson) writes:
\...
\My program was using fcntl(F_SETFL,...) to set the FNDELAY flag on
\descriptor 0 (non-blocking mode).  [...]  I had assumed
\that something like this would be local to the process which set the
\flag.  [...]

I consider this a misfeature too.  The worst thing: POSIX 1003.1 seems to
bless the sharing of the flag!  (The flag is called O_NONBLOCK and its
semantics differ slightly from FNDELAY.)
This behavior requires the shell to unset the flag after each command
(which is what csh does under SunOS [34].x[.y]).
Bletch!
Whenever a file descriptor is dup(2)ed (possibly implicitly through fork(2)),
it should get a *copy* of its parent's O_NONBLOCK (and O_APPEND) flag
(possibly copy-on-write).
Should I put on my asbestos suit, Doug?
-- 
A symbolic link is a POINTER to a file, | Maarten Litmaath @ VU Amsterdam:
 a hard link is the file system's GOTO. | maart at cs.vu.nl, mcsun!botter!maart



More information about the Comp.unix.wizards mailing list