Date: Sun, 25 Jan 2009 08:56:40 -1000 (HST) From: Jeff Roberson <jroberson@jroberson.net> To: Jeff Roberson <jeff@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r187693 - head/sys/kern Message-ID: <20090125085419.O983@desktop> In-Reply-To: <200901251838.n0PIcgXk024858@svn.freebsd.org> References: <200901251838.n0PIcgXk024858@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 25 Jan 2009, Jeff Roberson wrote: > 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(). Sorry about that, should've tested my earlier patch for more than a couple of days. I seldom remember c's integer promotion rules as they relate to constants. You'd think they'd make it easy on us and just promote it to the largest type in the expression/lvalue. I'm not sure why they don't. Perhaps the more careful among you knows the answer. Thanks, Jeff > > 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. */ >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090125085419.O983>