From owner-freebsd-bugs Sun May 13 19:28:24 2001 Delivered-To: freebsd-bugs@freebsd.org Received: from mout1.freenet.de (mout1.freenet.de [194.97.50.132]) by hub.freebsd.org (Postfix) with ESMTP id 1348837B423 for ; Sun, 13 May 2001 19:28:22 -0700 (PDT) (envelope-from rabat@web.de) Received: from [194.97.50.138] (helo=mx0.freenet.de) by mout1.freenet.de with esmtp (Exim 3.22 #1) id 14z85t-00018Y-00 for bugs@freebsd.org; Mon, 14 May 2001 04:28:21 +0200 Received: from a0e88.pppool.de ([213.6.14.136] helo=spotteswoode.yi.org) by mx0.freenet.de with asmtp (ID inode@freenet.de) (Exim 3.22 #1) id 14z85s-0004ff-00 for bugs@freebsd.org; Mon, 14 May 2001 04:28:20 +0200 Received: (qmail 3559 invoked by uid 0); 14 May 2001 02:28:40 -0000 Date: Mon, 14 May 2001 04:28:40 +0200 From: clemensF To: Jonathan Lemon Cc: bugs@freebsd.org, Bruce Guenter Subject: Re: kern/27287: poll(2) returns 0 when POLLIN-ing ordinary files Message-ID: <20010514042840.J543@spotteswoode.yi.org> References: <200105131616.f4DGG9111221@prism.flugsvamp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200105131616.f4DGG9111221@prism.flugsvamp.com>; from jlemon@flugsvamp.com on Sun, May 13, 2001 at 11:16:09AM -0500 Organization: private X-PGP-ID: 0x214190AF X-Stamper-To: post@stamper.itconsult.co.uk Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > 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 , 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