Mailinglist Archive: opensuse-programming (33 mails)

< Previous Next >
Re: [suse-programming-e] EAGAIN on a blocking socket?
  • From: Anders Johansson <andjoh@xxxxxxxxxx>
  • Date: Thu, 02 Mar 2006 19:53:26 +0100
  • Message-id: <44073F26.9070707@xxxxxxxxxx>
Per Jessen 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?
> They should be _copied_ with dup(), but the a change of flags on one
> filedescriptor is copied to another, that doesn't sound right - to me
> anyway.

No, see "man dup". The file status flags are shared between the two, so
a change to one means both are affected. The file descriptor flags are not.

At what point do you do the GET_FL? I don't see it in the code you sent


< Previous Next >
List Navigation
Follow Ups