From owner-svn-src-stable@FreeBSD.ORG Mon Sep 19 11:08:31 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8CAC910656EC; Mon, 19 Sep 2011 11:08:31 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 718828FC27; Mon, 19 Sep 2011 11:08:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8JB8VrC077307; Mon, 19 Sep 2011 11:08:31 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8JB8VgF077301; Mon, 19 Sep 2011 11:08:31 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201109191108.p8JB8VgF077301@svn.freebsd.org> From: Attilio Rao Date: Mon, 19 Sep 2011 11:08: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: r225663 - in stable/8/sys: conf kern sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2011 11:08:31 -0000 Author: attilio Date: Mon Sep 19 11:08:31 2011 New Revision: 225663 URL: http://svn.freebsd.org/changeset/base/225663 Log: MFC r225448: Improve busy buffers diagnostic on shutdown path. Modified: stable/8/sys/conf/NOTES stable/8/sys/conf/options stable/8/sys/kern/kern_shutdown.c stable/8/sys/kern/vfs_bio.c stable/8/sys/sys/buf.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) Modified: stable/8/sys/conf/NOTES ============================================================================== --- stable/8/sys/conf/NOTES Mon Sep 19 10:58:30 2011 (r225662) +++ stable/8/sys/conf/NOTES Mon Sep 19 11:08:31 2011 (r225663) @@ -2845,7 +2845,6 @@ options SCSI_NCR_MYADDR=7 options SC_DEBUG_LEVEL=5 # Syscons debug level options SC_RENDER_DEBUG # syscons rendering debugging -options SHOW_BUSYBUFS # List buffers that prevent root unmount options VFS_BIO_DEBUG # VFS buffer I/O debugging options KSTACK_MAX_PAGES=32 # Maximum pages to give the kernel stack Modified: stable/8/sys/conf/options ============================================================================== --- stable/8/sys/conf/options Mon Sep 19 10:58:30 2011 (r225662) +++ stable/8/sys/conf/options Mon Sep 19 11:08:31 2011 (r225663) @@ -150,7 +150,6 @@ QUOTA SCHED_4BSD opt_sched.h SCHED_STATS opt_sched.h SCHED_ULE opt_sched.h -SHOW_BUSYBUFS SLEEPQUEUE_PROFILING SLHCI_DEBUG opt_slhci.h SPX_HACK Modified: stable/8/sys/kern/kern_shutdown.c ============================================================================== --- stable/8/sys/kern/kern_shutdown.c Mon Sep 19 10:58:30 2011 (r225662) +++ stable/8/sys/kern/kern_shutdown.c Mon Sep 19 11:08:31 2011 (r225663) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" #include "opt_kdb.h" #include "opt_panic.h" -#include "opt_show_busybufs.h" #include "opt_sched.h" #include "opt_watchdog.h" @@ -66,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef SW_WATCHDOG #include #endif @@ -123,6 +123,14 @@ TUNABLE_INT("kern.sync_on_panic", &sync_ SYSCTL_NODE(_kern, OID_AUTO, shutdown, CTLFLAG_RW, 0, "Shutdown environment"); +#ifndef DIAGNOSTIC +static int show_busybufs; +#else +static int show_busybufs = 1; +#endif +SYSCTL_INT(_kern_shutdown, OID_AUTO, show_busybufs, CTLFLAG_RW, + &show_busybufs, 0, ""); + /* * Variable panicstr contains argument to first call to panic; used as flag * to indicate that the kernel has already called panic. @@ -388,13 +396,17 @@ boot(int howto) } #endif nbusy++; -#if defined(SHOW_BUSYBUFS) || defined(DIAGNOSTIC) - printf( - "%d: bufobj:%p, flags:%0x, blkno:%ld, lblkno:%ld\n", - nbusy, bp->b_bufobj, - bp->b_flags, (long)bp->b_blkno, - (long)bp->b_lblkno); -#endif + if (show_busybufs > 0) { + printf( + "%d: buf:%p, vnode:%p, flags:%0x, blkno:%jd, lblkno:%jd, buflock:", + nbusy, bp, bp->b_vp, bp->b_flags, + (intmax_t)bp->b_blkno, + (intmax_t)bp->b_lblkno); + BUF_LOCKPRINTINFO(bp); + if (show_busybufs > 1) + vn_printf(bp->b_vp, + "vnode content: "); + } } } if (nbusy) { Modified: stable/8/sys/kern/vfs_bio.c ============================================================================== --- stable/8/sys/kern/vfs_bio.c Mon Sep 19 10:58:30 2011 (r225662) +++ stable/8/sys/kern/vfs_bio.c Mon Sep 19 11:08:31 2011 (r225663) @@ -4106,7 +4106,7 @@ DB_SHOW_COMMAND(buffer, db_show_buffer) db_printf("\n"); } db_printf(" "); - lockmgr_printinfo(&bp->b_lock); + BUF_LOCKPRINTINFO(bp); } DB_SHOW_COMMAND(lockedbufs, lockedbufs) Modified: stable/8/sys/sys/buf.h ============================================================================== --- stable/8/sys/sys/buf.h Mon Sep 19 10:58:30 2011 (r225662) +++ stable/8/sys/sys/buf.h Mon Sep 19 11:08:31 2011 (r225663) @@ -311,6 +311,12 @@ extern const char *buf_wmesg; /* Defaul lockdestroy(&(bp)->b_lock) /* + * Print informations on a buffer lock. + */ +#define BUF_LOCKPRINTINFO(bp) \ + lockmgr_printinfo(&(bp)->b_lock) + +/* * Buffer lock assertions. */ #if defined(INVARIANTS) && defined(INVARIANT_SUPPORT) From owner-svn-src-stable@FreeBSD.ORG Mon Sep 19 16:25:37 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAD6C106566B; Mon, 19 Sep 2011 16:25:37 +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 550B08FC12; Mon, 19 Sep 2011 16:25:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8JGPb44087496; Mon, 19 Sep 2011 16:25:37 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8JGPbRD087493; Mon, 19 Sep 2011 16:25:37 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201109191625.p8JGPbRD087493@svn.freebsd.org> From: John Baldwin Date: Mon, 19 Sep 2011 16: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: r225673 - stable/8/usr.sbin/mfiutil X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2011 16:25:37 -0000 Author: jhb Date: Mon Sep 19 16:25:37 2011 New Revision: 225673 URL: http://svn.freebsd.org/changeset/base/225673 Log: MFC 225331: Move the logic to parse volume cache commands out into a separate function and use a loop so that multiple cache commands can be strung together on the command line into a single update to the volume's properties. Modified: stable/8/usr.sbin/mfiutil/mfi_volume.c stable/8/usr.sbin/mfiutil/mfiutil.8 Directory Properties: stable/8/usr.sbin/mfiutil/ (props changed) Modified: stable/8/usr.sbin/mfiutil/mfi_volume.c ============================================================================== --- stable/8/usr.sbin/mfiutil/mfi_volume.c Mon Sep 19 16:01:53 2011 (r225672) +++ stable/8/usr.sbin/mfiutil/mfi_volume.c Mon Sep 19 16:25:37 2011 (r225673) @@ -111,16 +111,16 @@ mfi_ld_set_props(int fd, struct mfi_ld_p } static int -update_cache_policy(int fd, struct mfi_ld_props *props, uint8_t new_policy, - uint8_t mask) +update_cache_policy(int fd, struct mfi_ld_props *old, struct mfi_ld_props *new) { int error; uint8_t changes, policy; - policy = (props->default_cache_policy & ~mask) | new_policy; - if (policy == props->default_cache_policy) + if (old->default_cache_policy == new->default_cache_policy && + old->disk_cache_policy == new->disk_cache_policy) return (0); - changes = policy ^ props->default_cache_policy; + policy = new->default_cache_policy; + changes = policy ^ old->default_cache_policy; if (changes & MR_LD_CACHE_ALLOW_WRITE_CACHE) printf("%s caching of I/O writes\n", policy & MR_LD_CACHE_ALLOW_WRITE_CACHE ? "Enabling" : @@ -142,9 +142,21 @@ update_cache_policy(int fd, struct mfi_l printf("%s write caching with bad BBU\n", policy & MR_LD_CACHE_WRITE_CACHE_BAD_BBU ? "Enabling" : "Disabling"); + if (old->disk_cache_policy != new->disk_cache_policy) { + switch (new->disk_cache_policy) { + case MR_PD_CACHE_ENABLE: + printf("Enabling write-cache on physical drives\n"); + break; + case MR_PD_CACHE_DISABLE: + printf("Disabling write-cache on physical drives\n"); + break; + case MR_PD_CACHE_UNCHANGED: + printf("Using default write-cache setting on physical drives\n"); + break; + } + } - props->default_cache_policy = policy; - if (mfi_ld_set_props(fd, props) < 0) { + if (mfi_ld_set_props(fd, new) < 0) { error = errno; warn("Failed to set volume properties"); return (error); @@ -152,12 +164,130 @@ update_cache_policy(int fd, struct mfi_l return (0); } +static void +stage_cache_setting(struct mfi_ld_props *props, uint8_t new_policy, + uint8_t mask) +{ + + props->default_cache_policy &= ~mask; + props->default_cache_policy |= new_policy; +} + +/* + * Parse a single cache directive modifying the passed in policy. + * Returns -1 on a parse error and the number of arguments consumed + * on success. + */ +static int +process_cache_command(int ac, char **av, struct mfi_ld_props *props) +{ + uint8_t policy; + + /* I/O cache settings. */ + if (strcmp(av[0], "all") == 0 || strcmp(av[0], "enable") == 0) { + stage_cache_setting(props, MR_LD_CACHE_ALLOW_READ_CACHE | + MR_LD_CACHE_ALLOW_WRITE_CACHE, + MR_LD_CACHE_ALLOW_READ_CACHE | + MR_LD_CACHE_ALLOW_WRITE_CACHE); + return (1); + } + if (strcmp(av[0], "none") == 0 || strcmp(av[0], "disable") == 0) { + stage_cache_setting(props, 0, MR_LD_CACHE_ALLOW_READ_CACHE | + MR_LD_CACHE_ALLOW_WRITE_CACHE); + return (1); + } + if (strcmp(av[0], "reads") == 0) { + stage_cache_setting(props, MR_LD_CACHE_ALLOW_READ_CACHE, + MR_LD_CACHE_ALLOW_READ_CACHE | + MR_LD_CACHE_ALLOW_WRITE_CACHE); + return (1); + } + if (strcmp(av[0], "writes") == 0) { + stage_cache_setting(props, MR_LD_CACHE_ALLOW_WRITE_CACHE, + MR_LD_CACHE_ALLOW_READ_CACHE | + MR_LD_CACHE_ALLOW_WRITE_CACHE); + return (1); + } + + /* Write cache behavior. */ + if (strcmp(av[0], "write-back") == 0) { + stage_cache_setting(props, MR_LD_CACHE_WRITE_BACK, + MR_LD_CACHE_WRITE_BACK); + return (1); + } + if (strcmp(av[0], "write-through") == 0) { + stage_cache_setting(props, 0, MR_LD_CACHE_WRITE_BACK); + return (1); + } + if (strcmp(av[0], "bad-bbu-write-cache") == 0) { + if (ac < 2) { + warnx("cache: bad BBU setting required"); + return (-1); + } + if (strcmp(av[1], "enable") == 0) + policy = MR_LD_CACHE_WRITE_CACHE_BAD_BBU; + else if (strcmp(av[1], "disable") == 0) + policy = 0; + else { + warnx("cache: invalid bad BBU setting"); + return (-1); + } + stage_cache_setting(props, policy, + MR_LD_CACHE_WRITE_CACHE_BAD_BBU); + return (2); + } + + /* Read cache behavior. */ + if (strcmp(av[0], "read-ahead") == 0) { + if (ac < 2) { + warnx("cache: read-ahead setting required"); + return (-1); + } + if (strcmp(av[1], "none") == 0) + policy = 0; + else if (strcmp(av[1], "always") == 0) + policy = MR_LD_CACHE_READ_AHEAD; + else if (strcmp(av[1], "adaptive") == 0) + policy = MR_LD_CACHE_READ_AHEAD | + MR_LD_CACHE_READ_ADAPTIVE; + else { + warnx("cache: invalid read-ahead setting"); + return (-1); + } + stage_cache_setting(props, policy, MR_LD_CACHE_READ_AHEAD | + MR_LD_CACHE_READ_ADAPTIVE); + return (2); + } + + /* Drive write-cache behavior. */ + if (strcmp(av[0], "write-cache") == 0) { + if (ac < 2) { + warnx("cache: write-cache setting required"); + return (-1); + } + if (strcmp(av[1], "enable") == 0) + props->disk_cache_policy = MR_PD_CACHE_ENABLE; + else if (strcmp(av[1], "disable") == 0) + props->disk_cache_policy = MR_PD_CACHE_DISABLE; + else if (strcmp(av[1], "default") == 0) + props->disk_cache_policy = MR_PD_CACHE_UNCHANGED; + else { + warnx("cache: invalid write-cache setting"); + return (-1); + } + return (2); + } + + warnx("cache: Invalid command"); + return (-1); +} + static int volume_cache(int ac, char **av) { - struct mfi_ld_props props; - int error, fd; - uint8_t target_id, policy; + struct mfi_ld_props props, new; + int error, fd, consumed; + uint8_t target_id; if (ac < 2) { warnx("cache: volume required"); @@ -235,113 +365,19 @@ volume_cache(int ac, char **av) printf("Cache Disabled Due to Dead Battery\n"); error = 0; } else { - if (strcmp(av[2], "all") == 0 || strcmp(av[2], "enable") == 0) - error = update_cache_policy(fd, &props, - MR_LD_CACHE_ALLOW_READ_CACHE | - MR_LD_CACHE_ALLOW_WRITE_CACHE, - MR_LD_CACHE_ALLOW_READ_CACHE | - MR_LD_CACHE_ALLOW_WRITE_CACHE); - else if (strcmp(av[2], "none") == 0 || - strcmp(av[2], "disable") == 0) - error = update_cache_policy(fd, &props, 0, - MR_LD_CACHE_ALLOW_READ_CACHE | - MR_LD_CACHE_ALLOW_WRITE_CACHE); - else if (strcmp(av[2], "reads") == 0) - error = update_cache_policy(fd, &props, - MR_LD_CACHE_ALLOW_READ_CACHE, - MR_LD_CACHE_ALLOW_READ_CACHE | - MR_LD_CACHE_ALLOW_WRITE_CACHE); - else if (strcmp(av[2], "writes") == 0) - error = update_cache_policy(fd, &props, - MR_LD_CACHE_ALLOW_WRITE_CACHE, - MR_LD_CACHE_ALLOW_READ_CACHE | - MR_LD_CACHE_ALLOW_WRITE_CACHE); - else if (strcmp(av[2], "write-back") == 0) - error = update_cache_policy(fd, &props, - MR_LD_CACHE_WRITE_BACK, - MR_LD_CACHE_WRITE_BACK); - else if (strcmp(av[2], "write-through") == 0) - error = update_cache_policy(fd, &props, 0, - MR_LD_CACHE_WRITE_BACK); - else if (strcmp(av[2], "read-ahead") == 0) { - if (ac < 4) { - warnx("cache: read-ahead setting required"); - close(fd); - return (EINVAL); - } - if (strcmp(av[3], "none") == 0) - policy = 0; - else if (strcmp(av[3], "always") == 0) - policy = MR_LD_CACHE_READ_AHEAD; - else if (strcmp(av[3], "adaptive") == 0) - policy = MR_LD_CACHE_READ_AHEAD | - MR_LD_CACHE_READ_ADAPTIVE; - else { - warnx("cache: invalid read-ahead setting"); - close(fd); - return (EINVAL); - } - error = update_cache_policy(fd, &props, policy, - MR_LD_CACHE_READ_AHEAD | - MR_LD_CACHE_READ_ADAPTIVE); - } else if (strcmp(av[2], "bad-bbu-write-cache") == 0) { - if (ac < 4) { - warnx("cache: bad BBU setting required"); + new = props; + av += 2; + ac -= 2; + while (ac > 0) { + consumed = process_cache_command(ac, av, &new); + if (consumed < 0) { close(fd); return (EINVAL); } - if (strcmp(av[3], "enable") == 0) - policy = MR_LD_CACHE_WRITE_CACHE_BAD_BBU; - else if (strcmp(av[3], "disable") == 0) - policy = 0; - else { - warnx("cache: invalid bad BBU setting"); - close(fd); - return (EINVAL); - } - error = update_cache_policy(fd, &props, policy, - MR_LD_CACHE_WRITE_CACHE_BAD_BBU); - } else if (strcmp(av[2], "write-cache") == 0) { - if (ac < 4) { - warnx("cache: write-cache setting required"); - close(fd); - return (EINVAL); - } - if (strcmp(av[3], "enable") == 0) - policy = MR_PD_CACHE_ENABLE; - else if (strcmp(av[3], "disable") == 0) - policy = MR_PD_CACHE_DISABLE; - else if (strcmp(av[3], "default") == 0) - policy = MR_PD_CACHE_UNCHANGED; - else { - warnx("cache: invalid write-cache setting"); - close(fd); - return (EINVAL); - } - error = 0; - if (policy != props.disk_cache_policy) { - switch (policy) { - case MR_PD_CACHE_ENABLE: - printf("Enabling write-cache on physical drives\n"); - break; - case MR_PD_CACHE_DISABLE: - printf("Disabling write-cache on physical drives\n"); - break; - case MR_PD_CACHE_UNCHANGED: - printf("Using default write-cache setting on physical drives\n"); - break; - } - props.disk_cache_policy = policy; - if (mfi_ld_set_props(fd, &props) < 0) { - error = errno; - warn("Failed to set volume properties"); - } - } - } else { - warnx("cache: Invalid command"); - close(fd); - return (EINVAL); + av += consumed; + ac -= consumed; } + error = update_cache_policy(fd, &props, &new); } close(fd); Modified: stable/8/usr.sbin/mfiutil/mfiutil.8 ============================================================================== --- stable/8/usr.sbin/mfiutil/mfiutil.8 Mon Sep 19 16:01:53 2011 (r225672) +++ stable/8/usr.sbin/mfiutil/mfiutil.8 Mon Sep 19 16:25:37 2011 (r225673) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 20, 2011 +.Dd September 2, 2011 .Dt MFIUTIL 8 .Os .Sh NAME @@ -103,7 +103,7 @@ .Cm locate Ar drive Brq "on | off" .Nm .Op Fl u Ar unit -.Cm cache Ar volume Op Ar setting Op Ar value +.Cm cache Ar volume Op Ar setting Oo Ar value Oc Op ... .Nm .Op Fl u Ar unit .Cm name Ar volume Ar name @@ -367,19 +367,23 @@ Change the state of the external LED ass .Pp The logical volume management commands include: .Bl -tag -width indent -.It Cm cache Ar volume Op Ar setting Op Ar value +.It Cm cache Ar volume Op Ar setting Oo Ar value Oc Op ... If no .Ar setting -argument is supplied, then the current cache policy for +arguments are supplied, then the current cache policy for .Ar volume is displayed; otherwise, the cache policy for .Ar volume is modified. -The optional +One or more .Ar setting -argument can be one of the following values: +arguments may be given. +Some settings take an additional +.Ar value +argument as noted below. +The valid settings are: .Bl -tag -width indent .It Cm enable Enable caching for both read and write I/O operations. From owner-svn-src-stable@FreeBSD.ORG Mon Sep 19 16:28:37 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44275106566C; Mon, 19 Sep 2011 16:28:37 +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 33ABA8FC14; Mon, 19 Sep 2011 16:28:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8JGSbKU087628; Mon, 19 Sep 2011 16:28:37 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8JGSbDY087626; Mon, 19 Sep 2011 16:28:37 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201109191628.p8JGSbDY087626@svn.freebsd.org> From: John Baldwin Date: Mon, 19 Sep 2011 16:28: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: r225674 - stable/8/sbin/mount X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Sep 2011 16:28:37 -0000 Author: jhb Date: Mon Sep 19 16:28:36 2011 New Revision: 225674 URL: http://svn.freebsd.org/changeset/base/225674 Log: MFC 225341: Clear the mountprog variable after each mountfs() call so that mountprog options don't leak over into subsequent mounts listed in /etc/fstab. While here, fix a memory leak in debug mode. Modified: stable/8/sbin/mount/mount.c Directory Properties: stable/8/sbin/mount/ (props changed) Modified: stable/8/sbin/mount/mount.c ============================================================================== --- stable/8/sbin/mount/mount.c Mon Sep 19 16:25:37 2011 (r225673) +++ stable/8/sbin/mount/mount.c Mon Sep 19 16:28:36 2011 (r225674) @@ -588,6 +588,9 @@ mountfs(const char *vfstype, const char for (i = 1; i < mnt_argv.c; i++) (void)printf(" %s", mnt_argv.a[i]); (void)printf("\n"); + free(optbuf); + free(mountprog); + mountprog = NULL; return (0); } @@ -598,6 +601,8 @@ mountfs(const char *vfstype, const char } free(optbuf); + free(mountprog); + mountprog = NULL; if (verbose) { if (statfs(name, &sf) < 0) { From owner-svn-src-stable@FreeBSD.ORG Tue Sep 20 04:59:35 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2DBB4106566C; Tue, 20 Sep 2011 04:59:35 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D3A98FC08; Tue, 20 Sep 2011 04:59:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8K4xZYt011271; Tue, 20 Sep 2011 04:59:35 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8K4xYd0011269; Tue, 20 Sep 2011 04:59:34 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201109200459.p8K4xYd0011269@svn.freebsd.org> From: Christian Brueffer Date: Tue, 20 Sep 2011 04:59:34 +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: r225687 - stable/8/sys/dev/acpica X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2011 04:59:35 -0000 Author: brueffer Date: Tue Sep 20 04:59:34 2011 New Revision: 225687 URL: http://svn.freebsd.org/changeset/base/225687 Log: MFC: r225533 Improve the sleep_delay sysctl description by specifying which unit the number is in. Modified: stable/8/sys/dev/acpica/acpi.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) Modified: stable/8/sys/dev/acpica/acpi.c ============================================================================== --- stable/8/sys/dev/acpica/acpi.c Tue Sep 20 04:30:23 2011 (r225686) +++ stable/8/sys/dev/acpica/acpi.c Tue Sep 20 04:59:34 2011 (r225687) @@ -586,7 +586,7 @@ acpi_attach(device_t dev) &sc->acpi_suspend_sx, 0, acpi_sleep_state_sysctl, "A", ""); SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), OID_AUTO, "sleep_delay", CTLFLAG_RW, &sc->acpi_sleep_delay, 0, - "sleep delay"); + "sleep delay in seconds"); SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), OID_AUTO, "s4bios", CTLFLAG_RW, &sc->acpi_s4bios, 0, "S4BIOS mode"); SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), From owner-svn-src-stable@FreeBSD.ORG Tue Sep 20 05:02:48 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A33B4106564A; Tue, 20 Sep 2011 05:02:48 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 92C468FC0A; Tue, 20 Sep 2011 05:02:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8K52mfg011438; Tue, 20 Sep 2011 05:02:48 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8K52mUY011436; Tue, 20 Sep 2011 05:02:48 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201109200502.p8K52mUY011436@svn.freebsd.org> From: Christian Brueffer Date: Tue, 20 Sep 2011 05:02:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225688 - stable/7/sys/dev/acpica X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2011 05:02:48 -0000 Author: brueffer Date: Tue Sep 20 05:02:48 2011 New Revision: 225688 URL: http://svn.freebsd.org/changeset/base/225688 Log: MFC: r225533 Improve the sleep_delay sysctl description by specifying which unit the number is in. Modified: stable/7/sys/dev/acpica/acpi.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/7/sys/dev/acpica/acpi.c ============================================================================== --- stable/7/sys/dev/acpica/acpi.c Tue Sep 20 04:59:34 2011 (r225687) +++ stable/7/sys/dev/acpica/acpi.c Tue Sep 20 05:02:48 2011 (r225688) @@ -534,7 +534,7 @@ acpi_attach(device_t dev) &sc->acpi_suspend_sx, 0, acpi_sleep_state_sysctl, "A", ""); SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), OID_AUTO, "sleep_delay", CTLFLAG_RW, &sc->acpi_sleep_delay, 0, - "sleep delay"); + "sleep delay in seconds"); SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), OID_AUTO, "s4bios", CTLFLAG_RW, &sc->acpi_s4bios, 0, "S4BIOS mode"); SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), From owner-svn-src-stable@FreeBSD.ORG Tue Sep 20 08:34:15 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88736106564A; Tue, 20 Sep 2011 08:34:15 +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 5DD928FC1B; Tue, 20 Sep 2011 08:34:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8K8YFFB018222; Tue, 20 Sep 2011 08:34:15 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8K8YFaL018220; Tue, 20 Sep 2011 08:34:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201109200834.p8K8YFaL018220@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 20 Sep 2011 08:34: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: r225692 - stable/8/sbin/mdmfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2011 08:34:15 -0000 Author: kib Date: Tue Sep 20 08:34:15 2011 New Revision: 225692 URL: http://svn.freebsd.org/changeset/base/225692 Log: MFC r225534: Do not try to change the mode or ownership of the root of the mountpoint when newly established mdmfs mount is readonly. Modified: stable/8/sbin/mdmfs/mdmfs.c Directory Properties: stable/8/sbin/mdmfs/ (props changed) Modified: stable/8/sbin/mdmfs/mdmfs.c ============================================================================== --- stable/8/sbin/mdmfs/mdmfs.c Tue Sep 20 08:11:07 2011 (r225691) +++ stable/8/sbin/mdmfs/mdmfs.c Tue Sep 20 08:34:15 2011 (r225692) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -60,6 +61,7 @@ struct mtpt_info { bool mi_have_gid; mode_t mi_mode; bool mi_have_mode; + bool mi_forced_pw; }; static bool debug; /* Emit debugging information? */ @@ -204,6 +206,7 @@ main(int argc, char **argv) usage(); mi.mi_mode = getmode(set, S_IRWXU | S_IRWXG | S_IRWXO); mi.mi_have_mode = true; + mi.mi_forced_pw = true; free(set); break; case 'S': @@ -223,6 +226,7 @@ main(int argc, char **argv) break; case 'w': extract_ugid(optarg, &mi); + mi.mi_forced_pw = true; break; case 'X': debug = true; @@ -443,6 +447,29 @@ do_mount(const char *args, const char *m static void do_mtptsetup(const char *mtpoint, struct mtpt_info *mip) { + struct statfs sfs; + + if (!mip->mi_have_mode && !mip->mi_have_uid && !mip->mi_have_gid) + return; + + if (!norun) { + if (statfs(mtpoint, &sfs) == -1) { + warn("statfs: %s", mtpoint); + return; + } + if ((sfs.f_flags & MNT_RDONLY) != 0) { + if (mip->mi_forced_pw) { + warnx( + "Not changing mode/owner of %s since it is read-only", + mtpoint); + } else { + debugprintf( + "Not changing mode/owner of %s since it is read-only", + mtpoint); + } + return; + } + } if (mip->mi_have_mode) { debugprintf("changing mode of %s to %o.", mtpoint, From owner-svn-src-stable@FreeBSD.ORG Wed Sep 21 07:31:17 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6955B106566B; Wed, 21 Sep 2011 07:31:17 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F08B8FC13; Wed, 21 Sep 2011 07:31:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8L7VHR2064393; Wed, 21 Sep 2011 07:31:17 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8L7VHrd064391; Wed, 21 Sep 2011 07:31:17 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201109210731.p8L7VHrd064391@svn.freebsd.org> From: Hans Petter Selasky Date: Wed, 21 Sep 2011 07:31: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: r225712 - stable/8/sys/dev/usb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2011 07:31:17 -0000 Author: hselasky Date: Wed Sep 21 07:31:16 2011 New Revision: 225712 URL: http://svn.freebsd.org/changeset/base/225712 Log: MFC r225556: Reduce USB memory usage during enumeration. Modified: stable/8/sys/dev/usb/usb_msctest.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) Modified: stable/8/sys/dev/usb/usb_msctest.c ============================================================================== --- stable/8/sys/dev/usb/usb_msctest.c Wed Sep 21 06:35:05 2011 (r225711) +++ stable/8/sys/dev/usb/usb_msctest.c Wed Sep 21 07:31:16 2011 (r225712) @@ -183,6 +183,7 @@ static const struct usb_config bbb_confi .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = sizeof(struct bbb_cbw), + .flags = {.ext_buffer = 1,}, .callback = &bbb_command_callback, .timeout = 4 * USB_MS_HZ, /* 4 seconds */ }, @@ -192,7 +193,7 @@ static const struct usb_config bbb_confi .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .bufsize = BULK_SIZE, - .flags = {.proxy_buffer = 1,.short_xfer_ok = 1,}, + .flags = {.ext_buffer = 1,.proxy_buffer = 1,.short_xfer_ok = 1,}, .callback = &bbb_data_read_callback, .timeout = 4 * USB_MS_HZ, /* 4 seconds */ }, @@ -211,7 +212,7 @@ static const struct usb_config bbb_confi .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = BULK_SIZE, - .flags = {.proxy_buffer = 1,}, + .flags = {.ext_buffer = 1,.proxy_buffer = 1,}, .callback = &bbb_data_write_callback, .timeout = 4 * USB_MS_HZ, /* 4 seconds */ }, @@ -230,7 +231,7 @@ static const struct usb_config bbb_confi .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .bufsize = sizeof(struct bbb_csw), - .flags = {.short_xfer_ok = 1,}, + .flags = {.ext_buffer = 1,.short_xfer_ok = 1,}, .callback = &bbb_status_callback, .timeout = 1 * USB_MS_HZ, /* 1 second */ }, From owner-svn-src-stable@FreeBSD.ORG Thu Sep 22 01:13:41 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F60A106564A; Thu, 22 Sep 2011 01:13:41 +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 D8D418FC18; Thu, 22 Sep 2011 01:13:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8M1De92099170; Thu, 22 Sep 2011 01:13:40 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8M1DeEi099168; Thu, 22 Sep 2011 01:13:40 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201109220113.p8M1DeEi099168@svn.freebsd.org> From: Xin LI Date: Thu, 22 Sep 2011 01:13:40 +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: r225721 - in stable: 7/etc 8/etc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 01:13:41 -0000 Author: delphij Date: Thu Sep 22 01:13:40 2011 New Revision: 225721 URL: http://svn.freebsd.org/changeset/base/225721 Log: MFC r225452: Sync pf.os with OpenBSD: - Update OpenBSD fingerprints through OpenBSD 4.9 - Fix typos. Obtained from: OpenBSD Modified: stable/8/etc/pf.os Directory Properties: stable/8/etc/ (props changed) Changes in other areas also in this revision: Modified: stable/7/etc/pf.os Directory Properties: stable/7/etc/ (props changed) Modified: stable/8/etc/pf.os ============================================================================== --- stable/8/etc/pf.os Wed Sep 21 23:48:19 2011 (r225720) +++ stable/8/etc/pf.os Thu Sep 22 01:13:40 2011 (r225721) @@ -1,5 +1,5 @@ # $FreeBSD$ -# $OpenBSD: pf.os,v 1.21 2006/07/28 21:51:12 david Exp $ +# $OpenBSD: pf.os,v 1.25 2010/10/18 15:55:27 deraadt Exp $ # passive OS fingerprinting # ------------------------- # @@ -299,13 +299,16 @@ S22:64:1:52:M*,N,N,S,N,W0: Linux:2.2:ts: # ----------------- OpenBSD ----------------- 16384:64:0:60:M*,N,W0,N,N,T: OpenBSD:2.6::NetBSD 1.3 (or OpenBSD 2.6) -16384:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.0::OpenBSD 3.0-4.0 -16384:64:0:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.0:no-df:OpenBSD 3.0-4.0 (scrub no-df) +16384:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.8::OpenBSD 3.0-4.8 +16384:64:0:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.8:no-df:OpenBSD 3.0-4.8 (scrub no-df) 57344:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.3-4.0::OpenBSD 3.3-4.0 57344:64:0:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.3-4.0:no-df:OpenBSD 3.3-4.0 (scrub no-df) 65535:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.0:opera:OpenBSD 3.0-4.0 (Opera) +16384:64:1:64:M*,N,N,S,N,W3,N,N,T: OpenBSD:4.9::OpenBSD 4.9 +16384:64:0:64:M*,N,N,S,N,W3,N,N,T: OpenBSD:4.9:no-df:OpenBSD 4.9 (scrub no-df) + # ----------------- Solaris ----------------- S17:64:1:64:N,W3,N,N,T0,N,N,S,M*: Solaris:8:RFC1323:Solaris 8 RFC1323 @@ -362,7 +365,7 @@ S34:64:1:52:M*,N,W0,N,N,S: Solaris:10:b # ----------------- Windows ----------------- # Windows TCP/IP stack is a mess. For most recent XP, 2000 and -# even 98, the pathlevel, not the actual OS version, is more +# even 98, the patchlevel, not the actual OS version, is more # relevant to the signature. They share the same code, so it would # seem. Luckily for us, almost all Windows 9x boxes have an # awkward MSS of 536, which I use to tell one from another From owner-svn-src-stable@FreeBSD.ORG Thu Sep 22 01:13:41 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2FDF0106566B; Thu, 22 Sep 2011 01:13:41 +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 0553F8FC19; Thu, 22 Sep 2011 01:13:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8M1DeiJ099176; Thu, 22 Sep 2011 01:13:40 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8M1DeeO099174; Thu, 22 Sep 2011 01:13:40 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201109220113.p8M1DeeO099174@svn.freebsd.org> From: Xin LI Date: Thu, 22 Sep 2011 01:13:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225721 - in stable: 7/etc 8/etc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 01:13:41 -0000 Author: delphij Date: Thu Sep 22 01:13:40 2011 New Revision: 225721 URL: http://svn.freebsd.org/changeset/base/225721 Log: MFC r225452: Sync pf.os with OpenBSD: - Update OpenBSD fingerprints through OpenBSD 4.9 - Fix typos. Obtained from: OpenBSD Modified: stable/7/etc/pf.os Directory Properties: stable/7/etc/ (props changed) Changes in other areas also in this revision: Modified: stable/8/etc/pf.os Directory Properties: stable/8/etc/ (props changed) Modified: stable/7/etc/pf.os ============================================================================== --- stable/7/etc/pf.os Wed Sep 21 23:48:19 2011 (r225720) +++ stable/7/etc/pf.os Thu Sep 22 01:13:40 2011 (r225721) @@ -1,5 +1,5 @@ # $FreeBSD$ -# $OpenBSD: pf.os,v 1.21 2006/07/28 21:51:12 david Exp $ +# $OpenBSD: pf.os,v 1.25 2010/10/18 15:55:27 deraadt Exp $ # passive OS fingerprinting # ------------------------- # @@ -299,13 +299,16 @@ S22:64:1:52:M*,N,N,S,N,W0: Linux:2.2:ts: # ----------------- OpenBSD ----------------- 16384:64:0:60:M*,N,W0,N,N,T: OpenBSD:2.6::NetBSD 1.3 (or OpenBSD 2.6) -16384:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.0::OpenBSD 3.0-4.0 -16384:64:0:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.0:no-df:OpenBSD 3.0-4.0 (scrub no-df) +16384:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.8::OpenBSD 3.0-4.8 +16384:64:0:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.8:no-df:OpenBSD 3.0-4.8 (scrub no-df) 57344:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.3-4.0::OpenBSD 3.3-4.0 57344:64:0:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.3-4.0:no-df:OpenBSD 3.3-4.0 (scrub no-df) 65535:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.0:opera:OpenBSD 3.0-4.0 (Opera) +16384:64:1:64:M*,N,N,S,N,W3,N,N,T: OpenBSD:4.9::OpenBSD 4.9 +16384:64:0:64:M*,N,N,S,N,W3,N,N,T: OpenBSD:4.9:no-df:OpenBSD 4.9 (scrub no-df) + # ----------------- Solaris ----------------- S17:64:1:64:N,W3,N,N,T0,N,N,S,M*: Solaris:8:RFC1323:Solaris 8 RFC1323 @@ -362,7 +365,7 @@ S34:64:1:52:M*,N,W0,N,N,S: Solaris:10:b # ----------------- Windows ----------------- # Windows TCP/IP stack is a mess. For most recent XP, 2000 and -# even 98, the pathlevel, not the actual OS version, is more +# even 98, the patchlevel, not the actual OS version, is more # relevant to the signature. They share the same code, so it would # seem. Luckily for us, almost all Windows 9x boxes have an # awkward MSS of 536, which I use to tell one from another From owner-svn-src-stable@FreeBSD.ORG Thu Sep 22 08:39:20 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDD52106566C; Thu, 22 Sep 2011 08:39:20 +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 AB8468FC13; Thu, 22 Sep 2011 08:39:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8M8dKjM013219; Thu, 22 Sep 2011 08:39:20 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8M8dKv0013217; Thu, 22 Sep 2011 08:39:20 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201109220839.p8M8dKv0013217@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 22 Sep 2011 08:39: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: r225726 - stable/8/libexec/rtld-elf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 08:39:20 -0000 Author: kib Date: Thu Sep 22 08:39:20 2011 New Revision: 225726 URL: http://svn.freebsd.org/changeset/base/225726 Log: MFC r225582: Use the proper dynamic tls block to calculate the tls variable address in case tls data generation was updated. PR: misc/160721 Modified: stable/8/libexec/rtld-elf/rtld.c Directory Properties: stable/8/libexec/rtld-elf/ (props changed) Modified: stable/8/libexec/rtld-elf/rtld.c ============================================================================== --- stable/8/libexec/rtld-elf/rtld.c Thu Sep 22 08:24:33 2011 (r225725) +++ stable/8/libexec/rtld-elf/rtld.c Thu Sep 22 08:39:20 2011 (r225726) @@ -3126,7 +3126,7 @@ tls_get_addr_common(Elf_Addr** dtvp, int newdtv[1] = tls_max_index; free(dtv); wlock_release(rtld_bind_lock, lockstate); - *dtvp = newdtv; + dtv = *dtvp = newdtv; } /* Dynamically allocate module TLS if necessary */ From owner-svn-src-stable@FreeBSD.ORG Thu Sep 22 11:07:12 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3504F1065672; Thu, 22 Sep 2011 11:07:12 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 232718FC13; Thu, 22 Sep 2011 11:07:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8MB7C0s020095; Thu, 22 Sep 2011 11:07:12 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8MB7CTb020093; Thu, 22 Sep 2011 11:07:12 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201109221107.p8MB7CTb020093@svn.freebsd.org> From: Attilio Rao Date: Thu, 22 Sep 2011 11:07:12 +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: r225728 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 11:07:12 -0000 Author: attilio Date: Thu Sep 22 11:07:11 2011 New Revision: 225728 URL: http://svn.freebsd.org/changeset/base/225728 Log: MFC r225516: Return ENOSPC rather than ENXIO when dump_write() cannot proceed in order to correctl deal with consumers. Sponsored by: Sandvine Incorporated 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) Modified: stable/8/sys/kern/kern_shutdown.c ============================================================================== --- stable/8/sys/kern/kern_shutdown.c Thu Sep 22 10:52:14 2011 (r225727) +++ stable/8/sys/kern/kern_shutdown.c Thu Sep 22 11:07:11 2011 (r225728) @@ -712,8 +712,11 @@ dump_write(struct dumperinfo *di, void * if (length != 0 && (offset < di->mediaoffset || offset - di->mediaoffset + length > di->mediasize)) { - printf("Attempt to write outside dump device boundaries.\n"); - return (ENXIO); + printf("Attempt to write outside dump device boundaries.\n" + "offset(%jd), mediaoffset(%jd), length(%ju), mediasize(%jd).\n", + (intmax_t)offset, (intmax_t)di->mediaoffset, + (uintmax_t)length, (intmax_t)di->mediasize); + return (ENOSPC); } return (di->dumper(di->priv, virtual, physical, offset, length)); } From owner-svn-src-stable@FreeBSD.ORG Thu Sep 22 17:59:33 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFF2B1065673; Thu, 22 Sep 2011 17:59:33 +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 CF8E78FC1C; Thu, 22 Sep 2011 17:59:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8MHxXME033208; Thu, 22 Sep 2011 17:59:33 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8MHxX9h033206; Thu, 22 Sep 2011 17:59:33 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201109221759.p8MHxX9h033206@svn.freebsd.org> From: Jaakko Heinonen Date: Thu, 22 Sep 2011 17:59: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: r225731 - stable/8/etc/defaults X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 17:59:34 -0000 Author: jh Date: Thu Sep 22 17:59:33 2011 New Revision: 225731 URL: http://svn.freebsd.org/changeset/base/225731 Log: MFC r225587: Expose "log" in the default devfs rules. /etc/rc.d/jail creates /dev/log as a symbolic link. PR: conf/160711 Modified: stable/8/etc/defaults/devfs.rules Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/defaults/devfs.rules ============================================================================== --- stable/8/etc/defaults/devfs.rules Thu Sep 22 17:51:09 2011 (r225730) +++ stable/8/etc/defaults/devfs.rules Thu Sep 22 17:59:33 2011 (r225731) @@ -26,6 +26,7 @@ add hide # Requires: devfsrules_hide_all # [devfsrules_unhide_basic=2] +add path log unhide add path null unhide add path zero unhide add path crypto unhide From owner-svn-src-stable@FreeBSD.ORG Thu Sep 22 18:21:15 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76105106566B; Thu, 22 Sep 2011 18:21:15 +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 659288FC08; Thu, 22 Sep 2011 18:21:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8MILFiF033965; Thu, 22 Sep 2011 18:21:15 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8MILFjP033963; Thu, 22 Sep 2011 18:21:15 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201109221821.p8MILFjP033963@svn.freebsd.org> From: Jaakko Heinonen Date: Thu, 22 Sep 2011 18:21:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225732 - stable/7/etc/defaults X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 18:21:15 -0000 Author: jh Date: Thu Sep 22 18:21:15 2011 New Revision: 225732 URL: http://svn.freebsd.org/changeset/base/225732 Log: MFC r225587: Expose "log" in the default devfs rules. /etc/rc.d/jail creates /dev/log as a symbolic link. PR: conf/160711 Modified: stable/7/etc/defaults/devfs.rules Directory Properties: stable/7/etc/ (props changed) Modified: stable/7/etc/defaults/devfs.rules ============================================================================== --- stable/7/etc/defaults/devfs.rules Thu Sep 22 17:59:33 2011 (r225731) +++ stable/7/etc/defaults/devfs.rules Thu Sep 22 18:21:15 2011 (r225732) @@ -26,6 +26,7 @@ add hide # Requires: devfsrules_hide_all # [devfsrules_unhide_basic=2] +add path log unhide add path null unhide add path zero unhide add path crypto unhide From owner-svn-src-stable@FreeBSD.ORG Thu Sep 22 22:08:09 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA42C106564A; Thu, 22 Sep 2011 22:08:09 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 905F88FC0A; Thu, 22 Sep 2011 22:08:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8MM89Tu040877; Thu, 22 Sep 2011 22:08:09 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8MM89FK040875; Thu, 22 Sep 2011 22:08:09 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201109222208.p8MM89FK040875@svn.freebsd.org> From: Gabor Kovesdan Date: Thu, 22 Sep 2011 22:08:09 +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: r225733 - stable/8/lib/libc/nls X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2011 22:08:09 -0000 Author: gabor Date: Thu Sep 22 22:08:09 2011 New Revision: 225733 URL: http://svn.freebsd.org/changeset/base/225733 Log: MFC r202992: Cache failing and opened catalogs in catopen() and related functions. Continuous catopen() calls cause 4 failig stat(2) each, which means a lot of overhead. It is also a good idea to keep the opened catalogs in the memory to speed up further catopen() calls to the same catalog since these catalogs are not big at all. In this case, we count references and only free() the allocated space when the reference count reaches 0. The reads and writes to the cache are syncronized with an rwlock when these functions are called from a threaded program. MFC r202993, r203174, r203719, r204110: Small fixes and style nits for the above change. Approved by: delphij (mentor) Modified: stable/8/lib/libc/nls/msgcat.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) Modified: stable/8/lib/libc/nls/msgcat.c ============================================================================== --- stable/8/lib/libc/nls/msgcat.c Thu Sep 22 18:21:15 2011 (r225732) +++ stable/8/lib/libc/nls/msgcat.c Thu Sep 22 22:08:09 2011 (r225733) @@ -1,5 +1,6 @@ /*********************************************************** Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts. +Copyright 2010, Gabor Kovesdan All Rights Reserved @@ -39,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include /* for ntohl() */ @@ -47,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -57,38 +60,109 @@ __FBSDID("$FreeBSD$"); #define _DEFAULT_NLS_PATH "/usr/share/nls/%L/%N.cat:/usr/share/nls/%N/%L:/usr/local/share/nls/%L/%N.cat:/usr/local/share/nls/%N/%L" +#define RLOCK(fail) { int ret; \ + if (__isthreaded && \ + ((ret = _pthread_rwlock_rdlock(&rwlock)) != 0)) { \ + errno = ret; \ + return (fail); \ + }} +#define WLOCK(fail) { int ret; \ + if (__isthreaded && \ + ((ret = _pthread_rwlock_wrlock(&rwlock)) != 0)) { \ + errno = ret; \ + return (fail); \ + }} +#define UNLOCK { if (__isthreaded) \ + _pthread_rwlock_unlock(&rwlock); } + #define NLERR ((nl_catd) -1) #define NLRETERR(errc) { errno = errc; return (NLERR); } +#define SAVEFAIL(n, l, e) { WLOCK(NLERR); \ + np = malloc(sizeof(struct catentry)); \ + if (np != NULL) { \ + np->name = strdup(n); \ + np->path = NULL; \ + np->lang = (l == NULL) ? NULL : \ + strdup(l); \ + np->caterrno = e; \ + SLIST_INSERT_HEAD(&cache, np, list); \ + } \ + UNLOCK; \ + errno = e; \ + } + +static nl_catd load_msgcat(const char *, const char *, const char *); -static nl_catd load_msgcat(const char *); +static pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER; + +struct catentry { + SLIST_ENTRY(catentry) list; + char *name; + char *path; + int caterrno; + nl_catd catd; + char *lang; + int refcount; +}; + +SLIST_HEAD(listhead, catentry) cache = + SLIST_HEAD_INITIALIZER(cache); nl_catd catopen(const char *name, int type) { - int spcleft, saverr; - char path[PATH_MAX]; - char *nlspath, *lang, *base, *cptr, *pathP, *tmpptr; - char *cptr1, *plang, *pter, *pcode; - struct stat sbuf; + struct stat sbuf; + struct catentry *np; + char *base, *cptr, *cptr1, *lang, *nlspath, *pathP, *pcode; + char *plang, *pter, *tmpptr; + int saverr, spcleft; + char path[PATH_MAX]; + /* sanity checking */ if (name == NULL || *name == '\0') NLRETERR(EINVAL); - /* is it absolute path ? if yes, load immediately */ if (strchr(name, '/') != NULL) - return (load_msgcat(name)); + /* have a pathname */ + lang = NULL; + else { + if (type == NL_CAT_LOCALE) + lang = setlocale(LC_MESSAGES, NULL); + else + lang = getenv("LANG"); + + if (lang == NULL || *lang == '\0' || strlen(lang) > ENCODING_LEN || + (lang[0] == '.' && + (lang[1] == '\0' || (lang[1] == '.' && lang[2] == '\0'))) || + strchr(lang, '/') != NULL) + lang = "C"; + } + + /* Try to get it from the cache first */ + RLOCK(NLERR); + SLIST_FOREACH(np, &cache, list) { + if ((strcmp(np->name, name) == 0) && + ((lang != NULL && np->lang != NULL && + strcmp(np->lang, lang) == 0) || (np->lang == lang))) { + if (np->caterrno != 0) { + /* Found cached failing entry */ + UNLOCK; + NLRETERR(np->caterrno); + } else { + /* Found cached successful entry */ + np->refcount++; + UNLOCK; + return (np->catd); + } + } + } + UNLOCK; - if (type == NL_CAT_LOCALE) - lang = setlocale(LC_MESSAGES, NULL); - else - lang = getenv("LANG"); - - if (lang == NULL || *lang == '\0' || strlen(lang) > ENCODING_LEN || - (lang[0] == '.' && - (lang[1] == '\0' || (lang[1] == '.' && lang[2] == '\0'))) || - strchr(lang, '/') != NULL) - lang = "C"; + /* is it absolute path ? if yes, load immediately */ + if (strchr(name, '/') != NULL) + return (load_msgcat(name, name, lang)); + /* sanity checking */ if ((plang = cptr1 = strdup(lang)) == NULL) return (NLERR); if ((cptr = strchr(cptr1, '@')) != NULL) @@ -136,7 +210,7 @@ catopen(const char *name, int type) break; case '%': ++nlspath; - /* fallthrough */ + /* FALLTHROUGH */ default: if (pathP - path >= sizeof(path) - 1) @@ -153,6 +227,7 @@ catopen(const char *name, int type) too_long: free(plang); free(base); + SAVEFAIL(name, lang, ENAMETOOLONG); NLRETERR(ENAMETOOLONG); } pathP += strlen(tmpptr); @@ -166,7 +241,7 @@ catopen(const char *name, int type) if (stat(path, &sbuf) == 0) { free(plang); free(base); - return (load_msgcat(path)); + return (load_msgcat(path, name, lang)); } } else { tmpptr = (char *)name; @@ -176,6 +251,7 @@ catopen(const char *name, int type) } free(plang); free(base); + SAVEFAIL(name, lang, ENOENT); NLRETERR(ENOENT); } @@ -183,19 +259,19 @@ char * catgets(nl_catd catd, int set_id, int msg_id, const char *s) { struct _nls_cat_hdr *cat_hdr; - struct _nls_set_hdr *set_hdr; struct _nls_msg_hdr *msg_hdr; - int l, u, i, r; + struct _nls_set_hdr *set_hdr; + int i, l, r, u; if (catd == NULL || catd == NLERR) { errno = EBADF; /* LINTED interface problem */ - return (char *) s; -} + return ((char *)s); + } - cat_hdr = (struct _nls_cat_hdr *)catd->__data; - set_hdr = (struct _nls_set_hdr *)(void *)((char *)catd->__data - + sizeof(struct _nls_cat_hdr)); + cat_hdr = (struct _nls_cat_hdr *)catd->__data; + set_hdr = (struct _nls_set_hdr *)(void *)((char *)catd->__data + + sizeof(struct _nls_cat_hdr)); /* binary search, see knuth algorithm b */ l = 0; @@ -228,7 +304,7 @@ catgets(nl_catd catd, int set_id, int ms } else { l = i + 1; } -} + } /* not found */ goto notfound; @@ -238,25 +314,44 @@ catgets(nl_catd catd, int set_id, int ms } else { l = i + 1; } -} + } notfound: /* not found */ errno = ENOMSG; /* LINTED interface problem */ - return (char *) s; + return ((char *)s); } int catclose(nl_catd catd) { + struct catentry *np; + + /* sanity checking */ if (catd == NULL || catd == NLERR) { errno = EBADF; return (-1); } - munmap(catd->__data, (size_t)catd->__size); - free(catd); + /* Remove from cache if not referenced any more */ + WLOCK(-1); + SLIST_FOREACH(np, &cache, list) { + if (catd == np->catd) { + np->refcount--; + if (np->refcount == 0) { + munmap(catd->__data, (size_t)catd->__size); + free(catd); + SLIST_REMOVE(&cache, np, catentry, list); + free(np->name); + free(np->path); + free(np->lang); + free(np); + } + break; + } + } + UNLOCK; return (0); } @@ -265,43 +360,88 @@ catclose(nl_catd catd) */ static nl_catd -load_msgcat(const char *path) +load_msgcat(const char *path, const char *name, const char *lang) { struct stat st; - nl_catd catd; + nl_catd catd; + struct catentry *np; void *data; int fd; - /* XXX: path != NULL? */ + /* path/name will never be NULL here */ - if ((fd = _open(path, O_RDONLY)) == -1) - return (NLERR); + /* + * One more try in cache; if it was not found by name, + * it might still be found by absolute path. + */ + RLOCK(NLERR); + SLIST_FOREACH(np, &cache, list) { + if ((np->path != NULL) && (strcmp(np->path, path) == 0)) { + np->refcount++; + UNLOCK; + return (np->catd); + } + } + UNLOCK; + + if ((fd = _open(path, O_RDONLY)) == -1) { + SAVEFAIL(name, lang, errno); + NLRETERR(errno); + } if (_fstat(fd, &st) != 0) { _close(fd); - return (NLERR); + SAVEFAIL(name, lang, EFTYPE); + NLRETERR(EFTYPE); } - data = mmap(0, (size_t)st.st_size, PROT_READ, MAP_FILE|MAP_SHARED, fd, - (off_t)0); - _close(fd); + /* + * If the file size cannot be held in size_t we cannot mmap() + * it to the memory. Probably, this will not be a problem given + * that catalog files are usually small. + */ + if (st.st_size > SIZE_T_MAX) { + _close(fd); + SAVEFAIL(name, lang, EFBIG); + NLRETERR(EFBIG); + } - if (data == MAP_FAILED) - return (NLERR); + if ((data = mmap(0, (size_t)st.st_size, PROT_READ, + MAP_FILE|MAP_SHARED, fd, (off_t)0)) == MAP_FAILED) { + int saved_errno = errno; + _close(fd); + SAVEFAIL(name, lang, saved_errno); + NLRETERR(saved_errno); + } + _close(fd); if (ntohl((u_int32_t)((struct _nls_cat_hdr *)data)->__magic) != _NLS_MAGIC) { munmap(data, (size_t)st.st_size); - NLRETERR(EINVAL); + SAVEFAIL(name, lang, EFTYPE); + NLRETERR(EFTYPE); } if ((catd = malloc(sizeof (*catd))) == NULL) { munmap(data, (size_t)st.st_size); - return (NLERR); + SAVEFAIL(name, lang, ENOMEM); + NLRETERR(ENOMEM); } catd->__data = data; catd->__size = (int)st.st_size; + + /* Caching opened catalog */ + WLOCK(NLERR); + if ((np = malloc(sizeof(struct catentry))) != NULL) { + np->name = strdup(name); + np->path = strdup(path); + np->catd = catd; + np->lang = (lang == NULL) ? NULL : strdup(lang); + np->refcount = 1; + np->caterrno = 0; + SLIST_INSERT_HEAD(&cache, np, list); + } + UNLOCK; return (catd); } - From owner-svn-src-stable@FreeBSD.ORG Fri Sep 23 00:51:37 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81A921065673; Fri, 23 Sep 2011 00:51:37 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 56E528FC12; Fri, 23 Sep 2011 00:51:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8N0pbOG045996; Fri, 23 Sep 2011 00:51:37 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8N0pbV2045995; Fri, 23 Sep 2011 00:51:37 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201109230051.p8N0pbV2045995@svn.freebsd.org> From: Ken Smith Date: Fri, 23 Sep 2011 00:51:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-other@freebsd.org X-SVN-Group: stable-other MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225736 - stable/9 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2011 00:51:37 -0000 Author: kensmith Date: Fri Sep 23 00:51:37 2011 New Revision: 225736 URL: http://svn.freebsd.org/changeset/base/225736 Log: Copy head to stable/9 as part of 9.0-RELEASE release cycle. Approved by: re (implicit) Added: - copied from r225735, head/ Directory Properties: stable/9/ (props changed) From owner-svn-src-stable@FreeBSD.ORG Fri Sep 23 05:28:09 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1E4E106564A; Fri, 23 Sep 2011 05:28:09 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE57D8FC15; Fri, 23 Sep 2011 05:28:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8N5S9hd056318; Fri, 23 Sep 2011 05:28:09 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8N5S90n056304; Fri, 23 Sep 2011 05:28:09 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201109230528.p8N5S90n056304@svn.freebsd.org> From: Lawrence Stewart Date: Fri, 23 Sep 2011 05:28:09 +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: r225738 - in stable/8: . share/man/man4 share/man/man7 share/man/man9 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2011 05:28:10 -0000 Author: lstewart Date: Fri Sep 23 05:28:09 2011 New Revision: 225738 URL: http://svn.freebsd.org/changeset/base/225738 Log: MFC r225583: Rename the cc.4 and cc.9 modular congestion control related man pages to mod_cc.4 and mod_cc.9 respectively to avoid any possible confusion with the cc.1 gcc man page. Update references to these man pages where required. Requested by: Grenville Armitage Added: stable/8/share/man/man4/mod_cc.4 - copied unchanged from r225583, head/share/man/man4/mod_cc.4 stable/8/share/man/man9/mod_cc.9 - copied unchanged from r225583, head/share/man/man9/mod_cc.9 Deleted: stable/8/share/man/man4/cc.4 stable/8/share/man/man9/cc.9 Modified: stable/8/ObsoleteFiles.inc (contents, props changed) stable/8/share/man/man4/Makefile stable/8/share/man/man4/cc_chd.4 stable/8/share/man/man4/cc_cubic.4 stable/8/share/man/man4/cc_hd.4 stable/8/share/man/man4/cc_htcp.4 stable/8/share/man/man4/cc_newreno.4 stable/8/share/man/man4/cc_vegas.4 stable/8/share/man/man4/h_ertt.4 stable/8/share/man/man4/tcp.4 stable/8/share/man/man9/Makefile Directory Properties: stable/8/ (props changed) stable/8/COPYRIGHT (props changed) stable/8/LOCKS (props changed) stable/8/MAINTAINERS (props changed) stable/8/Makefile (props changed) stable/8/Makefile.inc1 (props changed) stable/8/README (props changed) stable/8/UPDATING (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/man7/ports.7 (props changed) stable/8/share/man/man8/ (props changed) stable/8/share/man/man9/ (props changed) Modified: stable/8/ObsoleteFiles.inc ============================================================================== --- stable/8/ObsoleteFiles.inc Fri Sep 23 02:58:59 2011 (r225737) +++ stable/8/ObsoleteFiles.inc Fri Sep 23 05:28:09 2011 (r225738) @@ -14,6 +14,9 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20110915: rename congestion control manpages +OLD_FILES+=usr/share/man/man4/cc.4.gz +OLD_FILES+=usr/share/man/man9/cc.9.gz # 20101123: removed subblock.h from liblzma OLD_FILES+=usr/include/lzma/subblock.h # 20101114: Remove long-obsolete MAKEDEV.8 Modified: stable/8/share/man/man4/Makefile ============================================================================== --- stable/8/share/man/man4/Makefile Fri Sep 23 02:58:59 2011 (r225737) +++ stable/8/share/man/man4/Makefile Fri Sep 23 05:28:09 2011 (r225738) @@ -67,7 +67,6 @@ MAN= aac.4 \ cardbus.4 \ carp.4 \ cas.4 \ - cc.4 \ cc_chd.4 \ cc_cubic.4 \ cc_hd.4 \ @@ -225,6 +224,8 @@ MAN= aac.4 \ mmc.4 \ mmcsd.4 \ mn.4 \ + mod_cc.4 \ + mos.4 \ mouse.4 \ mps.4 \ mpt.4 \ Modified: stable/8/share/man/man4/cc_chd.4 ============================================================================== --- stable/8/share/man/man4/cc_chd.4 Fri Sep 23 02:58:59 2011 (r225737) +++ stable/8/share/man/man4/cc_chd.4 Fri Sep 23 05:28:09 2011 (r225738) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 15, 2011 +.Dd September 15, 2011 .Dt CC_CHD 4 .Os .Sh NAME @@ -86,16 +86,16 @@ is used. Default is 1. .El .Sh SEE ALSO -.Xr cc 4 , .Xr cc_cubic 4 , .Xr cc_hd 4 , .Xr cc_htcp 4 , .Xr cc_newreno 4 , .Xr cc_vegas 4 , .Xr h_ertt 4 , +.Xr mod_cc 4 , .Xr tcp 4 , -.Xr cc 9 , -.Xr khelp 9 +.Xr khelp 9 , +.Xr mod_cc 9 .Rs .%A "D. A. Hayes" .%A "G. Armitage" Modified: stable/8/share/man/man4/cc_cubic.4 ============================================================================== --- stable/8/share/man/man4/cc_cubic.4 Fri Sep 23 02:58:59 2011 (r225737) +++ stable/8/share/man/man4/cc_cubic.4 Fri Sep 23 05:28:09 2011 (r225738) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 15, 2011 +.Dd September 15, 2011 .Dt CC_CUBIC 4 .Os .Sh NAME @@ -62,14 +62,14 @@ section below. .Sh MIB Variables There are currently no tunable MIB variables. .Sh SEE ALSO -.Xr cc 4 , .Xr cc_chd 4 , .Xr cc_hd 4 , .Xr cc_htcp 4 , .Xr cc_newreno 4 , .Xr cc_vegas 4 , +.Xr mod_cc 4 , .Xr tcp 4 , -.Xr cc 9 +.Xr mod_cc 9 .Rs .%A "Sangtae Ha" .%A "Injong Rhee" Modified: stable/8/share/man/man4/cc_hd.4 ============================================================================== --- stable/8/share/man/man4/cc_hd.4 Fri Sep 23 02:58:59 2011 (r225737) +++ stable/8/share/man/man4/cc_hd.4 Fri Sep 23 05:28:09 2011 (r225738) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 15, 2011 +.Dd September 15, 2011 .Dt CC_HD 4 .Os .Sh NAME @@ -69,16 +69,16 @@ Minimum queuing delay threshold (qmin) i Default is 5. .El .Sh SEE ALSO -.Xr cc 4 , .Xr cc_chd 4 , .Xr cc_cubic 4 , .Xr cc_htcp 4 , .Xr cc_newreno 4 , .Xr cc_vegas 4 , .Xr h_ertt 4 , +.Xr mod_cc 4 , .Xr tcp 4 , -.Xr cc 9 , -.Xr khelp 9 +.Xr khelp 9 , +.Xr mod_cc 9 .Rs .%A "L. Budzisz" .%A "R. Stanojevic" Modified: stable/8/share/man/man4/cc_htcp.4 ============================================================================== --- stable/8/share/man/man4/cc_htcp.4 Fri Sep 23 02:58:59 2011 (r225737) +++ stable/8/share/man/man4/cc_htcp.4 Fri Sep 23 05:28:09 2011 (r225738) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 15, 2011 +.Dd September 15, 2011 .Dt CC_HTCP 4 .Os .Sh NAME @@ -69,14 +69,14 @@ window increase during congestion avoida Default is 0 (disabled). .El .Sh SEE ALSO -.Xr cc 4 , .Xr cc_chd 4 , .Xr cc_cubic 4 , .Xr cc_hd 4 , .Xr cc_newreno 4 , .Xr cc_vegas 4 , +.Xr mod_cc 4 , .Xr tcp 4 , -.Xr cc 9 +.Xr mod_cc 9 .Rs .%A "D. Leith" .%A "R. Shorten" Modified: stable/8/share/man/man4/cc_newreno.4 ============================================================================== --- stable/8/share/man/man4/cc_newreno.4 Fri Sep 23 02:58:59 2011 (r225737) +++ stable/8/share/man/man4/cc_newreno.4 Fri Sep 23 05:28:09 2011 (r225738) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 15, 2011 +.Dd September 15, 2011 .Dt CC_NEWRENO 4 .Os .Sh NAME @@ -42,14 +42,14 @@ Details about the algorithm can be found .Sh MIB Variables There are currently no tunable MIB variables. .Sh SEE ALSO -.Xr cc 4 , .Xr cc_chd 4 , .Xr cc_cubic 4 , .Xr cc_hd 4 , .Xr cc_htcp 4 , .Xr cc_vegas 4 , +.Xr mod_cc 4 , .Xr tcp 4 , -.Xr cc 9 +.Xr mod_cc 9 .Sh ACKNOWLEDGEMENTS Development and testing of this software were made possible in part by grants from the FreeBSD Foundation and Cisco University Research Program Fund at Modified: stable/8/share/man/man4/cc_vegas.4 ============================================================================== --- stable/8/share/man/man4/cc_vegas.4 Fri Sep 23 02:58:59 2011 (r225737) +++ stable/8/share/man/man4/cc_vegas.4 Fri Sep 23 05:28:09 2011 (r225738) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 15, 2011 +.Dd September 15, 2011 .Dt CC_VEGAS 4 .Os .Sh NAME @@ -94,16 +94,16 @@ When setting beta, the value must satisf Default is 3. .El .Sh SEE ALSO -.Xr cc 4 , .Xr cc_chd 4 , .Xr cc_cubic 4 , .Xr cc_hd 4 , .Xr cc_htcp 4 , .Xr cc_newreno 4 , .Xr h_ertt 4 , +.Xr mod_cc 4 , .Xr tcp 4 , -.Xr cc 9 , -.Xr khelp 9 +.Xr khelp 9 , +.Xr mod_cc 9 .Rs .%A "L. S. Brakmo" .%A "L. L. Peterson" Modified: stable/8/share/man/man4/h_ertt.4 ============================================================================== --- stable/8/share/man/man4/h_ertt.4 Fri Sep 23 02:58:59 2011 (r225737) +++ stable/8/share/man/man4/h_ertt.4 Fri Sep 23 05:28:09 2011 (r225738) @@ -108,10 +108,10 @@ consumers to unset the flag if they wish new measurements. .El .Sh SEE ALSO -.Xr cc 4 , .Xr cc_chd 4 , .Xr cc_hd 4 , .Xr cc_vegas 4 , +.Xr mod_cc 4 , .Xr hhook 9 , .Xr khelp 9 .Sh ACKNOWLEDGEMENTS Copied: stable/8/share/man/man4/mod_cc.4 (from r225583, head/share/man/man4/mod_cc.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/share/man/man4/mod_cc.4 Fri Sep 23 05:28:09 2011 (r225738, copy of r225583, head/share/man/man4/mod_cc.4) @@ -0,0 +1,117 @@ +.\" +.\" Copyright (c) 2010-2011 The FreeBSD Foundation +.\" All rights reserved. +.\" +.\" This documentation was written at the Centre for Advanced Internet +.\" Architectures, Swinburne University of Technology, Melbourne, Australia by +.\" David Hayes and Lawrence Stewart under sponsorship from the FreeBSD +.\" Foundation. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR +.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd September 15, 2011 +.Dt MOD_CC 4 +.Os +.Sh NAME +.Nm mod_cc +.Nd Modular congestion control +.Sh DESCRIPTION +The modular congestion control framework allows the TCP implementation to +dynamically change the congestion control algorithm used by new and existing +connections. +Algorithms are identified by a unique +.Xr ascii 7 +name. +Algorithm modules can be compiled into the kernel or loaded as kernel modules +using the +.Xr kld 4 +facility. +.Pp +The default algorithm is NewReno, and all connections use the default unless +explicitly overridden using the TCP_CONGESTION socket option (see +.Xr tcp 4 +for details). +The default can be changed using a +.Xr sysctl 3 +MIB variable detailed in the +.Sx MIB Variables +section below. +.Sh MIB Variables +The framework exposes the following variables in the +.Va net.inet.tcp.cc +branch of the +.Xr sysctl 3 +MIB: +.Bl -tag -width ".Va available" +.It Va available +Read-only list of currently available congestion control algorithms by name. +.It Va algorithm +Returns the current default congestion control algorithm when read, and changes +the default when set. +When attempting to change the default algorithm, this variable should be set to +one of the names listed by the +.Va net.inet.tcp.cc.available +MIB variable. +.El +.Sh SEE ALSO +.Xr cc_chd 4 , +.Xr cc_cubic 4 , +.Xr cc_hd 4 , +.Xr cc_htcp 4 , +.Xr cc_newreno 4 , +.Xr cc_vegas 4 , +.Xr tcp 4 , +.Xr mod_cc 9 +.Sh ACKNOWLEDGEMENTS +Development and testing of this software were made possible in part by grants +from the FreeBSD Foundation and Cisco University Research Program Fund at +Community Foundation Silicon Valley. +.Sh HISTORY +The +.Nm +modular congestion control framework first appeared in +.Fx 9.0 . +.Pp +The framework was first released in 2007 by James Healy and Lawrence Stewart +whilst working on the NewTCP research project at Swinburne University of +Technology's Centre for Advanced Internet Architectures, Melbourne, Australia, +which was made possible in part by a grant from the Cisco University Research +Program Fund at Community Foundation Silicon Valley. +More details are available at: +.Pp +http://caia.swin.edu.au/urp/newtcp/ +.Sh AUTHORS +.An -nosplit +The +.Nm +facility was written by +.An Lawrence Stewart Aq lstewart@FreeBSD.org , +.An James Healy Aq jimmy@deefa.com +and +.An David Hayes Aq david.hayes@ieee.org . +.Pp +This manual page was written by +.An David Hayes Aq david.hayes@ieee.org +and +.An Lawrence Stewart Aq lstewart@FreeBSD.org . Modified: stable/8/share/man/man4/tcp.4 ============================================================================== --- stable/8/share/man/man4/tcp.4 Fri Sep 23 02:58:59 2011 (r225737) +++ stable/8/share/man/man4/tcp.4 Fri Sep 23 05:28:09 2011 (r225738) @@ -38,7 +38,7 @@ .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd February 15, 2011 +.Dd September 15, 2011 .Dt TCP 4 .Os .Sh NAME @@ -144,7 +144,7 @@ bandwidth-controlled window space. Select or query the congestion control algorithm that TCP will use for the connection. See -.Xr cc 4 +.Xr mod_cc 4 for details. .It Dv TCP_NODELAY Under most circumstances, @@ -249,7 +249,7 @@ The default congestion control algorithm is .Xr cc_newreno 4 . Other congestion control algorithms can be made available using the -.Xr cc 4 +.Xr mod_cc 4 framework. .Ss MIB Variables The @@ -576,10 +576,10 @@ address. .Xr socket 2 , .Xr sysctl 3 , .Xr blackhole 4 , -.Xr cc 4 , .Xr inet 4 , .Xr intro 4 , .Xr ip 4 , +.Xr mod_cc 4 , .Xr syncache 4 , .Xr setkey 8 .Rs Modified: stable/8/share/man/man9/Makefile ============================================================================== --- stable/8/share/man/man9/Makefile Fri Sep 23 02:58:59 2011 (r225737) +++ stable/8/share/man/man9/Makefile Fri Sep 23 05:28:09 2011 (r225738) @@ -44,7 +44,6 @@ MAN= accept_filter.9 \ BUS_SETUP_INTR.9 \ bus_space.9 \ byteorder.9 \ - cc.9 \ cd.9 \ condvar.9 \ config_intrhook.9 \ @@ -170,6 +169,7 @@ MAN= accept_filter.9 \ microtime.9 \ microuptime.9 \ mi_switch.9 \ + mod_cc.9 \ module.9 \ MODULE_DEPEND.9 \ MODULE_VERSION.9 \ Copied: stable/8/share/man/man9/mod_cc.9 (from r225583, head/share/man/man9/mod_cc.9) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/share/man/man9/mod_cc.9 Fri Sep 23 05:28:09 2011 (r225738, copy of r225583, head/share/man/man9/mod_cc.9) @@ -0,0 +1,333 @@ +.\" +.\" Copyright (c) 2008-2009 Lawrence Stewart +.\" Copyright (c) 2010-2011 The FreeBSD Foundation +.\" All rights reserved. +.\" +.\" Portions of this documentation were written at the Centre for Advanced +.\" Internet Architectures, Swinburne University of Technology, Melbourne, +.\" Australia by David Hayes and Lawrence Stewart under sponsorship from the +.\" FreeBSD Foundation. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR +.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd September 15, 2011 +.Dt MOD_CC 9 +.Os +.Sh NAME +.Nm mod_cc , +.Nm DECLARE_CC_MODULE , +.Nm CC_VAR +.Nd Modular Congestion Control +.Sh SYNOPSIS +.In netinet/cc.h +.In netinet/cc/cc_module.h +.Fn DECLARE_CC_MODULE "ccname" "ccalgo" +.Fn CC_VAR "ccv" "what" +.Sh DESCRIPTION +The +.Nm +framework allows congestion control algorithms to be implemented as dynamically +loadable kernel modules via the +.Xr kld 4 +facility. +Transport protocols can select from the list of available algorithms on a +connection-by-connection basis, or use the system default (see +.Xr mod_cc 4 +for more details). +.Pp +.Nm +modules are identified by an +.Xr ascii 7 +name and set of hook functions encapsulated in a +.Vt "struct cc_algo" , +which has the following members: +.Bd -literal -offset indent +struct cc_algo { + char name[TCP_CA_NAME_MAX]; + int (*mod_init) (void); + int (*mod_destroy) (void); + int (*cb_init) (struct cc_var *ccv); + void (*cb_destroy) (struct cc_var *ccv); + void (*conn_init) (struct cc_var *ccv); + void (*ack_received) (struct cc_var *ccv, uint16_t type); + void (*cong_signal) (struct cc_var *ccv, uint32_t type); + void (*post_recovery) (struct cc_var *ccv); + void (*after_idle) (struct cc_var *ccv); +}; +.Ed +.Pp +The +.Va name +field identifies the unique name of the algorithm, and should be no longer than +TCP_CA_NAME_MAX-1 characters in length (the TCP_CA_NAME_MAX define lives in +.In netinet/tcp.h +for compatibility reasons). +.Pp +The +.Va mod_init +function is called when a new module is loaded into the system but before the +registration process is complete. +It should be implemented if a module needs to set up some global state prior to +being available for use by new connections. +Returning a non-zero value from +.Va mod_init +will cause the loading of the module to fail. +.Pp +The +.Va mod_destroy +function is called prior to unloading an existing module from the kernel. +It should be implemented if a module needs to clean up any global state before +being removed from the kernel. +The return value is currently ignored. +.Pp +The +.Va cb_init +function is called when a TCP control block +.Vt struct tcpcb +is created. +It should be implemented if a module needs to allocate memory for storing +private per-connection state. +Returning a non-zero value from +.Va cb_init +will cause the connection set up to be aborted, terminating the connection as a +result. +.Pp +The +.Va cb_destroy +function is called when a TCP control block +.Vt struct tcpcb +is destroyed. +It should be implemented if a module needs to free memory allocated in +.Va cb_init . +.Pp +The +.Va conn_init +function is called when a new connection has been established and variables are +being initialised. +It should be implemented to initialise congestion control algorithm variables +for the newly established connection. +.Pp +The +.Va ack_received +function is called when a TCP acknowledgement (ACK) packet is received. +Modules use the +.Fa type +argument as an input to their congestion management algorithms. +The ACK types currently reported by the stack are CC_ACK and CC_DUPACK. +CC_ACK indicates the received ACK acknowledges previously unacknowledged data. +CC_DUPACK indicates the received ACK acknowledges data we have already received +an ACK for. +.Pp +The +.Va cong_signal +function is called when a congestion event is detected by the TCP stack. +Modules use the +.Fa type +argument as an input to their congestion management algorithms. +The congestion event types currently reported by the stack are CC_ECN, CC_RTO, +CC_RTO_ERR and CC_NDUPACK. +CC_ECN is reported when the TCP stack receives an explicit congestion notification +(RFC3168). +CC_RTO is reported when the retransmission time out timer fires. +CC_RTO_ERR is reported if the retransmission time out timer fired in error. +CC_NDUPACK is reported if N duplicate ACKs have been received back-to-back, +where N is the fast retransmit duplicate ack threshold (N=3 currently as per +RFC5681). +.Pp +The +.Va post_recovery +function is called after the TCP connection has recovered from a congestion event. +It should be implemented to adjust state as required. +.Pp +The +.Va after_idle +function is called when data transfer resumes after an idle period. +It should be implemented to adjust state as required. +.Pp +The +.Fn DECLARE_CC_MODULE +macro provides a convenient wrapper around the +.Xr DECLARE_MODULE 9 +macro, and is used to register a +.Nm +module with the +.Nm +framework. +The +.Fa ccname +argument specifies the module's name. +The +.Fa ccalgo +argument points to the module's +.Vt struct cc_algo . +.Pp +.Nm +modules must instantiate a +.Vt struct cc_algo , +but are only required to set the name field, and optionally any of the function +pointers. +The stack will skip calling any function pointer which is NULL, so there is no +requirement to implement any of the function pointers. +Using the C99 designated initialiser feature to set fields is encouraged. +.Pp +Each function pointer which deals with congestion control state is passed a +pointer to a +.Vt struct cc_var , +which has the following members: +.Bd -literal -offset indent +struct cc_var { + void *cc_data; + int bytes_this_ack; + tcp_seq curack; + uint32_t flags; + int type; + union ccv_container { + struct tcpcb *tcp; + struct sctp_nets *sctp; + } ccvc; +}; +.Ed +.Pp +.Vt struct cc_var +groups congestion control related variables into a single, embeddable structure +and adds a layer of indirection to accessing transport protocol control blocks. +The eventual goal is to allow a single set of +.Nm +modules to be shared between all congestion aware transport protocols, though +currently only +.Xr tcp 4 +is supported. +.Pp +To aid the eventual transition towards this goal, direct use of variables from +the transport protocol's data structures is strongly discouraged. +However, it is inevitable at the current time to require access to some of these +variables, and so the +.Fn CC_VAR +macro exists as a convenience accessor. +The +.Fa ccv +argument points to the +.Vt struct cc_var +passed into the function by the +.Nm +framework. +The +.Fa what +argument specifies the name of the variable to access. +.Pp +Apart from the +.Va type +and +.Va ccv_container +fields, the remaining fields in +.Vt struct cc_var +are for use by +.Nm +modules. +.Pp +The +.Va cc_data +field is available for algorithms requiring additional per-connection state to +attach a dynamic memory pointer to. +The memory should be allocated and attached in the module's +.Va cb_init +hook function. +.Pp +The +.Va bytes_this_ack +field specifies the number of new bytes acknowledged by the most recently +received ACK packet. +It is only valid in the +.Va ack_received +hook function. +.Pp +The +.Va curack +field specifies the sequence number of the most recently received ACK packet. +It is only valid in the +.Va ack_received , +.Va cong_signal +and +.Va post_recovery +hook functions. +.Pp +The +.Va flags +field is used to pass useful information from the stack to a +.Nm +module. +The CCF_ABC_SENTAWND flag is relevant in +.Va ack_received +and is set when appropriate byte counting (RFC3465) has counted a window's worth +of bytes has been sent. +It is the module's responsibility to clear the flag after it has processed the +signal. +The CCF_CWND_LIMITED flag is relevant in +.Va ack_received +and is set when the connection's ability to send data is currently constrained +by the value of the congestion window. +Algorithms should use the abscence of this flag being set to avoid accumulating +a large difference between the congestion window and send window. +.Sh SEE ALSO +.Xr cc_chd 4 , +.Xr cc_cubic 4 , +.Xr cc_hd 4 , +.Xr cc_htcp 4 , +.Xr cc_newreno 4 , +.Xr cc_vegas 4 , +.Xr mod_cc 4 , +.Xr tcp 4 +.Sh ACKNOWLEDGEMENTS +Development and testing of this software were made possible in part by grants +from the FreeBSD Foundation and Cisco University Research Program Fund at +Community Foundation Silicon Valley. +.Sh FUTURE WORK +Integrate with +.Xr sctp 4 . +.Sh HISTORY +The modular Congestion Control (CC) framework first appeared in +.Fx 9.0 . +.Pp +The framework was first released in 2007 by James Healy and Lawrence Stewart +whilst working on the NewTCP research project at Swinburne University of +Technology's Centre for Advanced Internet Architectures, Melbourne, Australia, +which was made possible in part by a grant from the Cisco University Research +Program Fund at Community Foundation Silicon Valley. +More details are available at: +.Pp +http://caia.swin.edu.au/urp/newtcp/ +.Sh AUTHORS +.An -nosplit +The +.Nm +framework was written by +.An Lawrence Stewart Aq lstewart@FreeBSD.org , +.An James Healy Aq jimmy@deefa.com +and +.An David Hayes Aq david.hayes@ieee.org . +.Pp +This manual page was written by +.An David Hayes Aq david.hayes@ieee.org +and +.An Lawrence Stewart Aq lstewart@FreeBSD.org . From owner-svn-src-stable@FreeBSD.ORG Fri Sep 23 05:35:24 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CACE1065670; Fri, 23 Sep 2011 05:35:24 +0000 (UTC) (envelope-from lstewart@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8BF028FC08; Fri, 23 Sep 2011 05:35:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8N5ZOt4056583; Fri, 23 Sep 2011 05:35:24 GMT (envelope-from lstewart@svn.freebsd.org) Received: (from lstewart@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8N5ZOuc056581; Fri, 23 Sep 2011 05:35:24 GMT (envelope-from lstewart@svn.freebsd.org) Message-Id: <201109230535.p8N5ZOuc056581@svn.freebsd.org> From: Lawrence Stewart Date: Fri, 23 Sep 2011 05:35: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: r225739 - stable/8/share/man/man4 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2011 05:35:24 -0000 Author: lstewart Date: Fri Sep 23 05:35:24 2011 New Revision: 225739 URL: http://svn.freebsd.org/changeset/base/225739 Log: Follow up to r225738 to fix the mismerge of share/man/man4/Makefile. This is an intentional direct commit to the 8-STABLE branch. Modified: stable/8/share/man/man4/Makefile Modified: stable/8/share/man/man4/Makefile ============================================================================== --- stable/8/share/man/man4/Makefile Fri Sep 23 05:28:09 2011 (r225738) +++ stable/8/share/man/man4/Makefile Fri Sep 23 05:35:24 2011 (r225739) @@ -225,7 +225,6 @@ MAN= aac.4 \ mmcsd.4 \ mn.4 \ mod_cc.4 \ - mos.4 \ mouse.4 \ mps.4 \ mpt.4 \ From owner-svn-src-stable@FreeBSD.ORG Fri Sep 23 16:37:29 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0132C106564A; Fri, 23 Sep 2011 16:37:29 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E4EE78FC0A; Fri, 23 Sep 2011 16:37:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8NGbSQp079917; Fri, 23 Sep 2011 16:37:28 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8NGbSbl079915; Fri, 23 Sep 2011 16:37:28 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201109231637.p8NGbSbl079915@svn.freebsd.org> From: Ken Smith Date: Fri, 23 Sep 2011 16:37:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-other@freebsd.org X-SVN-Group: stable-other MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225744 - stable/9/sys/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2011 16:37:29 -0000 Author: kensmith Date: Fri Sep 23 16:37:28 2011 New Revision: 225744 URL: http://svn.freebsd.org/changeset/base/225744 Log: Ready for BETA3. Approved by: re (implicit) Modified: stable/9/sys/conf/newvers.sh Modified: stable/9/sys/conf/newvers.sh ============================================================================== --- stable/9/sys/conf/newvers.sh Fri Sep 23 15:36:52 2011 (r225743) +++ stable/9/sys/conf/newvers.sh Fri Sep 23 16:37:28 2011 (r225744) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="9.0" -BRANCH="BETA2" +BRANCH="BETA3" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi