Background processes setting O_NONBLOCK on ttys
Stephen McKay
smckay at internode.on.net
Thu Jan 13 04:45:01 PST 2005
On Thursday, 13th January 2005, Jilles Tjoelker wrote:
>POSIX states that the O_NONBLOCK flag is per open file description. File
>descriptors created with dup(2), fork(2) or similar methods share the
>same open file description, while new descriptors created with open(2)
>do not.
Can you quote chapter and verse on this? Or is it merely implied? A pointer
to an online copy would be best.
I found that "The Open Group Base Specifications Issue 6" at
http://www.opengroup.org/onlinepubs/009695399/toc.htm is not clear
on the matter. Also "The Single UNIX Specification, Version 2" at
http://www.opengroup.org/onlinepubs/007908799/ is similarly unclear.
>Consequently, a POSIX-compliant implementation of O_NONBLOCK does not
>solve the problem, as all descriptors to the terminal refer to the same
>open file description. O_NONBLOCK is indeed unusable for descriptions
>shared with other unknowing processes :(
If we must be POSIX compliant and if you accept that POSIX demands that
dup'd file descriptors share a single O_NONBLOCK flag, then the logical
end position is that the threads library must not routinely set stdin,
stdout and stderr to non-blocking. Right?
Personally, I have no qualms being non-POSIX compliant in a good cause.
Wouldn't being non-POSIX on this issue be easier?
Hmm. Should this be on -arch now?
Stephen.
More information about the freebsd-hackers
mailing list