Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 May 2001 04:28:40 +0200
From:      clemensF <rabat@web.de>
To:        Jonathan Lemon <jlemon@flugsvamp.com>
Cc:        bugs@freebsd.org, Bruce Guenter <bruceg@em.ca>
Subject:   Re: kern/27287: poll(2) returns 0 when POLLIN-ing ordinary files
Message-ID:  <20010514042840.J543@spotteswoode.yi.org>
In-Reply-To: <200105131616.f4DGG9111221@prism.flugsvamp.com>; from jlemon@flugsvamp.com on Sun, May 13, 2001 at 11:16:09AM -0500
References:  <local.mail.freebsd-bugs/20010512163436.3789.qmail@spotteswoode.yi.org> <200105131616.f4DGG9111221@prism.flugsvamp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> Jonathan Lemon:

> >  x.fd = open("trypoll.c",O_RDONLY);
> >  if (x.fd == -1) _exit(111);
> >  x.events = POLLIN;
> >  if (poll(&x,1,10) == -1) _exit(1);
> >  if (x.revents != POLLIN) _exit(1);
> 
> 
> If you change "POLLIN" to "POLLRDNORM", then this will work as
> you expect.  Hoever, it's fairly pointless to poll() on a file,
> since it will always return true, no matter what, so the code
> above is fairly pointless.
> 
> If you really want to poll a file for readability, use kqueue.

the code snippet is part of "trypoll.c", which tests for a working poll(2) to
autoconfigure a software-package.  and it doesn't seem that pointless,
because, as stated in the original PR, freebsd's poll(2) *does not* return
true on an existing (local) file; it returns zero both as it's return- value
and in x.revents, which is *wrong*.

said package recognizes the deficiency, throws in it's workaround and
proceeds (cvm-0.6).  note that i'm not the author, which is bruce guenter
<bruceg@em.ca>, but he build the programs on a linux system.  i was the one
who discovered the bug within freebsd 4.

clemens fischer

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010514042840.J543>