From owner-svn-src-stable@FreeBSD.ORG Fri Mar 13 10:52:23 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DD671065672; Fri, 13 Mar 2009 10:52:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6AB738FC13; Fri, 13 Mar 2009 10:52:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2DAqNBH061370; Fri, 13 Mar 2009 10:52:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2DAqN8n061365; Fri, 13 Mar 2009 10:52:23 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200903131052.n2DAqN8n061365@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 13 Mar 2009 10:52:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189766 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb fs/devfs kern sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Mar 2009 10:52:24 -0000 Author: kib Date: Fri Mar 13 10:52:22 2009 New Revision: 189766 URL: http://svn.freebsd.org/changeset/base/189766 Log: MFC r189450: Extract the no_poll() and vop_nopoll() code into the common routine poll_no_poll(). Return a poll_no_poll() result from devfs_poll_f() when filedescriptor does not reference the live cdev, instead of ENXIO. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/fs/devfs/devfs_vnops.c stable/7/sys/kern/kern_conf.c stable/7/sys/kern/sys_generic.c stable/7/sys/kern/vfs_default.c stable/7/sys/sys/systm.h Modified: stable/7/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/7/sys/fs/devfs/devfs_vnops.c Fri Mar 13 10:40:38 2009 (r189765) +++ stable/7/sys/fs/devfs/devfs_vnops.c Fri Mar 13 10:52:22 2009 (r189766) @@ -973,7 +973,7 @@ devfs_poll_f(struct file *fp, int events fpop = td->td_fpop; error = devfs_fp_check(fp, &dev, &dsw); if (error) - return (error); + return (poll_no_poll(events)); error = dsw->d_poll(dev, events, td); td->td_fpop = fpop; dev_relthread(dev); Modified: stable/7/sys/kern/kern_conf.c ============================================================================== --- stable/7/sys/kern/kern_conf.c Fri Mar 13 10:40:38 2009 (r189765) +++ stable/7/sys/kern/kern_conf.c Fri Mar 13 10:52:22 2009 (r189766) @@ -313,18 +313,8 @@ no_strategy(struct bio *bp) static int no_poll(struct cdev *dev __unused, int events, struct thread *td __unused) { - /* - * Return true for read/write. If the user asked for something - * special, return POLLNVAL, so that clients have a way of - * determining reliably whether or not the extended - * functionality is present without hard-coding knowledge - * of specific filesystem implementations. - * Stay in sync with vop_nopoll(). - */ - if (events & ~POLLSTANDARD) - return (POLLNVAL); - return (events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)); + return (poll_no_poll(events)); } #define no_dump (dumper_t *)enodev Modified: stable/7/sys/kern/sys_generic.c ============================================================================== --- stable/7/sys/kern/sys_generic.c Fri Mar 13 10:40:38 2009 (r189765) +++ stable/7/sys/kern/sys_generic.c Fri Mar 13 10:52:22 2009 (r189766) @@ -637,6 +637,22 @@ struct cv selwait; u_int nselcoll; /* Select collisions since boot */ SYSCTL_UINT(_kern, OID_AUTO, nselcoll, CTLFLAG_RD, &nselcoll, 0, ""); +int +poll_no_poll(int events) +{ + /* + * Return true for read/write. If the user asked for something + * special, return POLLNVAL, so that clients have a way of + * determining reliably whether or not the extended + * functionality is present without hard-coding knowledge + * of specific filesystem implementations. + */ + if (events & ~POLLSTANDARD) + return (POLLNVAL); + + return (events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)); +} + #ifndef _SYS_SYSPROTO_H_ struct select_args { int nd; Modified: stable/7/sys/kern/vfs_default.c ============================================================================== --- stable/7/sys/kern/vfs_default.c Fri Mar 13 10:40:38 2009 (r189765) +++ stable/7/sys/kern/vfs_default.c Fri Mar 13 10:52:22 2009 (r189766) @@ -344,18 +344,8 @@ vop_nopoll(ap) struct thread *a_td; } */ *ap; { - /* - * Return true for read/write. If the user asked for something - * special, return POLLNVAL, so that clients have a way of - * determining reliably whether or not the extended - * functionality is present without hard-coding knowledge - * of specific filesystem implementations. - * Stay in sync with kern_conf.c::no_poll(). - */ - if (ap->a_events & ~POLLSTANDARD) - return (POLLNVAL); - return (ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)); + return (poll_no_poll(ap->a_events)); } /* Modified: stable/7/sys/sys/systm.h ============================================================================== --- stable/7/sys/sys/systm.h Fri Mar 13 10:40:38 2009 (r189765) +++ stable/7/sys/sys/systm.h Fri Mar 13 10:52:22 2009 (r189766) @@ -321,6 +321,8 @@ int uminor(dev_t dev); int umajor(dev_t dev); const char *devtoname(struct cdev *cdev); +int poll_no_poll(int events); + /* XXX: Should be void nanodelay(u_int nsec); */ void DELAY(int usec);