[haiku-development] Re: Bug in poll()?

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 15 Aug 2009 18:41:57 +0200

On 2009-08-15 at 16:01:49 [+0200], Ingo Weinhold <ingo_weinhold@xxxxxx> 
wrote:
> On 2009-08-15 at 15:58:45 [+0200], Ingo Weinhold <ingo_weinhold@xxxxxx>
> wrote:
> > On 2009-08-14 at 23:38:31 [+0200], Armando Camarero <arcepi@xxxxxxxxxx>
> > wrote:
> > >     I'm trying to compile libmsn in Haiku (to build a native MSN
> > > Messenger client for Haiku). With help from people on the IRC I got to
> > > compile it, but now I might have hit a bug in Haiku. Libmsn uses poll()
> > > to manage the sockets and it doesn't seem to work right. I've read the
> > > poll() manpage of FreeBSD (I think that Haiku implements BSD
> > > compatibility instead of Linux) and it should work as in Linux.
> > 
> > Haiku usually tries to follow POSIX, i.e. in this case:
> >   http://www.opengroup.org/onlinepubs/9699919799/functions/poll.html
> > 
> > >     I attach a simple C program which triggers the error. That program
> > > on Linux fetches the index page at www.arcepi.net and prints it on the
> > > terminal. On Haiku poll() marks the socket as POLLNVAL instead.
> > 
> > Your program polls two FDs, the second one being -1. Since that is an
> > invalid FD, Haiku correctly sets POLLNVAL for it. I'd say Linux is
> > non-conforming in this respect.
> 
> Just re-read the specs and I'm mistaken. There's special mention for
> negative FDs:
> 
> "If the value of fd is less than 0, events shall be ignored, and revents
> shall be set to 0 in that entry on return from poll()."
> 
> Will fix that.

Done in r32418.

CU, Ingo

Other related posts: