On 3/2/06, Per Jessen email@example.com wrote:
Anders Johansson wrote:
Per Jessen wrote:
right2=dup(right); fcntl( right, F_SETFL, O_NONBLOCK );
File status flags are shared between dup()licated file descriptors, so this operation sets both to O_NONBLOCK. Could this answer your problem?
Yeah, that would explain it, except when I do fcntl( GET_FL ) to read the setting of right2 it doesn't report nonblocking? Are you sure the flags are shared?
Yes, both descriptors share the same file table entry. For example:
fd1 = open(..., O_NONBLOCK); fd2 = dup(fd1);
fd2 shares the same file table entry as fd1 and therefore the same file status flags. Only close-on-exec is unset.