From owner-svn-src-head@FreeBSD.ORG Fri Jul 8 12:19:25 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0E4A106566C; Fri, 8 Jul 2011 12:19:25 +0000 (UTC) (envelope-from jonathan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A11EB8FC1C; Fri, 8 Jul 2011 12:19:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p68CJPg7017420; Fri, 8 Jul 2011 12:19:25 GMT (envelope-from jonathan@svn.freebsd.org) Received: (from jonathan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p68CJPDV017418; Fri, 8 Jul 2011 12:19:25 GMT (envelope-from jonathan@svn.freebsd.org) Message-Id: <201107081219.p68CJPDV017418@svn.freebsd.org> From: Jonathan Anderson Date: Fri, 8 Jul 2011 12:19:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r223866 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jul 2011 12:19:25 -0000 Author: jonathan Date: Fri Jul 8 12:19:25 2011 New Revision: 223866 URL: http://svn.freebsd.org/changeset/base/223866 Log: Fix the "passability" test in fdcopy(). Rather than checking to see if a descriptor is a kqueue, check to see if its fileops flags include DFLAG_PASSABLE. At the moment, these two tests are equivalent, but this will change with the addition of capabilities that wrap kqueues but are themselves of type DTYPE_CAPABILITY. We already have the DFLAG_PASSABLE abstraction, so let's use it. This change has been tested with [the newly improved] tools/regression/kqueue. Approved by: mentor (rwatson), re (Capsicum blanket) Sponsored by: Google Inc Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Jul 8 12:16:30 2011 (r223865) +++ head/sys/kern/kern_descrip.c Fri Jul 8 12:19:25 2011 (r223866) @@ -1780,11 +1780,11 @@ fdcopy(struct filedesc *fdp) FILEDESC_XUNLOCK(newfdp); FILEDESC_SLOCK(fdp); } - /* copy everything except kqueue descriptors */ + /* copy all passable descriptors (i.e. not kqueue) */ newfdp->fd_freefile = -1; for (i = 0; i <= fdp->fd_lastfile; ++i) { if (fdisused(fdp, i) && - fdp->fd_ofiles[i]->f_type != DTYPE_KQUEUE && + (fdp->fd_ofiles[i]->f_ops->fo_flags & DFLAG_PASSABLE) && fdp->fd_ofiles[i]->f_ops != &badfileops) { newfdp->fd_ofiles[i] = fdp->fd_ofiles[i]; newfdp->fd_ofileflags[i] = fdp->fd_ofileflags[i];