From owner-freebsd-hackers Fri Jul 16 0:36: 9 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.rdc1.sfba.home.com (ha1.rdc1.sfba.home.com [24.0.0.66]) by hub.freebsd.org (Postfix) with ESMTP id 8590A15581 for ; Fri, 16 Jul 1999 00:36:01 -0700 (PDT) (envelope-from adsharma@c62443-a.frmt1.sfba.home.com) Received: from c62443-a.frmt1.sfba.home.com ([24.0.69.165]) by mail.rdc1.sfba.home.com (InterMail v4.01.01.00 201-229-111) with ESMTP id <19990716073500.WSET8807.mail.rdc1.sfba.home.com@c62443-a.frmt1.sfba.home.com>; Fri, 16 Jul 1999 00:35:00 -0700 Received: (from adsharma@localhost) by c62443-a.frmt1.sfba.home.com (8.8.7/8.8.7) id AAA06026; Fri, 16 Jul 1999 00:34:59 -0700 To: Vasudha Ramnath Cc: hackers@FreeBSD.ORG Subject: Re: implementing poll() in a device driver (fwd) References: From: Arun Sharma Mime-Version: 1.0 (generated by tm-edit 7.108) Content-Type: text/plain; charset=US-ASCII Date: 16 Jul 1999 00:34:59 -0700 In-Reply-To: Vasudha Ramnath's message of "Fri, 16 Jul 1999 13:07:40 +0800 (SGT)" Message-ID: Lines: 24 X-Mailer: Gnus v5.5/XEmacs 20.4 - "Emerald" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Vasudha Ramnath writes: > > I'm running FreeBSD 3.1-RELEASE. > > Could someone explain what the poll() function in a device driver should > do ? > > Can it return POLLERR or POLLHUP ? > > 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. -Arun To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message