From owner-svn-src-stable-8@FreeBSD.ORG Sun Oct 10 07:07:21 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA0EB106564A; Sun, 10 Oct 2010 07:07:21 +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 98C928FC0C; Sun, 10 Oct 2010 07:07:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9A77LlN073626; Sun, 10 Oct 2010 07:07:21 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9A77LpV073624; Sun, 10 Oct 2010 07:07:21 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201010100707.o9A77LpV073624@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 10 Oct 2010 07:07:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213665 - stable/8/sys/amd64/amd64 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Oct 2010 07:07:21 -0000 Author: kib Date: Sun Oct 10 07:07:21 2010 New Revision: 213665 URL: http://svn.freebsd.org/changeset/base/213665 Log: MFC r213382: In makectx(), always use the tf_rsp from trap frame. %rsp is pushed unconditionally by hardware on the trap. PR: amd64/151167 Modified: stable/8/sys/amd64/amd64/machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/amd64/amd64/machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/machdep.c Sun Oct 10 07:05:47 2010 (r213664) +++ stable/8/sys/amd64/amd64/machdep.c Sun Oct 10 07:07:21 2010 (r213665) @@ -1795,7 +1795,7 @@ makectx(struct trapframe *tf, struct pcb pcb->pcb_rbp = tf->tf_rbp; pcb->pcb_rbx = tf->tf_rbx; pcb->pcb_rip = tf->tf_rip; - pcb->pcb_rsp = (ISPL(tf->tf_cs)) ? tf->tf_rsp : (long)(tf + 1) - 8; + pcb->pcb_rsp = tf->tf_rsp; } int From owner-svn-src-stable-8@FreeBSD.ORG Sun Oct 10 08:41:08 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A184910656C2; Sun, 10 Oct 2010 08:41:08 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 85EF68FC1C; Sun, 10 Oct 2010 08:41:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9A8f87v075583; Sun, 10 Oct 2010 08:41:08 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9A8f8ZN075579; Sun, 10 Oct 2010 08:41:08 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201010100841.o9A8f8ZN075579@svn.freebsd.org> From: Martin Matuska Date: Sun, 10 Oct 2010 08:41:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213667 - in stable/8: lib/libarchive usr.bin/ar usr.bin/tar X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Oct 2010 08:41:08 -0000 Author: mm Date: Sun Oct 10 08:41:08 2010 New Revision: 213667 URL: http://svn.freebsd.org/changeset/base/213667 Log: - Add liblzma support to libarchive and usr.bin/tar - Do not link usr.bin/ar to liblzma if building bootstrap-tools and the local system doesn't include liblzma (fixes world build on FreeBSD 7.x) This is a direct commit. Approved by: delphij (mentor) Modified: stable/8/lib/libarchive/Makefile stable/8/usr.bin/ar/Makefile stable/8/usr.bin/tar/Makefile Modified: stable/8/lib/libarchive/Makefile ============================================================================== --- stable/8/lib/libarchive/Makefile Sun Oct 10 07:28:56 2010 (r213666) +++ stable/8/lib/libarchive/Makefile Sun Oct 10 08:41:08 2010 (r213667) @@ -2,8 +2,16 @@ .include LIB= archive -DPADD= ${LIBBZ2} ${LIBZ} ${LIBMD} -LDADD= -lbz2 -lz -lmd +DPADD= ${LIBZ} ${LIBMD} +LDADD= -lz -lmd + +DPADD+= ${LIBBZ2} +LDADD+= -lbz2 +CFLAGS+= -DHAVE_BZLIB_H=1 + +DPADD+= ${LIBLZMA} +LDADD+= -llzma +CFLAGS+= -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1 # FreeBSD SHLIB_MAJOR value is managed as part of the FreeBSD system. # It has no real relation to the libarchive version number. @@ -11,10 +19,6 @@ SHLIB_MAJOR= 5 CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" CFLAGS+= -I${.OBJDIR} -#Uncomment to build with full lzma/xz support via liblzma -#liblzma is not (yet?) part of the FreeBSD base system -#CFLAGS+= -I/usr/local/include -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1 -#LDADD+= -L/usr/local/lib -llzma .if ${MK_OPENSSL} != "no" CFLAGS+= -DWITH_OPENSSL Modified: stable/8/usr.bin/ar/Makefile ============================================================================== --- stable/8/usr.bin/ar/Makefile Sun Oct 10 07:28:56 2010 (r213666) +++ stable/8/usr.bin/ar/Makefile Sun Oct 10 08:41:08 2010 (r213667) @@ -8,6 +8,13 @@ WARNS?= 5 DPADD= ${LIBARCHIVE} ${LIBBZ2} ${LIBZ} ${LIBELF} LDADD= -larchive -lbz2 -lz -lelf +# Do not depend on liblzma if we are building the bootstrap-tools and +# the local system doesn't include liblzma +.if !defined(BOOTSTRAPPING) || ${BOOTSTRAPPING} >= 800505 +DPADD+= ${LIBLZMA} +LDADD+= -llzma +.endif + CFLAGS+=-I. -I${.CURDIR} NO_SHARED?= yes Modified: stable/8/usr.bin/tar/Makefile ============================================================================== --- stable/8/usr.bin/tar/Makefile Sun Oct 10 07:28:56 2010 (r213666) +++ stable/8/usr.bin/tar/Makefile Sun Oct 10 08:41:08 2010 (r213667) @@ -5,13 +5,14 @@ PROG= bsdtar BSDTAR_VERSION_STRING=2.7.0 SRCS= bsdtar.c cmdline.c getdate.c matching.c read.c siginfo.c subst.c tree.c util.c write.c WARNS?= 5 -DPADD= ${LIBARCHIVE} ${LIBBZ2} ${LIBZ} -LDADD= -larchive -lbz2 -lz -lmd +DPADD= ${LIBARCHIVE} ${LIBBZ2} ${LIBZ} ${LIBLZMA} +LDADD= -larchive -lbz2 -lz -lmd -llzma .if ${MK_OPENSSL} != "no" LDADD+= -lcrypto .endif CFLAGS+= -DBSDTAR_VERSION_STRING=\"${BSDTAR_VERSION_STRING}\" CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" +CFLAGS+= -DHAVE_LIBLZMA CFLAGS+= -I${.CURDIR} SYMLINKS= bsdtar ${BINDIR}/tar MLINKS= bsdtar.1 tar.1 From owner-svn-src-stable-8@FreeBSD.ORG Sun Oct 10 12:18:53 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F4461065674; Sun, 10 Oct 2010 12:18:53 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DE928FC1A; Sun, 10 Oct 2010 12:18:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9ACIrNZ082301; Sun, 10 Oct 2010 12:18:53 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9ACIrl7082298; Sun, 10 Oct 2010 12:18:53 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201010101218.o9ACIrl7082298@svn.freebsd.org> From: Martin Matuska Date: Sun, 10 Oct 2010 12:18:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213669 - stable/8/usr.bin/tar X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Oct 2010 12:18:53 -0000 Author: mm Date: Sun Oct 10 12:18:53 2010 New Revision: 213669 URL: http://svn.freebsd.org/changeset/base/213669 Log: Move HAVE_LIBLZMA from Makefile to config_freebsd.h Approved by: delphij (mentor) Modified: stable/8/usr.bin/tar/Makefile stable/8/usr.bin/tar/config_freebsd.h Modified: stable/8/usr.bin/tar/Makefile ============================================================================== --- stable/8/usr.bin/tar/Makefile Sun Oct 10 09:24:19 2010 (r213668) +++ stable/8/usr.bin/tar/Makefile Sun Oct 10 12:18:53 2010 (r213669) @@ -12,7 +12,6 @@ LDADD+= -lcrypto .endif CFLAGS+= -DBSDTAR_VERSION_STRING=\"${BSDTAR_VERSION_STRING}\" CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" -CFLAGS+= -DHAVE_LIBLZMA CFLAGS+= -I${.CURDIR} SYMLINKS= bsdtar ${BINDIR}/tar MLINKS= bsdtar.1 tar.1 Modified: stable/8/usr.bin/tar/config_freebsd.h ============================================================================== --- stable/8/usr.bin/tar/config_freebsd.h Sun Oct 10 09:24:19 2010 (r213668) +++ stable/8/usr.bin/tar/config_freebsd.h Sun Oct 10 12:18:53 2010 (r213669) @@ -61,6 +61,9 @@ #define HAVE_LIBARCHIVE 1 #define HAVE_LIBBZ2 1 #define HAVE_LIBZ 1 +#if __FreeBSD_version >= 800505 /* liblzma introduced */ +#define HAVE_LIBLZMA 1 +#endif #define HAVE_LIMITS_H 1 #undef HAVE_LINUX_EXT2_FS_H #undef HAVE_LINUX_FS_H From owner-svn-src-stable-8@FreeBSD.ORG Sun Oct 10 12:20:05 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3611E10656BC; Sun, 10 Oct 2010 12:20:05 +0000 (UTC) (envelope-from kaiw@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A8208FC18; Sun, 10 Oct 2010 12:20:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9ACK4LB082373; Sun, 10 Oct 2010 12:20:05 GMT (envelope-from kaiw@svn.freebsd.org) Received: (from kaiw@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9ACK4xg082371; Sun, 10 Oct 2010 12:20:04 GMT (envelope-from kaiw@svn.freebsd.org) Message-Id: <201010101220.o9ACK4xg082371@svn.freebsd.org> From: Kai Wang Date: Sun, 10 Oct 2010 12:20:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213670 - stable/8/lib/libelf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Oct 2010 12:20:05 -0000 Author: kaiw Date: Sun Oct 10 12:20:04 2010 New Revision: 213670 URL: http://svn.freebsd.org/changeset/base/213670 Log: MFC r212373: libelf is overly strict about the type and alignment of Elf_Data objects inside one ELF section, which prevents the creation of a ELF section with mixed data types. For example, gcc LTO use libelf to create a .gnu_lto_XXX section that contains integers and a string table, which doesn't work with our libelf implementation. The changes made in this commit include: * Allow Elf_Data type to be different than section type. * Relax Elf_Data alignment check. * Align each Elf_Data by their own alignment instead of section alignment. Modified: stable/8/lib/libelf/elf_update.c Directory Properties: stable/8/lib/libelf/ (props changed) Modified: stable/8/lib/libelf/elf_update.c ============================================================================== --- stable/8/lib/libelf/elf_update.c Sun Oct 10 12:18:53 2010 (r213669) +++ stable/8/lib/libelf/elf_update.c Sun Oct 10 12:20:04 2010 (r213670) @@ -141,7 +141,7 @@ _libelf_compute_section_extents(Elf *e, /* Compute the section alignment. */ STAILQ_FOREACH(d, &s->s_data, d_next) { - if (d->d_type != elftype) { + if (d->d_type > ELF_T_LAST) { LIBELF_SET_ERROR(DATA, 0); return (0); } @@ -149,11 +149,7 @@ _libelf_compute_section_extents(Elf *e, LIBELF_SET_ERROR(VERSION, 0); return (0); } - if ((d_align = d->d_align) % sh_align) { - LIBELF_SET_ERROR(LAYOUT, 0); - return (0); - } - if (d_align == 0 || (d_align & (d_align - 1))) { + if ((d_align = d->d_align) == 0 || (d_align & (d_align - 1))) { LIBELF_SET_ERROR(DATA, 0); return (0); } @@ -168,7 +164,7 @@ _libelf_compute_section_extents(Elf *e, if ((uint64_t) d->d_off + d->d_size > scn_size) scn_size = d->d_off + d->d_size; } else { - scn_size = roundup2(scn_size, scn_alignment); + scn_size = roundup2(scn_size, d->d_align); d->d_off = scn_size; scn_size += d->d_size; } @@ -560,8 +556,6 @@ _libelf_write_scn(Elf *e, char *nf, Elf_ elftype = _libelf_xlate_shtype(sh_type); assert(elftype >= ELF_T_FIRST && elftype <= ELF_T_LAST); - msz = _libelf_msize(elftype, ec, e->e_version); - sh_off = s->s_offset; assert(sh_off % _libelf_falign(elftype, ec) == 0); @@ -608,6 +602,8 @@ _libelf_write_scn(Elf *e, char *nf, Elf_ STAILQ_FOREACH(d, &s->s_data, d_next) { + msz = _libelf_msize(d->d_type, ec, e->e_version); + if ((uint64_t) rc < sh_off + d->d_off) (void) memset(nf + rc, LIBELF_PRIVATE(fillchar), sh_off + d->d_off - rc); @@ -615,13 +611,12 @@ _libelf_write_scn(Elf *e, char *nf, Elf_ rc = sh_off + d->d_off; assert(d->d_buf != NULL); - assert(d->d_type == (Elf_Type) elftype); assert(d->d_version == e->e_version); assert(d->d_size % msz == 0); nobjects = d->d_size / msz; - fsz = _libelf_fsize(elftype, ec, e->e_version, nobjects); + fsz = _libelf_fsize(d->d_type, ec, e->e_version, nobjects); dst.d_buf = nf + rc; dst.d_size = fsz; From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 11 09:34:46 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 733B7106564A; Mon, 11 Oct 2010 09:34:46 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 60D218FC1B; Mon, 11 Oct 2010 09:34:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9B9Yki2008687; Mon, 11 Oct 2010 09:34:46 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9B9YkIY008683; Mon, 11 Oct 2010 09:34:46 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201010110934.o9B9YkIY008683@svn.freebsd.org> From: Martin Matuska Date: Mon, 11 Oct 2010 09:34:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213683 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Oct 2010 09:34:46 -0000 Author: mm Date: Mon Oct 11 09:34:46 2010 New Revision: 213683 URL: http://svn.freebsd.org/changeset/base/213683 Log: MFC r210470: Import two changesets from OpenSolaris to make future updates easier. The changes do not affect FreeBSD code because zfs_znode_move(), cleanlocks() and cleanshares() are not used. OpenSolaris onnv changeset: 9788:f660bc44f2e8, 9909:aa280f585a3e Approved by: pjd, delphij (mentor) Obtained from: OpenSolaris (Bug ID 6843700, 6790232) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon Oct 11 09:27:37 2010 (r213682) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Mon Oct 11 09:34:46 2010 (r213683) @@ -955,11 +955,22 @@ zfsvfs_setup(zfsvfs_t *zfsvfs, boolean_t return (0); } +extern krwlock_t zfsvfs_lock; /* in zfs_znode.c */ + void zfsvfs_free(zfsvfs_t *zfsvfs) { int i; + /* + * This is a barrier to prevent the filesystem from going away in + * zfs_znode_move() until we can safely ensure that the filesystem is + * not unmounted. We consider the filesystem valid before the barrier + * and invalid after the barrier. + */ + rw_enter(&zfsvfs_lock, RW_READER); + rw_exit(&zfsvfs_lock); + zfs_fuid_destroy(zfsvfs); mutex_destroy(&zfsvfs->z_znodes_lock); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Oct 11 09:27:37 2010 (r213682) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Mon Oct 11 09:34:46 2010 (r213683) @@ -200,6 +200,12 @@ zfs_close(vnode_t *vp, int flag, int cou znode_t *zp = VTOZ(vp); zfsvfs_t *zfsvfs = zp->z_zfsvfs; + /* + * Clean up any locks held by this process on the vp. + */ + cleanlocks(vp, ddi_get_pid(), 0); + cleanshares(vp, ddi_get_pid()); + ZFS_ENTER(zfsvfs); ZFS_VERIFY_ZP(zp); @@ -207,12 +213,6 @@ zfs_close(vnode_t *vp, int flag, int cou if ((flag & (FSYNC | FDSYNC)) && (count == 1)) atomic_dec_32(&zp->z_sync_cnt); - /* - * Clean up any locks held by this process on the vp. - */ - cleanlocks(vp, ddi_get_pid(), 0); - cleanshares(vp, ddi_get_pid()); - if (!zfs_has_ctldir(zp) && zp->z_zfsvfs->z_vscan && ZTOV(zp)->v_type == VREG && !(zp->z_phys->zp_flags & ZFS_AV_QUARANTINED) && Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Mon Oct 11 09:27:37 2010 (r213682) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Mon Oct 11 09:34:46 2010 (r213683) @@ -87,6 +87,12 @@ SYSCTL_INT(_debug_sizeof, OID_AUTO, znod * (such as VFS logic) that will not compile easily in userland. */ #ifdef _KERNEL +/* + * Needed to close a small window in zfs_znode_move() that allows the zfsvfs to + * be freed before it can be safely accessed. + */ +krwlock_t zfsvfs_lock; + static kmem_cache_t *znode_cache = NULL; /*ARGSUSED*/ @@ -200,8 +206,9 @@ zfs_znode_cache_destructor(void *buf, vo #ifdef ZNODE_STATS static struct { uint64_t zms_zfsvfs_invalid; + uint64_t zms_zfsvfs_recheck1; uint64_t zms_zfsvfs_unmounted; - uint64_t zms_zfsvfs_recheck_invalid; + uint64_t zms_zfsvfs_recheck2; uint64_t zms_obj_held; uint64_t zms_vnode_locked; uint64_t zms_not_only_dnlc; @@ -285,15 +292,32 @@ zfs_znode_move(void *buf, void *newbuf, } /* - * Ensure that the filesystem is not unmounted during the move. - * This is the equivalent to ZFS_ENTER(). + * Close a small window in which it's possible that the filesystem could + * be unmounted and freed, and zfsvfs, though valid in the previous + * statement, could point to unrelated memory by the time we try to + * prevent the filesystem from being unmounted. + */ + rw_enter(&zfsvfs_lock, RW_WRITER); + if (zfsvfs != ozp->z_zfsvfs) { + rw_exit(&zfsvfs_lock); + ZNODE_STAT_ADD(znode_move_stats.zms_zfsvfs_recheck1); + return (KMEM_CBRC_DONT_KNOW); + } + + /* + * If the znode is still valid, then so is the file system. We know that + * no valid file system can be freed while we hold zfsvfs_lock, so we + * can safely ensure that the filesystem is not and will not be + * unmounted. The next statement is equivalent to ZFS_ENTER(). */ rrw_enter(&zfsvfs->z_teardown_lock, RW_READER, FTAG); if (zfsvfs->z_unmounted) { ZFS_EXIT(zfsvfs); + rw_exit(&zfsvfs_lock); ZNODE_STAT_ADD(znode_move_stats.zms_zfsvfs_unmounted); return (KMEM_CBRC_DONT_KNOW); } + rw_exit(&zfsvfs_lock); mutex_enter(&zfsvfs->z_znodes_lock); /* @@ -303,7 +327,7 @@ zfs_znode_move(void *buf, void *newbuf, if (zfsvfs != ozp->z_zfsvfs) { mutex_exit(&zfsvfs->z_znodes_lock); ZFS_EXIT(zfsvfs); - ZNODE_STAT_ADD(znode_move_stats.zms_zfsvfs_recheck_invalid); + ZNODE_STAT_ADD(znode_move_stats.zms_zfsvfs_recheck2); return (KMEM_CBRC_DONT_KNOW); } @@ -360,6 +384,7 @@ zfs_znode_init(void) /* * Initialize zcache */ + rw_init(&zfsvfs_lock, NULL, RW_DEFAULT, NULL); ASSERT(znode_cache == NULL); znode_cache = kmem_cache_create("zfs_znode_cache", sizeof (znode_t), 0, /* zfs_znode_cache_constructor */ NULL, @@ -378,6 +403,7 @@ zfs_znode_fini(void) if (znode_cache) kmem_cache_destroy(znode_cache); znode_cache = NULL; + rw_destroy(&zfsvfs_lock); } int From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 11 09:39:32 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BEFFD106566B; Mon, 11 Oct 2010 09:39:32 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC3928FC13; Mon, 11 Oct 2010 09:39:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9B9dWdc008827; Mon, 11 Oct 2010 09:39:32 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9B9dWFm008824; Mon, 11 Oct 2010 09:39:32 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201010110939.o9B9dWFm008824@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Mon, 11 Oct 2010 09:39:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213684 - in stable/8/sbin/geom/class: part sched X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Oct 2010 09:39:32 -0000 Author: ae Date: Mon Oct 11 09:39:32 2010 New Revision: 213684 URL: http://svn.freebsd.org/changeset/base/213684 Log: GPART's control interface between kernel and user space has been changed in r212614. Perform partial MFC of r213097 adapted to the stable ABI: Implement "force" (-F) option for gpart destroy verb. This option doesn't passed to kernel and handled in user-space. With -F option gpart creates new "delete" request for each partition in table. Each request has flags="X" that disables auto-commit feature. Last request is the original "destroy" request. It has own flags and can have disabled or enabled auto-commit feature. If error is occurred when deleting partitions, then new "undo" request is created and all changes will be rolled back. Approved by: kib (mentor) Modified: stable/8/sbin/geom/class/part/geom_part.c stable/8/sbin/geom/class/part/gpart.8 Directory Properties: stable/8/sbin/geom/ (props changed) stable/8/sbin/geom/class/part/ (props changed) stable/8/sbin/geom/class/sched/gsched.8 (props changed) stable/8/sbin/geom/class/stripe/ (props changed) Modified: stable/8/sbin/geom/class/part/geom_part.c ============================================================================== --- stable/8/sbin/geom/class/part/geom_part.c Mon Oct 11 09:34:46 2010 (r213683) +++ stable/8/sbin/geom/class/part/geom_part.c Mon Oct 11 09:39:32 2010 (r213684) @@ -68,6 +68,7 @@ static char ssize[32]; static const char const bootcode_param[] = "bootcode"; static const char const index_param[] = "index"; static const char const partcode_param[] = "partcode"; +static const char const force_param[] = "force"; static struct gclass *find_class(struct gmesh *, const char *); static struct ggeom * find_geom(struct gclass *, const char *); @@ -84,6 +85,8 @@ static void gpart_show_geom(struct ggeom static int gpart_show_hasopt(struct gctl_req *, const char *, const char *); static void gpart_write_partcode(struct ggeom *, int, void *, ssize_t); static void gpart_write_partcode_vtoc8(struct ggeom *, int, void *); +static void gpart_destroy(struct gctl_req *, unsigned int); +static void gpart_print_error(const char *); struct g_command PUBSYM(class_commands)[] = { { "add", 0, gpart_issue, { @@ -118,7 +121,8 @@ struct g_command PUBSYM(class_commands)[ G_OPT_SENTINEL }, "geom", NULL }, - { "destroy", 0, gpart_issue, { + { "destroy", 0, gpart_destroy, { + { 'F', force_param, NULL, G_TYPE_BOOL }, { 'f', "flags", flags, G_TYPE_STRING }, G_OPT_SENTINEL }, "geom", NULL }, @@ -853,10 +857,101 @@ gpart_bootcode(struct gctl_req *req, uns } static void +gpart_destroy(struct gctl_req *req, unsigned int fl) +{ + struct gmesh mesh; + struct gclass *classp; + struct gctl_req *req2; + struct ggeom *gp; + struct gprovider *pp; + const char *s; + int error, val; + + if (gctl_has_param(req, force_param)) { + val = gctl_get_int(req, force_param); + error = gctl_delete_param(req, force_param); + if (error) + errc(EXIT_FAILURE, error, "internal error"); + if (val == 0) + goto done; + s = gctl_get_ascii(req, "class"); + if (s == NULL) + abort(); + error = geom_gettree(&mesh); + if (error != 0) + errc(EXIT_FAILURE, error, "Cannot get GEOM tree"); + classp = find_class(&mesh, s); + if (classp == NULL) { + geom_deletetree(&mesh); + errx(EXIT_FAILURE, "Class %s not found.", s); + } + s = gctl_get_ascii(req, "geom"); + if (s == NULL) + abort(); + gp = find_geom(classp, s); + if (gp == NULL) + errx(EXIT_FAILURE, "No such geom: %s.", s); + val = 0; + LIST_FOREACH(pp, &gp->lg_provider, lg_provider){ + s = find_provcfg(pp, "index"); + if (s == NULL) + errx(EXIT_FAILURE, "Index not found for %s.", + pp->lg_name); + req2 = gctl_get_handle(); + gctl_ro_param(req2, "class", -1, classp->lg_name); + gctl_ro_param(req2, "geom", -1, gp->lg_name); + gctl_ro_param(req2, "verb", -1, "delete"); + gctl_ro_param(req2, index_param, -1, s); + gctl_ro_param(req2, "flags", -1, "X"); + s = gctl_issue(req2); + if (s != NULL && s[0] != '\0') { + gpart_print_error(s); + gctl_free(req2); + if (val) { /* try to undo changes */ + req2 = gctl_get_handle(); + gctl_ro_param(req2, "verb", -1, + "undo"); + gctl_ro_param(req2, "class", -1, + classp->lg_name); + gctl_ro_param(req2, "geom", -1, + gp->lg_name); + gctl_issue(req2); + gctl_free(req2); + } + geom_deletetree(&mesh); + exit(EXIT_FAILURE); + } + gctl_free(req2); + val = 1; + } + geom_deletetree(&mesh); + } +done: + gpart_issue(req, fl); +} + +static void +gpart_print_error(const char *errstr) +{ + char *errmsg; + int error; + + error = strtol(errstr, &errmsg, 0); + if (errmsg != errstr) { + while (errmsg[0] == ' ') + errmsg++; + if (errmsg[0] != '\0') + warnc(error, "%s", errmsg); + else + warnc(error, NULL); + } else + warnx("%s", errmsg); +} + +static void gpart_issue(struct gctl_req *req, unsigned int fl __unused) { char buf[4096]; - char *errmsg; const char *errstr; int error, status; @@ -878,17 +973,7 @@ gpart_issue(struct gctl_req *req, unsign goto done; } - error = strtol(errstr, &errmsg, 0); - if (errmsg != errstr) { - while (errmsg[0] == ' ') - errmsg++; - if (errmsg[0] != '\0') - warnc(error, "%s", errmsg); - else - warnc(error, NULL); - } else - warnx("%s", errmsg); - + gpart_print_error(errstr); status = EXIT_FAILURE; done: Modified: stable/8/sbin/geom/class/part/gpart.8 ============================================================================== --- stable/8/sbin/geom/class/part/gpart.8 Mon Oct 11 09:34:46 2010 (r213683) +++ stable/8/sbin/geom/class/part/gpart.8 Mon Oct 11 09:39:32 2010 (r213684) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 27, 2010 +.Dd Sep 24, 2010 .Dt GPART 8 .Os .Sh NAME @@ -118,6 +118,7 @@ utility: .\" ==== DESTROY ==== .Nm .Cm destroy +.Op Fl F .Op Fl f Ar flags .Ar geom .\" ==== MODIFY ==== @@ -317,6 +318,8 @@ Destroy the partitioning scheme as imple .Pp Additional options include: .Bl -tag -width 10n +.It Fl F +Forced destroying of the partition table even if it is not empty. .It Fl f Ar flags Additional operational flags. See the section entitled From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 11 09:41:24 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 999E91065674; Mon, 11 Oct 2010 09:41:24 +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 87B6F8FC1C; Mon, 11 Oct 2010 09:41:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9B9fOWH008900; Mon, 11 Oct 2010 09:41:24 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9B9fObF008898; Mon, 11 Oct 2010 09:41:24 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201010110941.o9B9fObF008898@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 11 Oct 2010 09:41:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213685 - stable/8/sys/amd64/linux32 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Oct 2010 09:41:24 -0000 Author: kib Date: Mon Oct 11 09:41:24 2010 New Revision: 213685 URL: http://svn.freebsd.org/changeset/base/213685 Log: MFC r213544: Fix typo. Modified: stable/8/sys/amd64/linux32/syscalls.master Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/amd64/linux32/syscalls.master ============================================================================== --- stable/8/sys/amd64/linux32/syscalls.master Mon Oct 11 09:39:32 2010 (r213684) +++ stable/8/sys/amd64/linux32/syscalls.master Mon Oct 11 09:41:24 2010 (r213685) @@ -416,7 +416,7 @@ 245 AUE_NULL UNIMPL linux_io_setup 246 AUE_NULL UNIMPL linux_io_destroy 247 AUE_NULL UNIMPL linux_io_getevents -248 AUE_NULL UNIMPL inux_io_submit +248 AUE_NULL UNIMPL linux_io_submit 249 AUE_NULL UNIMPL linux_io_cancel 250 AUE_NULL STD { int linux_fadvise64(void); } 251 AUE_NULL UNIMPL From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 11 09:42:31 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 362CB106564A; Mon, 11 Oct 2010 09:42:31 +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 19C558FC21; Mon, 11 Oct 2010 09:42:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9B9gUwk008965; Mon, 11 Oct 2010 09:42:31 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9B9gUel008961; Mon, 11 Oct 2010 09:42:30 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201010110942.o9B9gUel008961@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 11 Oct 2010 09:42:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213686 - stable/8/sys/amd64/linux32 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Oct 2010 09:42:31 -0000 Author: kib Date: Mon Oct 11 09:42:30 2010 New Revision: 213686 URL: http://svn.freebsd.org/changeset/base/213686 Log: Regen. Modified: stable/8/sys/amd64/linux32/linux32_proto.h stable/8/sys/amd64/linux32/linux32_syscall.h stable/8/sys/amd64/linux32/linux32_sysent.c Modified: stable/8/sys/amd64/linux32/linux32_proto.h ============================================================================== --- stable/8/sys/amd64/linux32/linux32_proto.h Mon Oct 11 09:41:24 2010 (r213685) +++ stable/8/sys/amd64/linux32/linux32_proto.h Mon Oct 11 09:42:30 2010 (r213686) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 185438 2008-11-29 14:55:24Z kib + * created from FreeBSD: stable/8/sys/amd64/linux32/syscalls.master 213685 2010-10-11 09:41:24Z kib */ #ifndef _LINUX_SYSPROTO_H_ @@ -1257,6 +1257,13 @@ int linux_vmsplice(struct thread *, stru #endif /* COMPAT_FREEBSD6 */ + +#ifdef COMPAT_FREEBSD7 + +#define nosys linux_nosys + +#endif /* COMPAT_FREEBSD7 */ + #define LINUX_SYS_AUE_linux_fork AUE_FORK #define LINUX_SYS_AUE_linux_open AUE_OPEN_RWTC #define LINUX_SYS_AUE_linux_waitpid AUE_WAIT4 Modified: stable/8/sys/amd64/linux32/linux32_syscall.h ============================================================================== --- stable/8/sys/amd64/linux32/linux32_syscall.h Mon Oct 11 09:41:24 2010 (r213685) +++ stable/8/sys/amd64/linux32/linux32_syscall.h Mon Oct 11 09:42:30 2010 (r213686) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 185438 2008-11-29 14:55:24Z kib + * created from FreeBSD: stable/8/sys/amd64/linux32/syscalls.master 213685 2010-10-11 09:41:24Z kib */ #define LINUX_SYS_exit 1 Modified: stable/8/sys/amd64/linux32/linux32_sysent.c ============================================================================== --- stable/8/sys/amd64/linux32/linux32_sysent.c Mon Oct 11 09:41:24 2010 (r213685) +++ stable/8/sys/amd64/linux32/linux32_sysent.c Mon Oct 11 09:42:30 2010 (r213686) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 185438 2008-11-29 14:55:24Z kib + * created from FreeBSD: stable/8/sys/amd64/linux32/syscalls.master 213685 2010-10-11 09:41:24Z kib */ #include "opt_compat.h" @@ -267,7 +267,7 @@ struct sysent linux_sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 245 = linux_io_setup */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 246 = linux_io_destroy */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 247 = linux_io_getevents */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 248 = inux_io_submit */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 248 = linux_io_submit */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 249 = linux_io_cancel */ { 0, (sy_call_t *)linux_fadvise64, AUE_NULL, NULL, 0, 0, 0 }, /* 250 = linux_fadvise64 */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 251 = */ From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 11 11:25:37 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF6A31065670; Mon, 11 Oct 2010 11:25:37 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A368C8FC15; Mon, 11 Oct 2010 11:25:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9BBPbnv013634; Mon, 11 Oct 2010 11:25:37 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9BBPbGd013631; Mon, 11 Oct 2010 11:25:37 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201010111125.o9BBPbGd013631@svn.freebsd.org> From: Xin LI Date: Mon, 11 Oct 2010 11:25:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213687 - in stable: 7/sys/netinet 7/sys/netinet6 8/sys/netinet 8/sys/netinet6 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Oct 2010 11:25:38 -0000 Author: delphij Date: Mon Oct 11 11:25:37 2010 New Revision: 213687 URL: http://svn.freebsd.org/changeset/base/213687 Log: MFC r213225: Add a bandaid for a long-standing race condition during route entry un-expiring. The previous version of code have no locking when testing rt_refcnt. The result of the lack of locking may result in a condition where a routing entry have a reference count but at the same time have RTPRF_OURS bit set and an expiration timer. These would eventually lead to a panic: panic: rtqkill route really not free When the system have ICMP redirects accepted from local gateway in a moderate frequency, for instance. Commit this workaround for now until we have some better solution. PR: kern/149804 Reviewed by: bz Tested by: Zhao Xin, Pete French Modified: stable/8/sys/netinet/in_rmx.c stable/8/sys/netinet6/in6_rmx.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Changes in other areas also in this revision: Modified: stable/7/sys/netinet/in_rmx.c stable/7/sys/netinet6/in6_rmx.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/8/sys/netinet/in_rmx.c ============================================================================== --- stable/8/sys/netinet/in_rmx.c Mon Oct 11 09:42:30 2010 (r213686) +++ stable/8/sys/netinet/in_rmx.c Mon Oct 11 11:25:37 2010 (r213687) @@ -121,12 +121,13 @@ in_matroute(void *v_arg, struct radix_no struct radix_node *rn = rn_match(v_arg, head); struct rtentry *rt = (struct rtentry *)rn; - /*XXX locking? */ - if (rt && rt->rt_refcnt == 0) { /* this is first reference */ + if (rt) { + RT_LOCK(rt); if (rt->rt_flags & RTPRF_OURS) { rt->rt_flags &= ~RTPRF_OURS; rt->rt_rmx.rmx_expire = 0; } + RT_UNLOCK(rt); } return rn; } Modified: stable/8/sys/netinet6/in6_rmx.c ============================================================================== --- stable/8/sys/netinet6/in6_rmx.c Mon Oct 11 09:42:30 2010 (r213686) +++ stable/8/sys/netinet6/in6_rmx.c Mon Oct 11 11:25:37 2010 (r213687) @@ -193,11 +193,13 @@ in6_matroute(void *v_arg, struct radix_n struct radix_node *rn = rn_match(v_arg, head); struct rtentry *rt = (struct rtentry *)rn; - if (rt && rt->rt_refcnt == 0) { /* this is first reference */ + if (rt) { + RT_LOCK(rt); if (rt->rt_flags & RTPRF_OURS) { rt->rt_flags &= ~RTPRF_OURS; rt->rt_rmx.rmx_expire = 0; } + RT_UNLOCK(rt); } return rn; } From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 11 16:55:17 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 797191065679; Mon, 11 Oct 2010 16:55:17 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 66AD48FC18; Mon, 11 Oct 2010 16:55:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9BGtH7Z021177; Mon, 11 Oct 2010 16:55:17 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9BGtHZs021174; Mon, 11 Oct 2010 16:55:17 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201010111655.o9BGtHZs021174@svn.freebsd.org> From: "George V. Neville-Neil" Date: Mon, 11 Oct 2010 16:55:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213692 - stable/8/lib/libpmc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Oct 2010 16:55:17 -0000 Author: gnn Date: Mon Oct 11 16:55:17 2010 New Revision: 213692 URL: http://svn.freebsd.org/changeset/base/213692 Log: MFC 213402: Fix punctuation and grammar, mostly by ending sentences with a period. Modified: stable/8/lib/libpmc/pmc.westmere.3 stable/8/lib/libpmc/pmc.westmereuc.3 Directory Properties: stable/8/lib/libpmc/ (props changed) Modified: stable/8/lib/libpmc/pmc.westmere.3 ============================================================================== --- stable/8/lib/libpmc/pmc.westmere.3 Mon Oct 11 14:31:24 2010 (r213691) +++ stable/8/lib/libpmc/pmc.westmere.3 Mon Oct 11 16:55:17 2010 (r213692) @@ -388,7 +388,7 @@ requests include both L1D demand RFO mis .It Li L2_RQSTS.RFOS .Pq Event 24H , Umask 0CH Counts all L2 store RFO requests. L2 RFO requests include both L1D demand -RFO misses as well as L1D RFO prefetches.. +RFO misses as well as L1D RFO prefetches. .It Li L2_RQSTS.IFETCH_HIT .Pq Event 24H , Umask 10H Counts number of instruction fetches that hit the L2 cache. L2 instruction @@ -474,13 +474,13 @@ This is a demand RFO request .It Li L2_WRITE.RFO.S_STATE .Pq Event 27H , Umask 02H Counts number of L2 store RFO requests where the cache line to be loaded is -in the S (shared) state. The L1D prefetcher does not issue a RFO prefetch,. -This is a demand RFO request +in the S (shared) state. The L1D prefetcher does not issue a RFO prefetch. +This is a demand RFO request. .It Li L2_WRITE.RFO.M_STATE .Pq Event 27H , Umask 08H Counts number of L2 store RFO requests where the cache line to be loaded is in the M (modified) state. The L1D prefetcher does not issue a RFO prefetch. -This is a demand RFO request +This is a demand RFO request. .It Li L2_WRITE.RFO.HIT .Pq Event 27H , Umask 0EH Counts number of L2 store RFO requests where the cache line to be loaded is @@ -491,7 +491,7 @@ This is a demand RFO request .Pq Event 27H , Umask 0FH Counts all L2 store RFO requests.The L1D prefetcher does not issue a RFO prefetch. -This is a demand RFO request +This is a demand RFO request. .It Li L2_WRITE.LOCK.I_STATE .Pq Event 27H , Umask 10H Counts number of L2 demand lock RFO requests where the cache line to be @@ -539,13 +539,13 @@ Counts all L1 writebacks to the L2. Counts uncore Last Level Cache references. Because cache hierarchy, cache sizes and other implementation-specific characteristics; value comparison to estimate performance differences is not recommended. -see Table A-1 +See Table A-1. .It Li L3_LAT_CACHE.MISS .Pq Event 2EH , Umask 01H Counts uncore Last Level Cache misses. Because cache hierarchy, cache sizes and other implementation-specific characteristics; value comparison to estimate performance differences is not recommended. -see Table A-1 +See Table A-1. .It Li CPU_CLK_UNHALTED.THREAD_P .Pq Event 3CH , Umask 00H Counts the number of thread cycles while the thread is not in a halt state. @@ -601,16 +601,16 @@ Counts Extended Page walk cycles. .It Li L1D.REPL .Pq Event 51H , Umask 01H Counts the number of lines brought into the L1 data cache. -Counter 0, 1 only +Counter 0, 1 only. .It Li L1D.M_REPL .Pq Event 51H , Umask 02H Counts the number of modified lines brought into the L1 data cache. -Counter 0, 1 only +Counter 0, 1 only. .It Li L1D.M_EVICT .Pq Event 51H , Umask 04H Counts the number of modified lines evicted from the L1 data cache due to replacement. -Counter 0, 1 only +Counter 0, 1 only. .It Li L1D.M_SNOOP_EVICT .Pq Event 51H , Umask 08H Counts the number of modified lines evicted from the L1 data cache due to @@ -628,22 +628,22 @@ accepted into the fill buffer. .Pq Event 60H , Umask 01H Counts weighted cycles of offcore demand data read requests. Does not include L2 prefetch requests. -counter 0 +Counter 0. .It Li OFFCORE_REQUESTS_OUTSTANDING.DEMAND.READ_CODE .Pq Event 60H , Umask 02H Counts weighted cycles of offcore demand code read requests. Does not include L2 prefetch requests. -counter 0 +Counter 0. .It Li OFFCORE_REQUESTS_OUTSTANDING.DEMAND.RFO .Pq Event 60H , Umask 04H Counts weighted cycles of offcore demand RFO requests. Does not include L2 prefetch requests. -counter 0 +Counter 0. .It Li OFFCORE_REQUESTS_OUTSTANDING.ANY.READ .Pq Event 60H , Umask 08H Counts weighted cycles of offcore read requests of any kind. Include L2 prefetch requests. -counter 0 +Ccounter 0. .It Li CACHE_LOCK_CYCLES.L1D_L2 .Pq Event 63H , Umask 01H Cycle count during which the L1D and L2 are locked. A lock is asserted when @@ -915,7 +915,7 @@ ports. This is a core count only and can .It Li UOPS_EXECUTED.PORT015 .Pq Event B1H , Umask 40H Counts number of Uops executed that where issued on port 0, 1, or 5. -use cmask=1, invert=1 to count stall cycles +Use cmask=1, invert=1 to count stall cycles. .It Li UOPS_EXECUTED.PORT234 .Pq Event B1H , Umask 80H Counts number of Uops executed that where issued on port 2, 3, or 4. @@ -928,18 +928,18 @@ Counts weighted cycles of snoopq request Use cmask=1 to count cycles not empty. .It Li SNOOPQ_REQUESTS_OUTSTANDING.INVALIDATE .Pq Event B3H , Umask 02H -Counts weighted cycles of snoopq invalidate requests. Counter 0 only +Counts weighted cycles of snoopq invalidate requests. Counter 0 only. Use cmask=1 to count cycles not empty. .It Li SNOOPQ_REQUESTS_OUTSTANDING.CODE .Pq Event B3H , Umask 04H -Counts weighted cycles of snoopq requests for code. Counter 0 only +Counts weighted cycles of snoopq requests for code. Counter 0 only. Use cmask=1 to count cycles not empty. .It Li SNOOPQ_REQUESTS.CODE .Pq Event B4H , Umask 01H -Counts the number of snoop code requests +Counts the number of snoop code requests. .It Li SNOOPQ_REQUESTS.DATA .Pq Event B4H , Umask 02H -Counts the number of snoop data requests +Counts the number of snoop data requests. .It Li SNOOPQ_REQUESTS.INVALIDATE .Pq Event B4H , Umask 04H Counts the number of snoop invalidate requests @@ -947,7 +947,7 @@ Counts the number of snoop invalidate re .Pq Event B7H , Umask 01H see Section 30.6.1.3, Off-core Response Performance Monitoring in the Processor Core. -Requires programming MSR 01A6H +Requires programming MSR 01A6H. .It Li SNOOP_RESPONSE.HIT .Pq Event B8H , Umask 01H Counts HIT snoop response sent by this thread in response to a snoop @@ -963,8 +963,8 @@ request. .It Li OFF_CORE_RESPONSE_1 .Pq Event BBH , Umask 01H see Section 30.6.1.3, Off-core Response Performance Monitoring in the -Processor Core -Use MSR 01A7H +Processor Core. +Use MSR 01A7H. .It Li INST_RETIRED.ANY_P .Pq Event C0H , Umask 01H See Table A-1 @@ -1007,21 +1007,21 @@ Counts the number of machine clears due Counts the number of times that a program writes to a code section. Self-modifying code causes a sever penalty in all Intel 64 and IA-32 processors. The modified cache line is written back to the L2 and L3caches. -.It Li BR_INST_RETIRED.ALL_BRANCHES +.It Li BR_INST_RETIRED.ANY_P .Pq Event C4H , Umask 00H -See Table A-1 +See Table A-1. .It Li BR_INST_RETIRED.CONDITIONAL .Pq Event C4H , Umask 01H Counts the number of conditional branch instructions retired. .It Li BR_INST_RETIRED.NEAR_CALL .Pq Event C4H , Umask 02H -Counts the number of direct & indirect near unconditional calls retired +Counts the number of direct & indirect near unconditional calls retired. .It Li BR_INST_RETIRED.ALL_BRANCHES .Pq Event C4H , Umask 04H -Counts the number of branch instructions retired -.It Li BR_MISP_RETIRED.ALL_BRANCHES +Counts the number of branch instructions retired. +.It Li BR_MISP_RETIRED.ANY_P .Pq Event C5H , Umask 00H -See Table A-1 +See Table A-1. .It Li BR_MISP_RETIRED.CONDITIONAL .Pq Event C5H , Umask 01H Counts mispredicted conditional retired calls. Modified: stable/8/lib/libpmc/pmc.westmereuc.3 ============================================================================== --- stable/8/lib/libpmc/pmc.westmereuc.3 Mon Oct 11 14:31:24 2010 (r213691) +++ stable/8/lib/libpmc/pmc.westmereuc.3 Mon Oct 11 16:55:17 2010 (r213692) @@ -267,10 +267,10 @@ Number of responses to code or data read has the referenced line cached in the M state. .It Li SNP_RESP_TO_REMOTE_HOME.HITM .Pq Event 07H , Umask 24H -Number of HITM snoop responses to a remote home +Number of HITM snoop responses to a remote home. .It Li L3_HITS.READ .Pq Event 08H , Umask 01H -Number of code read, data read and RFO requests that hit in the L3 +Number of code read, data read and RFO requests that hit in the L3. .It Li L3_HITS.WRITE .Pq Event 08H , Umask 02H Number of writeback requests that hit in the L3. Writebacks from the cores @@ -715,7 +715,7 @@ qualified by mask value written to MSR 3 supported: 0: NONE 40000000_00000000H:RSPFWDI 40001A00_00000000H:RSPFWDS 40001D00_00000000H:RSPIWB -Match opcode/addres s by writing MSR 396H with mask supported mask value +Match opcode/address by writing MSR 396H with mask supported mask value. .It Li ADDR_OPCODE_MATCH.REMOTE .Pq Event 35H , Umask 02H Counts number of requests from the remote socket, address/opcode of request @@ -723,7 +723,7 @@ is qualified by mask value written to MS are supported: 0: NONE 40000000_00000000H:RSPFWDI 40001A00_00000000H:RSPFWDS 40001D00_00000000H:RSPIWB -Match opcode/addres s by writing MSR 396H with mask supported mask value +Match opcode/address by writing MSR 396H with mask supported mask value. .It Li ADDR_OPCODE_MATCH.LOCAL .Pq Event 35H , Umask 04H Counts number of requests from the local socket, address/opcode of request @@ -731,7 +731,7 @@ is qualified by mask value written to MS are supported: 0: NONE 40000000_00000000H:RSPFWDI 40001A00_00000000H:RSPFWDS 40001D00_00000000H:RSPIWB -Match opcode/addres s by writing MSR 396H with mask supported mask value +Match opcode/address by writing MSR 396H with mask supported mask value. .It Li QPI_TX_STALLED_SINGLE_FLIT.HOME.LINK_0 .Pq Event 40H , Umask 01H Counts cycles the Quickpath outbound link 0 HOME virtual channel is stalled From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 11 21:23:07 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62E3A106564A; Mon, 11 Oct 2010 21:23:07 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 504928FC18; Mon, 11 Oct 2010 21:23:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9BLN7tn027819; Mon, 11 Oct 2010 21:23:07 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9BLN757027817; Mon, 11 Oct 2010 21:23:07 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201010112123.o9BLN757027817@svn.freebsd.org> From: "George V. Neville-Neil" Date: Mon, 11 Oct 2010 21:23:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213701 - stable/8/sys/dev/hwpmc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Oct 2010 21:23:07 -0000 Author: gnn Date: Mon Oct 11 21:23:07 2010 New Revision: 213701 URL: http://svn.freebsd.org/changeset/base/213701 Log: MFC 213409: Fix two aliases that had the same name but were pointing to different events. These are now disamiguated. Modified: stable/8/sys/dev/hwpmc/pmc_events.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/hwpmc/pmc_events.h ============================================================================== --- stable/8/sys/dev/hwpmc/pmc_events.h Mon Oct 11 21:16:50 2010 (r213700) +++ stable/8/sys/dev/hwpmc/pmc_events.h Mon Oct 11 21:23:07 2010 (r213701) @@ -2243,11 +2243,11 @@ __PMC_EV_ALIAS("UOPS_RETIRED.MACRO_FUSED __PMC_EV_ALIAS("MACHINE_CLEARS.CYCLES", IAP_EVENT_C3H_01H) \ __PMC_EV_ALIAS("MACHINE_CLEARS.MEM_ORDER", IAP_EVENT_C3H_02H) \ __PMC_EV_ALIAS("MACHINE_CLEARS.SMC", IAP_EVENT_C3H_04H) \ -__PMC_EV_ALIAS("BR_INST_RETIRED.ALL_BRANCHES", IAP_EVENT_C4H_00H) \ +__PMC_EV_ALIAS("BR_INST_RETIRED.ANY_P", IAP_EVENT_C4H_00H) \ __PMC_EV_ALIAS("BR_INST_RETIRED.CONDITIONAL", IAP_EVENT_C4H_01H) \ __PMC_EV_ALIAS("BR_INST_RETIRED.NEAR_CALL", IAP_EVENT_C4H_02H) \ __PMC_EV_ALIAS("BR_INST_RETIRED.ALL_BRANCHES", IAP_EVENT_C4H_04H) \ -__PMC_EV_ALIAS("BR_MISP_RETIRED.ALL_BRANCHES", IAP_EVENT_C5H_00H) \ +__PMC_EV_ALIAS("BR_MISP_RETIRED.ANY_P", IAP_EVENT_C5H_00H) \ __PMC_EV_ALIAS("BR_MISP_RETIRED.CONDITIONAL", IAP_EVENT_C5H_01H) \ __PMC_EV_ALIAS("BR_MISP_RETIRED.NEAR_CALL", IAP_EVENT_C5H_02H) \ __PMC_EV_ALIAS("BR_MISP_RETIRED.ALL_BRANCHES", IAP_EVENT_C5H_04H) \ From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 11 22:41:02 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CA54106566B; Mon, 11 Oct 2010 22:41:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 395C98FC0A; Mon, 11 Oct 2010 22:41:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9BMf2v9029741; Mon, 11 Oct 2010 22:41:02 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9BMf2OZ029739; Mon, 11 Oct 2010 22:41:02 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201010112241.o9BMf2OZ029739@svn.freebsd.org> From: Andriy Gapon Date: Mon, 11 Oct 2010 22:41:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213706 - stable/8/sys/dev/acpica X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Oct 2010 22:41:02 -0000 Author: avg Date: Mon Oct 11 22:41:01 2010 New Revision: 213706 URL: http://svn.freebsd.org/changeset/base/213706 Log: MFC r208722: Remove unnecessary pointer type castings, shift operations and dead code. On behalf of: jkim Modified: stable/8/sys/dev/acpica/acpi_ec.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/acpica/acpi_ec.c ============================================================================== --- stable/8/sys/dev/acpica/acpi_ec.c Mon Oct 11 21:53:03 2010 (r213705) +++ stable/8/sys/dev/acpica/acpi_ec.c Mon Oct 11 22:41:01 2010 (r213706) @@ -223,7 +223,7 @@ static ACPI_STATUS EcSpaceSetup(ACPI_HAN void *Context, void **return_Context); static ACPI_STATUS EcSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, - UINT32 width, UINT64 *Value, + UINT32 Width, UINT64 *Value, void *Context, void *RegionContext); static ACPI_STATUS EcWaitEvent(struct acpi_ec_softc *sc, EC_EVENT Event, u_int gen_count); @@ -231,7 +231,7 @@ static ACPI_STATUS EcCommand(struct acpi static ACPI_STATUS EcRead(struct acpi_ec_softc *sc, UINT8 Address, UINT8 *Data); static ACPI_STATUS EcWrite(struct acpi_ec_softc *sc, UINT8 Address, - UINT8 *Data); + UINT8 Data); static int acpi_ec_probe(device_t dev); static int acpi_ec_attach(device_t dev); static int acpi_ec_suspend(device_t dev); @@ -717,25 +717,27 @@ EcSpaceSetup(ACPI_HANDLE Region, UINT32 } static ACPI_STATUS -EcSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 width, +EcSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 Width, UINT64 *Value, void *Context, void *RegionContext) { struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; ACPI_STATUS Status; - UINT8 EcAddr, EcData; - int i; + UINT8 *EcData; + UINT8 EcAddr; + int bytes, i; ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, (UINT32)Address); - if (width % 8 != 0 || Value == NULL || Context == NULL) + if (Width % 8 != 0 || Value == NULL || Context == NULL) return_ACPI_STATUS (AE_BAD_PARAMETER); - if (Address + (width / 8) - 1 > 0xFF) + bytes = Width / 8; + if (Address + bytes - 1 > 0xFF) return_ACPI_STATUS (AE_BAD_ADDRESS); if (Function == ACPI_READ) *Value = 0; EcAddr = Address; - Status = AE_ERROR; + EcData = (UINT8 *)Value; /* * If booting, check if we need to run the query handler. If so, we @@ -753,17 +755,14 @@ EcSpaceHandler(UINT32 Function, ACPI_PHY if (ACPI_FAILURE(Status)) return_ACPI_STATUS (Status); - /* Perform the transaction(s), based on width. */ - for (i = 0; i < width; i += 8, EcAddr++) { + /* Perform the transaction(s), based on Width. */ + for (i = 0; i < bytes; i++, EcAddr++, EcData++) { switch (Function) { case ACPI_READ: - Status = EcRead(sc, EcAddr, &EcData); - if (ACPI_SUCCESS(Status)) - *Value |= ((UINT64)EcData) << i; + Status = EcRead(sc, EcAddr, EcData); break; case ACPI_WRITE: - EcData = (UINT8)((*Value) >> i); - Status = EcWrite(sc, EcAddr, &EcData); + Status = EcWrite(sc, EcAddr, *EcData); break; default: device_printf(sc->ec_dev, "invalid EcSpaceHandler function %d\n", @@ -986,14 +985,14 @@ EcRead(struct acpi_ec_softc *sc, UINT8 A } static ACPI_STATUS -EcWrite(struct acpi_ec_softc *sc, UINT8 Address, UINT8 *Data) +EcWrite(struct acpi_ec_softc *sc, UINT8 Address, UINT8 Data) { ACPI_STATUS status; UINT8 data; u_int gen_count; ACPI_SERIAL_ASSERT(ec); - CTR2(KTR_ACPI, "ec write to %#x, data %#x", Address, *Data); + CTR2(KTR_ACPI, "ec write to %#x, data %#x", Address, Data); /* If we can't start burst mode, continue anyway. */ status = EcCommand(sc, EC_COMMAND_BURST_ENABLE); @@ -1018,7 +1017,7 @@ EcWrite(struct acpi_ec_softc *sc, UINT8 } gen_count = sc->ec_gencount; - EC_SET_DATA(sc, *Data); + EC_SET_DATA(sc, Data); status = EcWaitEvent(sc, EC_EVENT_INPUT_BUFFER_EMPTY, gen_count); if (ACPI_FAILURE(status)) { device_printf(sc->ec_dev, "EcWrite: failed waiting for sent data\n"); From owner-svn-src-stable-8@FreeBSD.ORG Mon Oct 11 22:46:15 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C254F106566B; Mon, 11 Oct 2010 22:46:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF21A8FC17; Mon, 11 Oct 2010 22:46:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9BMkFxI030056; Mon, 11 Oct 2010 22:46:15 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9BMkFKA030054; Mon, 11 Oct 2010 22:46:15 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201010112246.o9BMkFKA030054@svn.freebsd.org> From: Andriy Gapon Date: Mon, 11 Oct 2010 22:46:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213709 - stable/8/sys/dev/acpica X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Oct 2010 22:46:15 -0000 Author: avg Date: Mon Oct 11 22:46:15 2010 New Revision: 213709 URL: http://svn.freebsd.org/changeset/base/213709 Log: MFC r210977: When EC burst mode is activated and multiple bytes are accessed, do not disable and enable repeatedly, just do it once per call. It also reduces code duplication. Check all parameters early and fail immediately. On behalf of: jkim Modified: stable/8/sys/dev/acpica/acpi_ec.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/acpica/acpi_ec.c ============================================================================== --- stable/8/sys/dev/acpica/acpi_ec.c Mon Oct 11 22:44:15 2010 (r213708) +++ stable/8/sys/dev/acpica/acpi_ec.c Mon Oct 11 22:46:15 2010 (r213709) @@ -721,24 +721,19 @@ EcSpaceHandler(UINT32 Function, ACPI_PHY UINT64 *Value, void *Context, void *RegionContext) { struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; - ACPI_STATUS Status; + ACPI_PHYSICAL_ADDRESS EcAddr; UINT8 *EcData; - UINT8 EcAddr; - int bytes, i; + ACPI_STATUS Status; ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, (UINT32)Address); + if (Function != ACPI_READ && Function != ACPI_WRITE) + return_ACPI_STATUS (AE_BAD_PARAMETER); if (Width % 8 != 0 || Value == NULL || Context == NULL) return_ACPI_STATUS (AE_BAD_PARAMETER); - bytes = Width / 8; - if (Address + bytes - 1 > 0xFF) + if (Address + Width / 8 > 256) return_ACPI_STATUS (AE_BAD_ADDRESS); - if (Function == ACPI_READ) - *Value = 0; - EcAddr = Address; - EcData = (UINT8 *)Value; - /* * If booting, check if we need to run the query handler. If so, we * we call it directly here since our thread taskq is not active yet. @@ -755,8 +750,21 @@ EcSpaceHandler(UINT32 Function, ACPI_PHY if (ACPI_FAILURE(Status)) return_ACPI_STATUS (Status); + /* If we can't start burst mode, continue anyway. */ + Status = EcCommand(sc, EC_COMMAND_BURST_ENABLE); + if (ACPI_SUCCESS(Status)) { + if (EC_GET_DATA(sc) == EC_BURST_ACK) { + CTR0(KTR_ACPI, "ec burst enabled"); + sc->ec_burstactive = TRUE; + } + } + /* Perform the transaction(s), based on Width. */ - for (i = 0; i < bytes; i++, EcAddr++, EcData++) { + EcAddr = Address; + EcData = (UINT8 *)Value; + if (Function == ACPI_READ) + *Value = 0; + do { switch (Function) { case ACPI_READ: Status = EcRead(sc, EcAddr, EcData); @@ -764,14 +772,17 @@ EcSpaceHandler(UINT32 Function, ACPI_PHY case ACPI_WRITE: Status = EcWrite(sc, EcAddr, *EcData); break; - default: - device_printf(sc->ec_dev, "invalid EcSpaceHandler function %d\n", - Function); - Status = AE_BAD_PARAMETER; - break; } if (ACPI_FAILURE(Status)) break; + EcAddr++; + EcData++; + } while (EcAddr < Address + Width / 8); + + if (sc->ec_burstactive) { + sc->ec_burstactive = FALSE; + if (ACPI_SUCCESS(EcCommand(sc, EC_COMMAND_BURST_DISABLE))) + CTR0(KTR_ACPI, "ec disabled burst ok"); } EcUnlock(sc); @@ -944,22 +955,11 @@ static ACPI_STATUS EcRead(struct acpi_ec_softc *sc, UINT8 Address, UINT8 *Data) { ACPI_STATUS status; - UINT8 data; u_int gen_count; ACPI_SERIAL_ASSERT(ec); CTR1(KTR_ACPI, "ec read from %#x", Address); - /* If we can't start burst mode, continue anyway. */ - status = EcCommand(sc, EC_COMMAND_BURST_ENABLE); - if (status == AE_OK) { - data = EC_GET_DATA(sc); - if (data == EC_BURST_ACK) { - CTR0(KTR_ACPI, "ec burst enabled"); - sc->ec_burstactive = TRUE; - } - } - status = EcCommand(sc, EC_COMMAND_READ); if (ACPI_FAILURE(status)) return (status); @@ -973,14 +973,6 @@ EcRead(struct acpi_ec_softc *sc, UINT8 A } *Data = EC_GET_DATA(sc); - if (sc->ec_burstactive) { - sc->ec_burstactive = FALSE; - status = EcCommand(sc, EC_COMMAND_BURST_DISABLE); - if (ACPI_FAILURE(status)) - return (status); - CTR0(KTR_ACPI, "ec disabled burst ok"); - } - return (AE_OK); } @@ -988,22 +980,11 @@ static ACPI_STATUS EcWrite(struct acpi_ec_softc *sc, UINT8 Address, UINT8 Data) { ACPI_STATUS status; - UINT8 data; u_int gen_count; ACPI_SERIAL_ASSERT(ec); CTR2(KTR_ACPI, "ec write to %#x, data %#x", Address, Data); - /* If we can't start burst mode, continue anyway. */ - status = EcCommand(sc, EC_COMMAND_BURST_ENABLE); - if (status == AE_OK) { - data = EC_GET_DATA(sc); - if (data == EC_BURST_ACK) { - CTR0(KTR_ACPI, "ec burst enabled"); - sc->ec_burstactive = TRUE; - } - } - status = EcCommand(sc, EC_COMMAND_WRITE); if (ACPI_FAILURE(status)) return (status); @@ -1024,13 +1005,5 @@ EcWrite(struct acpi_ec_softc *sc, UINT8 return (status); } - if (sc->ec_burstactive) { - sc->ec_burstactive = FALSE; - status = EcCommand(sc, EC_COMMAND_BURST_DISABLE); - if (ACPI_FAILURE(status)) - return (status); - CTR0(KTR_ACPI, "ec disabled burst ok"); - } - return (AE_OK); } From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 12 09:10:24 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C60901065679; Tue, 12 Oct 2010 09:10:24 +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 988A58FC16; Tue, 12 Oct 2010 09:10:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9C9AOaM043093; Tue, 12 Oct 2010 09:10:24 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9C9AO4Q043088; Tue, 12 Oct 2010 09:10:24 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201010120910.o9C9AO4Q043088@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 12 Oct 2010 09:10:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213715 - in stable/8/sys: amd64/amd64 amd64/include i386/i386 i386/include X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Oct 2010 09:10:24 -0000 Author: kib Date: Tue Oct 12 09:10:24 2010 New Revision: 213715 URL: http://svn.freebsd.org/changeset/base/213715 Log: MFC r213452: Display PCID capability of CPU and add CPUID define for it. Modified: stable/8/sys/amd64/amd64/identcpu.c stable/8/sys/amd64/include/specialreg.h stable/8/sys/i386/i386/identcpu.c stable/8/sys/i386/include/specialreg.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/amd64/amd64/identcpu.c ============================================================================== --- stable/8/sys/amd64/amd64/identcpu.c Tue Oct 12 00:36:56 2010 (r213714) +++ stable/8/sys/amd64/amd64/identcpu.c Tue Oct 12 09:10:24 2010 (r213715) @@ -278,7 +278,7 @@ printcpuinfo(void) "\017xTPR" /* Send Task Priority Messages*/ "\020PDCM" /* Perf/Debug Capability MSR */ "\021" - "\022" + "\022PCID" /* Process-context Identifiers */ "\023DCA" /* Direct Cache Access */ "\024SSE4.1" "\025SSE4.2" Modified: stable/8/sys/amd64/include/specialreg.h ============================================================================== --- stable/8/sys/amd64/include/specialreg.h Tue Oct 12 00:36:56 2010 (r213714) +++ stable/8/sys/amd64/include/specialreg.h Tue Oct 12 09:10:24 2010 (r213715) @@ -126,6 +126,7 @@ #define CPUID2_CX16 0x00002000 #define CPUID2_XTPR 0x00004000 #define CPUID2_PDCM 0x00008000 +#define CPUID2_PCID 0x00020000 #define CPUID2_DCA 0x00040000 #define CPUID2_SSE41 0x00080000 #define CPUID2_SSE42 0x00100000 Modified: stable/8/sys/i386/i386/identcpu.c ============================================================================== --- stable/8/sys/i386/i386/identcpu.c Tue Oct 12 00:36:56 2010 (r213714) +++ stable/8/sys/i386/i386/identcpu.c Tue Oct 12 09:10:24 2010 (r213715) @@ -743,7 +743,7 @@ printcpuinfo(void) "\017xTPR" /* Send Task Priority Messages*/ "\020PDCM" /* Perf/Debug Capability MSR */ "\021" - "\022" + "\022PCID" /* Process-context Identifiers */ "\023DCA" /* Direct Cache Access */ "\024SSE4.1" "\025SSE4.2" Modified: stable/8/sys/i386/include/specialreg.h ============================================================================== --- stable/8/sys/i386/include/specialreg.h Tue Oct 12 00:36:56 2010 (r213714) +++ stable/8/sys/i386/include/specialreg.h Tue Oct 12 09:10:24 2010 (r213715) @@ -123,6 +123,7 @@ #define CPUID2_CX16 0x00002000 #define CPUID2_XTPR 0x00004000 #define CPUID2_PDCM 0x00008000 +#define CPUID2_PCID 0x00020000 #define CPUID2_DCA 0x00040000 #define CPUID2_SSE41 0x00080000 #define CPUID2_SSE42 0x00100000 From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 12 13:13:20 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FA5E1065697; Tue, 12 Oct 2010 13:13:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8B92F8FC2D; Tue, 12 Oct 2010 13:13:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9CDDKve048600; Tue, 12 Oct 2010 13:13:20 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9CDDKVw048587; Tue, 12 Oct 2010 13:13:20 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201010121313.o9CDDKVw048587@svn.freebsd.org> From: John Baldwin Date: Tue, 12 Oct 2010 13:13:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213720 - stable/8/lib/libc/stdio X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Oct 2010 13:13:20 -0000 Author: jhb Date: Tue Oct 12 13:13:20 2010 New Revision: 213720 URL: http://svn.freebsd.org/changeset/base/213720 Log: MFC 205021: - Use an initializer macro to initialize fields in 'fake' FILE objects used by *sprintf(), etc. - Explicitly initialize _fl_mutex to PTHREAD_MUTEX_INITIALIZER for all FILE objects. This is currently a nop on FreeBSD, but is import for other platforms (or in the future) where PTHREAD_MUTEX_INITIALIZER is not simply zero. Modified: stable/8/lib/libc/stdio/findfp.c stable/8/lib/libc/stdio/local.h stable/8/lib/libc/stdio/snprintf.c stable/8/lib/libc/stdio/vasprintf.c stable/8/lib/libc/stdio/vdprintf.c stable/8/lib/libc/stdio/vfprintf.c stable/8/lib/libc/stdio/vsnprintf.c stable/8/lib/libc/stdio/vsprintf.c stable/8/lib/libc/stdio/vsscanf.c stable/8/lib/libc/stdio/vswprintf.c stable/8/lib/libc/stdio/vswscanf.c stable/8/lib/libc/stdio/xprintf.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/locale/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/sys/ (props changed) Modified: stable/8/lib/libc/stdio/findfp.c ============================================================================== --- stable/8/lib/libc/stdio/findfp.c Tue Oct 12 11:05:32 2010 (r213719) +++ stable/8/lib/libc/stdio/findfp.c Tue Oct 12 13:13:20 2010 (r213720) @@ -61,6 +61,7 @@ int __sdidinit; ._read = __sread, \ ._seek = __sseek, \ ._write = __swrite, \ + ._fl_mutex = PTHREAD_MUTEX_INITIALIZER, \ } /* the usual - (stdin + stdout + stderr) */ static FILE usual[FOPEN_MAX - 3]; @@ -96,7 +97,7 @@ moreglue(n) int n; { struct glue *g; - static FILE empty; + static FILE empty = { ._fl_mutex = PTHREAD_MUTEX_INITIALIZER }; FILE *p; g = (struct glue *)malloc(sizeof(*g) + ALIGNBYTES + n * sizeof(FILE)); @@ -154,7 +155,7 @@ found: fp->_ub._size = 0; fp->_lb._base = NULL; /* no line buffer */ fp->_lb._size = 0; -/* fp->_lock = NULL; */ /* once set always set (reused) */ +/* fp->_fl_mutex = NULL; */ /* once set always set (reused) */ fp->_orientation = 0; memset(&fp->_mbstate, 0, sizeof(mbstate_t)); return (fp); Modified: stable/8/lib/libc/stdio/local.h ============================================================================== --- stable/8/lib/libc/stdio/local.h Tue Oct 12 11:05:32 2010 (r213719) +++ stable/8/lib/libc/stdio/local.h Tue Oct 12 13:13:20 2010 (r213720) @@ -110,6 +110,14 @@ extern int __sdidinit; } /* + * Structure initializations for 'fake' FILE objects. + */ +#define FAKE_FILE { \ + ._file = -1, \ + ._fl_mutex = PTHREAD_MUTEX_INITIALIZER, \ +} + +/* * Set the orientation for a stream. If o > 0, the stream has wide- * orientation. If o < 0, the stream has byte-orientation. */ Modified: stable/8/lib/libc/stdio/snprintf.c ============================================================================== --- stable/8/lib/libc/stdio/snprintf.c Tue Oct 12 11:05:32 2010 (r213719) +++ stable/8/lib/libc/stdio/snprintf.c Tue Oct 12 13:13:20 2010 (r213720) @@ -48,7 +48,7 @@ snprintf(char * __restrict str, size_t n size_t on; int ret; va_list ap; - FILE f; + FILE f = FAKE_FILE; on = n; if (n != 0) @@ -56,12 +56,9 @@ snprintf(char * __restrict str, size_t n if (n > INT_MAX) n = INT_MAX; va_start(ap, fmt); - f._file = -1; f._flags = __SWR | __SSTR; f._bf._base = f._p = (unsigned char *)str; f._bf._size = f._w = n; - f._orientation = 0; - memset(&f._mbstate, 0, sizeof(mbstate_t)); ret = __vfprintf(&f, fmt, ap); if (on > 0) *f._p = '\0'; Modified: stable/8/lib/libc/stdio/vasprintf.c ============================================================================== --- stable/8/lib/libc/stdio/vasprintf.c Tue Oct 12 11:05:32 2010 (r213719) +++ stable/8/lib/libc/stdio/vasprintf.c Tue Oct 12 13:13:20 2010 (r213720) @@ -42,9 +42,8 @@ vasprintf(str, fmt, ap) __va_list ap; { int ret; - FILE f; + FILE f = FAKE_FILE; - f._file = -1; f._flags = __SWR | __SSTR | __SALC; f._bf._base = f._p = (unsigned char *)malloc(128); if (f._bf._base == NULL) { @@ -53,8 +52,6 @@ vasprintf(str, fmt, ap) return (-1); } f._bf._size = f._w = 127; /* Leave room for the NUL */ - f._orientation = 0; - memset(&f._mbstate, 0, sizeof(mbstate_t)); ret = __vfprintf(&f, fmt, ap); if (ret < 0) { free(f._bf._base); Modified: stable/8/lib/libc/stdio/vdprintf.c ============================================================================== --- stable/8/lib/libc/stdio/vdprintf.c Tue Oct 12 11:05:32 2010 (r213719) +++ stable/8/lib/libc/stdio/vdprintf.c Tue Oct 12 13:13:20 2010 (r213720) @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); int vdprintf(int fd, const char * __restrict fmt, va_list ap) { - FILE f; + FILE f = FAKE_FILE; unsigned char buf[BUFSIZ]; int ret; @@ -56,8 +56,6 @@ vdprintf(int fd, const char * __restrict f._write = __swrite; f._bf._base = buf; f._bf._size = sizeof(buf); - f._orientation = 0; - bzero(&f._mbstate, sizeof(f._mbstate)); if ((ret = __vfprintf(&f, fmt, ap)) < 0) return (ret); Modified: stable/8/lib/libc/stdio/vfprintf.c ============================================================================== --- stable/8/lib/libc/stdio/vfprintf.c Tue Oct 12 11:05:32 2010 (r213719) +++ stable/8/lib/libc/stdio/vfprintf.c Tue Oct 12 13:13:20 2010 (r213720) @@ -169,7 +169,7 @@ static int __sbprintf(FILE *fp, const char *fmt, va_list ap) { int ret; - FILE fake; + FILE fake = FAKE_FILE; unsigned char buf[BUFSIZ]; /* XXX This is probably not needed. */ Modified: stable/8/lib/libc/stdio/vsnprintf.c ============================================================================== --- stable/8/lib/libc/stdio/vsnprintf.c Tue Oct 12 11:05:32 2010 (r213719) +++ stable/8/lib/libc/stdio/vsnprintf.c Tue Oct 12 13:13:20 2010 (r213720) @@ -47,7 +47,7 @@ vsnprintf(char * __restrict str, size_t size_t on; int ret; char dummy[2]; - FILE f; + FILE f = FAKE_FILE; on = n; if (n != 0) @@ -61,12 +61,9 @@ vsnprintf(char * __restrict str, size_t str = dummy; n = 1; } - f._file = -1; f._flags = __SWR | __SSTR; f._bf._base = f._p = (unsigned char *)str; f._bf._size = f._w = n; - f._orientation = 0; - memset(&f._mbstate, 0, sizeof(mbstate_t)); ret = __vfprintf(&f, fmt, ap); if (on > 0) *f._p = '\0'; Modified: stable/8/lib/libc/stdio/vsprintf.c ============================================================================== --- stable/8/lib/libc/stdio/vsprintf.c Tue Oct 12 11:05:32 2010 (r213719) +++ stable/8/lib/libc/stdio/vsprintf.c Tue Oct 12 13:13:20 2010 (r213720) @@ -44,14 +44,11 @@ int vsprintf(char * __restrict str, const char * __restrict fmt, __va_list ap) { int ret; - FILE f; + FILE f = FAKE_FILE; - f._file = -1; f._flags = __SWR | __SSTR; f._bf._base = f._p = (unsigned char *)str; f._bf._size = f._w = INT_MAX; - f._orientation = 0; - memset(&f._mbstate, 0, sizeof(mbstate_t)); ret = __vfprintf(&f, fmt, ap); *f._p = 0; return (ret); Modified: stable/8/lib/libc/stdio/vsscanf.c ============================================================================== --- stable/8/lib/libc/stdio/vsscanf.c Tue Oct 12 11:05:32 2010 (r213719) +++ stable/8/lib/libc/stdio/vsscanf.c Tue Oct 12 13:13:20 2010 (r213720) @@ -55,16 +55,11 @@ int vsscanf(const char * __restrict str, const char * __restrict fmt, __va_list ap) { - FILE f; + FILE f = FAKE_FILE; - f._file = -1; f._flags = __SRD; f._bf._base = f._p = (unsigned char *)str; f._bf._size = f._r = strlen(str); f._read = eofread; - f._ub._base = NULL; - f._lb._base = NULL; - f._orientation = 0; - memset(&f._mbstate, 0, sizeof(mbstate_t)); return (__svfscanf(&f, fmt, ap)); } Modified: stable/8/lib/libc/stdio/vswprintf.c ============================================================================== --- stable/8/lib/libc/stdio/vswprintf.c Tue Oct 12 11:05:32 2010 (r213719) +++ stable/8/lib/libc/stdio/vswprintf.c Tue Oct 12 13:13:20 2010 (r213720) @@ -45,7 +45,7 @@ vswprintf(wchar_t * __restrict s, size_t { static const mbstate_t initial; mbstate_t mbs; - FILE f; + FILE f = FAKE_FILE; char *mbp; int ret, sverrno; size_t nwc; @@ -55,7 +55,6 @@ vswprintf(wchar_t * __restrict s, size_t return (-1); } - f._file = -1; f._flags = __SWR | __SSTR | __SALC; f._bf._base = f._p = (unsigned char *)malloc(128); if (f._bf._base == NULL) { @@ -63,8 +62,6 @@ vswprintf(wchar_t * __restrict s, size_t return (-1); } f._bf._size = f._w = 127; /* Leave room for the NUL */ - f._orientation = 0; - memset(&f._mbstate, 0, sizeof(mbstate_t)); ret = __vfwprintf(&f, fmt, ap); if (ret < 0) { sverrno = errno; Modified: stable/8/lib/libc/stdio/vswscanf.c ============================================================================== --- stable/8/lib/libc/stdio/vswscanf.c Tue Oct 12 11:05:32 2010 (r213719) +++ stable/8/lib/libc/stdio/vswscanf.c Tue Oct 12 13:13:20 2010 (r213720) @@ -62,7 +62,7 @@ vswscanf(const wchar_t * __restrict str, { static const mbstate_t initial; mbstate_t mbs; - FILE f; + FILE f = FAKE_FILE; char *mbstr; size_t mlen; int r; @@ -80,15 +80,10 @@ vswscanf(const wchar_t * __restrict str, free(mbstr); return (EOF); } - f._file = -1; f._flags = __SRD; f._bf._base = f._p = (unsigned char *)mbstr; f._bf._size = f._r = mlen; f._read = eofread; - f._ub._base = NULL; - f._lb._base = NULL; - f._orientation = 0; - memset(&f._mbstate, 0, sizeof(mbstate_t)); r = __vfwscanf(&f, fmt, ap); free(mbstr); Modified: stable/8/lib/libc/stdio/xprintf.c ============================================================================== --- stable/8/lib/libc/stdio/xprintf.c Tue Oct 12 11:05:32 2010 (r213719) +++ stable/8/lib/libc/stdio/xprintf.c Tue Oct 12 13:13:20 2010 (r213720) @@ -48,6 +48,7 @@ #include #include "un-namespace.h" +#include "local.h" #include "printf.h" #include "fvwrite.h" @@ -575,7 +576,7 @@ static int __v3printf(FILE *fp, const char *fmt, int pct, va_list ap) { int ret; - FILE fake; + FILE fake = FAKE_FILE; unsigned char buf[BUFSIZ]; /* copy the important variables */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 12 15:26:13 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EFB71106566B; Tue, 12 Oct 2010 15:26:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD7A68FC18; Tue, 12 Oct 2010 15:26:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9CFQDP7051618; Tue, 12 Oct 2010 15:26:13 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9CFQDJl051615; Tue, 12 Oct 2010 15:26:13 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201010121526.o9CFQDJl051615@svn.freebsd.org> From: John Baldwin Date: Tue, 12 Oct 2010 15:26:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213721 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Oct 2010 15:26:14 -0000 Author: jhb Date: Tue Oct 12 15:26:13 2010 New Revision: 213721 URL: http://svn.freebsd.org/changeset/base/213721 Log: MFC 212974: Comment nit, set TDF_NEEDRESCHED after the comment describing why it is done rather than before. Modified: stable/8/sys/kern/sched_ule.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/sched_ule.c ============================================================================== --- stable/8/sys/kern/sched_ule.c Tue Oct 12 13:13:20 2010 (r213720) +++ stable/8/sys/kern/sched_ule.c Tue Oct 12 15:26:13 2010 (r213721) @@ -2409,12 +2409,12 @@ sched_affinity(struct thread *td) } if (!TD_IS_RUNNING(td)) return; - td->td_flags |= TDF_NEEDRESCHED; /* * Force a switch before returning to userspace. If the * target thread is not running locally send an ipi to force * the issue. */ + td->td_flags |= TDF_NEEDRESCHED; if (td != curthread) ipi_selected(1 << ts->ts_cpu, IPI_PREEMPT); #endif From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 12 15:48:15 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B61210656C0; Tue, 12 Oct 2010 15:48:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 393128FC21; Tue, 12 Oct 2010 15:48:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9CFmFv4052158; Tue, 12 Oct 2010 15:48:15 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9CFmFw2052156; Tue, 12 Oct 2010 15:48:15 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201010121548.o9CFmFw2052156@svn.freebsd.org> From: John Baldwin Date: Tue, 12 Oct 2010 15:48:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213723 - stable/8/sys/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Oct 2010 15:48:15 -0000 Author: jhb Date: Tue Oct 12 15:48:14 2010 New Revision: 213723 URL: http://svn.freebsd.org/changeset/base/213723 Log: MFC 213271: Account for unlocking a spin mutex in the lock profiling code in the !SMP case. Modified: stable/8/sys/sys/mutex.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/sys/mutex.h ============================================================================== --- stable/8/sys/sys/mutex.h Tue Oct 12 15:26:37 2010 (r213722) +++ stable/8/sys/sys/mutex.h Tue Oct 12 15:48:14 2010 (r213723) @@ -251,8 +251,11 @@ void _thread_lock_flags(struct thread *, #define _rel_spin_lock(mp) do { \ if (mtx_recursed((mp))) \ (mp)->mtx_recurse--; \ - else \ + else { \ + LOCKSTAT_PROFILE_RELEASE_LOCK(LS_MTX_SPIN_UNLOCK_RELEASE, \ + mp); \ (mp)->mtx_lock = MTX_UNOWNED; \ + } \ spinlock_exit(); \ } while (0) #endif /* SMP */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 12 16:08:20 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7ED44106566C; Tue, 12 Oct 2010 16:08:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B9FA8FC08; Tue, 12 Oct 2010 16:08:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9CG8K3r052789; Tue, 12 Oct 2010 16:08:20 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9CG8KWa052786; Tue, 12 Oct 2010 16:08:20 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201010121608.o9CG8KWa052786@svn.freebsd.org> From: John Baldwin Date: Tue, 12 Oct 2010 16:08:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213726 - stable/8/sys/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Oct 2010 16:08:20 -0000 Author: jhb Date: Tue Oct 12 16:08:20 2010 New Revision: 213726 URL: http://svn.freebsd.org/changeset/base/213726 Log: MFC 213028,213328: - Expand scope of tun/tap softc locks to cover more softc fields and driver-maintained ifnet fields (such as if_drv_flags). - Use soft locks as the mutex that protects each interface's knote list rather than using the global knote list lock. Also, use the softc for kn_hook instead of the cdev. - Use mtx_sleep() instead of tsleep() when blocking in the read routines. This fixes a lost wakeup race. - Remove D_NEEDGIANT now that the cdevsw routines use the softc lock where locking is needed. - Lock IFQ when calculating the result for FIONREAD in tap(4). tun(4) already did this. - Remove remaining spl calls. Modified: stable/8/sys/net/if_tap.c stable/8/sys/net/if_tun.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/net/if_tap.c ============================================================================== --- stable/8/sys/net/if_tap.c Tue Oct 12 15:58:52 2010 (r213725) +++ stable/8/sys/net/if_tap.c Tue Oct 12 16:08:20 2010 (r213726) @@ -132,7 +132,7 @@ static struct filterops tap_write_filter static struct cdevsw tap_cdevsw = { .d_version = D_VERSION, - .d_flags = D_PSEUDO | D_NEEDGIANT | D_NEEDMINOR, + .d_flags = D_PSEUDO | D_NEEDMINOR, .d_open = tapopen, .d_close = tapclose, .d_read = tapread, @@ -209,7 +209,6 @@ static void tap_destroy(struct tap_softc *tp) { struct ifnet *ifp = tp->tap_ifp; - int s; /* Unlocked read. */ KASSERT(!(tp->tap_flags & TAP_OPEN), @@ -217,10 +216,8 @@ tap_destroy(struct tap_softc *tp) knlist_destroy(&tp->tap_rsel.si_note); destroy_dev(tp->tap_dev); - s = splimp(); ether_ifdetach(ifp); if_free_type(ifp, IFT_ETHER); - splx(s); mtx_destroy(&tp->tap_mtx); free(tp, M_TAP); @@ -398,7 +395,7 @@ tapcreate(struct cdev *dev) struct tap_softc *tp = NULL; unsigned short macaddr_hi; uint32_t macaddr_mid; - int unit, s; + int unit; char *name = NULL; u_char eaddr[6]; @@ -442,22 +439,20 @@ tapcreate(struct cdev *dev) ifp->if_ioctl = tapifioctl; ifp->if_mtu = ETHERMTU; ifp->if_flags = (IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST); - ifp->if_snd.ifq_maxlen = ifqmaxlen; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); ifp->if_capabilities |= IFCAP_LINKSTATE; ifp->if_capenable |= IFCAP_LINKSTATE; dev->si_drv1 = tp; tp->tap_dev = dev; - s = splimp(); ether_ifattach(ifp, eaddr); - splx(s); mtx_lock(&tp->tap_mtx); tp->tap_flags |= TAP_INITED; mtx_unlock(&tp->tap_mtx); - knlist_init_mtx(&tp->tap_rsel.si_note, NULL); + knlist_init_mtx(&tp->tap_rsel.si_note, &tp->tap_mtx); TAPDEBUG("interface %s is created. minor = %#x\n", ifp->if_xname, dev2unit(dev)); @@ -474,7 +469,7 @@ tapopen(struct cdev *dev, int flag, int { struct tap_softc *tp = NULL; struct ifnet *ifp = NULL; - int error, s; + int error; if (tapuopen == 0) { error = priv_check(td, PRIV_NET_TAP); @@ -497,15 +492,13 @@ tapopen(struct cdev *dev, int flag, int tp->tap_pid = td->td_proc->p_pid; tp->tap_flags |= TAP_OPEN; ifp = tp->tap_ifp; - mtx_unlock(&tp->tap_mtx); - s = splimp(); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; if (tapuponopen) ifp->if_flags |= IFF_UP; if_link_state_change(ifp, LINK_STATE_UP); - splx(s); + mtx_unlock(&tp->tap_mtx); TAPDEBUG("%s is open. minor = %#x\n", ifp->if_xname, dev2unit(dev)); @@ -524,9 +517,9 @@ tapclose(struct cdev *dev, int foo, int struct ifaddr *ifa; struct tap_softc *tp = dev->si_drv1; struct ifnet *ifp = tp->tap_ifp; - int s; /* junk all pending output */ + mtx_lock(&tp->tap_mtx); IF_DRAIN(&ifp->if_snd); /* @@ -534,28 +527,26 @@ tapclose(struct cdev *dev, int foo, int * interface, if we are in VMnet mode. just close the device. */ - mtx_lock(&tp->tap_mtx); if (((tp->tap_flags & TAP_VMNET) == 0) && (ifp->if_flags & IFF_UP)) { mtx_unlock(&tp->tap_mtx); - s = splimp(); if_down(ifp); + mtx_lock(&tp->tap_mtx); if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + mtx_unlock(&tp->tap_mtx); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { rtinit(ifa, (int)RTM_DELETE, 0); } if_purgeaddrs(ifp); - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + mtx_lock(&tp->tap_mtx); } - splx(s); - } else - mtx_unlock(&tp->tap_mtx); + } if_link_state_change(ifp, LINK_STATE_DOWN); funsetown(&tp->tap_sigio); selwakeuppri(&tp->tap_rsel, PZERO+1); - KNOTE_UNLOCKED(&tp->tap_rsel.si_note, 0); + KNOTE_LOCKED(&tp->tap_rsel.si_note, 0); - mtx_lock(&tp->tap_mtx); tp->tap_flags &= ~TAP_OPEN; tp->tap_pid = 0; mtx_unlock(&tp->tap_mtx); @@ -580,8 +571,10 @@ tapifinit(void *xtp) TAPDEBUG("initializing %s\n", ifp->if_xname); + mtx_lock(&tp->tap_mtx); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + mtx_unlock(&tp->tap_mtx); /* attempt to start output */ tapifstart(ifp); @@ -599,7 +592,7 @@ tapifioctl(struct ifnet *ifp, u_long cmd struct tap_softc *tp = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; struct ifstat *ifs = NULL; - int s, dummy; + int dummy; switch (cmd) { case SIOCSIFFLAGS: /* XXX -- just like vmnet does */ @@ -612,7 +605,6 @@ tapifioctl(struct ifnet *ifp, u_long cmd break; case SIOCGIFSTATUS: - s = splimp(); ifs = (struct ifstat *)data; dummy = strlen(ifs->ascii); mtx_lock(&tp->tap_mtx); @@ -621,14 +613,10 @@ tapifioctl(struct ifnet *ifp, u_long cmd sizeof(ifs->ascii) - dummy, "\tOpened by PID %d\n", tp->tap_pid); mtx_unlock(&tp->tap_mtx); - splx(s); break; default: - s = splimp(); - dummy = ether_ioctl(ifp, cmd, data); - splx(s); - return (dummy); + return (ether_ioctl(ifp, cmd, data)); /* NOT REACHED */ } @@ -645,7 +633,6 @@ static void tapifstart(struct ifnet *ifp) { struct tap_softc *tp = ifp->if_softc; - int s; TAPDEBUG("%s starting\n", ifp->if_xname); @@ -657,32 +644,28 @@ tapifstart(struct ifnet *ifp) mtx_lock(&tp->tap_mtx); if (((tp->tap_flags & TAP_VMNET) == 0) && ((tp->tap_flags & TAP_READY) != TAP_READY)) { - struct mbuf *m = NULL; - - mtx_unlock(&tp->tap_mtx); + struct mbuf *m; /* Unlocked read. */ TAPDEBUG("%s not ready, tap_flags = 0x%x\n", ifp->if_xname, tp->tap_flags); - s = splimp(); - do { + for (;;) { IF_DEQUEUE(&ifp->if_snd, m); - if (m != NULL) + if (m != NULL) { m_freem(m); - ifp->if_oerrors ++; - } while (m != NULL); - splx(s); + ifp->if_oerrors++; + } else + break; + } + mtx_unlock(&tp->tap_mtx); return; } - mtx_unlock(&tp->tap_mtx); - s = splimp(); ifp->if_drv_flags |= IFF_DRV_OACTIVE; - if (ifp->if_snd.ifq_len != 0) { - mtx_lock(&tp->tap_mtx); + if (!IFQ_IS_EMPTY(&ifp->if_snd)) { if (tp->tap_flags & TAP_RWAIT) { tp->tap_flags &= ~TAP_RWAIT; wakeup(tp); @@ -691,16 +674,16 @@ tapifstart(struct ifnet *ifp) if ((tp->tap_flags & TAP_ASYNC) && (tp->tap_sigio != NULL)) { mtx_unlock(&tp->tap_mtx); pgsigio(&tp->tap_sigio, SIGIO, 0); - } else - mtx_unlock(&tp->tap_mtx); + mtx_lock(&tp->tap_mtx); + } selwakeuppri(&tp->tap_rsel, PZERO+1); - KNOTE_UNLOCKED(&tp->tap_rsel.si_note, 0); + KNOTE_LOCKED(&tp->tap_rsel.si_note, 0); ifp->if_opackets ++; /* obytes are counted in ether_output */ } ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - splx(s); + mtx_unlock(&tp->tap_mtx); } /* tapifstart */ @@ -715,7 +698,6 @@ tapioctl(struct cdev *dev, u_long cmd, c struct tap_softc *tp = dev->si_drv1; struct ifnet *ifp = tp->tap_ifp; struct tapinfo *tapp = NULL; - int s; int f; #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \ defined(COMPAT_FREEBSD4) @@ -724,19 +706,21 @@ tapioctl(struct cdev *dev, u_long cmd, c switch (cmd) { case TAPSIFINFO: - s = splimp(); tapp = (struct tapinfo *)data; + mtx_lock(&tp->tap_mtx); ifp->if_mtu = tapp->mtu; ifp->if_type = tapp->type; ifp->if_baudrate = tapp->baudrate; - splx(s); + mtx_unlock(&tp->tap_mtx); break; case TAPGIFINFO: tapp = (struct tapinfo *)data; + mtx_lock(&tp->tap_mtx); tapp->mtu = ifp->if_mtu; tapp->type = ifp->if_type; tapp->baudrate = ifp->if_baudrate; + mtx_unlock(&tp->tap_mtx); break; case TAPSDEBUG: @@ -757,26 +741,26 @@ tapioctl(struct cdev *dev, u_long cmd, c break; case FIOASYNC: - s = splimp(); mtx_lock(&tp->tap_mtx); if (*(int *)data) tp->tap_flags |= TAP_ASYNC; else tp->tap_flags &= ~TAP_ASYNC; mtx_unlock(&tp->tap_mtx); - splx(s); break; case FIONREAD: - s = splimp(); - if (ifp->if_snd.ifq_head) { - struct mbuf *mb = ifp->if_snd.ifq_head; + if (!IFQ_IS_EMPTY(&ifp->if_snd)) { + struct mbuf *mb; - for(*(int *)data = 0;mb != NULL;mb = mb->m_next) + IFQ_LOCK(&ifp->if_snd); + IFQ_POLL_NOLOCK(&ifp->if_snd, mb); + for (*(int *)data = 0; mb != NULL; + mb = mb->m_next) *(int *)data += mb->m_len; + IFQ_UNLOCK(&ifp->if_snd); } else *(int *)data = 0; - splx(s); break; case FIOSETOWN: @@ -797,10 +781,6 @@ tapioctl(struct cdev *dev, u_long cmd, c /* VMware/VMnet port ioctl's */ - case SIOCGIFFLAGS: /* get ifnet flags */ - bcopy(&ifp->if_flags, data, sizeof(ifp->if_flags)); - break; - #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \ defined(COMPAT_FREEBSD4) case _IO('V', 0): @@ -814,9 +794,9 @@ tapioctl(struct cdev *dev, u_long cmd, c f &= ~IFF_CANTCHANGE; f |= IFF_UP; - s = splimp(); + mtx_lock(&tp->tap_mtx); ifp->if_flags = f | (ifp->if_flags & IFF_CANTCHANGE); - splx(s); + mtx_unlock(&tp->tap_mtx); break; case OSIOCGIFADDR: /* get MAC address of the remote side */ @@ -851,7 +831,7 @@ tapread(struct cdev *dev, struct uio *ui struct tap_softc *tp = dev->si_drv1; struct ifnet *ifp = tp->tap_ifp; struct mbuf *m = NULL; - int error = 0, len, s; + int error = 0, len; TAPDEBUG("%s reading, minor = %#x\n", ifp->if_xname, dev2unit(dev)); @@ -867,26 +847,27 @@ tapread(struct cdev *dev, struct uio *ui } tp->tap_flags &= ~TAP_RWAIT; - mtx_unlock(&tp->tap_mtx); /* sleep until we get a packet */ do { - s = splimp(); IF_DEQUEUE(&ifp->if_snd, m); - splx(s); if (m == NULL) { - if (flag & O_NONBLOCK) + if (flag & O_NONBLOCK) { + mtx_unlock(&tp->tap_mtx); return (EWOULDBLOCK); + } - mtx_lock(&tp->tap_mtx); tp->tap_flags |= TAP_RWAIT; - mtx_unlock(&tp->tap_mtx); - error = tsleep(tp,PCATCH|(PZERO+1),"taprd",0); - if (error) + error = mtx_sleep(tp, &tp->tap_mtx, PCATCH | (PZERO + 1), + "taprd", 0); + if (error) { + mtx_unlock(&tp->tap_mtx); return (error); + } } } while (m == NULL); + mtx_unlock(&tp->tap_mtx); /* feed packet to bpf */ BPF_MTAP(ifp, m); @@ -982,14 +963,14 @@ tappoll(struct cdev *dev, int events, st { struct tap_softc *tp = dev->si_drv1; struct ifnet *ifp = tp->tap_ifp; - int s, revents = 0; + int revents = 0; TAPDEBUG("%s polling, minor = %#x\n", ifp->if_xname, dev2unit(dev)); - s = splimp(); if (events & (POLLIN | POLLRDNORM)) { - if (ifp->if_snd.ifq_len > 0) { + IFQ_LOCK(&ifp->if_snd); + if (!IFQ_IS_EMPTY(&ifp->if_snd)) { TAPDEBUG("%s have data in queue. len = %d, " \ "minor = %#x\n", ifp->if_xname, ifp->if_snd.ifq_len, dev2unit(dev)); @@ -1001,12 +982,12 @@ tappoll(struct cdev *dev, int events, st selrecord(td, &tp->tap_rsel); } + IFQ_UNLOCK(&ifp->if_snd); } if (events & (POLLOUT | POLLWRNORM)) revents |= (events & (POLLOUT | POLLWRNORM)); - splx(s); return (revents); } /* tappoll */ @@ -1019,11 +1000,9 @@ tappoll(struct cdev *dev, int events, st static int tapkqfilter(struct cdev *dev, struct knote *kn) { - int s; struct tap_softc *tp = dev->si_drv1; struct ifnet *ifp = tp->tap_ifp; - s = splimp(); switch (kn->kn_filter) { case EVFILT_READ: TAPDEBUG("%s kqfilter: EVFILT_READ, minor = %#x\n", @@ -1040,13 +1019,11 @@ tapkqfilter(struct cdev *dev, struct kno default: TAPDEBUG("%s kqfilter: invalid filter, minor = %#x\n", ifp->if_xname, dev2unit(dev)); - splx(s); return (EINVAL); /* NOT REACHED */ } - splx(s); - kn->kn_hook = (caddr_t) dev; + kn->kn_hook = tp; knlist_add(&tp->tap_rsel.si_note, kn, 0); return (0); @@ -1061,12 +1038,11 @@ tapkqfilter(struct cdev *dev, struct kno static int tapkqread(struct knote *kn, long hint) { - int ret, s; - struct cdev *dev = (struct cdev *)(kn->kn_hook); - struct tap_softc *tp = dev->si_drv1; + int ret; + struct tap_softc *tp = kn->kn_hook; + struct cdev *dev = tp->tap_dev; struct ifnet *ifp = tp->tap_ifp; - s = splimp(); if ((kn->kn_data = ifp->if_snd.ifq_len) > 0) { TAPDEBUG("%s have data in queue. len = %d, minor = %#x\n", ifp->if_xname, ifp->if_snd.ifq_len, dev2unit(dev)); @@ -1076,7 +1052,6 @@ tapkqread(struct knote *kn, long hint) ifp->if_xname, dev2unit(dev)); ret = 0; } - splx(s); return (ret); } /* tapkqread */ @@ -1090,13 +1065,10 @@ tapkqread(struct knote *kn, long hint) static int tapkqwrite(struct knote *kn, long hint) { - int s; - struct tap_softc *tp = ((struct cdev *) kn->kn_hook)->si_drv1; + struct tap_softc *tp = kn->kn_hook; struct ifnet *ifp = tp->tap_ifp; - s = splimp(); kn->kn_data = ifp->if_mtu; - splx(s); return (1); } /* tapkqwrite */ @@ -1105,7 +1077,7 @@ tapkqwrite(struct knote *kn, long hint) static void tapkqdetach(struct knote *kn) { - struct tap_softc *tp = ((struct cdev *) kn->kn_hook)->si_drv1; + struct tap_softc *tp = kn->kn_hook; knlist_remove(&tp->tap_rsel.si_note, kn, 0); } /* tapkqdetach */ Modified: stable/8/sys/net/if_tun.c ============================================================================== --- stable/8/sys/net/if_tun.c Tue Oct 12 15:58:52 2010 (r213725) +++ stable/8/sys/net/if_tun.c Tue Oct 12 16:08:20 2010 (r213726) @@ -165,7 +165,7 @@ static struct filterops tun_write_filter static struct cdevsw tun_cdevsw = { .d_version = D_VERSION, - .d_flags = D_PSEUDO | D_NEEDGIANT | D_NEEDMINOR, + .d_flags = D_PSEUDO | D_NEEDMINOR, .d_open = tunopen, .d_close = tunclose, .d_read = tunread, @@ -344,13 +344,13 @@ tunstart(struct ifnet *ifp) tp->tun_flags &= ~TUN_RWAIT; wakeup(tp); } + selwakeuppri(&tp->tun_rsel, PZERO + 1); + KNOTE_LOCKED(&tp->tun_rsel.si_note, 0); if (tp->tun_flags & TUN_ASYNC && tp->tun_sigio) { mtx_unlock(&tp->tun_mtx); pgsigio(&tp->tun_sigio, SIGIO, 0); } else mtx_unlock(&tp->tun_mtx); - selwakeuppri(&tp->tun_rsel, PZERO + 1); - KNOTE_UNLOCKED(&tp->tun_rsel.si_note, 0); } /* XXX: should return an error code so it can fail. */ @@ -385,7 +385,7 @@ tuncreate(const char *name, struct cdev IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); ifp->if_snd.ifq_drv_maxlen = 0; IFQ_SET_READY(&ifp->if_snd); - knlist_init_mtx(&sc->tun_rsel.si_note, NULL); + knlist_init_mtx(&sc->tun_rsel.si_note, &sc->tun_mtx); ifp->if_capabilities |= IFCAP_LINKSTATE; ifp->if_capenable |= IFCAP_LINKSTATE; @@ -426,10 +426,10 @@ tunopen(struct cdev *dev, int flag, int tp->tun_pid = td->td_proc->p_pid; tp->tun_flags |= TUN_OPEN; - mtx_unlock(&tp->tun_mtx); ifp = TUN2IFP(tp); if_link_state_change(ifp, LINK_STATE_UP); TUNDEBUG(ifp, "open\n"); + mtx_unlock(&tp->tun_mtx); return (0); } @@ -443,7 +443,6 @@ tunclose(struct cdev *dev, int foo, int { struct tun_softc *tp; struct ifnet *ifp; - int s; tp = dev->si_drv1; ifp = TUN2IFP(tp); @@ -451,27 +450,25 @@ tunclose(struct cdev *dev, int foo, int mtx_lock(&tp->tun_mtx); tp->tun_flags &= ~TUN_OPEN; tp->tun_pid = 0; - mtx_unlock(&tp->tun_mtx); /* * junk all pending output */ CURVNET_SET(ifp->if_vnet); - s = splimp(); IFQ_PURGE(&ifp->if_snd); - splx(s); if (ifp->if_flags & IFF_UP) { - s = splimp(); + mtx_unlock(&tp->tun_mtx); if_down(ifp); - splx(s); + mtx_lock(&tp->tun_mtx); } /* Delete all addresses and routes which reference this interface. */ if (ifp->if_drv_flags & IFF_DRV_RUNNING) { struct ifaddr *ifa; - s = splimp(); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + mtx_unlock(&tp->tun_mtx); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { /* deal w/IPv4 PtP destination; unlocked read */ if (ifa->ifa_addr->sa_family == AF_INET) { @@ -482,16 +479,14 @@ tunclose(struct cdev *dev, int foo, int } } if_purgeaddrs(ifp); - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - splx(s); + mtx_lock(&tp->tun_mtx); } if_link_state_change(ifp, LINK_STATE_DOWN); CURVNET_RESTORE(); - mtx_lock(&tp->tun_mtx); funsetown(&tp->tun_sigio); selwakeuppri(&tp->tun_rsel, PZERO + 1); - KNOTE_UNLOCKED(&tp->tun_rsel.si_note, 0); + KNOTE_LOCKED(&tp->tun_rsel.si_note, 0); TUNDEBUG (ifp, "closed\n"); cv_broadcast(&tp->tun_cv); @@ -502,14 +497,15 @@ tunclose(struct cdev *dev, int foo, int static int tuninit(struct ifnet *ifp) { -#ifdef INET struct tun_softc *tp = ifp->if_softc; +#ifdef INET struct ifaddr *ifa; #endif int error = 0; TUNDEBUG(ifp, "tuninit\n"); + mtx_lock(&tp->tun_mtx); ifp->if_flags |= IFF_UP; ifp->if_drv_flags |= IFF_DRV_RUNNING; getmicrotime(&ifp->if_lastchange); @@ -521,18 +517,17 @@ tuninit(struct ifnet *ifp) struct sockaddr_in *si; si = (struct sockaddr_in *)ifa->ifa_addr; - mtx_lock(&tp->tun_mtx); if (si->sin_addr.s_addr) tp->tun_flags |= TUN_IASET; si = (struct sockaddr_in *)ifa->ifa_dstaddr; if (si && si->sin_addr.s_addr) tp->tun_flags |= TUN_DSTADDR; - mtx_unlock(&tp->tun_mtx); } } if_addr_runlock(ifp); #endif + mtx_unlock(&tp->tun_mtx); return (error); } @@ -545,9 +540,8 @@ tunifioctl(struct ifnet *ifp, u_long cmd struct ifreq *ifr = (struct ifreq *)data; struct tun_softc *tp = ifp->if_softc; struct ifstat *ifs; - int error = 0, s; + int error = 0; - s = splimp(); switch(cmd) { case SIOCGIFSTATUS: ifs = (struct ifstat *)data; @@ -576,7 +570,6 @@ tunifioctl(struct ifnet *ifp, u_long cmd default: error = EINVAL; } - splx(s); return (error); } @@ -682,7 +675,6 @@ tunoutput( static int tunioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { - int s; int error; struct tun_softc *tp = dev->si_drv1; struct tuninfo *tunp; @@ -697,15 +689,19 @@ tunioctl(struct cdev *dev, u_long cmd, c if (error) return (error); } + mtx_lock(&tp->tun_mtx); TUN2IFP(tp)->if_mtu = tunp->mtu; TUN2IFP(tp)->if_type = tunp->type; TUN2IFP(tp)->if_baudrate = tunp->baudrate; + mtx_unlock(&tp->tun_mtx); break; case TUNGIFINFO: tunp = (struct tuninfo *)data; + mtx_lock(&tp->tun_mtx); tunp->mtu = TUN2IFP(tp)->if_mtu; tunp->type = TUN2IFP(tp)->if_type; tunp->baudrate = TUN2IFP(tp)->if_baudrate; + mtx_unlock(&tp->tun_mtx); break; case TUNSDEBUG: tundebug = *(int *)data; @@ -732,7 +728,6 @@ tunioctl(struct cdev *dev, u_long cmd, c mtx_unlock(&tp->tun_mtx); break; case TUNGIFHEAD: - /* Could be unlocked read? */ mtx_lock(&tp->tun_mtx); *(int *)data = (tp->tun_flags & TUN_IFHEAD) ? 1 : 0; mtx_unlock(&tp->tun_mtx); @@ -745,9 +740,11 @@ tunioctl(struct cdev *dev, u_long cmd, c switch (*(int *)data & ~IFF_MULTICAST) { case IFF_POINTOPOINT: case IFF_BROADCAST: + mtx_lock(&tp->tun_mtx); TUN2IFP(tp)->if_flags &= ~(IFF_BROADCAST|IFF_POINTOPOINT|IFF_MULTICAST); TUN2IFP(tp)->if_flags |= *(int *)data; + mtx_unlock(&tp->tun_mtx); break; default: return(EINVAL); @@ -769,17 +766,15 @@ tunioctl(struct cdev *dev, u_long cmd, c mtx_unlock(&tp->tun_mtx); break; case FIONREAD: - s = splimp(); if (!IFQ_IS_EMPTY(&TUN2IFP(tp)->if_snd)) { struct mbuf *mb; IFQ_LOCK(&TUN2IFP(tp)->if_snd); IFQ_POLL_NOLOCK(&TUN2IFP(tp)->if_snd, mb); - for( *(int *)data = 0; mb != 0; mb = mb->m_next) + for (*(int *)data = 0; mb != NULL; mb = mb->m_next) *(int *)data += mb->m_len; IFQ_UNLOCK(&TUN2IFP(tp)->if_snd); } else *(int *)data = 0; - splx(s); break; case FIOSETOWN: return (fsetown(*(int *)data, &tp->tun_sigio)); @@ -813,7 +808,7 @@ tunread(struct cdev *dev, struct uio *ui struct tun_softc *tp = dev->si_drv1; struct ifnet *ifp = TUN2IFP(tp); struct mbuf *m; - int error=0, len, s; + int error=0, len; TUNDEBUG (ifp, "read\n"); mtx_lock(&tp->tun_mtx); @@ -824,27 +819,24 @@ tunread(struct cdev *dev, struct uio *ui } tp->tun_flags &= ~TUN_RWAIT; - mtx_unlock(&tp->tun_mtx); - s = splimp(); do { IFQ_DEQUEUE(&ifp->if_snd, m); if (m == NULL) { if (flag & O_NONBLOCK) { - splx(s); + mtx_unlock(&tp->tun_mtx); return (EWOULDBLOCK); } - mtx_lock(&tp->tun_mtx); tp->tun_flags |= TUN_RWAIT; - mtx_unlock(&tp->tun_mtx); - if ((error = tsleep(tp, PCATCH | (PZERO + 1), - "tunread", 0)) != 0) { - splx(s); + error = mtx_sleep(tp, &tp->tun_mtx, PCATCH | (PZERO + 1), + "tunread", 0); + if (error != 0) { + mtx_unlock(&tp->tun_mtx); return (error); } } } while (m == NULL); - splx(s); + mtx_unlock(&tp->tun_mtx); while (m && uio->uio_resid > 0 && error == 0) { len = min(uio->uio_resid, m->m_len); @@ -957,13 +949,11 @@ tunwrite(struct cdev *dev, struct uio *u static int tunpoll(struct cdev *dev, int events, struct thread *td) { - int s; struct tun_softc *tp = dev->si_drv1; struct ifnet *ifp = TUN2IFP(tp); int revents = 0; struct mbuf *m; - s = splimp(); TUNDEBUG(ifp, "tunpoll\n"); if (events & (POLLIN | POLLRDNORM)) { @@ -981,7 +971,6 @@ tunpoll(struct cdev *dev, int events, st if (events & (POLLOUT | POLLWRNORM)) revents |= events & (POLLOUT | POLLWRNORM); - splx(s); return (revents); } @@ -991,11 +980,9 @@ tunpoll(struct cdev *dev, int events, st static int tunkqfilter(struct cdev *dev, struct knote *kn) { - int s; struct tun_softc *tp = dev->si_drv1; struct ifnet *ifp = TUN2IFP(tp); - s = splimp(); switch(kn->kn_filter) { case EVFILT_READ: TUNDEBUG(ifp, "%s kqfilter: EVFILT_READ, minor = %#x\n", @@ -1012,12 +999,10 @@ tunkqfilter(struct cdev *dev, struct kno default: TUNDEBUG(ifp, "%s kqfilter: invalid filter, minor = %#x\n", ifp->if_xname, dev2unit(dev)); - splx(s); return(EINVAL); } - splx(s); - kn->kn_hook = (caddr_t) dev; + kn->kn_hook = tp; knlist_add(&tp->tun_rsel.si_note, kn, 0); return (0); @@ -1029,12 +1014,11 @@ tunkqfilter(struct cdev *dev, struct kno static int tunkqread(struct knote *kn, long hint) { - int ret, s; - struct cdev *dev = (struct cdev *)(kn->kn_hook); - struct tun_softc *tp = dev->si_drv1; + int ret; + struct tun_softc *tp = kn->kn_hook; + struct cdev *dev = tp->tun_dev; struct ifnet *ifp = TUN2IFP(tp); - s = splimp(); if ((kn->kn_data = ifp->if_snd.ifq_len) > 0) { TUNDEBUG(ifp, "%s have data in the queue. Len = %d, minor = %#x\n", @@ -1046,7 +1030,6 @@ tunkqread(struct knote *kn, long hint) dev2unit(dev)); ret = 0; } - splx(s); return (ret); } @@ -1057,13 +1040,10 @@ tunkqread(struct knote *kn, long hint) static int tunkqwrite(struct knote *kn, long hint) { - int s; - struct tun_softc *tp = ((struct cdev *)kn->kn_hook)->si_drv1; + struct tun_softc *tp = kn->kn_hook; struct ifnet *ifp = TUN2IFP(tp); - s = splimp(); kn->kn_data = ifp->if_mtu; - splx(s); return (1); } @@ -1071,7 +1051,7 @@ tunkqwrite(struct knote *kn, long hint) static void tunkqdetach(struct knote *kn) { - struct tun_softc *tp = ((struct cdev *)kn->kn_hook)->si_drv1; + struct tun_softc *tp = kn->kn_hook; knlist_remove(&tp->tun_rsel.si_note, kn, 0); } From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 12 16:23:50 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72CC910656A6; Tue, 12 Oct 2010 16:23:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 60A748FC21; Tue, 12 Oct 2010 16:23:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9CGNo0Q053330; Tue, 12 Oct 2010 16:23:50 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9CGNooX053328; Tue, 12 Oct 2010 16:23:50 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201010121623.o9CGNooX053328@svn.freebsd.org> From: John Baldwin Date: Tue, 12 Oct 2010 16:23:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213728 - stable/8/sys/dev/ral X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Oct 2010 16:23:50 -0000 Author: jhb Date: Tue Oct 12 16:23:50 2010 New Revision: 213728 URL: http://svn.freebsd.org/changeset/base/213728 Log: MFC 213268: If rt2560_bbp_init() fails, don't drop the lock as the callers of rt2560_init_locked() expect the lock to be held on return. Modified: stable/8/sys/dev/ral/rt2560.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ral/rt2560.c ============================================================================== --- stable/8/sys/dev/ral/rt2560.c Tue Oct 12 16:09:08 2010 (r213727) +++ stable/8/sys/dev/ral/rt2560.c Tue Oct 12 16:23:50 2010 (r213728) @@ -2667,8 +2667,7 @@ rt2560_init_locked(struct rt2560_softc * RAL_WRITE(sc, RT2560_CSR1, RT2560_HOST_READY); if (rt2560_bbp_init(sc) != 0) { - rt2560_stop(sc); - RAL_UNLOCK(sc); + rt2560_stop_locked(sc); return; } From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 12 17:12:13 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 575841065670; Tue, 12 Oct 2010 17:12:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 451DD8FC1C; Tue, 12 Oct 2010 17:12:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9CHCDrm054635; Tue, 12 Oct 2010 17:12:13 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9CHCDV9054633; Tue, 12 Oct 2010 17:12:13 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201010121712.o9CHCDV9054633@svn.freebsd.org> From: John Baldwin Date: Tue, 12 Oct 2010 17:12:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213732 - stable/8/contrib/csup X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Oct 2010 17:12:13 -0000 Author: jhb Date: Tue Oct 12 17:12:13 2010 New Revision: 213732 URL: http://svn.freebsd.org/changeset/base/213732 Log: MFC 213300: If an RCS file is truncated, rcsfile_getdelta() will return NULL. Instead of faulting, check for NULL. However, returning an error would cause csup to just abort the entire update. Instead, break out of the loop and return ok. The attempts to update the file will trigger a MD5 failure which will cause csup to download the entire file as a fixup. Modified: stable/8/contrib/csup/rcsparse.c Directory Properties: stable/8/contrib/csup/ (props changed) Modified: stable/8/contrib/csup/rcsparse.c ============================================================================== --- stable/8/contrib/csup/rcsparse.c Tue Oct 12 17:09:33 2010 (r213731) +++ stable/8/contrib/csup/rcsparse.c Tue Oct 12 17:12:13 2010 (r213732) @@ -318,6 +318,14 @@ parse_deltatexts(struct rcsfile *rf, yys d = rcsfile_getdelta(rf, revnum); free(revnum); + /* + * XXX: The RCS file is corrupt, but lie and say it is ok. + * If it is actually broken, then the MD5 mismatch will + * trigger a fixup. + */ + if (d == NULL) + return (0); + /* log string */ asserttoken(sp, KEYWORD); asserttoken(sp, STRING); From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 12 19:07:36 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBF86106566B; Tue, 12 Oct 2010 19:07:36 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B8A4D8FC18; Tue, 12 Oct 2010 19:07:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9CJ7aNM058885; Tue, 12 Oct 2010 19:07:36 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9CJ7a7H058882; Tue, 12 Oct 2010 19:07:36 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201010121907.o9CJ7a7H058882@svn.freebsd.org> From: "George V. Neville-Neil" Date: Tue, 12 Oct 2010 19:07:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213741 - in stable/8/tools/tools: ath/common mcgrab mctest termcap X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Oct 2010 19:07:36 -0000 Author: gnn Date: Tue Oct 12 19:07:36 2010 New Revision: 213741 URL: http://svn.freebsd.org/changeset/base/213741 Log: MFC 204310: Moved mcgrab(1) into a separate directory -- our .mk infrastructure doesn't currently have support for building multiple programs in a single makefile. While here, fixed manpages and makefiles (missing dependencies). Added: stable/8/tools/tools/mcgrab/ - copied from r204310, head/tools/tools/mcgrab/ Deleted: stable/8/tools/tools/mctest/mcgrab.1 stable/8/tools/tools/mctest/mcgrab.cc Modified: stable/8/tools/tools/mctest/Makefile stable/8/tools/tools/mctest/mctest.1 Directory Properties: stable/8/tools/tools/ (props changed) stable/8/tools/tools/ath/ (props changed) stable/8/tools/tools/ath/common/dumpregs.h (props changed) stable/8/tools/tools/ath/common/dumpregs_5210.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5211.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5212.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5416.c (props changed) stable/8/tools/tools/nanobsd/ (props changed) stable/8/tools/tools/netrate/tcpp/ (props changed) stable/8/tools/tools/termcap/termcap.pl (props changed) stable/8/tools/tools/umastat/ (props changed) stable/8/tools/tools/vimage/ (props changed) Modified: stable/8/tools/tools/mctest/Makefile ============================================================================== --- stable/8/tools/tools/mctest/Makefile Tue Oct 12 19:00:18 2010 (r213740) +++ stable/8/tools/tools/mctest/Makefile Tue Oct 12 19:07:36 2010 (r213741) @@ -1,11 +1,7 @@ -# # $FreeBSD$ -# -# A Makefile that builds both the mctest program and its manual page. PROG_CXX= mctest -PROG_CXX= mcgrab - -LDADD+= -lpthread +DPADD= ${LIBPTHREAD} +LDADD= -lpthread .include Modified: stable/8/tools/tools/mctest/mctest.1 ============================================================================== --- stable/8/tools/tools/mctest/mctest.1 Tue Oct 12 19:00:18 2010 (r213740) +++ stable/8/tools/tools/mctest/mctest.1 Tue Oct 12 19:07:36 2010 (r213741) @@ -25,7 +25,7 @@ .\" $FreeBSD$ .\" .Dd April 3, 2008 -.Dt mctest 1 +.Dt MCTEST 1 .Os .Sh NAME .Nm mctest @@ -40,29 +40,34 @@ .Op Fl t Ar inter-packet gap .Op Fl M Ar number of clients (source only) .Op Fl m Ar my client number (sink only) -.Op Fl r +.Op Fl r .Sh DESCRIPTION -The +The .Nm -command implements a multicast test which involved a source -and a sink. The source sends packets to a pre-configured -multicast address over the interface given as a command line -argument. The sink listens for multicast packets, records -the time at which they're received and then reflects them back -over unicast to the source. When the source has captured all +command implements a multicast test which involves a source +and a sink. +The source sends packets to a pre-configured +multicast address over the interface given as a command line +argument. +The sink listens for multicast packets, records +the time at which they are received and then reflects them back +over unicast to the source. +When the source has captured all the reflected packets it prints out the round trip time of each. .Pp The source prints out the round trip time of packets sent to the -sinks. The sink prints out the time between the packets received. +sinks. +The sink prints out the time between the packets received. .Pp The options are as follows: -.Bl -tag -width ".Fl d Ar argument" +.Bl -tag -width ".Fl i Ar interface" .It Fl i Ar interface -Network interface, which can be found with ifconfig(1). +Network interface, which can be found with +.Xr ifconfig 8 . .It Fl g Ar group -Multicast group +Multicast group. .It Fl b Ar base port -Port on which to listen +Port on which to listen. .It Fl s Ar size Packet size in bytes. .It Fl n Ar number @@ -70,14 +75,15 @@ Number of packets. .It Fl t Ar gap Inter-packet gap in nanoseconds. .It Fl M Ar clients -The number of clients that are listening +The number of clients that are listening. .It Fl m Ar my number The client's number 0, 1, etc. .It Fl r This version of .Nm -is the receiver aka the sink. This option MUST -only be used with one copy of the program at a time. +is the receiver aka the sink. +This option MUST +only be used with one copy of the program at a time. .El .Sh EXAMPLES The following is an example of a typical usage @@ -92,14 +98,15 @@ Sink .Pp Send 100 packets of 1024 bytes, with an inter-packet gap of 1 nanosecond. .Pp -Gaps are measured with +Gaps are measured with .Xr nanosleep 2 , and so are not accurate down to nanoseconds -but depend on the setting of kern.hz. +but depend on the setting of +.Va kern.hz . .Sh SEE ALSO -.Xr ifconfig 8 , .Xr netstat 1 , -.Xr nanosleep 2 . +.Xr nanosleep 2 , +.Xr ifconfig 8 .Sh HISTORY The .Nm @@ -110,4 +117,5 @@ This manual page was written by .An George V. Neville-Neil Aq gnn@FreeBSD.org . .Sh BUGS -Should be reported to the author or to net@freebsd.org. +Should be reported to the author or to +.Aq net@FreeBSD.org . From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 12 19:28:21 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4463010656A4; Tue, 12 Oct 2010 19:28:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3139A8FC1C; Tue, 12 Oct 2010 19:28:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9CJSL4D059625; Tue, 12 Oct 2010 19:28:21 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9CJSLWA059623; Tue, 12 Oct 2010 19:28:21 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201010121928.o9CJSLWA059623@svn.freebsd.org> From: John Baldwin Date: Tue, 12 Oct 2010 19:28:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213745 - stable/8/sys/i386/i386 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Oct 2010 19:28:21 -0000 Author: jhb Date: Tue Oct 12 19:28:20 2010 New Revision: 213745 URL: http://svn.freebsd.org/changeset/base/213745 Log: MFC 213226: Rewrite the i386 memory probe: - Check for SMAP data from the loader first. If it exists, don't bother doing any VM86 calls at all. This will be more friendly for non-BIOS boot environments such as EFI, etc. - Move the base memory setup into a new basemem_setup() routine instead of duplicating it. - Simplify the XEN case by removing all of the VM86/SMAP parsing code rather than just jumping over it. - Adjust some comments to better explain the code flow. Modified: stable/8/sys/i386/i386/machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/i386/i386/machdep.c ============================================================================== --- stable/8/sys/i386/i386/machdep.c Tue Oct 12 19:24:41 2010 (r213744) +++ stable/8/sys/i386/i386/machdep.c Tue Oct 12 19:28:20 2010 (r213745) @@ -1938,6 +1938,7 @@ sdtossd(sd, ssd) ssd->ssd_gran = sd->sd_gran; } +#ifndef XEN static int add_smap_entry(struct bios_smap *smap, vm_paddr_t *physmap, int *physmap_idxp) { @@ -2017,78 +2018,13 @@ add_smap_entry(struct bios_smap *smap, v return (1); } -/* - * Populate the (physmap) array with base/bound pairs describing the - * available physical memory in the system, then test this memory and - * build the phys_avail array describing the actually-available memory. - * - * If we cannot accurately determine the physical memory map, then use - * value from the 0xE801 call, and failing that, the RTC. - * - * Total memory size may be set by the kernel environment variable - * hw.physmem or the compile-time define MAXMEM. - * - * XXX first should be vm_paddr_t. - */ static void -getmemsize(int first) +basemem_setup(void) { - int i, off, physmap_idx, pa_indx, da_indx; - int hasbrokenint12, has_smap; - u_long physmem_tunable; - u_int extmem; - struct vm86frame vmf; - struct vm86context vmc; - vm_paddr_t pa, physmap[PHYSMAP_SIZE]; + vm_paddr_t pa; pt_entry_t *pte; - struct bios_smap *smap, *smapbase, *smapend; - u_int32_t smapsize; - quad_t dcons_addr, dcons_size; - caddr_t kmdp; - - has_smap = 0; -#ifdef XBOX - if (arch_i386_is_xbox) { - /* - * We queried the memory size before, so chop off 4MB for - * the framebuffer and inform the OS of this. - */ - physmap[0] = 0; - physmap[1] = (arch_i386_xbox_memsize * 1024 * 1024) - XBOX_FB_SIZE; - physmap_idx = 0; - goto physmap_done; - } -#endif -#if defined(XEN) - has_smap = 0; - Maxmem = xen_start_info->nr_pages - init_first; - physmem = Maxmem; - basemem = 0; - physmap[0] = init_first << PAGE_SHIFT; - physmap[1] = ptoa(Maxmem) - round_page(MSGBUF_SIZE); - physmap_idx = 0; - goto physmap_done; -#endif - hasbrokenint12 = 0; - TUNABLE_INT_FETCH("hw.hasbrokenint12", &hasbrokenint12); - bzero(&vmf, sizeof(vmf)); - bzero(physmap, sizeof(physmap)); - basemem = 0; - - /* - * Some newer BIOSes has broken INT 12H implementation which cause - * kernel panic immediately. In this case, we need to scan SMAP - * with INT 15:E820 first, then determine base memory size. - */ - if (hasbrokenint12) { - goto int15e820; - } + int i; - /* - * Perform "base memory" related probes & setup - */ - vm86_intcall(0x12, &vmf); - basemem = vmf.vmf_ax; if (basemem > 640) { printf("Preposterous BIOS basemem of %uK, truncating to 640K\n", basemem); @@ -2128,12 +2064,69 @@ getmemsize(int first) pte = (pt_entry_t *)vm86paddr; for (i = basemem / 4; i < 160; i++) pte[i] = (i << PAGE_SHIFT) | PG_V | PG_RW | PG_U; +} +#endif + +/* + * Populate the (physmap) array with base/bound pairs describing the + * available physical memory in the system, then test this memory and + * build the phys_avail array describing the actually-available memory. + * + * If we cannot accurately determine the physical memory map, then use + * value from the 0xE801 call, and failing that, the RTC. + * + * Total memory size may be set by the kernel environment variable + * hw.physmem or the compile-time define MAXMEM. + * + * XXX first should be vm_paddr_t. + */ +static void +getmemsize(int first) +{ + int has_smap, off, physmap_idx, pa_indx, da_indx; + u_long physmem_tunable; + vm_paddr_t physmap[PHYSMAP_SIZE]; + pt_entry_t *pte; + quad_t dcons_addr, dcons_size; +#ifndef XEN + int hasbrokenint12, i; + u_int extmem; + struct vm86frame vmf; + struct vm86context vmc; + vm_paddr_t pa; + struct bios_smap *smap, *smapbase, *smapend; + u_int32_t smapsize; + caddr_t kmdp; +#endif + + has_smap = 0; +#if defined(XEN) + Maxmem = xen_start_info->nr_pages - init_first; + physmem = Maxmem; + basemem = 0; + physmap[0] = init_first << PAGE_SHIFT; + physmap[1] = ptoa(Maxmem) - round_page(MSGBUF_SIZE); + physmap_idx = 0; +#else +#ifdef XBOX + if (arch_i386_is_xbox) { + /* + * We queried the memory size before, so chop off 4MB for + * the framebuffer and inform the OS of this. + */ + physmap[0] = 0; + physmap[1] = (arch_i386_xbox_memsize * 1024 * 1024) - XBOX_FB_SIZE; + physmap_idx = 0; + goto physmap_done; + } +#endif + bzero(&vmf, sizeof(vmf)); + bzero(physmap, sizeof(physmap)); + basemem = 0; -int15e820: /* - * Fetch the memory map with INT 15:E820. First, check to see - * if the loader supplied it and use that if so. Otherwise, - * use vm86 to invoke the BIOS call directly. + * Check if the loader supplied an SMAP memory map. If so, + * use that and do not make any VM86 calls. */ physmap_idx = 0; smapbase = NULL; @@ -2144,9 +2137,10 @@ int15e820: smapbase = (struct bios_smap *)preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_SMAP); if (smapbase != NULL) { - /* subr_module.c says: + /* + * subr_module.c says: * "Consumer may safely assume that size value precedes data." - * ie: an int32_t immediately precedes smap. + * ie: an int32_t immediately precedes SMAP. */ smapsize = *((u_int32_t *)smapbase - 1); smapend = (struct bios_smap *)((uintptr_t)smapbase + smapsize); @@ -2155,33 +2149,50 @@ int15e820: for (smap = smapbase; smap < smapend; smap++) if (!add_smap_entry(smap, physmap, &physmap_idx)) break; - } else { - /* - * map page 1 R/W into the kernel page table so we can use it - * as a buffer. The kernel will unmap this page later. - */ - pmap_kenter(KERNBASE + (1 << PAGE_SHIFT), 1 << PAGE_SHIFT); - vmc.npages = 0; - smap = (void *)vm86_addpage(&vmc, 1, KERNBASE + - (1 << PAGE_SHIFT)); - vm86_getptr(&vmc, (vm_offset_t)smap, &vmf.vmf_es, &vmf.vmf_di); - - vmf.vmf_ebx = 0; - do { - vmf.vmf_eax = 0xE820; - vmf.vmf_edx = SMAP_SIG; - vmf.vmf_ecx = sizeof(struct bios_smap); - i = vm86_datacall(0x15, &vmf, &vmc); - if (i || vmf.vmf_eax != SMAP_SIG) - break; - has_smap = 1; - if (!add_smap_entry(smap, physmap, &physmap_idx)) - break; - } while (vmf.vmf_ebx != 0); + goto have_smap; } /* - * Perform "base memory" related probes & setup based on SMAP + * Some newer BIOSes have a broken INT 12H implementation + * which causes a kernel panic immediately. In this case, we + * need use the SMAP to determine the base memory size. + */ + hasbrokenint12 = 0; + TUNABLE_INT_FETCH("hw.hasbrokenint12", &hasbrokenint12); + if (hasbrokenint12 == 0) { + /* Use INT12 to determine base memory size. */ + vm86_intcall(0x12, &vmf); + basemem = vmf.vmf_ax; + basemem_setup(); + } + + /* + * Fetch the memory map with INT 15:E820. Map page 1 R/W into + * the kernel page table so we can use it as a buffer. The + * kernel will unmap this page later. + */ + pmap_kenter(KERNBASE + (1 << PAGE_SHIFT), 1 << PAGE_SHIFT); + vmc.npages = 0; + smap = (void *)vm86_addpage(&vmc, 1, KERNBASE + (1 << PAGE_SHIFT)); + vm86_getptr(&vmc, (vm_offset_t)smap, &vmf.vmf_es, &vmf.vmf_di); + + vmf.vmf_ebx = 0; + do { + vmf.vmf_eax = 0xE820; + vmf.vmf_edx = SMAP_SIG; + vmf.vmf_ecx = sizeof(struct bios_smap); + i = vm86_datacall(0x15, &vmf, &vmc); + if (i || vmf.vmf_eax != SMAP_SIG) + break; + has_smap = 1; + if (!add_smap_entry(smap, physmap, &physmap_idx)) + break; + } while (vmf.vmf_ebx != 0); + +have_smap: + /* + * If we didn't fetch the "base memory" size from INT12, + * figure it out from the SMAP (or just guess). */ if (basemem == 0) { for (i = 0; i <= physmap_idx; i += 2) { @@ -2191,49 +2202,39 @@ int15e820: } } - /* - * XXX this function is horribly organized and has to the same - * things that it does above here. - */ + /* XXX: If we couldn't find basemem from SMAP, just guess. */ if (basemem == 0) basemem = 640; - if (basemem > 640) { - printf( - "Preposterous BIOS basemem of %uK, truncating to 640K\n", - basemem); - basemem = 640; - } - - /* - * Let vm86 scribble on pages between basemem and - * ISA_HOLE_START, as above. - */ - for (pa = trunc_page(basemem * 1024); - pa < ISA_HOLE_START; pa += PAGE_SIZE) - pmap_kenter(KERNBASE + pa, pa); - pte = (pt_entry_t *)vm86paddr; - for (i = basemem / 4; i < 160; i++) - pte[i] = (i << PAGE_SHIFT) | PG_V | PG_RW | PG_U; + basemem_setup(); } if (physmap[1] != 0) goto physmap_done; /* - * If we failed above, try memory map with INT 15:E801 + * If we failed to find an SMAP, figure out the extended + * memory size. We will then build a simple memory map with + * two segments, one for "base memory" and the second for + * "extended memory". Note that "extended memory" starts at a + * physical address of 1MB and that both basemem and extmem + * are in units of 1KB. + * + * First, try to fetch the extended memory size via INT 15:E801. */ vmf.vmf_ax = 0xE801; if (vm86_intcall(0x15, &vmf) == 0) { extmem = vmf.vmf_cx + vmf.vmf_dx * 64; } else { + /* + * If INT15:E801 fails, this is our last ditch effort + * to determine the extended memory size. Currently + * we prefer the RTC value over INT15:88. + */ #if 0 vmf.vmf_ah = 0x88; vm86_intcall(0x15, &vmf); extmem = vmf.vmf_ax; -#elif !defined(XEN) - /* - * Prefer the RTC value for extended memory. - */ +#else extmem = rtcin(RTC_EXTLO) + (rtcin(RTC_EXTHI) << 8); #endif } @@ -2258,6 +2259,7 @@ int15e820: physmap[physmap_idx + 1] = physmap[physmap_idx] + extmem * 1024; physmap_done: +#endif /* * Now, physmap contains a map of physical memory. */ From owner-svn-src-stable-8@FreeBSD.ORG Tue Oct 12 22:10:08 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 523291065672; Tue, 12 Oct 2010 22:10:08 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F2A88FC14; Tue, 12 Oct 2010 22:10:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9CMA8Dm063622; Tue, 12 Oct 2010 22:10:08 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9CMA8WN063620; Tue, 12 Oct 2010 22:10:08 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201010122210.o9CMA8WN063620@svn.freebsd.org> From: "George V. Neville-Neil" Date: Tue, 12 Oct 2010 22:10:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213753 - stable/8/usr.sbin/pmccontrol X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Oct 2010 22:10:08 -0000 Author: gnn Date: Tue Oct 12 22:10:07 2010 New Revision: 213753 URL: http://svn.freebsd.org/changeset/base/213753 Log: MFC 213691: Add code to print the number and type of the CPU that is present in the system as well has how many PMCs there are per CPU. In this code CPU and core are equivalent. Modified: stable/8/usr.sbin/pmccontrol/pmccontrol.c Directory Properties: stable/8/usr.sbin/pmccontrol/ (props changed) Modified: stable/8/usr.sbin/pmccontrol/pmccontrol.c ============================================================================== --- stable/8/usr.sbin/pmccontrol/pmccontrol.c Tue Oct 12 22:09:33 2010 (r213752) +++ stable/8/usr.sbin/pmccontrol/pmccontrol.c Tue Oct 12 22:10:07 2010 (r213753) @@ -243,6 +243,10 @@ pmcc_do_list_state(void) if (pmc_cpuinfo(&pc) != 0) err(EX_OSERR, "Unable to determine CPU information"); + printf("%d %s CPUs present, with %d PMCs per CPU\n", pc->pm_ncpu, + pmc_name_of_cputype(pc->pm_cputype), + pc->pm_npmc); + dummy = sizeof(logical_cpus_mask); if (sysctlbyname("machdep.logical_cpus_mask", &logical_cpus_mask, &dummy, NULL, 0) < 0) From owner-svn-src-stable-8@FreeBSD.ORG Wed Oct 13 11:39:37 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D85051065670; Wed, 13 Oct 2010 11:39:37 +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 C570B8FC18; Wed, 13 Oct 2010 11:39:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9DBdblq086397; Wed, 13 Oct 2010 11:39:37 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9DBdbpn086396; Wed, 13 Oct 2010 11:39:37 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201010131139.o9DBdbpn086396@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 13 Oct 2010 11:39:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213773 - stable/8/lib/libc/stdlib X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Oct 2010 11:39:38 -0000 Author: kib Date: Wed Oct 13 11:39:36 2010 New Revision: 213773 URL: http://svn.freebsd.org/changeset/base/213773 Log: MFC r213476: Add cross-references to lrand48(3) and arc4random(3) from rand(3) and random(3). MFC r213477: Missed space. Modified: stable/8/lib/libc/stdlib/rand.3 stable/8/lib/libc/stdlib/random.3 Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/locale/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/sys/ (props changed) Modified: stable/8/lib/libc/stdlib/rand.3 ============================================================================== --- stable/8/lib/libc/stdlib/rand.3 Wed Oct 13 11:38:24 2010 (r213772) +++ stable/8/lib/libc/stdlib/rand.3 Wed Oct 13 11:39:36 2010 (r213773) @@ -32,7 +32,7 @@ .\" @(#)rand.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd May 25, 1999 +.Dd October 6, 2010 .Dt RAND 3 .Os .Sh NAME @@ -100,7 +100,16 @@ provides the same functionality as A pointer to the context value .Fa ctx must be supplied by the caller. +.Pp +For better generator quality, use +.Xr random 3 +or +.Xr lrand48 3 . +Applications requiring cryptographic quality randomness should use +.Xr arc4random 3 . .Sh SEE ALSO +.Xr arc4random 3 , +.Xr lrand48 3 , .Xr random 3 , .Xr random 4 .Sh STANDARDS Modified: stable/8/lib/libc/stdlib/random.3 ============================================================================== --- stable/8/lib/libc/stdlib/random.3 Wed Oct 13 11:38:24 2010 (r213772) +++ stable/8/lib/libc/stdlib/random.3 Wed Oct 13 11:39:36 2010 (r213773) @@ -173,6 +173,7 @@ detects that the state information has b messages are printed on the standard error output. .Sh SEE ALSO .Xr arc4random 3 , +.Xr lrand48 3 , .Xr rand 3 , .Xr srand 3 , .Xr random 4 From owner-svn-src-stable-8@FreeBSD.ORG Wed Oct 13 14:02:45 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B37D1065674; Wed, 13 Oct 2010 14:02:45 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 788608FC13; Wed, 13 Oct 2010 14:02:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9DE2jgA089581; Wed, 13 Oct 2010 14:02:45 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9DE2jh3089579; Wed, 13 Oct 2010 14:02:45 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201010131402.o9DE2jh3089579@svn.freebsd.org> From: Jaakko Heinonen Date: Wed, 13 Oct 2010 14:02:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213776 - stable/8/sys/cam/scsi X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Oct 2010 14:02:45 -0000 Author: jh Date: Wed Oct 13 14:02:45 2010 New Revision: 213776 URL: http://svn.freebsd.org/changeset/base/213776 Log: MFC r200036 by scottl: Fix several cases where the periph lock was held over malloc. PR: kern/130735 Modified: stable/8/sys/cam/scsi/scsi_cd.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_cd.c Wed Oct 13 13:22:11 2010 (r213775) +++ stable/8/sys/cam/scsi/scsi_cd.c Wed Oct 13 14:02:45 2010 (r213776) @@ -2671,12 +2671,10 @@ cdioctl(struct disk *dp, u_long cmd, voi authinfo = (struct dvd_authinfo *)addr; - cam_periph_lock(periph); if (cmd == DVDIOCREPORTKEY) error = cdreportkey(periph, authinfo); else error = cdsendkey(periph, authinfo); - cam_periph_unlock(periph); break; } case DVDIOCREADSTRUCTURE: { @@ -2684,9 +2682,7 @@ cdioctl(struct disk *dp, u_long cmd, voi dvdstruct = (struct dvd_struct *)addr; - cam_periph_lock(periph); error = cdreaddvdstructure(periph, dvdstruct); - cam_periph_unlock(periph); break; } @@ -3732,8 +3728,6 @@ cdreportkey(struct cam_periph *periph, s databuf = NULL; lba = 0; - ccb = cdgetccb(periph, CAM_PRIORITY_NORMAL); - switch (authinfo->format) { case DVD_REPORT_AGID: length = sizeof(struct scsi_report_key_data_agid); @@ -3759,9 +3753,7 @@ cdreportkey(struct cam_periph *periph, s length = 0; break; default: - error = EINVAL; - goto bailout; - break; /* NOTREACHED */ + return (EINVAL); } if (length != 0) { @@ -3769,6 +3761,8 @@ cdreportkey(struct cam_periph *periph, s } else databuf = NULL; + cam_periph_lock(periph); + ccb = cdgetccb(periph, CAM_PRIORITY_NORMAL); scsi_report_key(&ccb->csio, /* retries */ cd_retry_count, @@ -3869,12 +3863,14 @@ cdreportkey(struct cam_periph *periph, s goto bailout; break; /* NOTREACHED */ } + bailout: + xpt_release_ccb(ccb); + cam_periph_unlock(periph); + if (databuf != NULL) free(databuf, M_DEVBUF); - xpt_release_ccb(ccb); - return(error); } @@ -3889,8 +3885,6 @@ cdsendkey(struct cam_periph *periph, str error = 0; databuf = NULL; - ccb = cdgetccb(periph, CAM_PRIORITY_NORMAL); - switch(authinfo->format) { case DVD_SEND_CHALLENGE: { struct scsi_report_key_data_challenge *challenge_data; @@ -3942,11 +3936,12 @@ cdsendkey(struct cam_periph *periph, str break; } default: - error = EINVAL; - goto bailout; - break; /* NOTREACHED */ + return (EINVAL); } + cam_periph_lock(periph); + ccb = cdgetccb(periph, CAM_PRIORITY_NORMAL); + scsi_send_key(&ccb->csio, /* retries */ cd_retry_count, /* cbfcnp */ cddone, @@ -3961,13 +3956,12 @@ cdsendkey(struct cam_periph *periph, str error = cdrunccb(ccb, cderror, /*cam_flags*/CAM_RETRY_SELTO, /*sense_flags*/SF_RETRY_UA); -bailout: + xpt_release_ccb(ccb); + cam_periph_unlock(periph); if (databuf != NULL) free(databuf, M_DEVBUF); - xpt_release_ccb(ccb); - return(error); } @@ -3985,8 +3979,6 @@ cdreaddvdstructure(struct cam_periph *pe /* The address is reserved for many of the formats */ address = 0; - ccb = cdgetccb(periph, CAM_PRIORITY_NORMAL); - switch(dvdstruct->format) { case DVD_STRUCT_PHYSICAL: length = sizeof(struct scsi_read_dvd_struct_data_physical); @@ -4004,13 +3996,7 @@ cdreaddvdstructure(struct cam_periph *pe length = sizeof(struct scsi_read_dvd_struct_data_manufacturer); break; case DVD_STRUCT_CMI: - error = ENODEV; - goto bailout; -#ifdef notyet - length = sizeof(struct scsi_read_dvd_struct_data_copy_manage); - address = dvdstruct->address; -#endif - break; /* NOTREACHED */ + return (ENODEV); case DVD_STRUCT_PROTDISCID: length = sizeof(struct scsi_read_dvd_struct_data_prot_discid); break; @@ -4027,21 +4013,9 @@ cdreaddvdstructure(struct cam_periph *pe length = sizeof(struct scsi_read_dvd_struct_data_spare_area); break; case DVD_STRUCT_RMD_LAST: - error = ENODEV; - goto bailout; -#ifdef notyet - length = sizeof(struct scsi_read_dvd_struct_data_rmd_borderout); - address = dvdstruct->address; -#endif - break; /* NOTREACHED */ + return (ENODEV); case DVD_STRUCT_RMD_RMA: - error = ENODEV; - goto bailout; -#ifdef notyet - length = sizeof(struct scsi_read_dvd_struct_data_rmd); - address = dvdstruct->address; -#endif - break; /* NOTREACHED */ + return (ENODEV); case DVD_STRUCT_PRERECORDED: length = sizeof(struct scsi_read_dvd_struct_data_leadin); break; @@ -4049,13 +4023,7 @@ cdreaddvdstructure(struct cam_periph *pe length = sizeof(struct scsi_read_dvd_struct_data_disc_id); break; case DVD_STRUCT_DCB: - error = ENODEV; - goto bailout; -#ifdef notyet - length = sizeof(struct scsi_read_dvd_struct_data_dcb); - address = dvdstruct->address; -#endif - break; /* NOTREACHED */ + return (ENODEV); case DVD_STRUCT_LIST: /* * This is the maximum allocation length for the READ DVD @@ -4067,9 +4035,7 @@ cdreaddvdstructure(struct cam_periph *pe length = 65535; break; default: - error = EINVAL; - goto bailout; - break; /* NOTREACHED */ + return (EINVAL); } if (length != 0) { @@ -4077,6 +4043,9 @@ cdreaddvdstructure(struct cam_periph *pe } else databuf = NULL; + cam_periph_lock(periph); + ccb = cdgetccb(periph, CAM_PRIORITY_NORMAL); + scsi_read_dvd_structure(&ccb->csio, /* retries */ cd_retry_count, /* cbfcnp */ cddone, @@ -4164,13 +4133,14 @@ cdreaddvdstructure(struct cam_periph *pe min(sizeof(dvdstruct->data), dvdstruct->length)); break; } + bailout: + xpt_release_ccb(ccb); + cam_periph_unlock(periph); if (databuf != NULL) free(databuf, M_DEVBUF); - xpt_release_ccb(ccb); - return(error); } From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 14 00:46:34 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27FC7106564A; Thu, 14 Oct 2010 00:46:34 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 169E48FC18; Thu, 14 Oct 2010 00:46:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9E0kXGh006097; Thu, 14 Oct 2010 00:46:33 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9E0kXd6006095; Thu, 14 Oct 2010 00:46:33 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201010140046.o9E0kXd6006095@svn.freebsd.org> From: Ed Maste Date: Thu, 14 Oct 2010 00:46:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213816 - stable/8/sys/dev/aac X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Oct 2010 00:46:34 -0000 Author: emaste Date: Thu Oct 14 00:46:33 2010 New Revision: 213816 URL: http://svn.freebsd.org/changeset/base/213816 Log: MFC r212594: Avoid repeatedly spamming the console while a timed out command is waiting to complete. Instead, print one message after the timeout period expires, and one more when (if) the command eventually completes. Modified: stable/8/sys/dev/aac/aac.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/aac/aac.c ============================================================================== --- stable/8/sys/dev/aac/aac.c Wed Oct 13 23:31:17 2010 (r213815) +++ stable/8/sys/dev/aac/aac.c Thu Oct 14 00:46:33 2010 (r213816) @@ -1129,6 +1129,11 @@ aac_complete(void *context, int pending) AAC_PRINT_FIB(sc, fib); break; } + if ((cm->cm_flags & AAC_CMD_TIMEDOUT) != 0) + device_printf(sc->aac_dev, + "COMMAND %p COMPLETED AFTER %d SECONDS\n", + cm, (int)(time_uptime-cm->cm_timestamp)); + aac_remove_busy(cm); aac_unmap_command(cm); @@ -2348,7 +2353,7 @@ aac_timeout(struct aac_softc *sc) deadline = time_uptime - AAC_CMD_TIMEOUT; TAILQ_FOREACH(cm, &sc->aac_busy, cm_link) { if ((cm->cm_timestamp < deadline) - /* && !(cm->cm_flags & AAC_CMD_TIMEDOUT) */) { + && !(cm->cm_flags & AAC_CMD_TIMEDOUT)) { cm->cm_flags |= AAC_CMD_TIMEDOUT; device_printf(sc->aac_dev, "COMMAND %p (TYPE %d) TIMEOUT AFTER %d SECONDS\n", From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 14 01:21:45 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B8D0106566C; Thu, 14 Oct 2010 01:21:45 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 071998FC1A; Thu, 14 Oct 2010 01:21:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9E1Lj3Q006866; Thu, 14 Oct 2010 01:21:45 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9E1Li3e006863; Thu, 14 Oct 2010 01:21:44 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201010140121.o9E1Li3e006863@svn.freebsd.org> From: "David E. O'Brien" Date: Thu, 14 Oct 2010 01:21:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213817 - in stable/8: . contrib/top etc/periodic/daily gnu/usr.bin lib/libusb release/picobsd/floppy.tree/sbin sbin/geom/class/sched tools/regression/lib/msun tools/regression/usr.bin/... X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Oct 2010 01:21:45 -0000 Author: obrien Date: Thu Oct 14 01:21:44 2010 New Revision: 213817 URL: http://svn.freebsd.org/changeset/base/213817 Log: MFC r212770 & r212832: + Add the SCRIPT environmental variable to the sub-shell. + Add the 'command' argument (if supplied on the command line) to the typescript file. Modified: stable/8/usr.bin/script/script.1 stable/8/usr.bin/script/script.c Directory Properties: stable/8/ (props changed) stable/8/Makefile (props changed) stable/8/Makefile.inc1 (props changed) stable/8/ObsoleteFiles.inc (props changed) stable/8/UPDATING (props changed) stable/8/bin/ (props changed) stable/8/bin/chio/ (props changed) stable/8/bin/chmod/ (props changed) stable/8/bin/cp/ (props changed) stable/8/bin/csh/ (props changed) stable/8/bin/date/ (props changed) stable/8/bin/expr/ (props changed) stable/8/bin/getfacl/ (props changed) stable/8/bin/kill/ (props changed) stable/8/bin/ln/ (props changed) stable/8/bin/ls/ (props changed) stable/8/bin/mv/ (props changed) stable/8/bin/pax/ (props changed) stable/8/bin/pkill/ (props changed) stable/8/bin/ps/ (props changed) stable/8/bin/pwait/ (props changed) stable/8/bin/setfacl/ (props changed) stable/8/bin/sh/ (props changed) stable/8/bin/sleep/ (props changed) stable/8/bin/test/ (props changed) stable/8/cddl/compat/opensolaris/ (props changed) stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/cddl/lib/libnvpair/ (props changed) stable/8/cddl/lib/libzpool/ (props changed) stable/8/contrib/ (props changed) stable/8/contrib/bind9/ (props changed) stable/8/contrib/binutils/ (props changed) stable/8/contrib/bsnmp/ (props changed) stable/8/contrib/bzip2/ (props changed) stable/8/contrib/com_err/ (props changed) stable/8/contrib/csup/ (props changed) stable/8/contrib/ee/ (props changed) stable/8/contrib/expat/ (props changed) stable/8/contrib/file/ (props changed) stable/8/contrib/gcc/ (props changed) stable/8/contrib/gdb/ (props changed) stable/8/contrib/gdtoa/ (props changed) stable/8/contrib/groff/ (props changed) stable/8/contrib/ipfilter/ (props changed) stable/8/contrib/less/ (props changed) stable/8/contrib/libpcap/ (props changed) stable/8/contrib/ncurses/ (props changed) stable/8/contrib/netcat/ (props changed) stable/8/contrib/ntp/ (props changed) stable/8/contrib/nvi/ (props changed) stable/8/contrib/one-true-awk/ (props changed) stable/8/contrib/openbsm/ (props changed) stable/8/contrib/openpam/ (props changed) stable/8/contrib/pf/ (props changed) stable/8/contrib/sendmail/ (props changed) stable/8/contrib/tcp_wrappers/ (props changed) stable/8/contrib/tcpdump/ (props changed) stable/8/contrib/tcsh/ (props changed) stable/8/contrib/telnet/ (props changed) stable/8/contrib/top/ (props changed) stable/8/contrib/top/install-sh (props changed) stable/8/contrib/traceroute/ (props changed) stable/8/contrib/wpa/ (props changed) stable/8/contrib/xz/ (props changed) stable/8/crypto/heimdal/ (props changed) stable/8/crypto/openssh/ (props changed) stable/8/crypto/openssl/ (props changed) stable/8/etc/ (props changed) stable/8/etc/periodic/daily/ (props changed) stable/8/etc/periodic/daily/800.scrub-zfs (props changed) stable/8/games/factor/ (props changed) stable/8/games/fortune/ (props changed) stable/8/games/grdc/ (props changed) stable/8/games/pom/ (props changed) stable/8/gnu/lib/csu/ (props changed) stable/8/gnu/lib/libstdc++/ (props changed) stable/8/gnu/usr.bin/ (props changed) stable/8/gnu/usr.bin/Makefile (props changed) stable/8/gnu/usr.bin/dialog/ (props changed) stable/8/gnu/usr.bin/gdb/ (props changed) stable/8/gnu/usr.bin/gdb/kgdb/ (props changed) stable/8/gnu/usr.bin/groff/ (props changed) stable/8/gnu/usr.bin/patch/ (props changed) stable/8/include/ (props changed) stable/8/kerberos5/lib/libgssapi_krb5/ (props changed) stable/8/kerberos5/lib/libgssapi_spnego/ (props changed) stable/8/kerberos5/usr.bin/kdestroy/ (props changed) stable/8/kerberos5/usr.bin/kpasswd/ (props changed) stable/8/lib/ (props changed) stable/8/lib/bind/ (props changed) stable/8/lib/csu/ (props changed) stable/8/lib/libarchive/ (props changed) stable/8/lib/libbluetooth/ (props changed) stable/8/lib/libc/ (props changed) stable/8/lib/libc/locale/ (props changed) stable/8/lib/libc/stdtime/ (props changed) stable/8/lib/libc/sys/ (props changed) stable/8/lib/libc_r/ (props changed) stable/8/lib/libcam/ (props changed) stable/8/lib/libcompat/ (props changed) stable/8/lib/libdevinfo/ (props changed) stable/8/lib/libdisk/ (props changed) stable/8/lib/libedit/ (props changed) stable/8/lib/libelf/ (props changed) stable/8/lib/libexpat/ (props changed) stable/8/lib/libfetch/ (props changed) stable/8/lib/libgeom/ (props changed) stable/8/lib/libgpib/ (props changed) stable/8/lib/libgssapi/ (props changed) stable/8/lib/libjail/ (props changed) stable/8/lib/libkse/ (props changed) stable/8/lib/libkvm/ (props changed) stable/8/lib/liblzma/ (props changed) stable/8/lib/libmagic/ (props changed) stable/8/lib/libmemstat/ (props changed) stable/8/lib/libpam/ (props changed) stable/8/lib/libpmc/ (props changed) stable/8/lib/libradius/ (props changed) stable/8/lib/librpcsec_gss/ (props changed) stable/8/lib/libsm/ (props changed) stable/8/lib/libstand/ (props changed) stable/8/lib/libtacplus/ (props changed) stable/8/lib/libthr/ (props changed) stable/8/lib/libufs/ (props changed) stable/8/lib/libugidfw/ (props changed) stable/8/lib/libusb/ (props changed) stable/8/lib/libusb/usb.h (props changed) stable/8/lib/libusbhid/ (props changed) stable/8/lib/libutil/ (props changed) stable/8/lib/libz/ (props changed) stable/8/lib/libz/contrib/ (props changed) stable/8/lib/msun/ (props changed) stable/8/libexec/ (props changed) stable/8/libexec/ftpd/ (props changed) stable/8/libexec/rtld-elf/ (props changed) stable/8/libexec/tftpd/ (props changed) stable/8/release/ (props changed) stable/8/release/doc/en_US.ISO8859-1/hardware/ (props changed) stable/8/release/picobsd/ (props changed) stable/8/release/picobsd/floppy.tree/sbin/ (props changed) stable/8/release/picobsd/floppy.tree/sbin/dhclient-script (props changed) stable/8/release/picobsd/qemu/ (props changed) stable/8/release/picobsd/tinyware/login/ (props changed) stable/8/sbin/ (props changed) stable/8/sbin/atacontrol/ (props changed) stable/8/sbin/bsdlabel/ (props changed) stable/8/sbin/camcontrol/ (props changed) stable/8/sbin/ddb/ (props changed) stable/8/sbin/devd/ (props changed) stable/8/sbin/devfs/ (props changed) stable/8/sbin/dhclient/ (props changed) stable/8/sbin/dump/ (props changed) stable/8/sbin/dumpfs/ (props changed) stable/8/sbin/fsck/ (props changed) stable/8/sbin/fsck_ffs/ (props changed) stable/8/sbin/fsck_msdosfs/ (props changed) stable/8/sbin/fsirand/ (props changed) stable/8/sbin/geom/ (props changed) stable/8/sbin/geom/class/part/ (props changed) stable/8/sbin/geom/class/sched/gsched.8 (props changed) stable/8/sbin/geom/class/stripe/ (props changed) stable/8/sbin/ggate/ (props changed) stable/8/sbin/growfs/ (props changed) stable/8/sbin/hastctl/ (props changed) stable/8/sbin/hastd/ (props changed) stable/8/sbin/ifconfig/ (props changed) stable/8/sbin/ipfw/ (props changed) stable/8/sbin/iscontrol/ (props changed) stable/8/sbin/kldload/ (props changed) stable/8/sbin/kldstat/ (props changed) stable/8/sbin/mdconfig/ (props changed) stable/8/sbin/mksnap_ffs/ (props changed) stable/8/sbin/mount/ (props changed) stable/8/sbin/mount_cd9660/ (props changed) stable/8/sbin/mount_msdosfs/ (props changed) stable/8/sbin/mount_nfs/ (props changed) stable/8/sbin/natd/ (props changed) stable/8/sbin/newfs/ (props changed) stable/8/sbin/newfs_msdos/ (props changed) stable/8/sbin/ping6/ (props changed) stable/8/sbin/reboot/ (props changed) stable/8/sbin/restore/ (props changed) stable/8/sbin/routed/ (props changed) stable/8/sbin/setkey/ (props changed) stable/8/sbin/spppcontrol/ (props changed) stable/8/sbin/sysctl/ (props changed) stable/8/sbin/tunefs/ (props changed) stable/8/sbin/umount/ (props changed) stable/8/secure/ (props changed) stable/8/secure/lib/libcrypto/ (props changed) stable/8/secure/lib/libssl/ (props changed) stable/8/secure/usr.bin/bdes/ (props changed) stable/8/secure/usr.bin/openssl/ (props changed) stable/8/share/dict/ (props changed) stable/8/share/examples/ (props changed) stable/8/share/examples/etc/ (props changed) stable/8/share/examples/kld/syscall/ (props changed) stable/8/share/man/ (props changed) stable/8/share/man/man1/ (props changed) stable/8/share/man/man3/ (props changed) stable/8/share/man/man4/ (props changed) stable/8/share/man/man5/ (props changed) stable/8/share/man/man7/ (props changed) stable/8/share/man/man8/ (props changed) stable/8/share/man/man9/ (props changed) stable/8/share/misc/ (props changed) stable/8/share/mk/ (props changed) stable/8/share/termcap/ (props changed) stable/8/share/timedef/ (props changed) stable/8/share/zoneinfo/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/tools/ (props changed) stable/8/tools/build/mk/ (props changed) stable/8/tools/build/options/ (props changed) stable/8/tools/debugscripts/ (props changed) stable/8/tools/kerneldoc/subsys/ (props changed) stable/8/tools/regression/acltools/ (props changed) stable/8/tools/regression/aio/aiotest/ (props changed) stable/8/tools/regression/bin/sh/ (props changed) stable/8/tools/regression/fifo/ (props changed) stable/8/tools/regression/geom/ (props changed) stable/8/tools/regression/lib/libc/ (props changed) stable/8/tools/regression/lib/msun/test-conj.t (props changed) stable/8/tools/regression/mqueue/mqtest1/ (props changed) stable/8/tools/regression/mqueue/mqtest2/ (props changed) stable/8/tools/regression/mqueue/mqtest3/ (props changed) stable/8/tools/regression/mqueue/mqtest4/ (props changed) stable/8/tools/regression/mqueue/mqtest5/ (props changed) stable/8/tools/regression/poll/ (props changed) stable/8/tools/regression/posixsem/ (props changed) stable/8/tools/regression/priv/ (props changed) stable/8/tools/regression/usr.bin/ (props changed) stable/8/tools/regression/usr.bin/pkill/pgrep-_g.t (props changed) stable/8/tools/regression/usr.bin/pkill/pgrep-_s.t (props changed) stable/8/tools/regression/usr.bin/pkill/pkill-_g.t (props changed) stable/8/tools/regression/usr.bin/sed/ (props changed) stable/8/tools/test/ (props changed) stable/8/tools/tools/ (props changed) stable/8/tools/tools/ath/ (props changed) stable/8/tools/tools/ath/common/dumpregs.h (props changed) stable/8/tools/tools/ath/common/dumpregs_5210.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5211.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5212.c (props changed) stable/8/tools/tools/ath/common/dumpregs_5416.c (props changed) stable/8/tools/tools/nanobsd/ (props changed) stable/8/tools/tools/netrate/tcpp/ (props changed) stable/8/tools/tools/termcap/termcap.pl (props changed) stable/8/tools/tools/umastat/ (props changed) stable/8/tools/tools/vimage/ (props changed) stable/8/usr.bin/ (props changed) stable/8/usr.bin/apply/ (props changed) stable/8/usr.bin/ar/ (props changed) stable/8/usr.bin/awk/ (props changed) stable/8/usr.bin/biff/ (props changed) stable/8/usr.bin/c89/ (props changed) stable/8/usr.bin/c99/ (props changed) stable/8/usr.bin/calendar/ (props changed) stable/8/usr.bin/catman/ (props changed) stable/8/usr.bin/column/ (props changed) stable/8/usr.bin/comm/ (props changed) stable/8/usr.bin/cpio/ (props changed) stable/8/usr.bin/csup/ (props changed) stable/8/usr.bin/du/ (props changed) stable/8/usr.bin/ee/ (props changed) stable/8/usr.bin/enigma/ (props changed) stable/8/usr.bin/fetch/ (props changed) stable/8/usr.bin/find/ (props changed) stable/8/usr.bin/finger/ (props changed) stable/8/usr.bin/fstat/ (props changed) stable/8/usr.bin/gcore/ (props changed) stable/8/usr.bin/getopt/ (props changed) stable/8/usr.bin/gzip/ (props changed) stable/8/usr.bin/hexdump/ (props changed) stable/8/usr.bin/indent/ (props changed) stable/8/usr.bin/jot/ (props changed) stable/8/usr.bin/kdump/ (props changed) stable/8/usr.bin/killall/ (props changed) stable/8/usr.bin/ktrace/ (props changed) stable/8/usr.bin/locale/ (props changed) stable/8/usr.bin/lockf/ (props changed) stable/8/usr.bin/look/ (props changed) stable/8/usr.bin/mail/ (props changed) stable/8/usr.bin/make/ (props changed) stable/8/usr.bin/makewhatis/ (props changed) stable/8/usr.bin/minigzip/ (props changed) stable/8/usr.bin/netstat/ (props changed) stable/8/usr.bin/pathchk/ (props changed) stable/8/usr.bin/perror/ (props changed) stable/8/usr.bin/procstat/ (props changed) stable/8/usr.bin/rpcgen/ (props changed) stable/8/usr.bin/script/ (props changed) stable/8/usr.bin/sed/ (props changed) stable/8/usr.bin/sockstat/ (props changed) stable/8/usr.bin/split/ (props changed) stable/8/usr.bin/stat/ (props changed) stable/8/usr.bin/systat/ (props changed) stable/8/usr.bin/tar/ (props changed) stable/8/usr.bin/tftp/ (props changed) stable/8/usr.bin/touch/ (props changed) stable/8/usr.bin/truss/ (props changed) stable/8/usr.bin/uname/ (props changed) stable/8/usr.bin/unifdef/ (props changed) stable/8/usr.bin/uniq/ (props changed) stable/8/usr.bin/unzip/ (props changed) stable/8/usr.bin/vmstat/ (props changed) stable/8/usr.bin/w/ (props changed) stable/8/usr.bin/whois/ (props changed) stable/8/usr.bin/xinstall/ (props changed) stable/8/usr.bin/xlint/ (props changed) stable/8/usr.sbin/ (props changed) stable/8/usr.sbin/Makefile (props changed) stable/8/usr.sbin/acpi/ (props changed) stable/8/usr.sbin/arp/ (props changed) stable/8/usr.sbin/asf/ (props changed) stable/8/usr.sbin/bluetooth/ (props changed) stable/8/usr.sbin/bluetooth/bthidcontrol/ (props changed) stable/8/usr.sbin/bluetooth/bthidd/ (props changed) stable/8/usr.sbin/boot0cfg/ (props changed) stable/8/usr.sbin/bsnmpd/ (props changed) stable/8/usr.sbin/burncd/ (props changed) stable/8/usr.sbin/cdcontrol/ (props changed) stable/8/usr.sbin/chown/ (props changed) stable/8/usr.sbin/config/ (props changed) stable/8/usr.sbin/cpucontrol/ (props changed) stable/8/usr.sbin/crashinfo/ (props changed) stable/8/usr.sbin/cron/ (props changed) stable/8/usr.sbin/crunch/examples/ (props changed) stable/8/usr.sbin/ctm/ (props changed) stable/8/usr.sbin/cxgbtool/ (props changed) stable/8/usr.sbin/devinfo/ (props changed) stable/8/usr.sbin/diskinfo/ (props changed) stable/8/usr.sbin/dumpcis/cardinfo.h (props changed) stable/8/usr.sbin/dumpcis/cis.h (props changed) stable/8/usr.sbin/faithd/ (props changed) stable/8/usr.sbin/fdcontrol/ (props changed) stable/8/usr.sbin/fdformat/ (props changed) stable/8/usr.sbin/fdread/ (props changed) stable/8/usr.sbin/fdwrite/ (props changed) stable/8/usr.sbin/fifolog/ (props changed) stable/8/usr.sbin/flowctl/ (props changed) stable/8/usr.sbin/freebsd-update/ (props changed) stable/8/usr.sbin/i2c/ (props changed) stable/8/usr.sbin/inetd/ (props changed) stable/8/usr.sbin/iostat/ (props changed) stable/8/usr.sbin/jail/ (props changed) stable/8/usr.sbin/jls/ (props changed) stable/8/usr.sbin/lpr/ (props changed) stable/8/usr.sbin/mailwrapper/ (props changed) stable/8/usr.sbin/makefs/ffs/ffs_bswap.c (props changed) stable/8/usr.sbin/makefs/ffs/ffs_subr.c (props changed) stable/8/usr.sbin/makefs/ffs/ufs_bswap.h (props changed) stable/8/usr.sbin/makefs/getid.c (props changed) stable/8/usr.sbin/mergemaster/ (props changed) stable/8/usr.sbin/mfiutil/mfiutil.8 (props changed) stable/8/usr.sbin/mountd/ (props changed) stable/8/usr.sbin/moused/ (props changed) stable/8/usr.sbin/mptutil/ (props changed) stable/8/usr.sbin/mtest/ (props changed) stable/8/usr.sbin/mtree/ (props changed) stable/8/usr.sbin/named/ (props changed) stable/8/usr.sbin/ndp/ (props changed) stable/8/usr.sbin/newsyslog/ (props changed) stable/8/usr.sbin/nfsdumpstate/ (props changed) stable/8/usr.sbin/ntp/ (props changed) stable/8/usr.sbin/pciconf/ (props changed) stable/8/usr.sbin/periodic/ (props changed) stable/8/usr.sbin/pmcannotate/ (props changed) stable/8/usr.sbin/pmccontrol/ (props changed) stable/8/usr.sbin/pmcstat/ (props changed) stable/8/usr.sbin/powerd/ (props changed) stable/8/usr.sbin/ppp/ (props changed) stable/8/usr.sbin/pppctl/ (props changed) stable/8/usr.sbin/pstat/ (props changed) stable/8/usr.sbin/rpc.lockd/ (props changed) stable/8/usr.sbin/rpc.umntall/ (props changed) stable/8/usr.sbin/rtsold/ (props changed) stable/8/usr.sbin/sade/ (props changed) stable/8/usr.sbin/service/ (props changed) stable/8/usr.sbin/services_mkdb/ (props changed) stable/8/usr.sbin/setfmac/ (props changed) stable/8/usr.sbin/setpmac/ (props changed) stable/8/usr.sbin/smbmsg/ (props changed) stable/8/usr.sbin/sysinstall/ (props changed) stable/8/usr.sbin/syslogd/ (props changed) stable/8/usr.sbin/traceroute/ (props changed) stable/8/usr.sbin/traceroute6/ (props changed) stable/8/usr.sbin/uathload/ (props changed) stable/8/usr.sbin/ugidfw/ (props changed) stable/8/usr.sbin/uhsoctl/ (props changed) stable/8/usr.sbin/usbconfig/ (props changed) stable/8/usr.sbin/vidcontrol/ (props changed) stable/8/usr.sbin/wpa/ (props changed) stable/8/usr.sbin/ypserv/ (props changed) stable/8/usr.sbin/zic/ (props changed) Modified: stable/8/usr.bin/script/script.1 ============================================================================== --- stable/8/usr.bin/script/script.1 Thu Oct 14 00:46:33 2010 (r213816) +++ stable/8/usr.bin/script/script.1 Thu Oct 14 01:21:44 2010 (r213817) @@ -117,6 +117,19 @@ The results are meant to emulate a hardc The following environment variable is utilized by .Nm : .Bl -tag -width SHELL +.It Ev SCRIPT +The +.Ev SCRIPT +environment variable is added to the sub-shell. +If +.Ev SCRIPT +already existed in the users environment, +its value is overwritten within the sub-shell. +The value of +.Ev SCRIPT +is the name of the +.Ar typescript +file. .It Ev SHELL If the variable .Ev SHELL Modified: stable/8/usr.bin/script/script.c ============================================================================== --- stable/8/usr.bin/script/script.c Thu Oct 14 00:46:33 2010 (r213816) +++ stable/8/usr.bin/script/script.c Thu Oct 14 01:21:44 2010 (r213817) @@ -236,14 +236,21 @@ void doshell(char **av) { const char *shell; + int k; shell = getenv("SHELL"); if (shell == NULL) shell = _PATH_BSHELL; + if (av[0]) + for (k = 0 ; av[k] ; ++k) + fprintf(fscript, "%s%s", k ? " " : "", av[k]); + fprintf(fscript, "\r\n"); + (void)close(master); (void)fclose(fscript); login_tty(slave); + setenv("SCRIPT", fname, 1); if (av[0]) { execvp(av[0], av); warn("%s", av[0]); From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 14 02:10:49 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0E78106564A; Thu, 14 Oct 2010 02:10:49 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F3BC8FC1C; Thu, 14 Oct 2010 02:10:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9E2AnjV009198; Thu, 14 Oct 2010 02:10:49 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9E2AnHa009196; Thu, 14 Oct 2010 02:10:49 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201010140210.o9E2AnHa009196@svn.freebsd.org> From: "David E. O'Brien" Date: Thu, 14 Oct 2010 02:10:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213825 - stable/8/usr.bin/ruptime X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Oct 2010 02:10:49 -0000 Author: obrien Date: Thu Oct 14 02:10:49 2010 New Revision: 213825 URL: http://svn.freebsd.org/changeset/base/213825 Log: MFC r212771: Increase the hostname display width to >12 characters. Modified: stable/8/usr.bin/ruptime/ruptime.c Directory Properties: stable/8/usr.bin/ruptime/ (props changed) Modified: stable/8/usr.bin/ruptime/ruptime.c ============================================================================== --- stable/8/usr.bin/ruptime/ruptime.c Thu Oct 14 02:02:55 2010 (r213824) +++ stable/8/usr.bin/ruptime/ruptime.c Thu Oct 14 02:10:49 2010 (r213825) @@ -244,12 +244,12 @@ ruptime(const char *host, int aflg, int for (i = 0; i < (int)nhosts; i++) { hsp = &hs[i]; if (ISDOWN(hsp)) { - (void)printf("%-12.12s%s\n", hsp->hs_wd->wd_hostname, + (void)printf("%-25.25s%s\n", hsp->hs_wd->wd_hostname, interval(now - hsp->hs_wd->wd_recvtime, "down")); continue; } (void)printf( - "%-12.12s%s, %4d user%s load %*.2f, %*.2f, %*.2f\n", + "%-25.25s%s, %4d user%s load %*.2f, %*.2f, %*.2f\n", hsp->hs_wd->wd_hostname, interval((time_t)hsp->hs_wd->wd_sendtime - (time_t)hsp->hs_wd->wd_boottime, " up"), From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 14 03:11:41 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63004106566B; Thu, 14 Oct 2010 03:11:41 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5187A8FC0A; Thu, 14 Oct 2010 03:11:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9E3BfoG010890; Thu, 14 Oct 2010 03:11:41 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9E3BfHg010888; Thu, 14 Oct 2010 03:11:41 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201010140311.o9E3BfHg010888@svn.freebsd.org> From: "David E. O'Brien" Date: Thu, 14 Oct 2010 03:11:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213827 - stable/8/usr.bin/script X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Oct 2010 03:11:41 -0000 Author: obrien Date: Thu Oct 14 03:11:41 2010 New Revision: 213827 URL: http://svn.freebsd.org/changeset/base/213827 Log: MFC r212832: update manpage Modified: stable/8/usr.bin/script/script.1 Directory Properties: stable/8/usr.bin/script/ (props changed) Modified: stable/8/usr.bin/script/script.1 ============================================================================== --- stable/8/usr.bin/script/script.1 Thu Oct 14 02:19:53 2010 (r213826) +++ stable/8/usr.bin/script/script.1 Thu Oct 14 03:11:41 2010 (r213827) @@ -114,7 +114,7 @@ The utility works best with commands that do not manipulate the screen. The results are meant to emulate a hardcopy terminal, not an addressable one. .Sh ENVIRONMENT -The following environment variable is utilized by +The following environment variables are utilized by .Nm : .Bl -tag -width SHELL .It Ev SCRIPT From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 14 09:29:59 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4818106566C; Thu, 14 Oct 2010 09:29:59 +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 A2BFC8FC1E; Thu, 14 Oct 2010 09:29:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9E9TxY6018894; Thu, 14 Oct 2010 09:29:59 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9E9TxcF018892; Thu, 14 Oct 2010 09:29:59 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201010140929.o9E9TxcF018892@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 14 Oct 2010 09:29:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213830 - stable/8/sys/fs/msdosfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Oct 2010 09:29:59 -0000 Author: kib Date: Thu Oct 14 09:29:59 2010 New Revision: 213830 URL: http://svn.freebsd.org/changeset/base/213830 Log: MFC r213508: Explicitely call cache_purge(fvp) when msdosfs_rename() succeeded, to flush aliases created due to msdosfs being case-insensitive. MFC r213543: Add a comment describing the reason for calling cache_purge(fvp). Modified: stable/8/sys/fs/msdosfs/msdosfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfs_vnops.c Thu Oct 14 08:01:33 2010 (r213829) +++ stable/8/sys/fs/msdosfs/msdosfs_vnops.c Thu Oct 14 09:29:59 2010 (r213830) @@ -1270,6 +1270,14 @@ abortit: } } + /* + * The msdosfs lookup is case insensitive. Several aliases may + * be inserted for a single directory entry. As a consequnce, + * name cache purge done by lookup for fvp when DELETE op for + * namei is specified, might be not enough to expunge all + * namecache entries that were installed for this direntry. + */ + cache_purge(fvp); VOP_UNLOCK(fvp, 0); bad: if (xp) From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 14 13:56:26 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B894B1065679; Thu, 14 Oct 2010 13:56:26 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5A488FC18; Thu, 14 Oct 2010 13:56:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9EDuQhW026105; Thu, 14 Oct 2010 13:56:26 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9EDuQwS026103; Thu, 14 Oct 2010 13:56:26 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201010141356.o9EDuQwS026103@svn.freebsd.org> From: Nathan Whitehorn Date: Thu, 14 Oct 2010 13:56:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213833 - stable/8/libexec/rtld-elf/powerpc X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Oct 2010 13:56:26 -0000 Author: nwhitehorn Date: Thu Oct 14 13:56:26 2010 New Revision: 213833 URL: http://svn.freebsd.org/changeset/base/213833 Log: MFC r213406: Fix two subtle problems in PPC32 RTLD. The first is a concurrency issue where long PLT calls in multi-threaded environments could end up with incorrect jmptab values. The second is that, after the addition of extended PLT support, I forgot to update the PLT icache synchronization code to cover the extended PLT instead of just the basic PLT. Modified: stable/8/libexec/rtld-elf/powerpc/reloc.c Directory Properties: stable/8/libexec/rtld-elf/ (props changed) Modified: stable/8/libexec/rtld-elf/powerpc/reloc.c ============================================================================== --- stable/8/libexec/rtld-elf/powerpc/reloc.c Thu Oct 14 12:32:49 2010 (r213832) +++ stable/8/libexec/rtld-elf/powerpc/reloc.c Thu Oct 14 13:56:26 2010 (r213833) @@ -38,6 +38,7 @@ #include #include #include +#include #include #include "debug.h" @@ -485,6 +486,7 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr jmptab = obj->pltgot + JMPTAB_BASE(N); jmptab[reloff] = target; + powerpc_mb(); /* Order jmptab update before next changes */ if (reloff < PLT_EXTENDED_BEGIN) { /* for extended PLT entries, we keep the old code */ @@ -493,7 +495,8 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr /* li r11,reloff */ /* b pltcall # use indirect pltcall routine */ - wherep[0] = 0x39600000 | reloff; + + /* first instruction same as before */ wherep[1] = 0x48000000 | (distance & 0x03fffffc); __syncicache(wherep, 8); } @@ -581,7 +584,7 @@ init_pltgot(Obj_Entry *obj) * Sync the icache for the byte range represented by the * trampoline routines and call slots. */ - __syncicache(pltcall, 72 + N * 8); + __syncicache(obj->pltgot, JMPTAB_BASE(N)*4); } void From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 14 21:16:15 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1BF6A106566C; Thu, 14 Oct 2010 21:16:15 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 09B528FC15; Thu, 14 Oct 2010 21:16:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9ELGEt5037536; Thu, 14 Oct 2010 21:16:14 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9ELGEgX037534; Thu, 14 Oct 2010 21:16:14 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201010142116.o9ELGEgX037534@svn.freebsd.org> From: Edwin Groothuis Date: Thu, 14 Oct 2010 21:16:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213859 - stable/8/usr.bin/calendar/calendars X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Oct 2010 21:16:15 -0000 Author: edwin Date: Thu Oct 14 21:16:14 2010 New Revision: 213859 URL: http://svn.freebsd.org/changeset/base/213859 Log: MFC of r213032 r213033 Fix location and year of the Battle of the Plains of Abraham PR: 150504 Submitted by: Douglas Berry Modified: stable/8/usr.bin/calendar/calendars/calendar.history Directory Properties: stable/8/usr.bin/calendar/ (props changed) Modified: stable/8/usr.bin/calendar/calendars/calendar.history ============================================================================== --- stable/8/usr.bin/calendar/calendars/calendar.history Thu Oct 14 21:14:58 2010 (r213858) +++ stable/8/usr.bin/calendar/calendars/calendar.history Thu Oct 14 21:16:14 2010 (r213859) @@ -303,7 +303,7 @@ 09/12 German paratroopers rescue Mussolini from captivity in Rome, 1943 09/12 Germany annexes Sudetenland, 1938 09/13 58° C (136.4° F) measured at el Azizia, Libya, 1922 -09/13 British defeat the French at Abraham near Quebec City, 1788 +09/13 British defeat the French at the Plains of Abraham, just outside the walls of Quebec City, 1759 09/13 Building of Hadrian's Wall begun, 122 09/13 Chiang Kai-Shek becomes president of China, 1943 09/14 Benjamin Franklin is sent to France as an American minister, 1778 From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 14 21:38:21 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10FAD1065674; Thu, 14 Oct 2010 21:38:21 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F1DE68FC16; Thu, 14 Oct 2010 21:38:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9ELcKTE038606; Thu, 14 Oct 2010 21:38:20 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9ELcK04038601; Thu, 14 Oct 2010 21:38:20 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201010142138.o9ELcK04038601@svn.freebsd.org> From: Edwin Groothuis Date: Thu, 14 Oct 2010 21:38:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213870 - in stable/8/usr.bin/calendar: . calendars X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Oct 2010 21:38:21 -0000 Author: edwin Date: Thu Oct 14 21:38:20 2010 New Revision: 213870 URL: http://svn.freebsd.org/changeset/base/213870 Log: MFC of r211517 r212035 r211517: '\0' -> 0 Fix silly mistake by being overly zeaolous[sp] of applying the style rules. r212035: For calendars which don't match the solar-based Gregorian calendar, be able to specify a year string in an entry. Modified: stable/8/usr.bin/calendar/calendar.1 stable/8/usr.bin/calendar/calendar.h stable/8/usr.bin/calendar/calendars/calendar.judaic stable/8/usr.bin/calendar/parsedata.c Directory Properties: stable/8/usr.bin/calendar/ (props changed) Modified: stable/8/usr.bin/calendar/calendar.1 ============================================================================== --- stable/8/usr.bin/calendar/calendar.1 Thu Oct 14 21:38:06 2010 (r213869) +++ stable/8/usr.bin/calendar/calendar.1 Thu Oct 14 21:38:20 2010 (r213870) @@ -103,6 +103,7 @@ Print lines from today and the next days (forward, future). Ignore weekends when calculating the number of days. .El +.Sh FILE FORMAT .Pp To handle calendars in your national code table you can specify .Dq LANG= @@ -196,6 +197,7 @@ Jun. 15\fB\et\fRJune 15. Thursday\fB\et\fREvery Thursday. June\fB\et\fREvery June 1st. 15 *\fB\et\fR15th of every month. +2010/4/15\fB\et\fR15 April 2010 May Sun+2\fB\et\fRsecond Sunday in May (Muttertag) 04/SunLast\fB\et\fRlast Sunday in April, Modified: stable/8/usr.bin/calendar/calendar.h ============================================================================== --- stable/8/usr.bin/calendar/calendar.h Thu Oct 14 21:38:06 2010 (r213869) +++ stable/8/usr.bin/calendar/calendar.h Thu Oct 14 21:38:20 2010 (r213870) @@ -80,6 +80,7 @@ extern int EastLongitude; #define F_SEPEQUINOX 0x08000 #define F_JUNSOLSTICE 0x10000 #define F_DECSOLSTICE 0x20000 +#define F_YEAR 0x40000 #define STRING_EASTER "Easter" #define STRING_PASKHA "Paskha" Modified: stable/8/usr.bin/calendar/calendars/calendar.judaic ============================================================================== --- stable/8/usr.bin/calendar/calendars/calendar.judaic Thu Oct 14 21:38:06 2010 (r213869) +++ stable/8/usr.bin/calendar/calendars/calendar.judaic Thu Oct 14 21:38:20 2010 (r213870) @@ -13,10 +13,477 @@ #define _calendar_judaic_ /* - * Jewish calendar for the CE year 2007 - * 11 Tevet 5767 - 22 tevet 5768 + * The calendar below has gotten from the port deskutils/hebcal for + * the year of 2010 and for the city of New York. + * This should be updated every year! */ +2010/Jan/16* Rosh Chodesh Sh'vat +2010/Jan/30* Tu B'Shvat +2010/Feb/13* Shabbat Shekalim +2010/Feb/14* Rosh Chodesh Adar +2010/Feb/15* Rosh Chodesh Adar +2010/Feb/25* Ta'anit Esther +2010/Feb/27* Shabbat Zachor +2010/Feb/28* Purim +2010/Mar/1* Shushan Purim +2010/Mar/6* Shabbat Parah +2010/Mar/13* Shabbat HaChodesh +2010/Mar/16* Rosh Chodesh Nisan +2010/Mar/27* Shabbat HaGadol +2010/Mar/29* Ta'anit Bechorot +2010/Mar/29* Erev Pesach +2010/Mar/30* Pesach I +2010/Mar/31* Pesach II +2010/Apr/1* Pesach III (CH''M) +2010/Apr/2* Pesach IV (CH''M) +2010/Apr/3* Pesach V (CH''M) +2010/Apr/4* Pesach VI (CH''M) +2010/Apr/5* Pesach VII +2010/Apr/6* Pesach VIII +2010/Apr/11* Yom HaShoah +2010/Apr/14* Rosh Chodesh Iyyar +2010/Apr/15* Rosh Chodesh Iyyar +2010/Apr/19* Yom HaZikaron +2010/Apr/20* Yom HaAtzma'ut +2010/May/2* Lag B'Omer +2010/May/Dec* Yom Yerushalayim +2010/May/14* Rosh Chodesh Sivan +2010/May/18* Erev Shavuot +2010/May/19* Shavuot I +2010/May/20* Shavuot II +2010/Jun/Dec* Rosh Chodesh Tamuz +2010/Jun/13* Rosh Chodesh Tamuz +2010/Jun/29* Tzom Tammuz +2010/Jul/Dec* Rosh Chodesh Av +2010/Jul/17* Shabbat Hazon +2010/Jul/20* Tish'a B'Av +2010/Jul/24* Shabbat Nachamu +2010/Aug/Oct* Rosh Chodesh Elul +2010/Aug/11* Rosh Chodesh Elul +2010/Sep/8* Erev Rosh Hashana +2010/Sep/9* Rosh Hashana 5771 +2010/Sep/Oct* Rosh Hashana II +2010/Sep/11* Shabbat Shuva +2010/Sep/Dec* Tzom Gedaliah +2010/Sep/17* Erev Yom Kippur +2010/Sep/18* Yom Kippur +2010/Sep/22* Erev Sukkot +2010/Sep/23* Sukkot I +2010/Sep/24* Sukkot II +2010/Sep/25* Sukkot III (CH''M) +2010/Sep/26* Sukkot IV (CH''M) +2010/Sep/27* Sukkot V (CH''M) +2010/Sep/28* Sukkot VI (CH''M) +2010/Sep/29* Sukkot VII (Hoshana Raba) +2010/Sep/30* Shmini Atzeret +2010/Oct/1* Simchat Torah +2010/Oct/8* Rosh Chodesh Cheshvan +2010/Oct/9* Rosh Chodesh Cheshvan +2010/Nov/7* Rosh Chodesh Kislev +2010/Nov/8* Rosh Chodesh Kislev +2010/Dec/1* Chanukah: 1 Candle +2010/Dec/2* Chanukah: 2 Candles +2010/Dec/3* Chanukah: 3 Candles +2010/Dec/4* Chanukah: 4 Candles +2010/Dec/5* Chanukah: 5 Candles +2010/Dec/6* Chanukah: 6 Candles +2010/Dec/7* Rosh Chodesh Tevet +2010/Dec/7* Chanukah: 7 Candles +2010/Dec/8* Rosh Chodesh Tevet +2010/Dec/8* Chanukah: 8 Candles +2010/Dec/9* Chanukah: 8th Day +2010/Dec/16* Asara B'Tevet +2011/1/6* Rosh Chodesh Sh'vat +2011/1/20* Tu B'Shvat +2011/2/4* Rosh Chodesh Adar I +2011/2/5* Rosh Chodesh Adar I +2011/2/18* Purim Katan +2011/3/5* Shabbat Shekalim +2011/3/6* Rosh Chodesh Adar II +2011/3/7* Rosh Chodesh Adar II +2011/3/17* Ta'anit Esther +2011/3/19* Shabbat Zachor +2011/3/20* Purim +2011/3/21* Shushan Purim +2011/3/26* Shabbat Parah +2011/4/2* Shabbat HaChodesh +2011/4/5* Rosh Chodesh Nisan +2011/4/16* Shabbat HaGadol +2011/4/18* Ta'anit Bechorot +2011/4/18* Erev Pesach +2011/4/19* Pesach I +2011/4/20* Pesach II +2011/4/21* Pesach III (CH''M) +2011/4/22* Pesach IV (CH''M) +2011/4/23* Pesach V (CH''M) +2011/4/24* Pesach VI (CH''M) +2011/4/25* Pesach VII +2011/4/26* Pesach VIII +2011/5/1* Yom HaShoah +2011/5/4* Rosh Chodesh Iyyar +2011/5/5* Rosh Chodesh Iyyar +2011/5/9* Yom HaZikaron +2011/5/10* Yom HaAtzma'ut +2011/5/22* Lag B'Omer +2011/6/1* Yom Yerushalayim +2011/6/3* Rosh Chodesh Sivan +2011/6/7* Erev Shavuot +2011/6/8* Shavuot I +2011/6/9* Shavuot II +2011/7/2* Rosh Chodesh Tamuz +2011/7/3* Rosh Chodesh Tamuz +2011/7/19* Tzom Tammuz +2011/8/1* Rosh Chodesh Av +2011/8/6* Shabbat Hazon +2011/8/9* Tish'a B'Av +2011/8/13* Shabbat Nachamu +2011/8/30* Rosh Chodesh Elul +2011/8/31* Rosh Chodesh Elul +2011/9/28* Erev Rosh Hashana +2011/9/29* Rosh Hashana 5772 +2011/9/30* Rosh Hashana II +2011/10/1* Shabbat Shuva +2011/10/2* Tzom Gedaliah +2011/10/7* Erev Yom Kippur +2011/10/8* Yom Kippur +2011/10/12* Erev Sukkot +2011/10/13* Sukkot I +2011/10/14* Sukkot II +2011/10/15* Sukkot III (CH''M) +2011/10/16* Sukkot IV (CH''M) +2011/10/17* Sukkot V (CH''M) +2011/10/18* Sukkot VI (CH''M) +2011/10/19* Sukkot VII (Hoshana Raba) +2011/10/20* Shmini Atzeret +2011/10/21* Simchat Torah +2011/10/28* Rosh Chodesh Cheshvan +2011/10/29* Rosh Chodesh Cheshvan +2011/11/27* Rosh Chodesh Kislev +2011/12/20* Chanukah: 1 Candle +2011/12/21* Chanukah: 2 Candles +2011/12/22* Chanukah: 3 Candles +2011/12/23* Chanukah: 4 Candles +2011/12/24* Chanukah: 5 Candles +2011/12/25* Chanukah: 6 Candles +2011/12/26* Rosh Chodesh Tevet +2011/12/26* Chanukah: 7 Candles +2011/12/27* Rosh Chodesh Tevet +2011/12/27* Chanukah: 8 Candles +2011/12/28* Chanukah: 8th Day +2012/1/5* Asara B'Tevet +2012/1/25* Rosh Chodesh Sh'vat +2012/2/8* Tu B'Shvat +2012/2/18* Shabbat Shekalim +2012/2/23* Rosh Chodesh Adar +2012/2/24* Rosh Chodesh Adar +2012/3/3* Shabbat Zachor +2012/3/7* Ta'anit Esther +2012/3/8* Purim +2012/3/9* Shushan Purim +2012/3/17* Shabbat Parah +2012/3/24* Rosh Chodesh Nisan +2012/3/24* Shabbat HaChodesh +2012/3/31* Shabbat HaGadol +2012/4/5* Ta'anit Bechorot +2012/4/6* Erev Pesach +2012/4/7* Pesach I +2012/4/8* Pesach II +2012/4/9* Pesach III (CH''M) +2012/4/10* Pesach IV (CH''M) +2012/4/11* Pesach V (CH''M) +2012/4/12* Pesach VI (CH''M) +2012/4/13* Pesach VII +2012/4/14* Pesach VIII +2012/4/19* Yom HaShoah +2012/4/22* Rosh Chodesh Iyyar +2012/4/23* Rosh Chodesh Iyyar +2012/4/25* Yom HaZikaron +2012/4/26* Yom HaAtzma'ut +2012/5/10* Lag B'Omer +2012/5/20* Yom Yerushalayim +2012/5/22* Rosh Chodesh Sivan +2012/5/26* Erev Shavuot +2012/5/27* Shavuot I +2012/5/28* Shavuot II +2012/6/20* Rosh Chodesh Tamuz +2012/6/21* Rosh Chodesh Tamuz +2012/7/8* Tzom Tammuz +2012/7/20* Rosh Chodesh Av +2012/7/28* Shabbat Hazon +2012/7/29* Tish'a B'Av +2012/8/4* Shabbat Nachamu +2012/8/18* Rosh Chodesh Elul +2012/8/19* Rosh Chodesh Elul +2012/9/16* Erev Rosh Hashana +2012/9/17* Rosh Hashana 5773 +2012/9/18* Rosh Hashana II +2012/9/19* Tzom Gedaliah +2012/9/22* Shabbat Shuva +2012/9/25* Erev Yom Kippur +2012/9/26* Yom Kippur +2012/9/30* Erev Sukkot +2012/10/1* Sukkot I +2012/10/2* Sukkot II +2012/10/3* Sukkot III (CH''M) +2012/10/4* Sukkot IV (CH''M) +2012/10/5* Sukkot V (CH''M) +2012/10/6* Sukkot VI (CH''M) +2012/10/7* Sukkot VII (Hoshana Raba) +2012/10/8* Shmini Atzeret +2012/10/9* Simchat Torah +2012/10/16* Rosh Chodesh Cheshvan +2012/10/17* Rosh Chodesh Cheshvan +2012/11/15* Rosh Chodesh Kislev +2012/12/8* Chanukah: 1 Candle +2012/12/9* Chanukah: 2 Candles +2012/12/10* Chanukah: 3 Candles +2012/12/11* Chanukah: 4 Candles +2012/12/12* Chanukah: 5 Candles +2012/12/13* Chanukah: 6 Candles +2012/12/14* Rosh Chodesh Tevet +2012/12/14* Chanukah: 7 Candles +2012/12/15* Chanukah: 8 Candles +2012/12/16* Chanukah: 8th Day +2012/12/23* Asara B'Tevet +2013/1/12* Rosh Chodesh Sh'vat +2013/1/26* Tu B'Shvat +2013/2/9* Shabbat Shekalim +2013/2/10* Rosh Chodesh Adar +2013/2/11* Rosh Chodesh Adar +2013/2/21* Ta'anit Esther +2013/2/23* Shabbat Zachor +2013/2/24* Purim +2013/2/25* Shushan Purim +2013/3/2* Shabbat Parah +2013/3/9* Shabbat HaChodesh +2013/3/12* Rosh Chodesh Nisan +2013/3/23* Shabbat HaGadol +2013/3/25* Ta'anit Bechorot +2013/3/25* Erev Pesach +2013/3/26* Pesach I +2013/3/27* Pesach II +2013/3/28* Pesach III (CH''M) +2013/3/29* Pesach IV (CH''M) +2013/3/30* Pesach V (CH''M) +2013/3/31* Pesach VI (CH''M) +2013/4/1* Pesach VII +2013/4/2* Pesach VIII +2013/4/7* Yom HaShoah +2013/4/10* Rosh Chodesh Iyyar +2013/4/11* Rosh Chodesh Iyyar +2013/4/15* Yom HaZikaron +2013/4/16* Yom HaAtzma'ut +2013/4/28* Lag B'Omer +2013/5/8* Yom Yerushalayim +2013/5/10* Rosh Chodesh Sivan +2013/5/14* Erev Shavuot +2013/5/15* Shavuot I +2013/5/16* Shavuot II +2013/6/8* Rosh Chodesh Tamuz +2013/6/9* Rosh Chodesh Tamuz +2013/6/25* Tzom Tammuz +2013/7/8* Rosh Chodesh Av +2013/7/13* Shabbat Hazon +2013/7/16* Tish'a B'Av +2013/7/20* Shabbat Nachamu +2013/8/6* Rosh Chodesh Elul +2013/8/7* Rosh Chodesh Elul +2013/9/4* Erev Rosh Hashana +2013/9/5* Rosh Hashana 5774 +2013/9/6* Rosh Hashana II +2013/9/7* Shabbat Shuva +2013/9/8* Tzom Gedaliah +2013/9/13* Erev Yom Kippur +2013/9/14* Yom Kippur +2013/9/18* Erev Sukkot +2013/9/19* Sukkot I +2013/9/20* Sukkot II +2013/9/21* Sukkot III (CH''M) +2013/9/22* Sukkot IV (CH''M) +2013/9/23* Sukkot V (CH''M) +2013/9/24* Sukkot VI (CH''M) +2013/9/25* Sukkot VII (Hoshana Raba) +2013/9/26* Shmini Atzeret +2013/9/27* Simchat Torah +2013/10/4* Rosh Chodesh Cheshvan +2013/10/5* Rosh Chodesh Cheshvan +2013/11/3* Rosh Chodesh Kislev +2013/11/4* Rosh Chodesh Kislev +2013/11/27* Chanukah: 1 Candle +2013/11/28* Chanukah: 2 Candles +2013/11/29* Chanukah: 3 Candles +2013/11/30* Chanukah: 4 Candles +2013/12/1* Chanukah: 5 Candles +2013/12/2* Chanukah: 6 Candles +2013/12/3* Rosh Chodesh Tevet +2013/12/3* Chanukah: 7 Candles +2013/12/4* Rosh Chodesh Tevet +2013/12/4* Chanukah: 8 Candles +2013/12/5* Chanukah: 8th Day +2013/12/12* Asara B'Tevet +2014/1/2* Rosh Chodesh Sh'vat +2014/1/16* Tu B'Shvat +2014/1/31* Rosh Chodesh Adar I +2014/2/1* Rosh Chodesh Adar I +2014/2/14* Purim Katan +2014/3/1* Shabbat Shekalim +2014/3/2* Rosh Chodesh Adar II +2014/3/3* Rosh Chodesh Adar II +2014/3/13* Ta'anit Esther +2014/3/15* Shabbat Zachor +2014/3/16* Purim +2014/3/17* Shushan Purim +2014/3/22* Shabbat Parah +2014/3/29* Shabbat HaChodesh +2014/4/1* Rosh Chodesh Nisan +2014/4/12* Shabbat HaGadol +2014/4/14* Ta'anit Bechorot +2014/4/14* Erev Pesach +2014/4/15* Pesach I +2014/4/16* Pesach II +2014/4/17* Pesach III (CH''M) +2014/4/18* Pesach IV (CH''M) +2014/4/19* Pesach V (CH''M) +2014/4/20* Pesach VI (CH''M) +2014/4/21* Pesach VII +2014/4/22* Pesach VIII +2014/4/27* Yom HaShoah +2014/4/30* Rosh Chodesh Iyyar +2014/5/1* Rosh Chodesh Iyyar +2014/5/5* Yom HaZikaron +2014/5/6* Yom HaAtzma'ut +2014/5/18* Lag B'Omer +2014/5/28* Yom Yerushalayim +2014/5/30* Rosh Chodesh Sivan +2014/6/3* Erev Shavuot +2014/6/4* Shavuot I +2014/6/5* Shavuot II +2014/6/28* Rosh Chodesh Tamuz +2014/6/29* Rosh Chodesh Tamuz +2014/7/15* Tzom Tammuz +2014/7/28* Rosh Chodesh Av +2014/8/2* Shabbat Hazon +2014/8/5* Tish'a B'Av +2014/8/9* Shabbat Nachamu +2014/8/26* Rosh Chodesh Elul +2014/8/27* Rosh Chodesh Elul +2014/9/24* Erev Rosh Hashana +2014/9/25* Rosh Hashana 5775 +2014/9/26* Rosh Hashana II +2014/9/27* Shabbat Shuva +2014/9/28* Tzom Gedaliah +2014/10/3* Erev Yom Kippur +2014/10/4* Yom Kippur +2014/10/8* Erev Sukkot +2014/10/9* Sukkot I +2014/10/10* Sukkot II +2014/10/11* Sukkot III (CH''M) +2014/10/12* Sukkot IV (CH''M) +2014/10/13* Sukkot V (CH''M) +2014/10/14* Sukkot VI (CH''M) +2014/10/15* Sukkot VII (Hoshana Raba) +2014/10/16* Shmini Atzeret +2014/10/17* Simchat Torah +2014/10/24* Rosh Chodesh Cheshvan +2014/10/25* Rosh Chodesh Cheshvan +2014/11/23* Rosh Chodesh Kislev +2014/12/16* Chanukah: 1 Candle +2014/12/17* Chanukah: 2 Candles +2014/12/18* Chanukah: 3 Candles +2014/12/19* Chanukah: 4 Candles +2014/12/20* Chanukah: 5 Candles +2014/12/21* Chanukah: 6 Candles +2014/12/22* Rosh Chodesh Tevet +2014/12/22* Chanukah: 7 Candles +2014/12/23* Rosh Chodesh Tevet +2014/12/23* Chanukah: 8 Candles +2014/12/24* Chanukah: 8th Day +2015/1/1* Asara B'Tevet +2015/1/21* Rosh Chodesh Sh'vat +2015/2/4* Tu B'Shvat +2015/2/14* Shabbat Shekalim +2015/2/19* Rosh Chodesh Adar +2015/2/20* Rosh Chodesh Adar +2015/2/28* Shabbat Zachor +2015/3/4* Ta'anit Esther +2015/3/5* Purim +2015/3/6* Shushan Purim +2015/3/14* Shabbat Parah +2015/3/21* Rosh Chodesh Nisan +2015/3/21* Shabbat HaChodesh +2015/3/28* Shabbat HaGadol +2015/4/2* Ta'anit Bechorot +2015/4/3* Erev Pesach +2015/4/4* Pesach I +2015/4/5* Pesach II +2015/4/6* Pesach III (CH''M) +2015/4/7* Pesach IV (CH''M) +2015/4/8* Pesach V (CH''M) +2015/4/9* Pesach VI (CH''M) +2015/4/10* Pesach VII +2015/4/11* Pesach VIII +2015/4/16* Yom HaShoah +2015/4/19* Rosh Chodesh Iyyar +2015/4/20* Rosh Chodesh Iyyar +2015/4/22* Yom HaZikaron +2015/4/23* Yom HaAtzma'ut +2015/5/7* Lag B'Omer +2015/5/17* Yom Yerushalayim +2015/5/19* Rosh Chodesh Sivan +2015/5/23* Erev Shavuot +2015/5/24* Shavuot I +2015/5/25* Shavuot II +2015/6/17* Rosh Chodesh Tamuz +2015/6/18* Rosh Chodesh Tamuz +2015/7/5* Tzom Tammuz +2015/7/17* Rosh Chodesh Av +2015/7/25* Shabbat Hazon +2015/7/26* Tish'a B'Av +2015/8/1* Shabbat Nachamu +2015/8/15* Rosh Chodesh Elul +2015/8/16* Rosh Chodesh Elul +2015/9/13* Erev Rosh Hashana +2015/9/14* Rosh Hashana 5776 +2015/9/15* Rosh Hashana II +2015/9/16* Tzom Gedaliah +2015/9/19* Shabbat Shuva +2015/9/22* Erev Yom Kippur +2015/9/23* Yom Kippur +2015/9/27* Erev Sukkot +2015/9/28* Sukkot I +2015/9/29* Sukkot II +2015/9/30* Sukkot III (CH''M) +2015/10/1* Sukkot IV (CH''M) +2015/10/2* Sukkot V (CH''M) +2015/10/3* Sukkot VI (CH''M) +2015/10/4* Sukkot VII (Hoshana Raba) +2015/10/5* Shmini Atzeret +2015/10/6* Simchat Torah +2015/10/13* Rosh Chodesh Cheshvan +2015/10/14* Rosh Chodesh Cheshvan +2015/11/12* Rosh Chodesh Kislev +2015/11/13* Rosh Chodesh Kislev +2015/12/6* Chanukah: 1 Candle +2015/12/7* Chanukah: 2 Candles +2015/12/8* Chanukah: 3 Candles +2015/12/9* Chanukah: 4 Candles +2015/12/10* Chanukah: 5 Candles +2015/12/11* Chanukah: 6 Candles +2015/12/12* Rosh Chodesh Tevet +2015/12/12* Chanukah: 7 Candles +2015/12/13* Rosh Chodesh Tevet +2015/12/13* Chanukah: 8 Candles +2015/12/14* Chanukah: 8th Day +2015/12/22* Asara B'Tevet + +/* + * The calendar data below was for 2007, so it is commented out. + */ + +/* + * Jewish calendar for the CE year 2007 + * 11 Tevet 5767 - 22 tevet 5768 01/06* Parshas Vayechi 01/13* Parshas Shemos @@ -223,5 +690,6 @@ 12/22* Parshas Vayechi 12/29* Parshas Shemos +*/ #endif /* !_calendar_judaic_ */ Modified: stable/8/usr.bin/calendar/parsedata.c ============================================================================== --- stable/8/usr.bin/calendar/parsedata.c Thu Oct 14 21:38:06 2010 (r213869) +++ stable/8/usr.bin/calendar/parsedata.c Thu Oct 14 21:38:20 2010 (r213870) @@ -87,9 +87,9 @@ static int determinestyle(char *date, int *flags, char *month, int *imonth, char *dayofmonth, int *idayofmonth, char *dayofweek, int *idayofweek, char *modifieroffset, - char *modifierindex, char *specialday) + char *modifierindex, char *specialday, char *year, int *iyear) { - char *p, *p1, *p2; + char *p, *p1, *p2, *py; const char *dow, *pmonth; char pold; size_t len, offset; @@ -97,6 +97,8 @@ determinestyle(char *date, int *flags, *flags = F_NONE; *month = '\0'; *imonth = 0; + *year = '\0'; + *iyear = 0; *dayofmonth = '\0'; *idayofmonth = 0; *dayofweek = '\0'; @@ -191,6 +193,22 @@ determinestyle(char *date, int *flags, p2 = p + 1; /* Now p2 points to the next field and p1 to the first field */ + if ((py = strchr(p2, '/')) != NULL) { + /* We have a year in the string. Now this is getting tricky */ + strcpy(year, p1); + *iyear = (int)strtol(year, NULL, 10); + p1 = p2; + p2 = py + 1; + *py = 0; + *flags |= F_YEAR; + } + + /* + printf("p1: %s\n", p1); + printf("p2: %s\n", p2); + printf("year: %s\n", year); + */ + /* Check if there is a month-string in the date */ if ((checkmonth(p1, &len, &offset, &pmonth) != 0) || (checkmonth(p2, &len, &offset, &pmonth) != 0 && (p2 = p1))) { @@ -323,7 +341,8 @@ remember(int *rememberindex, int *y, int static void debug_determinestyle(int dateonly, char *date, int flags, char *month, int imonth, char *dayofmonth, int idayofmonth, char *dayofweek, - int idayofweek, char *modifieroffset, char *modifierindex, char *specialday) + int idayofweek, char *modifieroffset, char *modifierindex, char *specialday, + char *year, int iyear) { if (dateonly != 0) { @@ -336,6 +355,8 @@ debug_determinestyle(int dateonly, char printf("modifieroffset: |%s|\n", modifieroffset); if (modifierindex[0] != '\0') printf("modifierindex: |%s|\n", modifierindex); + if (year[0] != '\0') + printf("year: |%s| (%d)\n", year, iyear); if (month[0] != '\0') printf("month: |%s| (%d)\n", month, imonth); if (dayofmonth[0] != '\0') @@ -371,8 +392,10 @@ parsedaymonth(char *date, int *yearp, in char **edp) { char month[100], dayofmonth[100], dayofweek[100], modifieroffset[100]; + char syear[100]; char modifierindex[100], specialday[100]; - int idayofweek = -1, imonth = -1, idayofmonth = -1, year, remindex; + int idayofweek = -1, imonth = -1, idayofmonth = -1, iyear = -1; + int year, remindex; int d, m, dow, rm, rd, offset; char *ed; int retvalsign = 1; @@ -394,10 +417,10 @@ parsedaymonth(char *date, int *yearp, in if (debug) debug_determinestyle(1, date, *flags, month, imonth, dayofmonth, idayofmonth, dayofweek, idayofweek, - modifieroffset, modifierindex, specialday); + modifieroffset, modifierindex, specialday, syear, iyear); if (determinestyle(date, flags, month, &imonth, dayofmonth, &idayofmonth, dayofweek, &idayofweek, modifieroffset, - modifierindex, specialday) == 0) { + modifierindex, specialday, syear, &iyear) == 0) { if (debug) printf("Failed!\n"); return (0); @@ -406,10 +429,18 @@ parsedaymonth(char *date, int *yearp, in if (debug) debug_determinestyle(0, date, *flags, month, imonth, dayofmonth, idayofmonth, dayofweek, idayofweek, - modifieroffset, modifierindex, specialday); + modifieroffset, modifierindex, specialday, syear, iyear); remindex = 0; for (year = year1; year <= year2; year++) { + + int lflags = *flags; + /* If the year is specified, only do it if it is this year! */ + if ((lflags & F_YEAR) != 0) + if (iyear != year) + continue; + lflags &= ~F_YEAR; + /* Get important dates for this year */ yearinfo = years; while (yearinfo != NULL) { @@ -452,7 +483,7 @@ parsedaymonth(char *date, int *yearp, in } /* Same day every year */ - if (*flags == (F_MONTH | F_DAYOFMONTH)) { + if (lflags == (F_MONTH | F_DAYOFMONTH)) { if (!remember_ymd(year, imonth, idayofmonth)) continue; remember(&remindex, yearp, monthp, dayp, edp, @@ -461,7 +492,7 @@ parsedaymonth(char *date, int *yearp, in } /* XXX Same day every year, but variable */ - if (*flags == (F_MONTH | F_DAYOFMONTH | F_VARIABLE)) { + if (lflags == (F_MONTH | F_DAYOFMONTH | F_VARIABLE)) { if (!remember_ymd(year, imonth, idayofmonth)) continue; remember(&remindex, yearp, monthp, dayp, edp, @@ -470,7 +501,7 @@ parsedaymonth(char *date, int *yearp, in } /* Same day every month */ - if (*flags == (F_ALLMONTH | F_DAYOFMONTH)) { + if (lflags == (F_ALLMONTH | F_DAYOFMONTH)) { for (m = 1; m <= 12; m++) { if (!remember_ymd(year, m, idayofmonth)) continue; @@ -481,7 +512,7 @@ parsedaymonth(char *date, int *yearp, in } /* Every day of a month */ - if (*flags == (F_ALLDAY | F_MONTH)) { + if (lflags == (F_ALLDAY | F_MONTH)) { for (d = 1; d <= yearinfo->mondays[imonth]; d++) { if (!remember_ymd(year, imonth, d)) continue; @@ -492,7 +523,7 @@ parsedaymonth(char *date, int *yearp, in } /* One day of every month */ - if (*flags == (F_ALLMONTH | F_DAYOFWEEK)) { + if (lflags == (F_ALLMONTH | F_DAYOFWEEK)) { for (m = 1; m <= 12; m++) { if (!remember_ymd(year, m, idayofmonth)) continue; @@ -503,7 +534,7 @@ parsedaymonth(char *date, int *yearp, in } /* Every dayofweek of the year */ - if (*flags == (F_DAYOFWEEK | F_VARIABLE)) { + if (lflags == (F_DAYOFWEEK | F_VARIABLE)) { dow = first_dayofweek_of_year(year); d = (idayofweek - dow + 8) % 7; while (d <= 366) { @@ -517,7 +548,7 @@ parsedaymonth(char *date, int *yearp, in } /* A certain dayofweek of a month */ - if (*flags == + if (lflags == (F_MONTH | F_DAYOFWEEK | F_MODIFIERINDEX | F_VARIABLE)) { offset = indextooffset(modifierindex); dow = first_dayofweek_of_month(year, imonth); @@ -553,7 +584,7 @@ parsedaymonth(char *date, int *yearp, in } /* Every dayofweek of the month */ - if (*flags == (F_DAYOFWEEK | F_MONTH | F_VARIABLE)) { + if (lflags == (F_DAYOFWEEK | F_MONTH | F_VARIABLE)) { dow = first_dayofweek_of_month(year, imonth); d = (idayofweek - dow + 8) % 7; while (d <= yearinfo->mondays[imonth]) { @@ -567,10 +598,10 @@ parsedaymonth(char *date, int *yearp, in } /* Easter */ - if ((*flags & ~F_MODIFIEROFFSET) == + if ((lflags & ~F_MODIFIEROFFSET) == (F_SPECIALDAY | F_VARIABLE | F_EASTER)) { offset = 0; - if ((*flags & F_MODIFIEROFFSET) != 0) + if ((lflags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->ieaster + offset, &rm, &rd)) @@ -580,10 +611,10 @@ parsedaymonth(char *date, int *yearp, in } /* Paskha */ - if ((*flags & ~F_MODIFIEROFFSET) == + if ((lflags & ~F_MODIFIEROFFSET) == (F_SPECIALDAY | F_VARIABLE | F_PASKHA)) { offset = 0; - if ((*flags & F_MODIFIEROFFSET) != 0) + if ((lflags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->ipaskha + offset, &rm, &rd)) @@ -593,10 +624,10 @@ parsedaymonth(char *date, int *yearp, in } /* Chinese New Year */ - if ((*flags & ~F_MODIFIEROFFSET) == + if ((lflags & ~F_MODIFIEROFFSET) == (F_SPECIALDAY | F_VARIABLE | F_CNY)) { offset = 0; - if ((*flags & F_MODIFIEROFFSET) != 0) + if ((lflags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->firstcnyday + offset, &rm, &rd)) @@ -606,12 +637,12 @@ parsedaymonth(char *date, int *yearp, in } /* FullMoon */ - if ((*flags & ~F_MODIFIEROFFSET) == + if ((lflags & ~F_MODIFIEROFFSET) == (F_SPECIALDAY | F_VARIABLE | F_FULLMOON)) { int i; offset = 0; - if ((*flags & F_MODIFIEROFFSET) != 0) + if ((lflags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); for (i = 0; yearinfo->ffullmoon[i] > 0; i++) { if (remember_yd(year, @@ -628,12 +659,12 @@ parsedaymonth(char *date, int *yearp, in } /* NewMoon */ - if ((*flags & ~F_MODIFIEROFFSET) == + if ((lflags & ~F_MODIFIEROFFSET) == (F_SPECIALDAY | F_VARIABLE | F_NEWMOON)) { int i; offset = 0; - if ((*flags & F_MODIFIEROFFSET) != 0) + if ((lflags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); for (i = 0; yearinfo->ffullmoon[i] > 0; i++) { if (remember_yd(year, @@ -649,10 +680,10 @@ parsedaymonth(char *date, int *yearp, in } /* (Mar|Sep)Equinox */ - if ((*flags & ~F_MODIFIEROFFSET) == + if ((lflags & ~F_MODIFIEROFFSET) == (F_SPECIALDAY | F_VARIABLE | F_MAREQUINOX)) { offset = 0; - if ((*flags & F_MODIFIEROFFSET) != 0) + if ((lflags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->equinoxdays[0] + offset, &rm, &rd)) { @@ -662,10 +693,10 @@ parsedaymonth(char *date, int *yearp, in } continue; } - if ((*flags & ~F_MODIFIEROFFSET) == + if ((lflags & ~F_MODIFIEROFFSET) == (F_SPECIALDAY | F_VARIABLE | F_SEPEQUINOX)) { offset = 0; - if ((*flags & F_MODIFIEROFFSET) != 0) + if ((lflags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->equinoxdays[1] + offset, &rm, &rd)) { @@ -677,10 +708,10 @@ parsedaymonth(char *date, int *yearp, in } /* (Jun|Dec)Solstice */ - if ((*flags & ~F_MODIFIEROFFSET) == + if ((lflags & ~F_MODIFIEROFFSET) == (F_SPECIALDAY | F_VARIABLE | F_JUNSOLSTICE)) { offset = 0; - if ((*flags & F_MODIFIEROFFSET) != 0) + if ((lflags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->solsticedays[0] + offset, &rm, &rd)) { @@ -690,10 +721,10 @@ parsedaymonth(char *date, int *yearp, in } continue; } - if ((*flags & ~F_MODIFIEROFFSET) == + if ((lflags & ~F_MODIFIEROFFSET) == (F_SPECIALDAY | F_VARIABLE | F_DECSOLSTICE)) { offset = 0; - if ((*flags & F_MODIFIEROFFSET) != 0) + if ((lflags & F_MODIFIEROFFSET) != 0) offset = parseoffset(modifieroffset); if (remember_yd(year, yearinfo->solsticedays[1] + offset, &rm, &rd)) { @@ -705,9 +736,9 @@ parsedaymonth(char *date, int *yearp, in } printf("Unprocessed:\n"); - debug_determinestyle(2, date, *flags, month, imonth, + debug_determinestyle(2, date, lflags, month, imonth, dayofmonth, idayofmonth, dayofweek, idayofweek, - modifieroffset, modifierindex, specialday); + modifieroffset, modifierindex, specialday, syear, iyear); retvalsign = -1; } @@ -723,6 +754,8 @@ showflags(int flags) static char s[1000]; s[0] = '\0'; + if ((flags & F_YEAR) != 0) + strcat(s, "year "); if ((flags & F_MONTH) != 0) strcat(s, "month "); if ((flags & F_DAYOFWEEK) != 0) From owner-svn-src-stable-8@FreeBSD.ORG Thu Oct 14 21:58:52 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2697F1065672; Thu, 14 Oct 2010 21:58:52 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 140EE8FC18; Thu, 14 Oct 2010 21:58:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9ELwpMl039299; Thu, 14 Oct 2010 21:58:51 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9ELwpaW039296; Thu, 14 Oct 2010 21:58:51 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201010142158.o9ELwpaW039296@svn.freebsd.org> From: Edwin Groothuis Date: Thu, 14 Oct 2010 21:58:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213877 - in stable/8/usr.bin/calendar: . calendars X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Oct 2010 21:58:52 -0000 Author: edwin Date: Thu Oct 14 21:58:51 2010 New Revision: 213877 URL: http://svn.freebsd.org/changeset/base/213877 Log: MFC of r213875 Update manual with regarding to the status of calendars/calendar.judaic. Modified: stable/8/usr.bin/calendar/calendar.1 stable/8/usr.bin/calendar/calendars/calendar.judaic Directory Properties: stable/8/usr.bin/calendar/ (props changed) Modified: stable/8/usr.bin/calendar/calendar.1 ============================================================================== --- stable/8/usr.bin/calendar/calendar.1 Thu Oct 14 21:53:42 2010 (r213876) +++ stable/8/usr.bin/calendar/calendar.1 Thu Oct 14 21:58:51 2010 (r213877) @@ -257,8 +257,8 @@ Other holidays, including the not-well-k obscure. .It Pa calendar.judaic Jewish holidays. -This calendar should be updated yearly by the local system administrator -so that roving holidays are set correctly for the current year. +The entries for this calendar have been obtained from the port +deskutils/hebcal. .It Pa calendar.music Musical events, births, and deaths. Strongly oriented toward rock 'n' roll. Modified: stable/8/usr.bin/calendar/calendars/calendar.judaic ============================================================================== --- stable/8/usr.bin/calendar/calendars/calendar.judaic Thu Oct 14 21:53:42 2010 (r213876) +++ stable/8/usr.bin/calendar/calendars/calendar.judaic Thu Oct 14 21:58:51 2010 (r213877) @@ -13,9 +13,8 @@ #define _calendar_judaic_ /* - * The calendar below has gotten from the port deskutils/hebcal for - * the year of 2010 and for the city of New York. - * This should be updated every year! + * The calendar below has been obtained from the port deskutils/hebcal + * for the year of 2010 to 2015 and for the city of New York. */ 2010/Jan/16* Rosh Chodesh Sh'vat From owner-svn-src-stable-8@FreeBSD.ORG Fri Oct 15 02:58:50 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F272A106564A; Fri, 15 Oct 2010 02:58:49 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E03798FC08; Fri, 15 Oct 2010 02:58:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9F2wnsB046343; Fri, 15 Oct 2010 02:58:49 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9F2wnpS046341; Fri, 15 Oct 2010 02:58:49 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201010150258.o9F2wnpS046341@svn.freebsd.org> From: Alan Cox Date: Fri, 15 Oct 2010 02:58:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213886 - stable/8/sys/vm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Oct 2010 02:58:50 -0000 Author: alc Date: Fri Oct 15 02:58:49 2010 New Revision: 213886 URL: http://svn.freebsd.org/changeset/base/213886 Log: MFC r212873 Allow a POSIX shared memory object that is opened for read but not for write to nonetheless be mapped PROT_WRITE and MAP_PRIVATE, i.e., copy-on-write. PR: 150260 Modified: stable/8/sys/vm/vm_mmap.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/vm/vm_mmap.c ============================================================================== --- stable/8/sys/vm/vm_mmap.c Thu Oct 14 23:38:37 2010 (r213885) +++ stable/8/sys/vm/vm_mmap.c Fri Oct 15 02:58:49 2010 (r213886) @@ -1316,7 +1316,8 @@ vm_mmap_shm(struct thread *td, vm_size_t { int error; - if ((*maxprotp & VM_PROT_WRITE) == 0 && + if ((*flagsp & MAP_SHARED) != 0 && + (*maxprotp & VM_PROT_WRITE) == 0 && (prot & PROT_WRITE) != 0) return (EACCES); #ifdef MAC From owner-svn-src-stable-8@FreeBSD.ORG Fri Oct 15 03:23:53 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EFE73106564A; Fri, 15 Oct 2010 03:23:53 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD1968FC14; Fri, 15 Oct 2010 03:23:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9F3NrJG047292; Fri, 15 Oct 2010 03:23:53 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9F3Nrlf047288; Fri, 15 Oct 2010 03:23:53 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201010150323.o9F3Nrlf047288@svn.freebsd.org> From: Alan Cox Date: Fri, 15 Oct 2010 03:23:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213887 - in stable/8/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Oct 2010 03:23:54 -0000 Author: alc Date: Fri Oct 15 03:23:53 2010 New Revision: 213887 URL: http://svn.freebsd.org/changeset/base/213887 Log: MFC r209789 Correctly maintain the per-cpu field "curpmap" on amd64 just like we do on i386. The consequences of not doing so on amd64 became apparent with the introduction of the COUNT_IPIS and COUNT_XINVLTLB_HITS options. Specifically, single-threaded applications were generating unnecessary IPIs to shoot-down the TLB on other processors. MFC r209887 Reduce the number of global TLB shootdowns generated by pmap_qenter(). Specifically, teach pmap_qenter() to recognize the case when it is being asked to replace a mapping with the very same mapping and not generate a shootdown. Modified: stable/8/sys/amd64/amd64/cpu_switch.S stable/8/sys/amd64/amd64/pmap.c stable/8/sys/i386/i386/pmap.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/amd64/amd64/cpu_switch.S ============================================================================== --- stable/8/sys/amd64/amd64/cpu_switch.S Fri Oct 15 02:58:49 2010 (r213886) +++ stable/8/sys/amd64/amd64/cpu_switch.S Fri Oct 15 03:23:53 2010 (r213887) @@ -69,16 +69,13 @@ * %rsi = newtd */ ENTRY(cpu_throw) + movl PCPU(CPUID),%eax testq %rdi,%rdi - jnz 1f - movq PCPU(IDLETHREAD),%rdi -1: - movq TD_PCB(%rdi),%r8 /* Old pcb */ - movl PCPU(CPUID), %eax + jz 1f /* release bit from old pm_active */ - movq TD_PROC(%rdi), %rdx /* oldtd->td_proc */ - movq P_VMSPACE(%rdx), %rdx /* proc->p_vmspace */ - LK btrl %eax, VM_PMAP+PM_ACTIVE(%rdx) /* clear old */ + movq PCPU(CURPMAP),%rdx + LK btrl %eax,PM_ACTIVE(%rdx) /* clear old */ +1: movq TD_PCB(%rsi),%r8 /* newtd->td_proc */ movq PCB_CR3(%r8),%rdx movq %rdx,%cr3 /* new address space */ @@ -140,15 +137,16 @@ swinact: movq %rcx,%cr3 /* new address space */ movl PCPU(CPUID), %eax /* Release bit from old pmap->pm_active */ - movq TD_PROC(%rdi), %rcx /* oldproc */ - movq P_VMSPACE(%rcx), %rcx - LK btrl %eax, VM_PMAP+PM_ACTIVE(%rcx) /* clear old */ + movq PCPU(CURPMAP),%rcx + LK btrl %eax,PM_ACTIVE(%rcx) /* clear old */ SETLK %rdx, TD_LOCK(%rdi) /* Release the old thread */ swact: /* Set bit in new pmap->pm_active */ movq TD_PROC(%rsi),%rdx /* newproc */ movq P_VMSPACE(%rdx), %rdx - LK btsl %eax, VM_PMAP+PM_ACTIVE(%rdx) /* set new */ + addq $VM_PMAP,%rdx + LK btsl %eax,PM_ACTIVE(%rdx) /* set new */ + movq %rdx,PCPU(CURPMAP) sw1: #if defined(SCHED_ULE) && defined(SMP) Modified: stable/8/sys/amd64/amd64/pmap.c ============================================================================== --- stable/8/sys/amd64/amd64/pmap.c Fri Oct 15 02:58:49 2010 (r213886) +++ stable/8/sys/amd64/amd64/pmap.c Fri Oct 15 03:23:53 2010 (r213887) @@ -1258,19 +1258,22 @@ pmap_map(vm_offset_t *virt, vm_paddr_t s void pmap_qenter(vm_offset_t sva, vm_page_t *ma, int count) { - pt_entry_t *endpte, oldpte, *pte; + pt_entry_t *endpte, oldpte, pa, *pte; + vm_page_t m; oldpte = 0; pte = vtopte(sva); endpte = pte + count; while (pte < endpte) { - oldpte |= *pte; - pte_store(pte, VM_PAGE_TO_PHYS(*ma) | PG_G | - pmap_cache_bits((*ma)->md.pat_mode, 0) | PG_RW | PG_V); + m = *ma++; + pa = VM_PAGE_TO_PHYS(m) | pmap_cache_bits(m->md.pat_mode, 0); + if ((*pte & (PG_FRAME | PG_PTE_CACHE)) != pa) { + oldpte |= *pte; + pte_store(pte, pa | PG_G | PG_RW | PG_V); + } pte++; - ma++; } - if ((oldpte & PG_V) != 0) + if (__predict_false((oldpte & PG_V) != 0)) pmap_invalidate_range(kernel_pmap, sva, sva + count * PAGE_SIZE); } @@ -1500,6 +1503,7 @@ pmap_pinit0(pmap_t pmap) pmap->pm_pml4 = (pml4_entry_t *)PHYS_TO_DMAP(KPML4phys); pmap->pm_root = NULL; pmap->pm_active = 0; + PCPU_SET(curpmap, pmap); TAILQ_INIT(&pmap->pm_pvchunk); bzero(&pmap->pm_stats, sizeof pmap->pm_stats); } @@ -4873,6 +4877,7 @@ if (oldpmap) /* XXX FIXME */ cr3 = DMAP_TO_PHYS((vm_offset_t)pmap->pm_pml4); td->td_pcb->pcb_cr3 = cr3; load_cr3(cr3); + PCPU_SET(curpmap, pmap); critical_exit(); } Modified: stable/8/sys/i386/i386/pmap.c ============================================================================== --- stable/8/sys/i386/i386/pmap.c Fri Oct 15 02:58:49 2010 (r213886) +++ stable/8/sys/i386/i386/pmap.c Fri Oct 15 03:23:53 2010 (r213887) @@ -1440,19 +1440,22 @@ pmap_map(vm_offset_t *virt, vm_paddr_t s void pmap_qenter(vm_offset_t sva, vm_page_t *ma, int count) { - pt_entry_t *endpte, oldpte, *pte; + pt_entry_t *endpte, oldpte, pa, *pte; + vm_page_t m; oldpte = 0; pte = vtopte(sva); endpte = pte + count; while (pte < endpte) { - oldpte |= *pte; - pte_store(pte, VM_PAGE_TO_PHYS(*ma) | pgeflag | - pmap_cache_bits((*ma)->md.pat_mode, 0) | PG_RW | PG_V); + m = *ma++; + pa = VM_PAGE_TO_PHYS(m) | pmap_cache_bits(m->md.pat_mode, 0); + if ((*pte & (PG_FRAME | PG_PTE_CACHE)) != pa) { + oldpte |= *pte; + pte_store(pte, pa | pgeflag | PG_RW | PG_V); + } pte++; - ma++; } - if ((oldpte & PG_V) != 0) + if (__predict_false((oldpte & PG_V) != 0)) pmap_invalidate_range(kernel_pmap, sva, sva + count * PAGE_SIZE); } From owner-svn-src-stable-8@FreeBSD.ORG Fri Oct 15 04:02:07 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B662E106566B; Fri, 15 Oct 2010 04:02:07 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89D548FC08; Fri, 15 Oct 2010 04:02:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9F427wr048235; Fri, 15 Oct 2010 04:02:07 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9F427vT048233; Fri, 15 Oct 2010 04:02:07 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201010150402.o9F427vT048233@svn.freebsd.org> From: Alan Cox Date: Fri, 15 Oct 2010 04:02:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213888 - stable/8/sys/amd64/amd64 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Oct 2010 04:02:07 -0000 Author: alc Date: Fri Oct 15 04:02:07 2010 New Revision: 213888 URL: http://svn.freebsd.org/changeset/base/213888 Log: MFC r210124 Optimize pmap_remove()'s handling of PG_G mappings. Modified: stable/8/sys/amd64/amd64/pmap.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/amd64/amd64/pmap.c ============================================================================== --- stable/8/sys/amd64/amd64/pmap.c Fri Oct 15 03:23:53 2010 (r213887) +++ stable/8/sys/amd64/amd64/pmap.c Fri Oct 15 04:02:07 2010 (r213888) @@ -2530,12 +2530,6 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t oldpte = pte_load_clear(ptq); if (oldpte & PG_W) pmap->pm_stats.wired_count -= 1; - /* - * Machines that don't support invlpg, also don't support - * PG_G. - */ - if (oldpte & PG_G) - pmap_invalidate_page(kernel_pmap, va); pmap->pm_stats.resident_count -= 1; if (oldpte & PG_MANAGED) { m = PHYS_TO_VM_PAGE(oldpte & PG_FRAME); @@ -2575,7 +2569,7 @@ pmap_remove_page(pmap_t pmap, vm_offset_ void pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { - vm_offset_t va_next; + vm_offset_t va, va_next; pml4_entry_t *pml4e; pdp_entry_t *pdpe; pd_entry_t ptpaddr, *pde; @@ -2676,20 +2670,27 @@ pmap_remove(pmap_t pmap, vm_offset_t sva if (va_next > eva) va_next = eva; + va = va_next; for (pte = pmap_pde_to_pte(pde, sva); sva != va_next; pte++, sva += PAGE_SIZE) { - if (*pte == 0) + if (*pte == 0) { + if (va != va_next) { + pmap_invalidate_range(pmap, va, sva); + va = va_next; + } continue; - - /* - * The TLB entry for a PG_G mapping is invalidated - * by pmap_remove_pte(). - */ + } if ((*pte & PG_G) == 0) anyvalid = 1; - if (pmap_remove_pte(pmap, pte, sva, ptpaddr, &free)) + else if (va == va_next) + va = sva; + if (pmap_remove_pte(pmap, pte, sva, ptpaddr, &free)) { + sva += PAGE_SIZE; break; + } } + if (va != va_next) + pmap_invalidate_range(pmap, va, sva); } out: if (anyvalid) From owner-svn-src-stable-8@FreeBSD.ORG Fri Oct 15 05:17:48 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7988E1065670; Fri, 15 Oct 2010 05:17:48 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 65A3B8FC08; Fri, 15 Oct 2010 05:17:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9F5HmKO049979; Fri, 15 Oct 2010 05:17:48 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9F5Hmo4049975; Fri, 15 Oct 2010 05:17:48 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <201010150517.o9F5Hmo4049975@svn.freebsd.org> From: Edwin Groothuis Date: Fri, 15 Oct 2010 05:17:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213889 - stable/8/usr.bin/ncal X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Oct 2010 05:17:48 -0000 Author: edwin Date: Fri Oct 15 05:17:48 2010 New Revision: 213889 URL: http://svn.freebsd.org/changeset/base/213889 Log: MFC of r204697 r204706 r204849 r204908 r205071 r205427 r212032 r212032: Use basename(3) to determine the name of the program. Submitted by: Alexander Best r205427: Replace -b with -C and -B (as proposed by Alexander). Add -3, -A and -B to the usage. Update regression test for the new parameters. r205071: - With the introduction of -A, -B and -3, not all combinations of arguments makes sense anymore. For example, what would a combination of -3 (show three months) and -y (show the whole year) do? We will abort on these cases. - Move the debug option -d to -H (from highlight), while -d is now used for setting the day of "today" so that -y and friends can be tested. r204908: - Fix the highlighting for non-terminals when the last week is not 7 days long. - "-m " now prints only the month, not the whole year. r204849: - document the -3, -A and -B properly in Synopsis. - add highlight of current date for non-terminals. - fix -J option. - code cleanup. r204706: Remove no-op of WARNS?= Submitted by: Ulrich Sp??rlein r204697: - Implement -3 option (show previous, this and next month) option. - Add -A option (months after this month). - Add -B option (months before this month). - Fix highlighting of today in year overview. - Fix aligning of "foreign" characters. Modified: stable/8/usr.bin/ncal/Makefile stable/8/usr.bin/ncal/ncal.1 stable/8/usr.bin/ncal/ncal.c Directory Properties: stable/8/usr.bin/ncal/ (props changed) Modified: stable/8/usr.bin/ncal/Makefile ============================================================================== --- stable/8/usr.bin/ncal/Makefile Fri Oct 15 04:02:07 2010 (r213888) +++ stable/8/usr.bin/ncal/Makefile Fri Oct 15 05:17:48 2010 (r213889) @@ -4,7 +4,6 @@ PROG= ncal DPADD= ${LIBCALENDAR} ${LIBTERMCAP} LDADD= -lcalendar -ltermcap -WARNS?= 1 LINKS= ${BINDIR}/ncal ${BINDIR}/cal MLINKS= ncal.1 cal.1 Modified: stable/8/usr.bin/ncal/ncal.1 ============================================================================== --- stable/8/usr.bin/ncal/ncal.1 Fri Oct 15 04:02:07 2010 (r213888) +++ stable/8/usr.bin/ncal/ncal.1 Fri Oct 15 05:17:48 2010 (r213889) @@ -33,25 +33,37 @@ .Nd displays a calendar and the date of Easter .Sh SYNOPSIS .Nm -.Op Fl hjy +.Op Fl 3hjy +.Op Fl A Ar number +.Op Fl B Ar number .Oo .Op Ar month .Ar year .Oc .Nm -.Op Fl hj +.Op Fl 3hj +.Op Fl A Ar number +.Op Fl B Ar number .Fl m Ar month .Op Ar year .Nm ncal -.Op Fl hjJpwy +.Op Fl 3hjJpwy +.Op Fl A Ar number +.Op Fl B Ar number .Op Fl s Ar country_code .Oo .Op Ar month .Ar year .Oc .Nm ncal -.Op Fl hJeo +.Op Fl 3hJeo +.Op Fl A Ar number +.Op Fl B Ar number .Op Ar year +.Nm ncal +.Op Fl CN +.Op Fl H Ar yyyy-mm-dd +.Op Fl d Ar yyyy-mm .Sh DESCRIPTION The .Nm @@ -109,6 +121,32 @@ Britain and her colonies switched to the Print the number of the week below each week column. .It Fl y Display a calendar for the specified year. +.It Fl 3 +Display the previous, current and next month surrounding today. +.It Fl A Ar number +Display the +.Ar number +of months after the current month. +.It Fl B Ar number +Display the +.Ar number +of months before the current month. +.It Fl C +Switch to +.Nm cal +mode. +.It Fl N +Switch to +.Nm ncal +mode. +.It Fl d Ar yyyy-mm +Use +.Ar yyyy-mm +as the current date (for debugging of date selection). +.It Fl H Ar yyyy-mm-dd +Use +.Ar yyyy-mm-dd +as the current date (for debugging of highlighting). .El .Pp A single parameter specifies the year (1\(en9999) to be displayed; @@ -116,12 +154,21 @@ note the year must be fully specified: .Dq Li cal 89 will .Em not -display a calendar for 1989. -Two parameters denote the month and year; the month is either a number between -1 and 12, or a full or abbreviated name as specified by the current locale. -Month and year default to those of the current system clock and time zone (so +display a calendar for 1989. Two parameters denote the month and +year; the month is either a number between 1 and 12, or a full or +abbreviated name as specified by the current locale. Month and +year default to those of the current system clock and time zone (so .Dq Li cal -m 8 -will display a calendar for the month of August in the current year). +will display a calendar for the month of August in the current +year). +.Pp +Not all options can be used together. For example +.Dq Li -3 -A 2 -B 3 -y -m 7 +would mean: +show me the three months around the seventh month, three before +that, two after that and the whole year. +.Nm ncal +will warn about these combinations. .Pp A year starts on January 1. .Sh SEE ALSO @@ -142,5 +189,8 @@ The command and manual were written by .An Wolfgang Helbig Aq helbig@FreeBSD.org . .Sh BUGS -The assignment of Julian\(enGregorian switching dates to -country codes is historically naive for many countries. +The assignment of Julian\(enGregorian switching dates to country +codes is historically naive for many countries. +.Pp +Not all options are compatible and using them in different orders +will give varying results. Modified: stable/8/usr.bin/ncal/ncal.c ============================================================================== --- stable/8/usr.bin/ncal/ncal.c Fri Oct 15 04:02:07 2010 (r213888) +++ stable/8/usr.bin/ncal/ncal.c Fri Oct 15 05:17:48 2010 (r213889) @@ -33,6 +33,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -45,12 +46,12 @@ static const char rcsid[] = #include #undef lines /* term.h defines this */ -/* Width of one month with backward compatibility */ +/* Width of one month with backward compatibility and in regular mode*/ #define MONTH_WIDTH_B_J 27 #define MONTH_WIDTH_B 20 -#define MONTH_WIDTH_J 24 -#define MONTH_WIDTH 18 +#define MONTH_WIDTH_R_J 24 +#define MONTH_WIDTH_R 18 #define MAX_WIDTH 64 @@ -60,6 +61,7 @@ struct monthlines { wchar_t name[MAX_WIDTH + 1]; char lines[7][MAX_WIDTH + 1]; char weeks[MAX_WIDTH + 1]; + unsigned int extralen[7]; }; struct weekdays { @@ -158,31 +160,29 @@ char jdaystr[] = " 1 2 3 4 " 350 351 352 353 354 355 356 357 358 359" " 360 361 362 363 364 365 366"; +int flag_nohighlight; /* user doesn't want a highlighted today */ int flag_weeks; /* user wants number of week */ int nswitch; /* user defined switch date */ int nswitchb; /* switch date for backward compatibility */ -const char *term_so, *term_se; -int today; +int highlightdate; -char *center(char *s, char *t, int w); +char *center(char *s, char *t, int w); wchar_t *wcenter(wchar_t *s, wchar_t *t, int w); -void mkmonth(int year, int month, int jd_flag, struct monthlines * monthl); -void mkmonthb(int year, int month, int jd_flag, struct monthlines * monthl); -void mkweekdays(struct weekdays * wds); -int parsemonth(const char *s, int *m, int *y); -void printcc(void); -void printeaster(int year, int julian, int orthodox); -void printmonth(int year, int month, int jd_flag); -void printmonthb(int year, int month, int jd_flag); -void printyear(int year, int jd_flag); -void printyearb(int year, int jd_flag); int firstday(int y, int m); -date *sdate(int ndays, struct date * d); -date *sdateb(int ndays, struct date * d); -int sndays(struct date * d); -int sndaysb(struct date * d); -static void usage(void); -int weekdayb(int nd); +void highlight(char *dst, char *src, int len, int *extraletters); +void mkmonthr(int year, int month, int jd_flag, struct monthlines * monthl); +void mkmonthb(int year, int month, int jd_flag, struct monthlines * monthl); +void mkweekdays(struct weekdays * wds); +void monthranger(int year, int m, int jd_flag, int before, int after); +void monthrangeb(int year, int m, int jd_flag, int before, int after); +int parsemonth(const char *s, int *m, int *y); +void printcc(void); +void printeaster(int year, int julian, int orthodox); +date *sdater(int ndays, struct date * d); +date *sdateb(int ndays, struct date * d); +int sndaysr(struct date * d); +int sndaysb(struct date * d); +static void usage(void); int main(int argc, char *argv[]) @@ -190,39 +190,31 @@ main(int argc, char *argv[]) struct djswitch *p, *q; /* to search user defined switch date */ date never = {10000, 1, 1}; /* outside valid range of dates */ date ukswitch = {1752, 9, 2};/* switch date for Great Britain */ + date dt; int ch; /* holds the option character */ int m = 0; /* month */ int y = 0; /* year */ int flag_backward = 0; /* user called cal--backward compat. */ - int flag_hole_year = 0; /* user wants the whole year */ + int flag_wholeyear = 0; /* user wants the whole year */ int flag_julian_cal = 0; /* user wants Julian Calendar */ - int flag_julian_day = 0; /* user wants the Julian day - * numbers */ - int flag_orthodox = 0; /* use wants Orthodox easter */ - int flag_easter = 0; /* use wants easter date */ + int flag_julian_day = 0; /* user wants the Julian day numbers */ + int flag_orthodox = 0; /* user wants Orthodox easter */ + int flag_easter = 0; /* user wants easter date */ + int flag_3months = 0; /* user wants 3 month display (-3) */ + int flag_after = 0; /* user wants to see months after */ + int flag_before = 0; /* user wants to see months before */ + int flag_specifiedmonth = 0;/* user wants to see this month (-m) */ + int flag_givenmonth = 0; /* user has specified month [n] */ + int flag_givenyear = 0; /* user has specified year [n] */ char *cp; /* character pointer */ + char *flag_today = NULL; /* debug: use date as being today */ char *flag_month = NULL; /* requested month as string */ + char *flag_highlightdate = NULL; /* debug: date to highlight */ + int before, after; const char *locale; /* locale to get country code */ - char tbuf[1024], cbuf[512], *b; - time_t t; - struct tm *tm1; - - term_se = term_so = NULL; - today = 0; - if (isatty(STDOUT_FILENO) && tgetent(tbuf, NULL) == 1) { - date dt; /* handy date */ - - b = cbuf; - term_so = tgetstr("so", &b); - term_se = tgetstr("se", &b); - t = time(NULL); - tm1 = localtime(&t); - dt.y = tm1->tm_year + 1900; - dt.m = tm1->tm_mon + 1; - dt.d = tm1->tm_mday; - today = sndaysb(&dt); - } + flag_nohighlight = 0; + flag_weeks = 0; /* * Use locale to determine the country code, @@ -254,25 +246,56 @@ main(int argc, char *argv[]) * Get the filename portion of argv[0] and set flag_backward if * this program is called "cal". */ - cp = strrchr(argv[0], '/'); - cp = (cp == NULL) ? argv[0] : cp + 1; - if (strcmp("cal", cp) == 0) + if (strncmp(basename(argv[0]), "cal", strlen("cal")) == 0) flag_backward = 1; /* Set the switch date to United Kingdom if backwards compatible */ if (flag_backward) nswitchb = ndaysj(&ukswitch); - while ((ch = getopt(argc, argv, "Jehjm:ops:wy")) != -1) + before = after = -1; + + while ((ch = getopt(argc, argv, "3A:B:Cd:eH:hjJm:Nops:wy")) != -1) switch (ch) { + case '3': + flag_3months = 1; + break; + case 'A': + if (flag_after > 0) + errx(EX_USAGE, "Double -A specified"); + flag_after = strtol(optarg, NULL, 10); + if (flag_after <= 0) + errx(EX_USAGE, + "Argument to -A must be positive"); + break; + case 'B': + if (flag_before > 0) + errx(EX_USAGE, "Double -A specified"); + flag_before = strtol(optarg, NULL, 10); + if (flag_before <= 0) + errx(EX_USAGE, + "Argument to -B must be positive"); + break; case 'J': if (flag_backward) usage(); nswitch = ndaysj(&never); flag_julian_cal = 1; break; + case 'C': + flag_backward = 1; + break; + case 'N': + flag_backward = 0; + break; + case 'd': + flag_today = optarg; + break; + case 'H': + flag_highlightdate = optarg; + break; case 'h': - term_so = term_se = NULL; + flag_nohighlight = 1; break; case 'e': if (flag_backward) @@ -283,7 +306,10 @@ main(int argc, char *argv[]) flag_julian_day = 1; break; case 'm': + if (flag_specifiedmonth) + errx(EX_USAGE, "Double -m specified"); flag_month = optarg; + flag_specifiedmonth = 1; break; case 'o': if (flag_backward) @@ -316,7 +342,7 @@ main(int argc, char *argv[]) flag_weeks = 1; break; case 'y': - flag_hole_year = 1; + flag_wholeyear = 1; break; default: usage(); @@ -330,14 +356,21 @@ main(int argc, char *argv[]) if (flag_easter) usage(); flag_month = *argv++; + flag_givenmonth = 1; + m = strtol(flag_month, NULL, 10); /* FALLTHROUGH */ case 1: - y = atoi(*argv++); + y = atoi(*argv); if (y < 1 || y > 9999) - errx(EX_USAGE, "year %d not in range 1..9999", y); + errx(EX_USAGE, "year `%s' not in range 1..9999", *argv); + argv++; + flag_givenyear = 1; break; case 0: - { + if (flag_today != NULL) { + y = strtol(flag_today, NULL, 10); + m = strtol(flag_today + 5, NULL, 10); + } else { time_t t; struct tm *tm; @@ -359,21 +392,108 @@ main(int argc, char *argv[]) } } + /* + * What is not supported: + * -3 with -A or -B + * -3 displays 3 months, -A and -B change that behaviour. + * -3 with -y + * -3 displays 3 months, -y says display a whole year. + * -3 with a given year but no given month or without -m + * -3 displays 3 months, no month specified doesn't make clear + * which three months. + * -m with a given month + * conflicting arguments, both specify the same field. + * -y with -m + * -y displays the whole year, -m displays a single month. + * -y with a given month + * -y displays the whole year, the given month displays a single + * month. + * -y with -A or -B + * -y displays the whole year, -A and -B display extra months. + */ + + /* -3 together with -A or -B. */ + if (flag_3months && (flag_after || flag_before)) + errx(EX_USAGE, "-3 together with -A and -B is not supported."); + /* -3 together with -y. */ + if (flag_3months && flag_wholeyear) + errx(EX_USAGE, "-3 together with -y is not supported."); + /* -3 together with givenyear but no givenmonth. */ + if (flag_3months && flag_givenyear && + !(flag_givenmonth || flag_specifiedmonth)) + errx(EX_USAGE, + "-3 together with a given year but no given month is " + "not supported."); + /* -m together with xx xxxx. */ + if (flag_specifiedmonth && flag_givenmonth) + errx(EX_USAGE, + "-m together with a given month is not supported."); + /* -y together with -m. */ + if (flag_wholeyear && flag_specifiedmonth) + errx(EX_USAGE, "-y together with -m is not supported."); + /* -y together with xx xxxx. */ + if (flag_wholeyear && flag_givenmonth) + errx(EX_USAGE, "-y together a given month is not supported."); + /* -y together with -A or -B. */ + if (flag_wholeyear && (flag_before > 0 || flag_after > 0)) + errx(EX_USAGE, "-y together a -A or -B is not supported."); + /* The rest should be fine. */ + + /* Select the period to display, in order of increasing priority .*/ + if (flag_wholeyear || + (flag_givenyear && !(flag_givenmonth || flag_specifiedmonth))) { + m = 1; + before = 0; + after = 11; + } + if (flag_givenyear && flag_givenmonth) { + before = 0; + after = 0; + } + if (flag_specifiedmonth) { + before = 0; + after = 0; + } + if (flag_before) { + before = flag_before; + } + if (flag_after) { + after = flag_after; + } + if (flag_3months) { + before = 1; + after = 1; + } + if (after == -1) + after = 0; + if (before == -1) + before = 0; + + /* Highlight a specified day or today .*/ + if (flag_highlightdate != NULL) { + dt.y = strtol(flag_highlightdate, NULL, 10); + dt.m = strtol(flag_highlightdate + 5, NULL, 10); + dt.d = strtol(flag_highlightdate + 8, NULL, 10); + } else { + time_t t; + struct tm *tm1; + + t = time(NULL); + tm1 = localtime(&t); + dt.y = tm1->tm_year + 1900; + dt.m = tm1->tm_mon + 1; + dt.d = tm1->tm_mday; + } + highlightdate = sndaysb(&dt); + + /* And now we finally start to calculate and output calendars. */ if (flag_easter) printeaster(y, flag_julian_cal, flag_orthodox); - else if (argc == 1 || flag_hole_year) { - /* disable the highlight for now */ - today = 0; - if (flag_backward) - printyearb(y, flag_julian_day); - else - printyear(y, flag_julian_day); - } else + else if (flag_backward) - printmonthb(y, m, flag_julian_day); + monthrangeb(y, m, flag_julian_day, before, after); else - printmonth(y, m, flag_julian_day); - + monthranger(y, m, flag_julian_day, before, after); return (0); } @@ -382,14 +502,17 @@ usage(void) { fputs( - "usage: cal [-hjy] [[month] year]\n" - " cal [-hj] [-m month] [year]\n" - " ncal [-hJjpwy] [-s country_code] [[month] year]\n" - " ncal [-hJeo] [year]\n", stderr); +"Usage: cal [general options] [-hjy] [[month] year]\n" +" cal [general options] [-hj] [-m month] [year]\n" +" ncal [general options] [-hJjpwy] [-s country_code] [[month] year]\n" +" ncal [general options] [-hJeo] [year]\n" +"General options: [-NC3] [-A months] [-B months]\n" +"For debug the highlighting: [-H yyyy-mm-dd] [-d yyyy-mm]\n", + stderr); exit(EX_USAGE); } -/* print the assumed switches for all countries */ +/* Print the assumed switches for all countries. */ void printcc(void) { @@ -410,13 +533,13 @@ printcc(void) printf(FSTR"\n", FSTRARG(p)); } -/* print the date of easter sunday */ +/* Print the date of easter sunday. */ void printeaster(int y, int julian, int orthodox) { date dt; struct tm tm; - char buf[80]; + char buf[MAX_WIDTH]; static int d_first = -1; if (d_first < 0) @@ -441,183 +564,201 @@ printeaster(int y, int julian, int ortho printf("%s\n", buf); } -void -printmonth(int y, int m, int jd_flag) -{ - struct monthlines month; - struct weekdays wds; - int i, len; - - mkmonth(y, m - 1, jd_flag, &month); - mkweekdays(&wds); - printf(" %ls %d\n", month.name, y); - for (i = 0; i != 7; i++) { - len = wcslen(wds.names[i]); - if (wcswidth(wds.names[i], len) == len) - wprintf(L"%.2ls%s\n", wds.names[i], month.lines[i]); - else - wprintf(L"%.1ls%s\n", wds.names[i], month.lines[i]); - } - if (flag_weeks) - printf(" %s\n", month.weeks); -} +#define MW(mw, me) ((mw) + me) +#define DECREASEMONTH(m, y) \ + if (--m == 0) { \ + m = 12; \ + y--; \ + } +#define INCREASEMONTH(m, y) \ + if (++(m) == 13) { \ + (m) = 1; \ + (y)++; \ + } +#define M2Y(m) ((m) / 12) +#define M2M(m) (1 + (m) % 12) +/* Print all months for the period in the range [ before .. y-m .. after ]. */ void -printmonthb(int y, int m, int jd_flag) +monthrangeb(int y, int m, int jd_flag, int before, int after) { - struct monthlines month; + struct monthlines year[12]; struct weekdays wds; - wchar_t s[MAX_WIDTH], t[MAX_WIDTH]; - int i; - int mw; - - mkmonthb(y, m - 1, jd_flag, &month); - mkweekdays(&wds); + char s[MAX_WIDTH], t[MAX_WIDTH]; + wchar_t ws[MAX_WIDTH], ws1[MAX_WIDTH]; + const char *wdss; + int i, j; + int mpl; + int mw; + int m1, m2; + int printyearheader; + int prevyear = -1; + mpl = jd_flag ? 2 : 3; mw = jd_flag ? MONTH_WIDTH_B_J : MONTH_WIDTH_B; + wdss = (mpl == 2) ? " " : ""; - swprintf(s, MAX_WIDTH, L"%ls %d", month.name, y); - wprintf(L"%ls\n", wcenter(t, s, mw)); + while (before != 0) { + DECREASEMONTH(m, y); + before--; + after++; + } + m1 = y * 12 + m - 1; + m2 = m1 + after; - if (jd_flag) - wprintf(L" %ls %ls %ls %ls %ls %ls %.2ls\n", - wds.names[6], wds.names[0], - wds.names[1], wds.names[2], wds.names[3], - wds.names[4], wds.names[5]); - else - wprintf(L"%ls%ls%ls%ls%ls%ls%.2ls\n", wds.names[6], - wds.names[0], wds.names[1], wds.names[2], wds.names[3], - wds.names[4], wds.names[5]); + mkweekdays(&wds); - for (i = 0; i != 6; i++) - printf("%s\n", month.lines[i]+1); -} + /* + * The year header is printed when there are more than 'mpl' months + * and if the first month is a multitude of 'mpl'. + * If not, it will print the year behind every month. + */ + printyearheader = (after >= mpl - 1) && (M2M(m1) - 1) % mpl == 0; -void -printyear(int y, int jd_flag) -{ - struct monthlines year[12]; - struct weekdays wds; - char s[80], t[80]; - int i, j; - int mpl; - int mw; + m = m1; + while (m <= m2) { + int count = 0; + for (i = 0; i != mpl && m + i <= m2; i++) { + mkmonthb(M2Y(m + i), M2M(m + i) - 1, jd_flag, year + i); + count++; + } - for (i = 0; i != 12; i++) - mkmonth(y, i, jd_flag, year + i); - mkweekdays(&wds); - mpl = jd_flag ? 3 : 4; - mw = jd_flag ? MONTH_WIDTH_J : MONTH_WIDTH; + /* Empty line between two rows of months */ + if (m != m1) + printf("\n"); + + /* Year at the top. */ + if (printyearheader && M2Y(m) != prevyear) { + sprintf(s, "%d", M2Y(m)); + printf("%s\n", center(t, s, mpl * mw)); + prevyear = M2Y(m); + } - sprintf(s, "%d", y); - printf("%s\n", center(t, s, mpl * mw)); + /* Month names. */ + for (i = 0; i < count; i++) + if (printyearheader) + wprintf(L"%-*ls ", + mw, wcenter(ws, year[i].name, mw)); + else { + swprintf(ws, sizeof(ws), L"%-ls %d", + year[i].name, M2Y(m + i)); + wprintf(L"%-*ls ", mw, wcenter(ws1, ws, mw)); + } + printf("\n"); - for (j = 0; j != 12; j += mpl) { - wprintf(L" %-*ls%-*ls", - mw, year[j].name, - mw, year[j + 1].name); - if (mpl == 3) - printf("%ls\n", year[j + 2].name); - else - wprintf(L"%-*ls%ls\n", - mw, year[j + 2].name, - year[j + 3].name); - for (i = 0; i != 7; i++) { - wprintf(L"%.2ls%-*s%-*s", - wds.names[i], - mw, year[j].lines[i], - mw, year[j + 1].lines[i]); - if (mpl == 3) - printf("%s\n", year[j + 2].lines[i]); - else - printf("%-*s%s\n", - mw, year[j + 2].lines[i], - year[j + 3].lines[i]); + /* Day of the week names. */ + for (i = 0; i < count; i++) { + wprintf(L"%s%ls%s%ls%s%ls%s%ls%s%ls%s%ls%s%ls ", + wdss, wds.names[6], wdss, wds.names[0], + wdss, wds.names[1], wdss, wds.names[2], + wdss, wds.names[3], wdss, wds.names[4], + wdss, wds.names[5]); } - if (flag_weeks) { - if (mpl == 3) - printf(" %-*s%-*s%-s\n", - mw, year[j].weeks, - mw, year[j + 1].weeks, - year[j + 2].weeks); - else - printf(" %-*s%-*s%-*s%-s\n", - mw, year[j].weeks, - mw, year[j + 1].weeks, - mw, year[j + 2].weeks, - year[j + 3].weeks); + printf("\n"); + + /* And the days of the month. */ + for (i = 0; i != 6; i++) { + for (j = 0; j < count; j++) + printf("%-*s ", + MW(mw, year[j].extralen[i]), + year[j].lines[i]+1); + printf("\n"); } + + m += mpl; } } void -printyearb(int y, int jd_flag) +monthranger(int y, int m, int jd_flag, int before, int after) { struct monthlines year[12]; struct weekdays wds; - char s[80], t[80]; - wchar_t ws[80], wt[80]; + char s[MAX_WIDTH], t[MAX_WIDTH]; int i, j; int mpl; int mw; + int m1, m2; + int prevyear = -1; + int printyearheader; + + mpl = jd_flag ? 3 : 4; + mw = jd_flag ? MONTH_WIDTH_R_J : MONTH_WIDTH_R; + + while (before != 0) { + DECREASEMONTH(m, y); + before--; + after++; + } + m1 = y * 12 + m - 1; + m2 = m1 + after; - for (i = 0; i != 12; i++) - mkmonthb(y, i, jd_flag, year + i); mkweekdays(&wds); - mpl = jd_flag ? 2 : 3; - mw = jd_flag ? MONTH_WIDTH_B_J : MONTH_WIDTH_B; - sprintf(s, "%d", y); - printf("%s\n\n", center(t, s, mw * mpl + mpl)); + /* + * The year header is printed when there are more than 'mpl' months + * and if the first month is a multitude of 'mpl'. + * If not, it will print the year behind every month. + */ + printyearheader = (after >= mpl - 1) && (M2M(m1) - 1) % mpl == 0; - for (j = 0; j != 12; j += mpl) { - wprintf(L"%-*ls ", mw, wcenter(ws, year[j].name, mw)); - if (mpl == 2) - printf("%ls\n", wcenter(ws, year[j + 1].name, mw)); - else - wprintf(L"%-*ls %ls\n", mw, - wcenter(ws, year[j + 1].name, mw), - wcenter(wt, year[j + 2].name, mw)); - - if (mpl == 2) - wprintf(L" %ls %ls %ls %ls %ls %ls %ls " - " %ls %ls %ls %ls %ls %ls %.2ls\n", - wds.names[6], wds.names[0], wds.names[1], - wds.names[2], wds.names[3], wds.names[4], - wds.names[5], - wds.names[6], wds.names[0], wds.names[1], - wds.names[2], wds.names[3], wds.names[4], - wds.names[5]); - else - wprintf(L"%ls%ls%ls%ls%ls%ls%ls " - "%ls%ls%ls%ls%ls%ls%ls " - "%ls%ls%ls%ls%ls%ls%.2ls\n", - wds.names[6], wds.names[0], wds.names[1], - wds.names[2], wds.names[3], wds.names[4], - wds.names[5], - wds.names[6], wds.names[0], wds.names[1], - wds.names[2], wds.names[3], wds.names[4], - wds.names[5], - wds.names[6], wds.names[0], wds.names[1], - wds.names[2], wds.names[3], wds.names[4], - wds.names[5]); - for (i = 0; i != 6; i++) { - if (mpl == 2) - printf("%-*s %s\n", - mw, year[j].lines[i]+1, - year[j + 1].lines[i]+1); + m = m1; + while (m <= m2) { + int count = 0; + for (i = 0; i != mpl && m + i <= m2; i++) { + mkmonthr(M2Y(m + i), M2M(m + i) - 1, jd_flag, year + i); + count++; + } + + /* Empty line between two rows of months. */ + if (m != m1) + printf("\n"); + + /* Year at the top. */ + if (printyearheader && M2Y(m) != prevyear) { + sprintf(s, "%d", M2Y(m)); + printf("%s\n", center(t, s, mpl * mw)); + prevyear = M2Y(m); + } + + /* Month names. */ + wprintf(L" "); + for (i = 0; i < count; i++) + if (printyearheader) + wprintf(L"%-*ls", mw, year[i].name); else - printf("%-*s %-*s %s\n", - mw, year[j].lines[i]+1, - mw, year[j + 1].lines[i]+1, - year[j + 2].lines[i]+1); + wprintf(L"%-ls %-*d", year[i].name, + mw - wcslen(year[i].name) - 1, M2Y(m + i)); + printf("\n"); + + /* And the days of the month. */ + for (i = 0; i != 7; i++) { + /* Week day */ + wprintf(L"%.2ls", wds.names[i]); + + /* Full months */ + for (j = 0; j < count; j++) + printf("%-*s", + MW(mw, year[j].extralen[i]), + year[j].lines[i]); + printf("\n"); + } + /* Week numbers. */ + if (flag_weeks) { + printf(" "); + for (i = 0; i < count; i++) + printf("%-*s", mw, year[i].weeks); + printf("\n"); } + + m += mpl; } + return; } void -mkmonth(int y, int m, int jd_flag, struct monthlines *mlines) +mkmonthr(int y, int m, int jd_flag, struct monthlines *mlines) { struct tm tm; /* for strftime printing local names of @@ -659,7 +800,7 @@ mkmonth(int y, int m, int jd_flag, struc */ firstm = first - weekday(first); - /* Set ds (daystring) and dw (daywidth) according to the jd_flag */ + /* Set ds (daystring) and dw (daywidth) according to the jd_flag. */ if (jd_flag) { ds = jdaystr; dw = 4; @@ -676,40 +817,25 @@ mkmonth(int y, int m, int jd_flag, struc for (i = 0; i != 7; i++) { l = 0; for (j = firstm + i, k = 0; j < last; j += 7, k += dw) { - if (j == today && (term_so != NULL && term_se != NULL)) { - l = strlen(term_so); - if (jd_flag) - dt.d = j - jan1 + 1; - else - sdateb(j, &dt); - /* separator */ - mlines->lines[i][k] = ' '; - /* the actual text */ - memcpy(mlines->lines[i] + k + l, - ds + dt.d * dw, dw); - /* highlight on */ - memcpy(mlines->lines[i] + k + 1, term_so, l); - /* highlight off */ - memcpy(mlines->lines[i] + k + l + dw, term_se, - strlen(term_se)); - l = strlen(term_se) + strlen(term_so); - continue; - } if (j >= first) { if (jd_flag) dt.d = j - jan1 + 1; else - sdate(j, &dt); - memcpy(mlines->lines[i] + k + l, - ds + dt.d * dw, dw); + sdater(j, &dt); + if (j == highlightdate && !flag_nohighlight) + highlight(mlines->lines[i] + k, + ds + dt.d * dw, dw, &l); + else + memcpy(mlines->lines[i] + k + l, + ds + dt.d * dw, dw); } else memcpy(mlines->lines[i] + k + l, " ", dw); } mlines->lines[i][k + l] = '\0'; - + mlines->extralen[i] = l; } - /* fill the weeknumbers */ + /* fill the weeknumbers. */ if (flag_weeks) { for (j = firstm, k = 0; j < last; k += dw, j += 7) if (j <= nswitch) @@ -746,7 +872,7 @@ mkmonthb(int y, int m, int jd_flag, stru dw = 3; } - /* Set name of month centered */ + /* Set name of month centered. */ memset(&tm, 0, sizeof(tm)); tm.tm_mon = m; wcsftime(mlines->name, sizeof(mlines->name) / sizeof(mlines->name[0]), @@ -795,32 +921,17 @@ mkmonthb(int y, int m, int jd_flag, stru l = 0; for (j = firsts + 7 * i, k = 0; j < last && k != dw * 7; j++, k += dw) { - if (j == today && (term_so != NULL && term_se != NULL)) { - l = strlen(term_so); - if (jd_flag) - dt.d = j - jan1 + 1; - else - sdateb(j, &dt); - /* separator */ - mlines->lines[i][k] = ' '; - /* the actual text */ - memcpy(mlines->lines[i] + k + l, - ds + dt.d * dw, dw); - /* highlight on */ - memcpy(mlines->lines[i] + k + 1, term_so, l); - /* highlight off */ - memcpy(mlines->lines[i] + k + l + dw, term_se, - strlen(term_se)); - l = strlen(term_se) + strlen(term_so); - continue; - } if (j >= first) { if (jd_flag) dt.d = j - jan1 + 1; else sdateb(j, &dt); - memcpy(mlines->lines[i] + k + l, - ds + dt.d * dw, dw); + if (j == highlightdate && !flag_nohighlight) + highlight(mlines->lines[i] + k, + ds + dt.d * dw, dw, &l); + else + memcpy(mlines->lines[i] + k + l, + ds + dt.d * dw, dw); } else memcpy(mlines->lines[i] + k + l, " ", dw); } @@ -828,10 +939,11 @@ mkmonthb(int y, int m, int jd_flag, stru mlines->lines[i][1] = '\0'; else mlines->lines[i][k + l] = '\0'; + mlines->extralen[i] = l; } } -/* Put the local names of weekdays into the wds */ +/* Put the local names of weekdays into the wds. */ void mkweekdays(struct weekdays *wds) { @@ -857,9 +969,8 @@ mkweekdays(struct weekdays *wds) } /* - * Compute the day number of the first - * existing date after the first day in month. - * (the first day in month and even the month might not exist!) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Fri Oct 15 05:42:36 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 330A8106564A; Fri, 15 Oct 2010 05:42:36 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2075C8FC19; Fri, 15 Oct 2010 05:42:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9F5gaNH050687; Fri, 15 Oct 2010 05:42:36 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9F5gZe1050685; Fri, 15 Oct 2010 05:42:35 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201010150542.o9F5gZe1050685@svn.freebsd.org> From: Alan Cox Date: Fri, 15 Oct 2010 05:42:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213890 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Oct 2010 05:42:36 -0000 Author: alc Date: Fri Oct 15 05:42:35 2010 New Revision: 213890 URL: http://svn.freebsd.org/changeset/base/213890 Log: MFC r209605 Improve bufdone_finish()'s handling of the bogus page. Specifically, if one or more mappings to the bogus page must be replaced, call pmap_qenter() just once. Previously, pmap_qenter() was called for each mapping to the bogus page. MFC r209902 Change the implementation of vm_hold_free_pages() so that it performs at most one call to pmap_qremove(), and thus one TLB shootdown, instead of one call and TLB shootdown per page. Simplify the interface to vm_hold_free_pages(). Modified: stable/8/sys/kern/vfs_bio.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/vfs_bio.c ============================================================================== --- stable/8/sys/kern/vfs_bio.c Fri Oct 15 05:17:48 2010 (r213889) +++ stable/8/sys/kern/vfs_bio.c Fri Oct 15 05:42:35 2010 (r213890) @@ -95,8 +95,7 @@ struct buf *buf; /* buffer header pool static struct proc *bufdaemonproc; static int inmem(struct vnode *vp, daddr_t blkno); -static void vm_hold_free_pages(struct buf *bp, vm_offset_t from, - vm_offset_t to); +static void vm_hold_free_pages(struct buf *bp, int newbsize); static void vm_hold_load_pages(struct buf *bp, vm_offset_t from, vm_offset_t to); static void vfs_page_set_valid(struct buf *bp, vm_ooffset_t off, vm_page_t m); @@ -2919,10 +2918,7 @@ allocbuf(struct buf *bp, int size) } return 1; } - vm_hold_free_pages( - bp, - (vm_offset_t) bp->b_data + newbsize, - (vm_offset_t) bp->b_data + bp->b_bufsize); + vm_hold_free_pages(bp, newbsize); } else if (newbsize > bp->b_bufsize) { /* * We only use malloced memory on the first allocation. @@ -3358,7 +3354,7 @@ bufdone_finish(struct buf *bp) vm_ooffset_t foff; vm_page_t m; vm_object_t obj; - int iosize; + int bogus, iosize; struct vnode *vp = bp->b_vp; obj = bp->b_bufobj->bo_object; @@ -3396,6 +3392,7 @@ bufdone_finish(struct buf *bp) !(bp->b_ioflags & BIO_ERROR)) { bp->b_flags |= B_CACHE; } + bogus = 0; for (i = 0; i < bp->b_npages; i++) { int bogusflag = 0; int resid; @@ -3409,13 +3406,11 @@ bufdone_finish(struct buf *bp) */ m = bp->b_pages[i]; if (m == bogus_page) { - bogusflag = 1; + bogus = bogusflag = 1; m = vm_page_lookup(obj, OFF_TO_IDX(foff)); if (m == NULL) panic("biodone: page disappeared!"); bp->b_pages[i] = m; - pmap_qenter(trunc_page((vm_offset_t)bp->b_data), - bp->b_pages, bp->b_npages); } #if defined(VFS_BIO_DEBUG) if (OFF_TO_IDX(foff) != m->pindex) { @@ -3469,6 +3464,9 @@ bufdone_finish(struct buf *bp) } vm_object_pip_wakeupn(obj, 0); VM_OBJECT_UNLOCK(obj); + if (bogus) + pmap_qenter(trunc_page((vm_offset_t)bp->b_data), + bp->b_pages, bp->b_npages); } /* @@ -3831,31 +3829,25 @@ tryagain: /* Return pages associated with this buf to the vm system */ static void -vm_hold_free_pages(struct buf *bp, vm_offset_t from, vm_offset_t to) +vm_hold_free_pages(struct buf *bp, int newbsize) { - vm_offset_t pg; + vm_offset_t from; vm_page_t p; int index, newnpages; - from = round_page(from); - to = round_page(to); - newnpages = index = (from - trunc_page((vm_offset_t)bp->b_data)) >> PAGE_SHIFT; - - for (pg = from; pg < to; pg += PAGE_SIZE, index++) { + from = round_page((vm_offset_t)bp->b_data + newbsize); + newnpages = (from - trunc_page((vm_offset_t)bp->b_data)) >> PAGE_SHIFT; + if (bp->b_npages > newnpages) + pmap_qremove(from, bp->b_npages - newnpages); + for (index = newnpages; index < bp->b_npages; index++) { p = bp->b_pages[index]; - if (p && (index < bp->b_npages)) { - if (p->busy) { - printf( - "vm_hold_free_pages: blkno: %jd, lblkno: %jd\n", - (intmax_t)bp->b_blkno, - (intmax_t)bp->b_lblkno); - } - bp->b_pages[index] = NULL; - pmap_qremove(pg, 1); - p->wire_count--; - vm_page_free(p); - atomic_subtract_int(&cnt.v_wire_count, 1); - } + bp->b_pages[index] = NULL; + if (p->busy != 0) + printf("vm_hold_free_pages: blkno: %jd, lblkno: %jd\n", + (intmax_t)bp->b_blkno, (intmax_t)bp->b_lblkno); + p->wire_count--; + vm_page_free(p); + atomic_subtract_int(&cnt.v_wire_count, 1); } bp->b_npages = newnpages; } From owner-svn-src-stable-8@FreeBSD.ORG Fri Oct 15 15:37:17 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25F10106566B; Fri, 15 Oct 2010 15:37:17 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 095298FC0C; Fri, 15 Oct 2010 15:37:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9FFbGi9066073; Fri, 15 Oct 2010 15:37:16 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9FFbG0u066069; Fri, 15 Oct 2010 15:37:16 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201010151537.o9FFbG0u066069@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 15 Oct 2010 15:37:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213899 - in stable/8: tools/regression/usr.bin/tr usr.bin/tr X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Oct 2010 15:37:17 -0000 Author: jilles Date: Fri Oct 15 15:37:16 2010 New Revision: 213899 URL: http://svn.freebsd.org/changeset/base/213899 Log: MFC r213284: tr: Fix '[=]=]' equivalence class. A closing bracket immediately after '[=' should not be treated as special. Different from the submitted patch, a string ending with '[=' does not cause access beyond the terminating '\0'. PR: bin/150384 Submitted by: Richard Lowe Added: stable/8/tools/regression/usr.bin/tr/regress.0c.out - copied unchanged from r213284, head/tools/regression/usr.bin/tr/regress.0c.out stable/8/tools/regression/usr.bin/tr/regress.0d.out - copied unchanged from r213284, head/tools/regression/usr.bin/tr/regress.0d.out Modified: stable/8/tools/regression/usr.bin/tr/regress.sh stable/8/usr.bin/tr/str.c Directory Properties: stable/8/tools/regression/usr.bin/tr/ (props changed) stable/8/usr.bin/tr/ (props changed) Copied: stable/8/tools/regression/usr.bin/tr/regress.0c.out (from r213284, head/tools/regression/usr.bin/tr/regress.0c.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/usr.bin/tr/regress.0c.out Fri Oct 15 15:37:16 2010 (r213899, copy of r213284, head/tools/regression/usr.bin/tr/regress.0c.out) @@ -0,0 +1 @@ +[[[[ Copied: stable/8/tools/regression/usr.bin/tr/regress.0d.out (from r213284, head/tools/regression/usr.bin/tr/regress.0d.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/usr.bin/tr/regress.0d.out Fri Oct 15 15:37:16 2010 (r213899, copy of r213284, head/tools/regression/usr.bin/tr/regress.0d.out) @@ -0,0 +1 @@ + Modified: stable/8/tools/regression/usr.bin/tr/regress.sh ============================================================================== --- stable/8/tools/regression/usr.bin/tr/regress.sh Fri Oct 15 15:24:59 2010 (r213898) +++ stable/8/tools/regression/usr.bin/tr/regress.sh Fri Oct 15 15:37:16 2010 (r213899) @@ -1,6 +1,6 @@ # $FreeBSD$ -echo 1..12 +echo 1..14 REGRESSION_START($1) @@ -16,5 +16,7 @@ REGRESSION_TEST(`08', `tr "[[:upper:]]" REGRESSION_TEST(`09', `printf "\\f\\r\\n" | tr "\\014\\r" "?#"') REGRESSION_TEST(`0a', `printf "0xdeadbeef\\n" | tr "x[[:xdigit:]]" "?\$"') REGRESSION_TEST(`0b', `(tr -cd "[[:xdigit:]]" < regress2.in ; echo)') +REGRESSION_TEST(`0c', `echo "[[[[]]]]" | tr -d "[=]=]"') +REGRESSION_TEST(`0d', `echo "]=[" | tr -d "[=]"') REGRESSION_END() Modified: stable/8/usr.bin/tr/str.c ============================================================================== --- stable/8/usr.bin/tr/str.c Fri Oct 15 15:24:59 2010 (r213898) +++ stable/8/usr.bin/tr/str.c Fri Oct 15 15:37:16 2010 (r213899) @@ -156,7 +156,7 @@ bracket(s) s->str = p + 1; return (1); case '=': /* "[=equiv=]" */ - if ((p = strchr(s->str + 2, ']')) == NULL) + if (s->str[2] == '\0' || (p = strchr(s->str + 3, ']')) == NULL) return (0); if (*(p - 1) != '=' || p - s->str < 4) goto repeat; From owner-svn-src-stable-8@FreeBSD.ORG Fri Oct 15 17:56:51 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6ADE1065706; Fri, 15 Oct 2010 17:56:51 +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 B3E5C8FC1A; Fri, 15 Oct 2010 17:56:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9FHupCv069855; Fri, 15 Oct 2010 17:56:51 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9FHupdQ069850; Fri, 15 Oct 2010 17:56:51 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201010151756.o9FHupdQ069850@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 15 Oct 2010 17:56:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213901 - in stable/8/sys: amd64/amd64 amd64/include i386/i386 i386/include X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Oct 2010 17:56:52 -0000 Author: kib Date: Fri Oct 15 17:56:51 2010 New Revision: 213901 URL: http://svn.freebsd.org/changeset/base/213901 Log: MFC r209862: For both i386 and amd64 pmap, - change the type of pm_active to cpumask_t, which it is; - in pmap_remove_pages(), compare with PCPU(curpmap), instead of dereferencing the long chain of pointers [1]. For amd64 pmap, remove the unneeded checks for validity of curpmap in pmap_activate(), since curpmap should be always valid after r209789. Modified: stable/8/sys/amd64/amd64/pmap.c stable/8/sys/amd64/include/pmap.h stable/8/sys/i386/i386/pmap.c stable/8/sys/i386/include/pmap.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/amd64/amd64/pmap.c ============================================================================== --- stable/8/sys/amd64/amd64/pmap.c Fri Oct 15 15:46:58 2010 (r213900) +++ stable/8/sys/amd64/amd64/pmap.c Fri Oct 15 17:56:51 2010 (r213901) @@ -3948,7 +3948,7 @@ pmap_remove_pages(pmap_t pmap) uint64_t inuse, bitmask; int allfree; - if (pmap != vmspace_pmap(curthread->td_proc->p_vmspace)) { + if (pmap != PCPU_GET(curpmap)) { printf("warning: pmap_remove_pages called with non-current pmap\n"); return; } @@ -4867,11 +4867,9 @@ pmap_activate(struct thread *td) pmap = vmspace_pmap(td->td_proc->p_vmspace); oldpmap = PCPU_GET(curpmap); #ifdef SMP -if (oldpmap) /* XXX FIXME */ atomic_clear_int(&oldpmap->pm_active, PCPU_GET(cpumask)); atomic_set_int(&pmap->pm_active, PCPU_GET(cpumask)); #else -if (oldpmap) /* XXX FIXME */ oldpmap->pm_active &= ~PCPU_GET(cpumask); pmap->pm_active |= PCPU_GET(cpumask); #endif Modified: stable/8/sys/amd64/include/pmap.h ============================================================================== --- stable/8/sys/amd64/include/pmap.h Fri Oct 15 15:46:58 2010 (r213900) +++ stable/8/sys/amd64/include/pmap.h Fri Oct 15 17:56:51 2010 (r213901) @@ -244,7 +244,7 @@ struct pmap { struct mtx pm_mtx; pml4_entry_t *pm_pml4; /* KVA of level 4 page table */ TAILQ_HEAD(,pv_chunk) pm_pvchunk; /* list of mappings in pmap */ - u_int pm_active; /* active on cpus */ + cpumask_t pm_active; /* active on cpus */ /* spare u_int here due to padding */ struct pmap_statistics pm_stats; /* pmap statistics */ vm_page_t pm_root; /* spare page table pages */ Modified: stable/8/sys/i386/i386/pmap.c ============================================================================== --- stable/8/sys/i386/i386/pmap.c Fri Oct 15 15:46:58 2010 (r213900) +++ stable/8/sys/i386/i386/pmap.c Fri Oct 15 17:56:51 2010 (r213901) @@ -4169,7 +4169,7 @@ pmap_remove_pages(pmap_t pmap) uint32_t inuse, bitmask; int allfree; - if (pmap != vmspace_pmap(curthread->td_proc->p_vmspace)) { + if (pmap != PCPU_GET(curpmap)) { printf("warning: pmap_remove_pages called with non-current pmap\n"); return; } Modified: stable/8/sys/i386/include/pmap.h ============================================================================== --- stable/8/sys/i386/include/pmap.h Fri Oct 15 15:46:58 2010 (r213900) +++ stable/8/sys/i386/include/pmap.h Fri Oct 15 17:56:51 2010 (r213901) @@ -417,7 +417,7 @@ struct pmap { struct mtx pm_mtx; pd_entry_t *pm_pdir; /* KVA of page directory */ TAILQ_HEAD(,pv_chunk) pm_pvchunk; /* list of mappings in pmap */ - u_int pm_active; /* active on cpus */ + cpumask_t pm_active; /* active on cpus */ struct pmap_statistics pm_stats; /* pmap statistics */ LIST_ENTRY(pmap) pm_list; /* List of all pmaps */ #ifdef PAE From owner-svn-src-stable-8@FreeBSD.ORG Fri Oct 15 18:07:45 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76830106567A; Fri, 15 Oct 2010 18:07:45 +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 57DDD8FC27; Fri, 15 Oct 2010 18:07:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9FI7jHZ070351; Fri, 15 Oct 2010 18:07:45 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9FI7jO3070349; Fri, 15 Oct 2010 18:07:45 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201010151807.o9FI7jO3070349@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 15 Oct 2010 18:07:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213902 - stable/8/sys/i386/include X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Oct 2010 18:07:45 -0000 Author: kib Date: Fri Oct 15 18:07:45 2010 New Revision: 213902 URL: http://svn.freebsd.org/changeset/base/213902 Log: MFC r209866: Fix spacing. Modified: stable/8/sys/i386/include/pmap.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/i386/include/pmap.h ============================================================================== --- stable/8/sys/i386/include/pmap.h Fri Oct 15 17:56:51 2010 (r213901) +++ stable/8/sys/i386/include/pmap.h Fri Oct 15 18:07:45 2010 (r213902) @@ -417,7 +417,7 @@ struct pmap { struct mtx pm_mtx; pd_entry_t *pm_pdir; /* KVA of page directory */ TAILQ_HEAD(,pv_chunk) pm_pvchunk; /* list of mappings in pmap */ - cpumask_t pm_active; /* active on cpus */ + cpumask_t pm_active; /* active on cpus */ struct pmap_statistics pm_stats; /* pmap statistics */ LIST_ENTRY(pmap) pm_list; /* List of all pmaps */ #ifdef PAE From owner-svn-src-stable-8@FreeBSD.ORG Sat Oct 16 08:38:13 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 483EE106564A; Sat, 16 Oct 2010 08:38:13 +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 362508FC08; Sat, 16 Oct 2010 08:38:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9G8cDPk068052; Sat, 16 Oct 2010 08:38:13 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9G8cDh2068050; Sat, 16 Oct 2010 08:38:13 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201010160838.o9G8cDh2068050@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 16 Oct 2010 08:38:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213914 - stable/8/sys/dev/ciss X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Oct 2010 08:38:13 -0000 Author: kib Date: Sat Oct 16 08:38:12 2010 New Revision: 213914 URL: http://svn.freebsd.org/changeset/base/213914 Log: MFC r213354: Cosmetic: make it less confusing when displaying RAID 1 level, that might be 1+0 as well. PR: kern/150936 Modified: stable/8/sys/dev/ciss/ciss.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ciss/ciss.c ============================================================================== --- stable/8/sys/dev/ciss/ciss.c Sat Oct 16 07:12:39 2010 (r213913) +++ stable/8/sys/dev/ciss/ciss.c Sat Oct 16 08:38:12 2010 (r213914) @@ -4394,7 +4394,7 @@ ciss_name_ldrive_org(int org) case CISS_LDRIVE_RAID0: return("RAID 0"); case CISS_LDRIVE_RAID1: - return("RAID 1"); + return("RAID 1(1+0)"); case CISS_LDRIVE_RAID4: return("RAID 4"); case CISS_LDRIVE_RAID5: From owner-svn-src-stable-8@FreeBSD.ORG Sat Oct 16 08:43:23 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E64FD106564A; Sat, 16 Oct 2010 08:43: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 B9C3F8FC16; Sat, 16 Oct 2010 08:43:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9G8hN0L068219; Sat, 16 Oct 2010 08:43:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9G8hNhv068216; Sat, 16 Oct 2010 08:43:23 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201010160843.o9G8hNhv068216@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 16 Oct 2010 08:43:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213915 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Oct 2010 08:43:24 -0000 Author: kib Date: Sat Oct 16 08:43:23 2010 New Revision: 213915 URL: http://svn.freebsd.org/changeset/base/213915 Log: MFC r213359: Release the vnode lock and close the linker file vnode earlier in the linker_load_file methods. This prevents the LOR between kernel linker sx xlock and vnode lock. Modified: stable/8/sys/kern/link_elf.c stable/8/sys/kern/link_elf_obj.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/link_elf.c ============================================================================== --- stable/8/sys/kern/link_elf.c Sat Oct 16 08:38:12 2010 (r213914) +++ stable/8/sys/kern/link_elf.c Sat Oct 16 08:43:23 2010 (r213915) @@ -967,15 +967,15 @@ nosyms: *result = lf; out: + VOP_UNLOCK(nd.ni_vp, 0); + vn_close(nd.ni_vp, FREAD, td->td_ucred, td); + VFS_UNLOCK_GIANT(vfslocked); if (error && lf) linker_file_unload(lf, LINKER_UNLOAD_FORCE); if (shdr) free(shdr, M_LINKER); if (firstpage) free(firstpage, M_LINKER); - VOP_UNLOCK(nd.ni_vp, 0); - vn_close(nd.ni_vp, FREAD, td->td_ucred, td); - VFS_UNLOCK_GIANT(vfslocked); return error; } Modified: stable/8/sys/kern/link_elf_obj.c ============================================================================== --- stable/8/sys/kern/link_elf_obj.c Sat Oct 16 08:38:12 2010 (r213914) +++ stable/8/sys/kern/link_elf_obj.c Sat Oct 16 08:43:23 2010 (r213915) @@ -885,13 +885,13 @@ link_elf_load_file(linker_class_t cls, c *result = lf; out: + VOP_UNLOCK(nd.ni_vp, 0); + vn_close(nd.ni_vp, FREAD, td->td_ucred, td); + VFS_UNLOCK_GIANT(vfslocked); if (error && lf) linker_file_unload(lf, LINKER_UNLOAD_FORCE); if (hdr) free(hdr, M_LINKER); - VOP_UNLOCK(nd.ni_vp, 0); - vn_close(nd.ni_vp, FREAD, td->td_ucred, td); - VFS_UNLOCK_GIANT(vfslocked); return error; } From owner-svn-src-stable-8@FreeBSD.ORG Sat Oct 16 11:19:31 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3FA9106564A; Sat, 16 Oct 2010 11:19:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A1A258FC12; Sat, 16 Oct 2010 11:19:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9GBJVxs074990; Sat, 16 Oct 2010 11:19:31 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9GBJVD7074988; Sat, 16 Oct 2010 11:19:31 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201010161119.o9GBJVD7074988@svn.freebsd.org> From: Andriy Gapon Date: Sat, 16 Oct 2010 11:19:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213919 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Oct 2010 11:19:31 -0000 Author: avg Date: Sat Oct 16 11:19:31 2010 New Revision: 213919 URL: http://svn.freebsd.org/changeset/base/213919 Log: MFC r213527: vm.kmem_map_size: a sysctl to query current kmem_map->size Modified: stable/8/sys/kern/kern_malloc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/kern_malloc.c ============================================================================== --- stable/8/sys/kern/kern_malloc.c Sat Oct 16 10:45:36 2010 (r213918) +++ stable/8/sys/kern/kern_malloc.c Sat Oct 16 11:19:31 2010 (r213919) @@ -197,6 +197,11 @@ static u_int vm_kmem_size_scale; SYSCTL_UINT(_vm, OID_AUTO, kmem_size_scale, CTLFLAG_RDTUN, &vm_kmem_size_scale, 0, "Scale factor for kernel memory size"); +static int sysctl_kmem_map_size(SYSCTL_HANDLER_ARGS); +SYSCTL_PROC(_vm, OID_AUTO, kmem_map_size, + CTLFLAG_RD | CTLTYPE_ULONG | CTLFLAG_MPSAFE, NULL, 0, + sysctl_kmem_map_size, "LU", "Current kmem_map allocation size"); + /* * The malloc_mtx protects the kmemstatistics linked list. */ @@ -233,6 +238,15 @@ SYSCTL_INT(_debug_malloc, OID_AUTO, fail &malloc_failure_count, 0, "Number of imposed M_NOWAIT malloc failures"); #endif +static int +sysctl_kmem_map_size(SYSCTL_HANDLER_ARGS) +{ + u_long size; + + size = kmem_map->size; + return (sysctl_handle_long(oidp, &size, 0, req)); +} + int malloc_last_fail(void) { From owner-svn-src-stable-8@FreeBSD.ORG Sat Oct 16 11:24:27 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A75491065674; Sat, 16 Oct 2010 11:24:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9520B8FC13; Sat, 16 Oct 2010 11:24:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9GBOR4o075196; Sat, 16 Oct 2010 11:24:27 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9GBORpP075194; Sat, 16 Oct 2010 11:24:27 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201010161124.o9GBORpP075194@svn.freebsd.org> From: Andriy Gapon Date: Sat, 16 Oct 2010 11:24:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213921 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Oct 2010 11:24:27 -0000 Author: avg Date: Sat Oct 16 11:24:27 2010 New Revision: 213921 URL: http://svn.freebsd.org/changeset/base/213921 Log: MFC r213651: add kmem_map_free sysctl: query largest contiguous free range in kmem_map Modified: stable/8/sys/kern/kern_malloc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/kern_malloc.c ============================================================================== --- stable/8/sys/kern/kern_malloc.c Sat Oct 16 11:20:53 2010 (r213920) +++ stable/8/sys/kern/kern_malloc.c Sat Oct 16 11:24:27 2010 (r213921) @@ -202,6 +202,11 @@ SYSCTL_PROC(_vm, OID_AUTO, kmem_map_size CTLFLAG_RD | CTLTYPE_ULONG | CTLFLAG_MPSAFE, NULL, 0, sysctl_kmem_map_size, "LU", "Current kmem_map allocation size"); +static int sysctl_kmem_map_free(SYSCTL_HANDLER_ARGS); +SYSCTL_PROC(_vm, OID_AUTO, kmem_map_free, + CTLFLAG_RD | CTLTYPE_ULONG | CTLFLAG_MPSAFE, NULL, 0, + sysctl_kmem_map_free, "LU", "Largest contiguous free range in kmem_map"); + /* * The malloc_mtx protects the kmemstatistics linked list. */ @@ -247,6 +252,18 @@ sysctl_kmem_map_size(SYSCTL_HANDLER_ARGS return (sysctl_handle_long(oidp, &size, 0, req)); } +static int +sysctl_kmem_map_free(SYSCTL_HANDLER_ARGS) +{ + u_long size; + + vm_map_lock_read(kmem_map); + size = kmem_map->root != NULL ? + kmem_map->root->max_free : kmem_map->size; + vm_map_unlock_read(kmem_map); + return (sysctl_handle_long(oidp, &size, 0, req)); +} + int malloc_last_fail(void) { From owner-svn-src-stable-8@FreeBSD.ORG Sat Oct 16 11:52:44 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5704B106566C; Sat, 16 Oct 2010 11:52:44 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 445568FC08; Sat, 16 Oct 2010 11:52:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9GBqiTg075921; Sat, 16 Oct 2010 11:52:44 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9GBqidB075919; Sat, 16 Oct 2010 11:52:44 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201010161152.o9GBqidB075919@svn.freebsd.org> From: Andriy Gapon Date: Sat, 16 Oct 2010 11:52:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213924 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Oct 2010 11:52:44 -0000 Author: avg Date: Sat Oct 16 11:52:43 2010 New Revision: 213924 URL: http://svn.freebsd.org/changeset/base/213924 Log: MFC r213730: zfs + sendfile: do not produce partially valid pages for vnode's tail Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Oct 16 11:44:58 2010 (r213923) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Oct 16 11:52:43 2010 (r213924) @@ -491,6 +491,8 @@ again: * but it pessimize performance of sendfile/UFS, that's * why I handle this special case in ZFS code. */ + KASSERT(off == 0, + ("unexpected offset in mappedread for sendfile")); if ((m->oflags & VPO_BUSY) != 0) { /* * Reference the page before unlocking and @@ -511,14 +513,15 @@ again: } if (error == 0) { va = zfs_map_page(m, &sf); - error = dmu_read(os, zp->z_id, start + off, - bytes, (void *)(va + off), + error = dmu_read(os, zp->z_id, start, bytes, va, DMU_READ_PREFETCH); + if (bytes != PAGE_SIZE) + bzero(va + bytes, PAGE_SIZE - bytes); zfs_unmap_page(sf); } VM_OBJECT_LOCK(obj); if (error == 0) - vm_page_set_valid(m, off, bytes); + m->valid = VM_PAGE_BITS_ALL; vm_page_wakeup(m); if (error == 0) { uio->uio_resid -= bytes; From owner-svn-src-stable-8@FreeBSD.ORG Sat Oct 16 19:56:47 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FA141065694; Sat, 16 Oct 2010 19:56:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5DE168FC32; Sat, 16 Oct 2010 19:56:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9GJule2088191; Sat, 16 Oct 2010 19:56:47 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9GJulGP088189; Sat, 16 Oct 2010 19:56:47 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201010161956.o9GJulGP088189@svn.freebsd.org> From: Andriy Gapon Date: Sat, 16 Oct 2010 19:56:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213933 - stable/8/sys/fs/tmpfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Oct 2010 19:56:47 -0000 Author: avg Date: Sat Oct 16 19:56:46 2010 New Revision: 213933 URL: http://svn.freebsd.org/changeset/base/213933 Log: MFC r213735: tmpfs + sendfile: do not produce partially valid pages for vnode's tail Modified: stable/8/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/8/sys/fs/tmpfs/tmpfs_vnops.c Sat Oct 16 19:53:22 2010 (r213932) +++ stable/8/sys/fs/tmpfs/tmpfs_vnops.c Sat Oct 16 19:56:46 2010 (r213933) @@ -525,6 +525,8 @@ lookupvpg: VM_OBJECT_UNLOCK(vobj); return (error); } else if (m != NULL && uio->uio_segflg == UIO_NOCOPY) { + KASSERT(offset == 0, + ("unexpected offset in tmpfs_mappedread for sendfile")); if (vm_page_sleep_if_busy(m, FALSE, "tmfsmr")) goto lookupvpg; vm_page_busy(m); @@ -532,9 +534,10 @@ lookupvpg: sched_pin(); sf = sf_buf_alloc(m, SFB_CPUPRIVATE); ma = (char *)sf_buf_kva(sf); - error = tmpfs_nocacheread_buf(tobj, idx, offset, tlen, - ma + offset); + error = tmpfs_nocacheread_buf(tobj, idx, 0, tlen, ma); if (error == 0) { + if (tlen != PAGE_SIZE) + bzero(ma + tlen, PAGE_SIZE - tlen); uio->uio_offset += tlen; uio->uio_resid -= tlen; } @@ -542,7 +545,7 @@ lookupvpg: sched_unpin(); VM_OBJECT_LOCK(vobj); if (error == 0) - vm_page_set_valid(m, offset, tlen); + m->valid = VM_PAGE_BITS_ALL; vm_page_wakeup(m); VM_OBJECT_UNLOCK(vobj); return (error); From owner-svn-src-stable-8@FreeBSD.ORG Sat Oct 16 19:58:49 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC5E3106566B; Sat, 16 Oct 2010 19:58:49 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CAC0D8FC19; Sat, 16 Oct 2010 19:58:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9GJwndD088309; Sat, 16 Oct 2010 19:58:49 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9GJwnvH088307; Sat, 16 Oct 2010 19:58:49 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201010161958.o9GJwnvH088307@svn.freebsd.org> From: Andriy Gapon Date: Sat, 16 Oct 2010 19:58:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213934 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Oct 2010 19:58:50 -0000 Author: avg Date: Sat Oct 16 19:58:49 2010 New Revision: 213934 URL: http://svn.freebsd.org/changeset/base/213934 Log: MFC r213648: panic_cpu variable should be volatile Modified: stable/8/sys/kern/kern_shutdown.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/kern/kern_shutdown.c ============================================================================== --- stable/8/sys/kern/kern_shutdown.c Sat Oct 16 19:56:46 2010 (r213933) +++ stable/8/sys/kern/kern_shutdown.c Sat Oct 16 19:58:49 2010 (r213934) @@ -513,10 +513,6 @@ shutdown_reset(void *junk, int howto) /* NOTREACHED */ /* assuming reset worked */ } -#ifdef SMP -static u_int panic_cpu = NOCPU; -#endif - /* * Panic is called on unresolvable fatal errors. It prints "panic: mesg", * and then reboots. If we are called twice, then we avoid trying to sync @@ -525,6 +521,9 @@ static u_int panic_cpu = NOCPU; void panic(const char *fmt, ...) { +#ifdef SMP + static volatile u_int panic_cpu = NOCPU; +#endif struct thread *td = curthread; int bootopt, newpanic; va_list ap; From owner-svn-src-stable-8@FreeBSD.ORG Sat Oct 16 20:13:15 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0C5E1065670; Sat, 16 Oct 2010 20:13:15 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B41DE8FC0A; Sat, 16 Oct 2010 20:13:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9GKDFcA088877; Sat, 16 Oct 2010 20:13:15 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9GKDFLn088875; Sat, 16 Oct 2010 20:13:15 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201010162013.o9GKDFLn088875@svn.freebsd.org> From: Andriy Gapon Date: Sat, 16 Oct 2010 20:13:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213936 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Oct 2010 20:13:16 -0000 Author: avg Date: Sat Oct 16 20:13:15 2010 New Revision: 213936 URL: http://svn.freebsd.org/changeset/base/213936 Log: Revert r213261 (MFC of r212652): vm_page_sleep change has not been MFCed yet Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Oct 16 20:01:41 2010 (r213935) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat Oct 16 20:13:15 2010 (r213936) @@ -322,17 +322,8 @@ page_lookup(vnode_t *vp, int64_t start, for (;;) { if ((pp = vm_page_lookup(obj, OFF_TO_IDX(start))) != NULL && vm_page_is_valid(pp, (vm_offset_t)off, nbytes)) { - if ((pp->oflags & VPO_BUSY) != 0) { - /* - * Reference the page before unlocking and - * sleeping so that the page daemon is less - * likely to reclaim it. - */ - vm_page_lock_queues(); - vm_page_flag_set(pp, PG_REFERENCED); - vm_page_sleep(pp, "zfsmwb"); + if (vm_page_sleep_if_busy(pp, FALSE, "zfsmwb")) continue; - } vm_page_busy(pp); vm_page_lock_queues(); vm_page_undirty(pp); @@ -460,18 +451,8 @@ mappedread(vnode_t *vp, int nbytes, uio_ again: if ((m = vm_page_lookup(obj, OFF_TO_IDX(start))) != NULL && vm_page_is_valid(m, off, bytes)) { - if ((m->oflags & VPO_BUSY) != 0) { - /* - * Reference the page before unlocking and - * sleeping so that the page daemon is less - * likely to reclaim it. - */ - vm_page_lock_queues(); - vm_page_flag_set(m, PG_REFERENCED); - vm_page_sleep(m, "zfsmrb"); + if (vm_page_sleep_if_busy(m, FALSE, "zfsmrb")) goto again; - } - vm_page_busy(m); VM_OBJECT_UNLOCK(obj); if (dirbytes > 0) { @@ -493,17 +474,8 @@ again: */ KASSERT(off == 0, ("unexpected offset in mappedread for sendfile")); - if ((m->oflags & VPO_BUSY) != 0) { - /* - * Reference the page before unlocking and - * sleeping so that the page daemon is less - * likely to reclaim it. - */ - vm_page_lock_queues(); - vm_page_flag_set(m, PG_REFERENCED); - vm_page_sleep(m, "zfsmrb"); + if (vm_page_sleep_if_busy(m, FALSE, "zfsmrb")) goto again; - } vm_page_busy(m); VM_OBJECT_UNLOCK(obj); if (dirbytes > 0) {