From owner-freebsd-bugs Sun May 13 9:16:23 2001 Delivered-To: freebsd-bugs@freebsd.org Received: from prism.flugsvamp.com (cb58709-a.mdsn1.wi.home.com [24.17.241.9]) by hub.freebsd.org (Postfix) with ESMTP id 192D537B424 for ; Sun, 13 May 2001 09:16:20 -0700 (PDT) (envelope-from jlemon@flugsvamp.com) Received: (from jlemon@localhost) by prism.flugsvamp.com (8.11.0/8.11.0) id f4DGG9111221; Sun, 13 May 2001 11:16:09 -0500 (CDT) (envelope-from jlemon) Date: Sun, 13 May 2001 11:16:09 -0500 (CDT) From: Jonathan Lemon Message-Id: <200105131616.f4DGG9111221@prism.flugsvamp.com> To: ino-waiting@gmx.net, bugs@freebsd.org Subject: Re: kern/27287: poll(2) returns 0 when POLLIN-ing ordinary files X-Newsgroups: local.mail.freebsd-bugs In-Reply-To: Organization: Cc: Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org In article you write: >given a file "trypoll.c" (for relevant lines see below), poll does not see >that input is ready immediately. the following code-snipet returns 0 for >the return value and also 0 in x.revents. > > 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. -- Jonathan To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message