Module Name: src Committed By: rmind Date: Wed Nov 11 09:48:51 UTC 2009
Modified Files: src/sys/compat/common: kern_time_50.c src/sys/compat/linux/common: linux_misc.c src/sys/compat/linux32/common: linux32_unistd.c src/sys/compat/netbsd32: netbsd32_compat_50.c netbsd32_select.c src/sys/compat/osf1: osf1_generic.c src/sys/kern: sys_select.c src/sys/sys: poll.h select.h Log Message: - selcommon/pollcommon: drop redundant l argument. - Use cached curlwp->l_fd, instead of p->p_fd. - Inline selscan/pollscan. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/compat/common/kern_time_50.c cvs rdiff -u -r1.210 -r1.211 src/sys/compat/linux/common/linux_misc.c cvs rdiff -u -r1.33 -r1.34 src/sys/compat/linux32/common/linux32_unistd.c cvs rdiff -u -r1.6 -r1.7 src/sys/compat/netbsd32/netbsd32_compat_50.c cvs rdiff -u -r1.17 -r1.18 src/sys/compat/netbsd32/netbsd32_select.c cvs rdiff -u -r1.15 -r1.16 src/sys/compat/osf1/osf1_generic.c cvs rdiff -u -r1.18 -r1.19 src/sys/kern/sys_select.c cvs rdiff -u -r1.14 -r1.15 src/sys/sys/poll.h cvs rdiff -u -r1.35 -r1.36 src/sys/sys/select.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/compat/common/kern_time_50.c diff -u src/sys/compat/common/kern_time_50.c:1.11 src/sys/compat/common/kern_time_50.c:1.12 --- src/sys/compat/common/kern_time_50.c:1.11 Wed Nov 4 21:23:02 2009 +++ src/sys/compat/common/kern_time_50.c Wed Nov 11 09:48:50 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_time_50.c,v 1.11 2009/11/04 21:23:02 rmind Exp $ */ +/* $NetBSD: kern_time_50.c,v 1.12 2009/11/11 09:48:50 rmind Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.11 2009/11/04 21:23:02 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.12 2009/11/11 09:48:50 rmind Exp $"); #ifdef _KERNEL_OPT #include "opt_aio.h" @@ -400,7 +400,8 @@ } int -compat_50_sys_select(struct lwp *l, const struct compat_50_sys_select_args *uap, register_t *retval) +compat_50_sys_select(struct lwp *l, + const struct compat_50_sys_select_args *uap, register_t *retval) { /* { syscallarg(int) nd; @@ -422,7 +423,7 @@ ts = &ats; } - return selcommon(l, retval, SCARG(uap, nd), SCARG(uap, in), + return selcommon(retval, SCARG(uap, nd), SCARG(uap, in), SCARG(uap, ou), SCARG(uap, ex), ts, NULL); } @@ -457,7 +458,7 @@ mask = &amask; } - return selcommon(l, retval, SCARG(uap, nd), SCARG(uap, in), + return selcommon(retval, SCARG(uap, nd), SCARG(uap, in), SCARG(uap, ou), SCARG(uap, ex), ts, mask); } int @@ -489,8 +490,7 @@ mask = &amask; } - return pollcommon(l, retval, SCARG(uap, fds), SCARG(uap, nfds), - ts, mask); + return pollcommon(retval, SCARG(uap, fds), SCARG(uap, nfds), ts, mask); } int Index: src/sys/compat/linux/common/linux_misc.c diff -u src/sys/compat/linux/common/linux_misc.c:1.210 src/sys/compat/linux/common/linux_misc.c:1.211 --- src/sys/compat/linux/common/linux_misc.c:1.210 Wed Nov 4 21:23:02 2009 +++ src/sys/compat/linux/common/linux_misc.c Wed Nov 11 09:48:50 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_misc.c,v 1.210 2009/11/04 21:23:02 rmind Exp $ */ +/* $NetBSD: linux_misc.c,v 1.211 2009/11/11 09:48:50 rmind Exp $ */ /*- * Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.210 2009/11/04 21:23:02 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.211 2009/11/11 09:48:50 rmind Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -851,7 +851,8 @@ * 2) select never returns ERESTART on Linux, always return EINTR */ int -linux_select1(struct lwp *l, register_t *retval, int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct linux_timeval *timeout) +linux_select1(struct lwp *l, register_t *retval, int nfds, fd_set *readfds, + fd_set *writefds, fd_set *exceptfds, struct linux_timeval *timeout) { struct timespec ts0, ts1, uts, *ts = NULL; struct linux_timeval ltv; @@ -884,8 +885,7 @@ nanotime(&ts0); } - error = selcommon(l, retval, nfds, readfds, writefds, exceptfds, - ts, NULL); + error = selcommon(retval, nfds, readfds, writefds, exceptfds, ts, NULL); if (error) { /* Index: src/sys/compat/linux32/common/linux32_unistd.c diff -u src/sys/compat/linux32/common/linux32_unistd.c:1.33 src/sys/compat/linux32/common/linux32_unistd.c:1.34 --- src/sys/compat/linux32/common/linux32_unistd.c:1.33 Tue Jun 2 13:00:24 2009 +++ src/sys/compat/linux32/common/linux32_unistd.c Wed Nov 11 09:48:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: linux32_unistd.c,v 1.33 2009/06/02 13:00:24 njoly Exp $ */ +/* $NetBSD: linux32_unistd.c,v 1.34 2009/11/11 09:48:51 rmind Exp $ */ /*- * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved. @@ -33,7 +33,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: linux32_unistd.c,v 1.33 2009/06/02 13:00:24 njoly Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux32_unistd.c,v 1.34 2009/11/11 09:48:51 rmind Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -182,8 +182,7 @@ } else timespecclear(&uts); /* XXX GCC4 */ - error = selcommon(l, retval, nfds, - readfds, writefds, exceptfds, ts, NULL); + error = selcommon(retval, nfds, readfds, writefds, exceptfds, ts, NULL); if (error) { /* Index: src/sys/compat/netbsd32/netbsd32_compat_50.c diff -u src/sys/compat/netbsd32/netbsd32_compat_50.c:1.6 src/sys/compat/netbsd32/netbsd32_compat_50.c:1.7 --- src/sys/compat/netbsd32/netbsd32_compat_50.c:1.6 Wed Nov 4 21:23:03 2009 +++ src/sys/compat/netbsd32/netbsd32_compat_50.c Wed Nov 11 09:48:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_compat_50.c,v 1.6 2009/11/04 21:23:03 rmind Exp $ */ +/* $NetBSD: netbsd32_compat_50.c,v 1.7 2009/11/11 09:48:51 rmind Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.6 2009/11/04 21:23:03 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.7 2009/11/11 09:48:51 rmind Exp $"); #if defined(_KERNEL_OPT) #include "opt_sysv.h" @@ -140,7 +140,7 @@ ts = &ats; } - return selcommon(l, retval, SCARG(uap, nd), SCARG_P32(uap, in), + return selcommon(retval, SCARG(uap, nd), SCARG_P32(uap, in), SCARG_P32(uap, ou), SCARG_P32(uap, ex), ts, NULL); return 0; } @@ -724,7 +724,7 @@ mask = &amask; } - return selcommon(l, retval, SCARG(uap, nd), SCARG_P32(uap, in), + return selcommon(retval, SCARG(uap, nd), SCARG_P32(uap, in), SCARG_P32(uap, ou), SCARG_P32(uap, ex), ts, mask); return 0; } @@ -758,7 +758,7 @@ mask = &amask; } - return pollcommon(l, retval, SCARG_P32(uap, fds), + return pollcommon(retval, SCARG_P32(uap, fds), SCARG(uap, nfds), ts, mask); } Index: src/sys/compat/netbsd32/netbsd32_select.c diff -u src/sys/compat/netbsd32/netbsd32_select.c:1.17 src/sys/compat/netbsd32/netbsd32_select.c:1.18 --- src/sys/compat/netbsd32/netbsd32_select.c:1.17 Sun Mar 29 19:21:19 2009 +++ src/sys/compat/netbsd32/netbsd32_select.c Wed Nov 11 09:48:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_select.c,v 1.17 2009/03/29 19:21:19 christos Exp $ */ +/* $NetBSD: netbsd32_select.c,v 1.18 2009/11/11 09:48:51 rmind Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: netbsd32_select.c,v 1.17 2009/03/29 19:21:19 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_select.c,v 1.18 2009/11/11 09:48:51 rmind Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -51,7 +51,8 @@ #include <compat/netbsd32/netbsd32_conv.h> int -netbsd32___select50(struct lwp *l, const struct netbsd32___select50_args *uap, register_t *retval) +netbsd32___select50(struct lwp *l, + const struct netbsd32___select50_args *uap, register_t *retval) { /* { syscallarg(int) nd; @@ -73,12 +74,13 @@ ts = &ats; } - return selcommon(l, retval, SCARG(uap, nd), SCARG_P32(uap, in), + return selcommon(retval, SCARG(uap, nd), SCARG_P32(uap, in), SCARG_P32(uap, ou), SCARG_P32(uap, ex), ts, NULL); } int -netbsd32___pselect50(struct lwp *l, const struct netbsd32___pselect50_args *uap, register_t *retval) +netbsd32___pselect50(struct lwp *l, + const struct netbsd32___pselect50_args *uap, register_t *retval) { /* { syscallarg(int) nd; @@ -107,12 +109,13 @@ mask = &amask; } - return selcommon(l, retval, SCARG(uap, nd), SCARG_P32(uap, in), + return selcommon(retval, SCARG(uap, nd), SCARG_P32(uap, in), SCARG_P32(uap, ou), SCARG_P32(uap, ex), ts, mask); } int -netbsd32___pollts50(struct lwp *l, const struct netbsd32___pollts50_args *uap, register_t *retval) +netbsd32___pollts50(struct lwp *l, const struct netbsd32___pollts50_args *uap, + register_t *retval) { /* { syscallarg(struct netbsd32_pollfdp_t) fds; @@ -139,6 +142,6 @@ mask = &amask; } - return pollcommon(l, retval, SCARG_P32(uap, fds), + return pollcommon(retval, SCARG_P32(uap, fds), SCARG(uap, nfds), ts, mask); } Index: src/sys/compat/osf1/osf1_generic.c diff -u src/sys/compat/osf1/osf1_generic.c:1.15 src/sys/compat/osf1/osf1_generic.c:1.16 --- src/sys/compat/osf1/osf1_generic.c:1.15 Wed Apr 1 03:06:06 2009 +++ src/sys/compat/osf1/osf1_generic.c Wed Nov 11 09:48:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: osf1_generic.c,v 1.15 2009/04/01 03:06:06 dogcow Exp $ */ +/* $NetBSD: osf1_generic.c,v 1.16 2009/11/11 09:48:51 rmind Exp $ */ /* * Copyright (c) 1999 Christopher G. Demetriou. All rights reserved. @@ -58,7 +58,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: osf1_generic.c,v 1.15 2009/04/01 03:06:06 dogcow Exp $"); +__KERNEL_RCSID(0, "$NetBSD: osf1_generic.c,v 1.16 2009/11/11 09:48:51 rmind Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -159,7 +159,8 @@ } int -osf1_sys_select(struct lwp *l, const struct osf1_sys_select_args *uap, register_t *retval) +osf1_sys_select(struct lwp *l, const struct osf1_sys_select_args *uap, + register_t *retval) { struct osf1_timeval otv; struct timespec ats, *ts = NULL; @@ -176,6 +177,6 @@ ts = &ats; } - return selcommon(l, retval, SCARG(uap, nd), SCARG(uap, in), + return selcommon(retval, SCARG(uap, nd), SCARG(uap, in), SCARG(uap, ou), SCARG(uap, ex), ts, NULL); } Index: src/sys/kern/sys_select.c diff -u src/sys/kern/sys_select.c:1.18 src/sys/kern/sys_select.c:1.19 --- src/sys/kern/sys_select.c:1.18 Sun Nov 1 21:46:09 2009 +++ src/sys/kern/sys_select.c Wed Nov 11 09:48:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_select.c,v 1.18 2009/11/01 21:46:09 rmind Exp $ */ +/* $NetBSD: sys_select.c,v 1.19 2009/11/11 09:48:51 rmind Exp $ */ /*- * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sys_select.c,v 1.18 2009/11/01 21:46:09 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_select.c,v 1.19 2009/11/11 09:48:51 rmind Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -108,9 +108,9 @@ uint32_t sc_mask; } selcpu_t; -static int selscan(char *, u_int, register_t *); -static int pollscan(struct pollfd *, u_int, register_t *); -static void selclear(void); +static inline int selscan(char *, u_int, register_t *); +static inline int pollscan(struct pollfd *, u_int, register_t *); +static void selclear(void); static syncobj_t select_sobj = { SOBJ_SLEEPQ_FIFO, @@ -152,7 +152,7 @@ mask = &amask; } - return selcommon(l, retval, SCARG(uap, nd), SCARG(uap, in), + return selcommon(retval, SCARG(uap, nd), SCARG(uap, in), SCARG(uap, ou), SCARG(uap, ex), ts, mask); } @@ -179,7 +179,7 @@ ts = &ats; } - return selcommon(l, retval, SCARG(uap, nd), SCARG(uap, in), + return selcommon(retval, SCARG(uap, nd), SCARG(uap, in), SCARG(uap, ou), SCARG(uap, ex), ts, NULL); } @@ -265,19 +265,18 @@ } int -selcommon(lwp_t *l, register_t *retval, int nd, fd_set *u_in, - fd_set *u_ou, fd_set *u_ex, struct timespec *ts, sigset_t *mask) +selcommon(register_t *retval, int nd, fd_set *u_in, fd_set *u_ou, + fd_set *u_ex, struct timespec *ts, sigset_t *mask) { char smallbits[howmany(FD_SETSIZE, NFDBITS) * sizeof(fd_mask) * 6]; - proc_t * const p = l->l_proc; char *bits; int error, nf; size_t ni; if (nd < 0) return (EINVAL); - nf = p->p_fd->fd_dt->dt_nfiles; + nf = curlwp->l_fd->fd_dt->dt_nfiles; if (nd > nf) { /* forgiving; slightly wrong */ nd = nf; @@ -320,7 +319,7 @@ return (error); } -static int +static inline int selscan(char *bits, u_int nfd, register_t *retval) { static const int flag[3] = { POLLRDNORM | POLLHUP | POLLERR, @@ -376,8 +375,7 @@ ts = &ats; } - return pollcommon(l, retval, SCARG(uap, fds), SCARG(uap, nfds), - ts, NULL); + return pollcommon(retval, SCARG(uap, fds), SCARG(uap, nfds), ts, NULL); } /* @@ -410,21 +408,19 @@ mask = &amask; } - return pollcommon(l, retval, SCARG(uap, fds), SCARG(uap, nfds), - ts, mask); + return pollcommon(retval, SCARG(uap, fds), SCARG(uap, nfds), ts, mask); } int -pollcommon(lwp_t *l, register_t *retval, struct pollfd *u_fds, u_int nfds, +pollcommon(register_t *retval, struct pollfd *u_fds, u_int nfds, struct timespec *ts, sigset_t *mask) { struct pollfd smallfds[32]; struct pollfd *fds; - proc_t * const p = l->l_proc; int error; size_t ni, nf; - nf = p->p_fd->fd_dt->dt_nfiles; + nf = curlwp->l_fd->fd_dt->dt_nfiles; if (nfds > nf) { /* forgiving; slightly wrong */ nfds = nf; @@ -455,7 +451,7 @@ return (error); } -static int +static inline int pollscan(struct pollfd *fds, u_int nfd, register_t *retval) { int i, n; Index: src/sys/sys/poll.h diff -u src/sys/sys/poll.h:1.14 src/sys/sys/poll.h:1.15 --- src/sys/sys/poll.h:1.14 Sun Mar 29 19:21:20 2009 +++ src/sys/sys/poll.h Wed Nov 11 09:48:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: poll.h,v 1.14 2009/03/29 19:21:20 christos Exp $ */ +/* $NetBSD: poll.h,v 1.15 2009/11/11 09:48:51 rmind Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -73,8 +73,9 @@ struct lwp; struct timespec; -int pollcommon(struct lwp *, register_t *, struct pollfd *, u_int, +int pollcommon(register_t *, struct pollfd *, u_int, struct timespec *, sigset_t *); + #else #include <sys/cdefs.h> Index: src/sys/sys/select.h diff -u src/sys/sys/select.h:1.35 src/sys/sys/select.h:1.36 --- src/sys/sys/select.h:1.35 Sun Mar 29 19:21:20 2009 +++ src/sys/sys/select.h Wed Nov 11 09:48:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: select.h,v 1.35 2009/03/29 19:21:20 christos Exp $ */ +/* $NetBSD: select.h,v 1.36 2009/11/11 09:48:51 rmind Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -48,8 +48,8 @@ struct cpu_info; struct socket; -int selcommon(struct lwp *, register_t *, int, fd_set *, fd_set *, - fd_set *, struct timespec *, sigset_t *); +int selcommon(register_t *, int, fd_set *, fd_set *, fd_set *, + struct timespec *, sigset_t *); void selrecord(struct lwp *selector, struct selinfo *); void selnotify(struct selinfo *, int, long); void selsysinit(struct cpu_info *);