From owner-freebsd-hackers Sun Jul 18 21:25:34 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from krdl.org.sg (rodin.krdl.org.sg [192.122.139.27]) by hub.freebsd.org (Postfix) with ESMTP id 27D1B14C93 for ; Sun, 18 Jul 1999 21:25:30 -0700 (PDT) (envelope-from vasu@krdl.org.sg) Received: from mailhost.krdl.org.sg (mailbox.krdl.org.sg [192.122.134.30]) by krdl.org.sg (8.9.3/8.9.3) with ESMTP id MAA17389; Mon, 19 Jul 1999 12:31:29 +0800 (SGT) Received: from boderek (boderek [192.122.135.157]) by mailhost.krdl.org.sg (8.9.3/8.9.3) with SMTP id MAA14807; Mon, 19 Jul 1999 12:23:48 +0800 (SGT) Date: Mon, 19 Jul 1999 12:09:03 +0800 (SGT) From: Vasudha Ramnath X-Sender: vasu@boderek To: Arun Sharma Cc: freebsd-hackers@freebsd.org Subject: Re: implementing poll() in a device driver (fwd) In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > > > I have a test driver that returns these values from the poll() function. > > However, the application > > that called the select() is not getting an error. Instead, the select > > is returning that the particular file descriptor is, in this case, > > 'readable' ! > > Take a look at "selscan" algorithm in /usr/src/sys/kern/sys_generic.c > if you wish to learn more. > > Basically, if your driver doesn't implement the poll() functionality, > it can always return 0. This will ensure that select never wakes up > because of a file descriptor associated with your driver. > thanks for your reply. I realise that one can return 0. My point is that if the driver returns POLLERR or POLLHUP, it is not getting handled correctly in sys_generic.c... It seems to me that a positive (non-zero) return value is being interpreted as 'readiness', although there is a comment in sys_generic.c that the backend (driver) can also return POLLHUP or POLLERR. --Vasudha To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message