From owner-svn-src-all@FreeBSD.ORG Sun Jan 25 18:38:43 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00BC4106564A; Sun, 25 Jan 2009 18:38:43 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E342F8FC12; Sun, 25 Jan 2009 18:38:42 +0000 (UTC) (envelope-from jeff@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 n0PIcg34024859; Sun, 25 Jan 2009 18:38:42 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0PIcgXk024858; Sun, 25 Jan 2009 18:38:42 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <200901251838.n0PIcgXk024858@svn.freebsd.org> From: Jeff Roberson Date: Sun, 25 Jan 2009 18:38:42 +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: r187693 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Jan 2009 18:38:43 -0000 Author: jeff Date: Sun Jan 25 18:38:42 2009 New Revision: 187693 URL: http://svn.freebsd.org/changeset/base/187693 Log: - bit has to be fd_mask to work properly on 64bit platforms. Constants must also be cast even though the result ultimately is promoted to 64bit. - Correct a loop index upper bound in selscan(). Modified: head/sys/kern/sys_generic.c Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Sun Jan 25 18:20:15 2009 (r187692) +++ head/sys/kern/sys_generic.c Sun Jan 25 18:38:42 2009 (r187693) @@ -965,8 +965,8 @@ selrescan(struct thread *td, fd_mask **i struct selfd *sfp; struct selfd *sfn; struct file *fp; - int fd, ev, n; - int idx, bit; + fd_mask bit; + int fd, ev, n, idx; fdp = td->td_proc->p_fd; stp = td->td_sel; @@ -984,7 +984,7 @@ selrescan(struct thread *td, fd_mask **i return (EBADF); } idx = fd / NFDBITS; - bit = 1 << (fd % NFDBITS); + bit = (fd_mask)1 << (fd % NFDBITS); ev = fo_poll(fp, selflags(ibits, idx, bit), td->td_ucred, td); if (ev != 0) n += selsetbits(ibits, obits, idx, bit, ev); @@ -1007,13 +1007,14 @@ selscan(td, ibits, obits, nfd) { struct filedesc *fdp; struct file *fp; + fd_mask bit; int ev, flags, end, fd; - int n, idx, bit; + int n, idx; fdp = td->td_proc->p_fd; n = 0; FILEDESC_SLOCK(fdp); - for (idx = 0, fd = 0; idx < nfd; idx++) { + for (idx = 0, fd = 0; fd < nfd; idx++) { end = imin(fd + NFDBITS, nfd); for (bit = 1; fd < end; bit <<= 1, fd++) { /* Compute the list of events we're interested in. */