From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 03:15:05 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 776B21065690; Sun, 23 Aug 2009 03:15:05 +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 6698E8FC08; Sun, 23 Aug 2009 03:15:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N3F5QT044834; Sun, 23 Aug 2009 03:15:05 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N3F5lv044833; Sun, 23 Aug 2009 03:15:05 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200908230315.n7N3F5lv044833@svn.freebsd.org> From: Ken Smith Date: Sun, 23 Aug 2009 03:15:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196433 - svnadmin/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 03:15:05 -0000 Author: kensmith Date: Sun Aug 23 03:15:04 2009 New Revision: 196433 URL: http://svn.freebsd.org/changeset/base/196433 Log: Open head for "normal" (conservative until 8.0 gets out please!) commit activity. Approved by: core (implicit) Modified: svnadmin/conf/approvers Modified: svnadmin/conf/approvers ============================================================================== --- svnadmin/conf/approvers Sat Aug 22 23:44:37 2009 (r196432) +++ svnadmin/conf/approvers Sun Aug 23 03:15:04 2009 (r196433) @@ -16,7 +16,7 @@ # # $FreeBSD$ # -^head/ re +#^head/ re ^stable/8/ re #^stable/7/ re ^releng/7.[0-2]/ (security-officer|so) From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 05:42:51 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D386106568C; Sun, 23 Aug 2009 05:42:51 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C48C8FC12; Sun, 23 Aug 2009 05:42:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N5goMO047842; Sun, 23 Aug 2009 05:42:50 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N5goM5047840; Sun, 23 Aug 2009 05:42:50 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200908230542.n7N5goM5047840@svn.freebsd.org> From: Doug Barton Date: Sun, 23 Aug 2009 05:42:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196434 - head/release/scripts X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 05:42:51 -0000 Author: dougb Date: Sun Aug 23 05:42:50 2009 New Revision: 196434 URL: http://svn.freebsd.org/changeset/base/196434 Log: Add a script to create the /var/db/mergemaster.mtree file for new releases so that when users subsequently update their source trees they can make use of mergemaster's -U option. Added: head/release/scripts/mm-mtree.sh (contents, props changed) Added: head/release/scripts/mm-mtree.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/release/scripts/mm-mtree.sh Sun Aug 23 05:42:50 2009 (r196434) @@ -0,0 +1,155 @@ +#!/bin/sh + +# mergemaster mtree database generator + +# This script is intended to be used as part of the release building +# process to generate the /var/db/mergemaster.mtree file relevant to +# the source tree used to create the release so that users can make +# use of mergemaster's -U option to update their files after csup'ing +# to -stable. + +# Copyright 2009 Douglas Barton +# dougb@FreeBSD.org + +# $FreeBSD$ + +PATH=/bin:/usr/bin:/usr/sbin + +display_usage () { + VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4` + echo "${0##*/} version ${VERSION_NUMBER}" + echo "Usage: ${0##*/} [-m /path] [-t /path] [-A arch] [-F ] [-D /path]" + echo "Options:" + echo " -m /path/directory Specify location of source to do the make in" + echo " -t /path/directory Specify temp root directory" + echo " -A architecture Alternative architecture name to pass to make" + echo " -F Specify what to put on the make command line" + echo ' -D /path/directory Specify the destination directory to install files to' + echo '' +} + +# Set the default path for the temporary root environment +# +TEMPROOT='/var/tmp/temproot' + +# Assign the location of the mtree database +# +MTREEDB=${MTREEDB:-/var/db} +MTREEFILE="${MTREEDB}/mergemaster.mtree" + +# Check the command line options +# +while getopts "m:t:A:F:D:h" COMMAND_LINE_ARGUMENT ; do + case "${COMMAND_LINE_ARGUMENT}" in + m) + SOURCEDIR=${OPTARG} + ;; + t) + TEMPROOT=${OPTARG} + ;; + A) + ARCHSTRING='TARGET_ARCH='${OPTARG} + ;; + F) + MM_MAKE_ARGS="${OPTARG}" + ;; + D) + DESTDIR=${OPTARG} + ;; + h) + display_usage + exit 0 + ;; + *) + echo '' + display_usage + exit 1 + ;; + esac +done + +# Assign the source directory +# +SOURCEDIR=${SOURCEDIR:-/usr/src} +if [ ! -f ${SOURCEDIR}/Makefile.inc1 -a \ + -f ${SOURCEDIR}/../Makefile.inc1 ]; then + echo " *** The source directory you specified (${SOURCEDIR})" + echo " will be reset to ${SOURCEDIR}/.." + echo '' + sleep 3 + SOURCEDIR=${SOURCEDIR}/.. +fi + +# Setup make to use system files from SOURCEDIR +MM_MAKE="make ${ARCHSTRING} ${MM_MAKE_ARGS} -m ${SOURCEDIR}/share/mk" + +delete_temproot () { + rm -rf "${TEMPROOT}" 2>/dev/null + chflags -R 0 "${TEMPROOT}" 2>/dev/null + rm -rf "${TEMPROOT}" || exit 1 +} + +[ -d "${TEMPROOT}" ] && delete_temproot + +echo "*** Creating the temporary root environment in ${TEMPROOT}" + +if mkdir -p "${TEMPROOT}"; then + echo " *** ${TEMPROOT} ready for use" +fi + +if [ ! -d "${TEMPROOT}" ]; then + echo '' + echo " *** FATAL ERROR: Cannot create ${TEMPROOT}" + echo '' + exit 1 +fi + +echo " *** Creating and populating directory structure in ${TEMPROOT}" +echo '' + +{ cd ${SOURCEDIR} || { echo "*** Cannot cd to ${SOURCEDIR}" ; exit 1;} + case "${DESTDIR}" in + '') ;; + *) + ${MM_MAKE} DESTDIR=${DESTDIR} distrib-dirs + ;; + esac + od=${TEMPROOT}/usr/obj + ${MM_MAKE} DESTDIR=${TEMPROOT} distrib-dirs && + MAKEOBJDIRPREFIX=$od ${MM_MAKE} _obj SUBDIR_OVERRIDE=etc && + MAKEOBJDIRPREFIX=$od ${MM_MAKE} everything SUBDIR_OVERRIDE=etc && + MAKEOBJDIRPREFIX=$od ${MM_MAKE} DESTDIR=${TEMPROOT} distribution;} || + { echo ''; + echo " *** FATAL ERROR: Cannot 'cd' to ${SOURCEDIR} and install files to"; + echo " the temproot environment"; + echo ''; + exit 1;} + +# We really don't want to have to deal with files like login.conf.db, pwd.db, +# or spwd.db. Instead, we want to compare the text versions, and run *_mkdb. +# Prompt the user to do so below, as needed. +# +rm -f ${TEMPROOT}/etc/*.db ${TEMPROOT}/etc/passwd + +# We only need to compare things like freebsd.cf once +find ${TEMPROOT}/usr/obj -type f -delete 2>/dev/null + +# Delete stuff we do not need to keep the mtree database small, +# and to make the actual comparison faster. +find ${TEMPROOT}/usr -type l -delete 2>/dev/null +find ${TEMPROOT} -type f -size 0 -delete 2>/dev/null +find -d ${TEMPROOT} -type d -empty -delete 2>/dev/null + +# Build the mtree database in a temporary location. +MTREENEW=`mktemp -t mergemaster.mtree` +mtree -ci -p ${TEMPROOT} -k size,md5digest > ${MTREENEW} 2>/dev/null + +if [ -s "${MTREENEW}" ]; then + echo "*** Saving mtree database for future upgrades" + test -e "${DESTDIR}${MTREEFILE}" && unlink ${DESTDIR}${MTREEFILE} + mv ${MTREENEW} ${DESTDIR}${MTREEFILE} +fi + +delete_temproot + +exit 0 From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 05:45:38 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A16A3106568D; Sun, 23 Aug 2009 05:45:38 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 918118FC14; Sun, 23 Aug 2009 05:45:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N5jc9C047954; Sun, 23 Aug 2009 05:45:38 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N5jcpZ047952; Sun, 23 Aug 2009 05:45:38 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200908230545.n7N5jcpZ047952@svn.freebsd.org> From: Doug Barton Date: Sun, 23 Aug 2009 05:45:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196435 - head/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 05:45:38 -0000 Author: dougb Date: Sun Aug 23 05:45:38 2009 New Revision: 196435 URL: http://svn.freebsd.org/changeset/base/196435 Log: The svnversion string is only relevant when newvers.sh is called during the kernel build process, the other places that call the script do not make use of that information. So restrict execution of the svnversion-related code to the kernel build context. Modified: head/sys/conf/newvers.sh Modified: head/sys/conf/newvers.sh ============================================================================== --- head/sys/conf/newvers.sh Sun Aug 23 05:42:50 2009 (r196434) +++ head/sys/conf/newvers.sh Sun Aug 23 05:45:38 2009 (r196435) @@ -87,29 +87,25 @@ touch version v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date` i=`${MAKE:-make} -V KERN_IDENT` -for dir in /bin /usr/bin /usr/local/bin; do - if [ -x "${dir}/svnversion" ]; then - svnversion=${dir}/svnversion - SRCDIR=${d##*obj} - if [ -n "$MACHINE" ]; then - SRCDIR=${SRCDIR##/$MACHINE} +case "$d" in +*/sys/*) + for dir in /bin /usr/bin /usr/local/bin; do + if [ -x "${dir}/svnversion" ]; then + svnversion=${dir}/svnversion + SRCDIR=${d##*obj} + if [ -n "$MACHINE" ]; then + SRCDIR=${SRCDIR##/$MACHINE} + fi + SRCDIR=${SRCDIR%%/sys/*} + break fi - SRCDIR=${SRCDIR%%/sys/*} - break - fi -done + done -if [ -n "$svnversion" -a -d "${SRCDIR}/.svn" ] ; then - # If we are called from the kernel build, limit - # the scope of svnversion to sys/ . - if [ -e "${SRCDIR}/sys/conf/newvers.sh" ] ; then - svn=" r`cd $SRCDIR/sys && $svnversion`" - else - svn=" r`cd $SRCDIR && $svnversion`" + if [ -n "$svnversion" -a -d "${SRCDIR}/sys/.svn" ] ; then + svn=" r`cd ${SRCDIR}/sys && $svnversion`" fi -else - svn="" -fi + ;; +esac cat << EOF > vers.c $COPYRIGHT From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 05:47:19 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC89B106568C; Sun, 23 Aug 2009 05:47:19 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B2AB28FC0C; Sun, 23 Aug 2009 05:47:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N5lJA5048024; Sun, 23 Aug 2009 05:47:19 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N5lJN5048021; Sun, 23 Aug 2009 05:47:19 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200908230547.n7N5lJN5048021@svn.freebsd.org> From: Doug Barton Date: Sun, 23 Aug 2009 05:47:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196436 - in head/etc: . rc.d X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 05:47:20 -0000 Author: dougb Date: Sun Aug 23 05:47:19 2009 New Revision: 196436 URL: http://svn.freebsd.org/changeset/base/196436 Log: Move is_wired_interface() from rc.d/wpa_supplicant into network.subr, simplify it a bit, and make use of that method to determine if an interface is a candidate for IPv6 rtsol rather than listing all of the possible wireless interfaces that should _not_ get rtsol'ed. This change is only relevant for 8.0+ unless the "wlan mandatory" code gets ported back to RELENG_7. Modified: head/etc/network.subr head/etc/rc.d/wpa_supplicant Modified: head/etc/network.subr ============================================================================== --- head/etc/network.subr Sun Aug 23 05:45:38 2009 (r196435) +++ head/etc/network.subr Sun Aug 23 05:47:19 2009 (r196436) @@ -816,6 +816,17 @@ hexprint() echo ${str} } +is_wired_interface() +{ + local media + + case `ifconfig $1 2>/dev/null` in + *media:?Ethernet*) media=Ethernet ;; + esac + + test "$media" = "Ethernet" +} + # Setup the interfaces for IPv6 network6_interface_setup() { @@ -858,14 +869,19 @@ network6_interface_setup() ifconfig $i inet6 ${ipv6_ifconfig} alias fi + # Wireless NIC cards are virtualized through the wlan interface + if ! is_wired_interface ${i}; then + case "${i}" in + wlan*) rtsol_available=yes ;; + *) rtsol_available=no ;; + esac + fi + if [ ${rtsol_available} = yes -a ${rtsol_interface} = yes ] then case ${i} in lo0|gif[0-9]*|stf[0-9]*|faith[0-9]*|lp[0-9]*|sl[0-9]*|tun[0-9]*|pflog[0-9]*|pfsync[0-9]*) ;; - # Wireless NIC cards are virtualized through the wlan interface - an[0-9]*|ath[0-9]*|ipw[0-9]*|iwi[0-9]*|iwn[0-9]*|ral[0-9]*|wi[0-9]*|wl[0-9]*|wpi[0-9]*) - ;; *) rtsol_interfaces="${rtsol_interfaces} ${i}" ;; Modified: head/etc/rc.d/wpa_supplicant ============================================================================== --- head/etc/rc.d/wpa_supplicant Sun Aug 23 05:45:38 2009 (r196435) +++ head/etc/rc.d/wpa_supplicant Sun Aug 23 05:47:19 2009 (r196436) @@ -18,18 +18,6 @@ if [ -z "$ifn" ]; then return 1 fi -is_wired_interface() -{ - media=`ifconfig $1 2>/dev/null | while read line; do - case "$line" in - *media:?Ethernet*) - echo Ethernet - ;; - esac - done` - test "$media" = "Ethernet" -} - is_ndis_interface() { case `sysctl -n net.wlan.${1#wlan}.%parent 2>/dev/null` in From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 05:47:34 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5824D1065703; Sun, 23 Aug 2009 05:47:34 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E4318FC17; Sun, 23 Aug 2009 05:47:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N5lYOn048064; Sun, 23 Aug 2009 05:47:34 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N5lYro048060; Sun, 23 Aug 2009 05:47:34 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200908230547.n7N5lYro048060@svn.freebsd.org> From: Joseph Koshy Date: Sun, 23 Aug 2009 05:47:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196437 - head/lib/libpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 05:47:34 -0000 Author: jkoshy Date: Sun Aug 23 05:47:33 2009 New Revision: 196437 URL: http://svn.freebsd.org/changeset/base/196437 Log: Fix typos. Reported by: Harald Servat Modified: head/lib/libpmc/pmc.3 head/lib/libpmc/pmc.atom.3 head/lib/libpmc/pmc.core2.3 Modified: head/lib/libpmc/pmc.3 ============================================================================== --- head/lib/libpmc/pmc.3 Sun Aug 23 05:47:19 2009 (r196436) +++ head/lib/libpmc/pmc.3 Sun Aug 23 05:47:33 2009 (r196437) @@ -187,7 +187,7 @@ enumeration. Supported PMC kinds include: .Bl -tag -width "Li PMC_CLASS_IAF" -compact .It Li PMC_CLASS_IAF -Fixed function hardwre counters presents in CPUs conforming to the +Fixed function hardware counters presents in CPUs conforming to the .Tn Intel performance measurement architecture version 2 and later. .It Li PMC_CLASS_IAP Modified: head/lib/libpmc/pmc.atom.3 ============================================================================== --- head/lib/libpmc/pmc.atom.3 Sun Aug 23 05:47:19 2009 (r196436) +++ head/lib/libpmc/pmc.atom.3 Sun Aug 23 05:47:33 2009 (r196437) @@ -222,7 +222,7 @@ Measure CMP2S snoops. .Pp The default is to measure both snoops. .Ss Event Specifiers (Programmable PMCs) -Core2 programmable PMCs support the following events: +Atom programmable PMCs support the following events: .Bl -tag -width indent .It Li BACLEARS .Pq Event E6H , Umask 01H @@ -576,7 +576,7 @@ The number of transitions from floating instructions. .It Li HW_INT_RCV .Pq Event C8H , Umask 00H -The number of hardware interrupts recieved. +The number of hardware interrupts received. .It Li ICACHE.ACCESSES .Pq Event 80H , Umask 03H The number of instruction fetches. Modified: head/lib/libpmc/pmc.core2.3 ============================================================================== --- head/lib/libpmc/pmc.core2.3 Sun Aug 23 05:47:19 2009 (r196436) +++ head/lib/libpmc/pmc.core2.3 Sun Aug 23 05:47:33 2009 (r196437) @@ -544,7 +544,7 @@ The number of transitions from floating instructions. .It Li HW_INT_RCV .Pq Event C8H , Umask 00H -The number of hardware interrupts recieved. +The number of hardware interrupts received. .It Li IDLE_DURING_DIV .Pq Event 18H , Umask 00H The number of cycles the divider is busy and no other execution unit From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 05:49:12 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F523106568E; Sun, 23 Aug 2009 05:49:12 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F4FE8FC08; Sun, 23 Aug 2009 05:49:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N5nCco048132; Sun, 23 Aug 2009 05:49:12 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N5nCCS048130; Sun, 23 Aug 2009 05:49:12 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200908230549.n7N5nCCS048130@svn.freebsd.org> From: Joseph Koshy Date: Sun, 23 Aug 2009 05:49:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196438 - head/lib/libpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 05:49:12 -0000 Author: jkoshy Date: Sun Aug 23 05:49:12 2009 New Revision: 196438 URL: http://svn.freebsd.org/changeset/base/196438 Log: Fix a typo. Reported by: John McCullough Modified: head/lib/libpmc/pmc.3 Modified: head/lib/libpmc/pmc.3 ============================================================================== --- head/lib/libpmc/pmc.3 Sun Aug 23 05:47:33 2009 (r196437) +++ head/lib/libpmc/pmc.3 Sun Aug 23 05:49:12 2009 (r196438) @@ -423,7 +423,7 @@ The PMCs would then be started using fun .Fn pmc_start . .It Once started, the values of counting PMCs may be read using function -.Fn pmc_start . +.Fn pmc_read . For PMCs that write events to the log file, this logged data would be read and parsed using the .Xr pmclog 3 From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 05:53:21 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58FB4106568B; Sun, 23 Aug 2009 05:53:21 +0000 (UTC) (envelope-from juli@clockworksquid.com) Received: from mail-yw0-f202.google.com (mail-yw0-f202.google.com [209.85.211.202]) by mx1.freebsd.org (Postfix) with ESMTP id EDDBC8FC08; Sun, 23 Aug 2009 05:53:20 +0000 (UTC) Received: by ywh40 with SMTP id 40so2372100ywh.14 for ; Sat, 22 Aug 2009 22:53:20 -0700 (PDT) MIME-Version: 1.0 Sender: juli@clockworksquid.com Received: by 10.150.17.2 with SMTP id 2mr4238345ybq.334.1251006800238; Sat, 22 Aug 2009 22:53:20 -0700 (PDT) In-Reply-To: <200908230545.n7N5jcpZ047952@svn.freebsd.org> References: <200908230545.n7N5jcpZ047952@svn.freebsd.org> From: Juli Mallett Date: Sat, 22 Aug 2009 22:53:00 -0700 X-Google-Sender-Auth: a0006664ed71865e Message-ID: To: Doug Barton Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196435 - head/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 05:53:21 -0000 On Sat, Aug 22, 2009 at 22:45, Doug Barton wrote: > Author: dougb > Date: Sun Aug 23 05:45:38 2009 > New Revision: 196435 > URL: http://svn.freebsd.org/changeset/base/196435 > > Log: > =A0The svnversion string is only relevant when newvers.sh is called > =A0during the kernel build process, the other places that call the script > =A0do not make use of that information. So restrict execution of the > =A0svnversion-related code to the kernel build context. This seems to assume that the kernel is always checked out in a directory called 'sys', is that right? That isn't always true in my experience, and I have a bad habit of keeping multiple kernel trees checked out named things like 'sys-head', etc. I could be misreading the code, which gave only constructs I'm not very familiar with for determining whether it's being used for a kernel build. Is it harmful to include the svnversion stuff for other newvers.sh users? Could they just set an environment variable to indicate they want it excluded? Or could you check the environment for kernel build-related variables? Or even set a variable when running newvers.sh for the kernel to explicitly request svnversion inclusion? Juli. From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 05:56:54 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7D12106564A; Sun, 23 Aug 2009 05:56:54 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B79A58FC08; Sun, 23 Aug 2009 05:56:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N5usNG048314; Sun, 23 Aug 2009 05:56:54 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N5us81048312; Sun, 23 Aug 2009 05:56:54 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200908230556.n7N5us81048312@svn.freebsd.org> From: Doug Barton Date: Sun, 23 Aug 2009 05:56:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196439 - head/etc/rc.d X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 05:56:54 -0000 Author: dougb Date: Sun Aug 23 05:56:54 2009 New Revision: 196439 URL: http://svn.freebsd.org/changeset/base/196439 Log: Fix the typo mentioned in the PR, and one additional. Fix caps while I'm here. PR: conf/138087 Submitted by: Chris Petrik Modified: head/etc/rc.d/ipsec Modified: head/etc/rc.d/ipsec ============================================================================== --- head/etc/rc.d/ipsec Sun Aug 23 05:49:12 2009 (r196438) +++ head/etc/rc.d/ipsec Sun Aug 23 05:56:54 2009 (r196439) @@ -41,9 +41,9 @@ ipsec_stop() { echo "Clearing ipsec manual keys/policies." - # still not 100% sure if we would like to do this. - # it is very questionable to do this during shutdown session, since - # it can hang any of remaining IPv4/v6 session. + # Still not 100% sure if we would like to do this. + # It is very questionable to do this during shutdown session + # since it can hang any of the remaining IPv4/v6 sessions. # ${ipsec_program} -F ${ipsec_program} -FP From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 06:09:40 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9603106568F for ; Sun, 23 Aug 2009 06:09:40 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 66B2D8FC0C for ; Sun, 23 Aug 2009 06:09:40 +0000 (UTC) Received: (qmail 6602 invoked by uid 399); 23 Aug 2009 06:09:33 -0000 Received: from localhost (HELO foreign.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 23 Aug 2009 06:09:33 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4A90DD18.2030107@FreeBSD.org> Date: Sat, 22 Aug 2009 23:09:28 -0700 From: Doug Barton Organization: http://www.FreeBSD.org/ User-Agent: Thunderbird 2.0.0.23 (X11/20090822) MIME-Version: 1.0 To: Juli Mallett References: <200908230545.n7N5jcpZ047952@svn.freebsd.org> In-Reply-To: X-Enigmail-Version: 0.95.7 OpenPGP: id=D5B2F0FB Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196435 - head/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 06:09:40 -0000 Juli Mallett wrote: > On Sat, Aug 22, 2009 at 22:45, Doug Barton wrote: >> Author: dougb >> Date: Sun Aug 23 05:45:38 2009 >> New Revision: 196435 >> URL: http://svn.freebsd.org/changeset/base/196435 >> >> Log: >> The svnversion string is only relevant when newvers.sh is called >> during the kernel build process, the other places that call the script >> do not make use of that information. So restrict execution of the >> svnversion-related code to the kernel build context. > > This seems to assume that the kernel is always checked out in a > directory called 'sys', Yes, I think that's a reasonable assumption. > Is it harmful to include the svnversion stuff for other newvers.sh > users? There was whinging that it took a "long time" to run svnversion on the whole src tree, so a very badly formed patch was applied to try and conditionalize it for only running when the kernel is being built. This change will actually restrict it to when the kernel is being built in a directory called */sys/* which will actually work for the vast majority of FreeBSD users. > Could they just set an environment variable to indicate they > want it excluded? Or could you check the environment for kernel > build-related variables? Or even set a variable when running > newvers.sh for the kernel to explicitly request svnversion inclusion? Knock yourself out, I look forward to reviewing your patches. This very simple little item has already received WAY more hackery than it really merits. The only reason I made the change I did (after swearing off touching it again on the principle of trying to avoid getting bike shed paint all over my clothes) was that the patch that was applied previously was just plain silly. FWIW, your comments would have been a lot more timely if they had been in response to my posting this patch following the discussion on the topic in -current on 8/15. Given that I have received no comments on that post at all in the 7 days since posting the patch I felt it was more than reasonable to commit it tonight. Doug -- This .signature sanitized for your protection From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 06:19:02 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AC6B1065672; Sun, 23 Aug 2009 06:19:02 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A8988FC1E; Sun, 23 Aug 2009 06:19:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N6J2WU048751; Sun, 23 Aug 2009 06:19:02 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N6J2Wx048749; Sun, 23 Aug 2009 06:19:02 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200908230619.n7N6J2Wx048749@svn.freebsd.org> From: Joseph Koshy Date: Sun, 23 Aug 2009 06:19:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196440 - head/lib/libpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 06:19:02 -0000 Author: jkoshy Date: Sun Aug 23 06:19:02 2009 New Revision: 196440 URL: http://svn.freebsd.org/changeset/base/196440 Log: Correct grammar. Modified: head/lib/libpmc/pmc.3 Modified: head/lib/libpmc/pmc.3 ============================================================================== --- head/lib/libpmc/pmc.3 Sun Aug 23 05:56:54 2009 (r196439) +++ head/lib/libpmc/pmc.3 Sun Aug 23 06:19:02 2009 (r196440) @@ -120,7 +120,7 @@ Process scope sampling PMCs. Process scope counting PMCs that have been configured to report PMC readings on process context switches or process exits. .El -Upto one log file may be configured per owner process. +Up to one log file may be configured per owner process. Events logged to a log file may be subsequently analyzed using the .Xr pmclog 3 family of functions. @@ -262,7 +262,7 @@ CPU is running unprivileged code. The ability to write to performance counters. .El .Ss CPU Naming Conventions -CPUs are named using small integers from zero uptil, but +CPUs are named using small integers from zero until, but excluding, the value returned by function .Fn pmc_ncpu . On platforms supporting sparsely numbered CPUs not all the numbers in From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 06:22:31 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E259C106568C; Sun, 23 Aug 2009 06:22:31 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D23278FC0C; Sun, 23 Aug 2009 06:22:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N6MVwm048938; Sun, 23 Aug 2009 06:22:31 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N6MV7L048936; Sun, 23 Aug 2009 06:22:31 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200908230622.n7N6MV7L048936@svn.freebsd.org> From: Joseph Koshy Date: Sun, 23 Aug 2009 06:22:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196441 - head/lib/libpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 06:22:32 -0000 Author: jkoshy Date: Sun Aug 23 06:22:31 2009 New Revision: 196441 URL: http://svn.freebsd.org/changeset/base/196441 Log: Correct typos. Modified: head/lib/libpmc/pmc_read.3 Modified: head/lib/libpmc/pmc_read.3 ============================================================================== --- head/lib/libpmc/pmc_read.3 Sun Aug 23 06:19:02 2009 (r196440) +++ head/lib/libpmc/pmc_read.3 Sun Aug 23 06:22:31 2009 (r196441) @@ -30,7 +30,7 @@ .Nm pmc_read , .Nm pmc_rw , .Nm pmc_write , -.Nd read and write hardware performace counters +.Nd read and write hardware performance counters .Sh LIBRARY .Lb libpmc .Sh SYNOPSIS @@ -62,7 +62,7 @@ Function .Fn pmc_rw combines a read and a write into a single atomic operation. .Pp -For write operations the PMC should be a quiesced state. +For write operations the PMC should be a quiescent state. .Sh RETURN VALUES .Rv -std .Sh ERRORS From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 06:30:14 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E27151065691; Sun, 23 Aug 2009 06:30:14 +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 D22888FC13; Sun, 23 Aug 2009 06:30:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N6UE4Q049119; Sun, 23 Aug 2009 06:30:14 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N6UEaD049117; Sun, 23 Aug 2009 06:30:14 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200908230630.n7N6UEaD049117@svn.freebsd.org> From: Ken Smith Date: Sun, 23 Aug 2009 06:30:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196442 - head/etc/defaults X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 06:30:15 -0000 Author: kensmith Date: Sun Aug 23 06:30:14 2009 New Revision: 196442 URL: http://svn.freebsd.org/changeset/base/196442 Log: Update name of INDEX file as part of 8.0 -> 9.0 transition. Modified: head/etc/defaults/periodic.conf Modified: head/etc/defaults/periodic.conf ============================================================================== --- head/etc/defaults/periodic.conf Sun Aug 23 06:22:31 2009 (r196441) +++ head/etc/defaults/periodic.conf Sun Aug 23 06:30:14 2009 (r196442) @@ -224,7 +224,7 @@ weekly_noid_dirs="/" # Look here # 400.status-pkg weekly_status_pkg_enable="NO" # Find out-of-date pkgs pkg_version=pkg_version # Use this program -pkg_version_index=/usr/ports/INDEX-8 # Use this index file +pkg_version_index=/usr/ports/INDEX-9 # Use this index file # 999.local weekly_local="/etc/weekly.local" # Local scripts From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 06:33:42 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8529D106568D; Sun, 23 Aug 2009 06:33:42 +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 741AF8FC12; Sun, 23 Aug 2009 06:33:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N6XgXW049222; Sun, 23 Aug 2009 06:33:42 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N6Xg4a049220; Sun, 23 Aug 2009 06:33:42 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200908230633.n7N6Xg4a049220@svn.freebsd.org> From: Ken Smith Date: Sun, 23 Aug 2009 06:33:42 +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: r196443 - stable/8/share/examples/cvsup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 06:33:42 -0000 Author: kensmith Date: Sun Aug 23 06:33:42 2009 New Revision: 196443 URL: http://svn.freebsd.org/changeset/base/196443 Log: Update for RELENG_8. Reminded by: dougb Approved by: re (implicit) Modified: stable/8/share/examples/cvsup/stable-supfile Modified: stable/8/share/examples/cvsup/stable-supfile ============================================================================== --- stable/8/share/examples/cvsup/stable-supfile Sun Aug 23 06:30:14 2009 (r196442) +++ stable/8/share/examples/cvsup/stable-supfile Sun Aug 23 06:33:42 2009 (r196443) @@ -69,7 +69,7 @@ # The following line is for 7-stable. If you want 6-stable, 5-stable, # 4-stable, 3-stable, or 2.2-stable, change to "RELENG_6", "RELENG_5", # "RELENG_4", "RELENG_3", or "RELENG_2_2" respectively. -*default release=cvs tag=RELENG_7 +*default release=cvs tag=RELENG_8 *default delete use-rel-suffix # If you seem to be limited by CPU rather than network or disk bandwidth, try From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 07:24:39 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E733106568D; Sun, 23 Aug 2009 07:24:39 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5DD5A8FC12; Sun, 23 Aug 2009 07:24:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N7OdK6050257; Sun, 23 Aug 2009 07:24:39 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N7OdcJ050255; Sun, 23 Aug 2009 07:24:39 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200908230724.n7N7OdcJ050255@svn.freebsd.org> From: Joseph Koshy Date: Sun, 23 Aug 2009 07:24:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196445 - head/lib/libpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 07:24:39 -0000 Author: jkoshy Date: Sun Aug 23 07:24:39 2009 New Revision: 196445 URL: http://svn.freebsd.org/changeset/base/196445 Log: Fix typos. Modified: head/lib/libpmc/pmc.core2.3 Modified: head/lib/libpmc/pmc.core2.3 ============================================================================== --- head/lib/libpmc/pmc.core2.3 Sun Aug 23 06:53:58 2009 (r196444) +++ head/lib/libpmc/pmc.core2.3 Sun Aug 23 07:24:39 2009 (r196445) @@ -42,7 +42,7 @@ family CPUs CPUs contain PMCs conforming to version 2 of the .Tn Intel performance measurement architecture. -These CPUs may contain upto two classes of PMCs: +These CPUs may contain up to two classes of PMCs: .Bl -tag -width "Li PMC_CLASS_IAP" .It Li PMC_CLASS_IAF Fixed-function counters that count only one hardware event per counter. @@ -92,13 +92,13 @@ Configure the PMC to increment only if t events measured in a cycle is greater than or equal to .Ar value . .It Li edge -Configure the PMC to count the number of deasserted to asserted +Configure the PMC to count the number of de-asserted to asserted transitions of the conditions expressed by the other qualifiers. If specified, the counter will increment only once whenever a condition becomes true, irrespective of the number of clocks during which the condition remains true. .It Li inv -Invert the sense of comparision when the +Invert the sense of comparison when the .Dq Li cmask qualifier is present, making the counter increment when the number of events per cycle is less than the value specified by the @@ -169,7 +169,7 @@ The default is .Dq Li both . .Pp Events that require a cache coherence qualifier to be specified use an -additional qualifer +additional qualifier .Dq Li cachestate= Ns Ar state , where argument .Ar state @@ -361,7 +361,7 @@ signal was asserted on the bus. .Xc .Pq Event 60H The number of pending full cache line read transactions on the bus -occuring in each cycle. +occurring in each cycle. .It Li BUS_TRANS_P Xo .Op ,agent= Ns Ar agent .Op ,core= Ns Ar core @@ -421,7 +421,7 @@ The number of burst read transactions. .Op ,core= Ns Ar core .Xc .Pq Event 6CH -The number of completed I/O bus transaactions due to +The number of completed I/O bus transactions due to .Li IN and .Li OUT @@ -437,7 +437,7 @@ The number of Read For Ownership bus tra .Op ,core= Ns Ar core .Xc .Pq Event 67H -The number explicit writeback bus transactions due to dirty line +The number explicit write-back bus transactions due to dirty line evictions. .It Li CMP_SNOOP Xo .Op ,core= Ns Ar core @@ -661,7 +661,7 @@ fetch unit. .It Li L2_LD Xo .Op ,cachestate= Ns Ar state .Op ,core= Ns Ar core -.Op ,prefech= Ns Ar prefetch +.Op ,prefetch= Ns Ar prefetch .Xc .Pq Event 29H The number of L2 cache read requests from L1 cache and L2 @@ -747,7 +747,7 @@ The number of loads blocked by preceding whose data value is not known. .It Li LOAD_BLOCK.UNTIL_RETIRE .Pq Event 03H , Umask 10H -The numer of load operations that were blocked until retirement. +The number of load operations that were blocked until retirement. .It Li LOAD_HIT_PRE .Pq Event 4CH , Umask 00H The number of load operations that conflicted with an prefetch to the From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 07:29:35 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D1A9106568B; Sun, 23 Aug 2009 07:29:35 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 23B008FC13; Sun, 23 Aug 2009 07:29:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N7TZb7050390; Sun, 23 Aug 2009 07:29:35 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N7TYtt050385; Sun, 23 Aug 2009 07:29:34 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200908230729.n7N7TYtt050385@svn.freebsd.org> From: Joseph Koshy Date: Sun, 23 Aug 2009 07:29:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196446 - head/lib/libpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 07:29:35 -0000 Author: jkoshy Date: Sun Aug 23 07:29:34 2009 New Revision: 196446 URL: http://svn.freebsd.org/changeset/base/196446 Log: Fix typos, use American English spellings. Modified: head/lib/libpmc/pmc.k7.3 head/lib/libpmc/pmc.k8.3 head/lib/libpmc/pmc.p4.3 head/lib/libpmc/pmc.p6.3 Modified: head/lib/libpmc/pmc.k7.3 ============================================================================== --- head/lib/libpmc/pmc.k7.3 Sun Aug 23 07:24:39 2009 (r196445) +++ head/lib/libpmc/pmc.k7.3 Sun Aug 23 07:29:34 2009 (r196446) @@ -79,7 +79,7 @@ In other words, the counter will increme condition becomes true, irrespective of the number of clocks during which the condition remains true. .It Li inv -Invert the sense of comparision when the +Invert the sense of comparison when the .Dq Li count qualifier is present, making the counter to increment when the number of events per cycle is less than the value specified by @@ -205,7 +205,7 @@ Count all retired branches (conditional, and interrupts). .It Li k7-retired-branches-mispredicted .Pq Event C3H -Count all misprediced retired branches. +Count all mispredicted retired branches. .It Li k7-retired-far-control-transfers .Pq Event C6H Count retired far control transfers. Modified: head/lib/libpmc/pmc.k8.3 ============================================================================== --- head/lib/libpmc/pmc.k8.3 Sun Aug 23 07:24:39 2009 (r196445) +++ head/lib/libpmc/pmc.k8.3 Sun Aug 23 07:29:34 2009 (r196446) @@ -82,7 +82,7 @@ In other words, the counter will increme condition becomes true, irrespective of the number of clocks during which the condition remains true. .It Li inv -Invert the sense of comparision when the +Invert the sense of comparison when the .Dq Li count qualifier is present, making the counter to increment when the number of events per cycle is less than the value specified by @@ -173,7 +173,7 @@ Count TLB reloads. The default is to count all types of requests. .It Li k8-dc-access .Pq Event 40H -Count data cache accesses including microcode scratchpad accesses. +Count data cache accesses including microcode scratch pad accesses. .It Li k8-dc-copyback Op Li ,mask= Ns Ar qualifier .Pq Event 44H Count data cache copyback operations. Modified: head/lib/libpmc/pmc.p4.3 ============================================================================== --- head/lib/libpmc/pmc.p4.3 Sun Aug 23 07:24:39 2009 (r196445) +++ head/lib/libpmc/pmc.p4.3 Sun Aug 23 07:29:34 2009 (r196446) @@ -121,7 +121,7 @@ See below for more information. .It Li edge Configure the counter to count false to true transitions of the threshold -comparision output. +comparison output. This qualifier only takes effect if a threshold qualifier has also been specified. .It Li complement @@ -547,7 +547,7 @@ Count cycles when the processor is activ .It Li p4-instr-retired Op Li ,mask= Ns Ar flags .Pq "TS event" Count instructions retired during a clock cycle. -Qualifer +Qualifier .Ar flags comprises of the following strings separated by .Ql + @@ -589,7 +589,7 @@ Count read entries. .It Li all-write Count write entries. .It Li mem-uc -Count entries accessing uncacheable memory. +Count entries accessing un-cacheable memory. .It Li mem-wc Count entries accessing write-combining memory. .It Li mem-wt @@ -620,7 +620,7 @@ The default is 0. The .Dq Li edge qualifier should not be used when counting cycles with this event. -The exact behaviour of this event depends on the processor revision. +The exact behavior of this event depends on the processor revision. .It Li p4-ioq-allocation Xo .Op Li ,mask= Ns Ar qualifier .Op Li ,busreqtype= Ns Ar req-type @@ -644,7 +644,7 @@ Count read entries. .It Li all-write Count write entries. .It Li mem-uc -Count entries accessing uncacheable memory. +Count entries accessing un-cacheable memory. .It Li mem-wc Count entries accessing write-combining memory. .It Li mem-wt @@ -676,10 +676,10 @@ The .Dq Li edge qualifier is normally used with this event to prevent multiple counting. -The exact behaviour of this event depends on the processor revision. +The exact behavior of this event depends on the processor revision. .It Li p4-itlb-reference Op mask= Ns Ar qualifier .Pq "TS event" -Count translations using the intruction translation look-aside +Count translations using the instruction translation look-aside buffer. The .Ar qualifier @@ -693,7 +693,7 @@ Count ITLB hits. .It Li miss Count ITLB misses. .It Li hit-uc -Count uncacheable ITLB hits. +Count un-cacheable ITLB hits. .El .Pp If no @@ -730,7 +730,7 @@ Count non-bogus retired branch instructi .It Li p4-machine-clear Op Li ,mask= Ns Ar flags .Pq "TS event" Count the number of pipeline clears seen by the processor. -Qualifer +Qualifier .Ar flags is a list of the following strings separated by .Ql + @@ -753,7 +753,7 @@ The default qualifier is .Dq Li clear . .It Li p4-memory-cancel Op Li ,mask= Ns Ar event-list .Pq "TS event" -Count the cancelling of various kinds of requests in the data cache +Count the canceling of various kinds of requests in the data cache address control unit of the CPU. The qualifier .Ar event-list @@ -773,8 +773,8 @@ If is not specified, then the default is to count both kinds of events. .It Li p4-memory-complete Op Li ,mask= Ns Ar event-list .Pq "TS event" -Count the completion of load split, store split, uncacheable split and -uncacheable load operations selected by qualifier +Count the completion of load split, store split, un-cacheable split and +un-cacheable load operations selected by qualifier .Ar event-list . The qualifier .Ar event-list @@ -784,7 +784,7 @@ separated list of the following flags: .Pp .Bl -tag -width indent -compact .It Li lsc -Count load splits completed, excluding loads from uncacheable or +Count load splits completed, excluding loads from un-cacheable or write-combining areas. .It Li ssc Count any split stores completed. @@ -1065,7 +1065,7 @@ The default qualifier counts all the abo .Pq "TS event" This event is used in conjunction with the front-end at-retirement mechanism to tag load and store uops. -Qualifer +Qualifier .Ar flags comprises the following strings separated by .Ql + @@ -1112,7 +1112,7 @@ WC buffer evictions due to any cause. WC buffer evictions due to no WC buffer being available. .El .Pp -The default qualifer counts both kinds of evictions. +The default qualifier counts both kinds of evictions. .It Li p4-x87-assist Op Li ,mask= Ns Ar flags .Pq "TS event" Count the retirement of x87 instructions that required special Modified: head/lib/libpmc/pmc.p6.3 ============================================================================== --- head/lib/libpmc/pmc.p6.3 Sun Aug 23 07:24:39 2009 (r196445) +++ head/lib/libpmc/pmc.p6.3 Sun Aug 23 07:29:34 2009 (r196446) @@ -89,13 +89,13 @@ Configure the PMC to increment only if t events measured in a cycle is greater than or equal to .Ar value . .It Li edge -Configure the PMC to count the number of deasserted to asserted +Configure the PMC to count the number of de-asserted to asserted transitions of the conditions expressed by the other qualifiers. If specified, the counter will increment only once whenever a condition becomes true, irrespective of the number of clocks during which the condition remains true. .It Li inv -Invert the sense of comparision when the +Invert the sense of comparison when the .Dq Li cmask qualifier is present, making the counter increment when the number of events per cycle is less than the value specified by the @@ -584,7 +584,7 @@ Count SSE2 scalar-double instructions. .El .Pp The default is to count SSE packed-single instructions. -.It Li p6-emon-sse-sse2-inst-retired Op Li ,umask= Ns Ar qualifer +.It Li p6-emon-sse-sse2-inst-retired Op Li ,umask= Ns Ar qualifier .Pq Event D8H , Tn "Pentium M" Count the number of SSE instructions retired. An additional qualifier can be specified, and can be one of the From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 07:30:12 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0BA41065691; Sun, 23 Aug 2009 07:30:12 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C09538FC26; Sun, 23 Aug 2009 07:30:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N7UCQa050448; Sun, 23 Aug 2009 07:30:12 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N7UCF6050446; Sun, 23 Aug 2009 07:30:12 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200908230730.n7N7UCF6050446@svn.freebsd.org> From: Joseph Koshy Date: Sun, 23 Aug 2009 07:30:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196447 - head/lib/libpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 07:30:12 -0000 Author: jkoshy Date: Sun Aug 23 07:30:12 2009 New Revision: 196447 URL: http://svn.freebsd.org/changeset/base/196447 Log: Fix a typo. Modified: head/lib/libpmc/pmc_capabilities.3 Modified: head/lib/libpmc/pmc_capabilities.3 ============================================================================== --- head/lib/libpmc/pmc_capabilities.3 Sun Aug 23 07:29:34 2009 (r196446) +++ head/lib/libpmc/pmc_capabilities.3 Sun Aug 23 07:30:12 2009 (r196447) @@ -63,7 +63,7 @@ is a PMC handle obtained by a prior call .Fn pmc_allocate . The function sets argument .Fa caps -to a bitmask of capabilities supported by the PMC denoted by +to a bit mask of capabilities supported by the PMC denoted by argument .Fa pmc . PMC capabilities are described in From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 07:31:11 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E29B1106568B; Sun, 23 Aug 2009 07:31:10 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B7E6E8FC13; Sun, 23 Aug 2009 07:31:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N7VAX1050508; Sun, 23 Aug 2009 07:31:10 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N7VARm050505; Sun, 23 Aug 2009 07:31:10 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200908230731.n7N7VARm050505@svn.freebsd.org> From: Joseph Koshy Date: Sun, 23 Aug 2009 07:31:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196448 - head/lib/libpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 07:31:11 -0000 Author: jkoshy Date: Sun Aug 23 07:31:10 2009 New Revision: 196448 URL: http://svn.freebsd.org/changeset/base/196448 Log: Fix typos. Modified: head/lib/libpmc/pmc.p5.3 Modified: head/lib/libpmc/pmc.p5.3 ============================================================================== --- head/lib/libpmc/pmc.p5.3 Sun Aug 23 07:30:12 2009 (r196447) +++ head/lib/libpmc/pmc.p5.3 Sun Aug 23 07:31:10 2009 (r196448) @@ -156,14 +156,14 @@ This event is only allocated on counter .It Li p5-code-cache-miss .Pq Event 0EH The number of instruction reads that miss the internal code cache. -Both cacheable and uncacheable misses are counted. +Both cacheable and un-cacheable misses are counted. .It Li p5-code-read .Pq Event 0CH -The number of instruction reads to both cacheable and uncacheable regions. +The number of instruction reads to both cacheable and un-cacheable regions. .It Li p5-code-tlb-miss .Pq Event 0DH The number of instruction reads that miss the instruction TLB. -Both cacheable and uncacheable unreads are counted. +Both cacheable and un-cacheable unreads are counted. .It Li p5-d1-starvation-and-fifo-is-empty .Pq Event 33H , Tn Pentium MMX The number of times the D1 stage cannot issue any instructions because @@ -193,13 +193,13 @@ Split cycle reads are counted individual .It Li p5-data-read-miss .Pq Event 03H The number of memory read accesses that miss the data cache, counting -both cacheable and uncacheable accesses. +both cacheable and un-cacheable accesses. Data accesses that are part of TLB miss processing are not included. I/O accesses are not included. .It Li p5-data-read-miss-or-write-miss .Pq Event 29H The number of data reads and writes that miss the internal data cache, -counting uncacheable accesses. +counting un-cacheable accesses. Data accesses due to TLB miss processing are not counted. .It Li p5-data-read-or-write .Pq Event 28H @@ -208,7 +208,7 @@ and misses. Data reads due to TLB miss processing are not counted. .It Li p5-data-tlb-miss .Pq Event 02H -The number of misses to the data cache translation lookaside buffer. +The number of misses to the data cache translation look aside buffer. .It Li p5-data-write .Pq Event 01H The number of memory data writes, counting internal data cache hits @@ -217,7 +217,7 @@ I/O is not included and split cycle writ .It Li p5-data-write-miss .Pq Event 04H The number of memory write accesses that miss the data cache, counting -both cacheable and uncacheable accesses. +both cacheable and un-cacheable accesses. I/O accesses are not counted. .It Li p5-emms-instructions-executed .Pq Event 2DH , Tn Pentium MMX From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 07:32:30 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E49C7106568C; Sun, 23 Aug 2009 07:32:30 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C8BC08FC17; Sun, 23 Aug 2009 07:32:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N7WUxj050566; Sun, 23 Aug 2009 07:32:30 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N7WUfV050562; Sun, 23 Aug 2009 07:32:30 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200908230732.n7N7WUfV050562@svn.freebsd.org> From: Joseph Koshy Date: Sun, 23 Aug 2009 07:32:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196449 - head/lib/libpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 07:32:31 -0000 Author: jkoshy Date: Sun Aug 23 07:32:30 2009 New Revision: 196449 URL: http://svn.freebsd.org/changeset/base/196449 Log: Use US spellings, fix typos. Modified: head/lib/libpmc/pmc.atom.3 head/lib/libpmc/pmc.core.3 head/lib/libpmc/pmc.iaf.3 Modified: head/lib/libpmc/pmc.atom.3 ============================================================================== --- head/lib/libpmc/pmc.atom.3 Sun Aug 23 07:31:10 2009 (r196448) +++ head/lib/libpmc/pmc.atom.3 Sun Aug 23 07:32:30 2009 (r196449) @@ -93,13 +93,13 @@ Configure the PMC to increment only if t events measured in a cycle is greater than or equal to .Ar value . .It Li edge -Configure the PMC to count the number of deasserted to asserted +Configure the PMC to count the number of de-asserted to asserted transitions of the conditions expressed by the other qualifiers. If specified, the counter will increment only once whenever a condition becomes true, irrespective of the number of clocks during which the condition remains true. .It Li inv -Invert the sense of comparision when the +Invert the sense of comparison when the .Dq Li cmask qualifier is present, making the counter increment when the number of events per cycle is less than the value specified by the @@ -170,7 +170,7 @@ The default is .Dq Li both . .Pp Events that require a cache coherence qualifier to be specified use an -additional qualifer +additional qualifier .Dq Li cachestate= Ns Ar state , where argument .Ar state @@ -371,7 +371,7 @@ This event is thread independent. .Xc .Pq Event 60H The number of pending full cache line read transactions on the bus -occuring in each cycle. +occurring in each cycle. This event is thread independent. .It Li BUS_TRANS_P Xo .Op ,agent= Ns Ar agent @@ -432,7 +432,7 @@ The number of burst read transactions. .Op ,core= Ns Ar core .Xc .Pq Event 6CH -The number of completed I/O bus transaactions due to +The number of completed I/O bus transactions due to .Li IN and .Li OUT @@ -448,7 +448,7 @@ The number of Read For Ownership bus tra .Op ,core= Ns Ar core .Xc .Pq Event 67H -The number explicit writeback bus transactions due to dirty line +The number explicit write-back bus transactions due to dirty line evictions. .It Li CMP_SNOOP Xo .Op ,core= Ns Ar core @@ -693,7 +693,7 @@ fetch unit. .It Li L2_LD Xo .Op ,cachestate= Ns Ar state .Op ,core= Ns Ar core -.Op ,prefech= Ns Ar prefetch +.Op ,prefetch= Ns Ar prefetch .Xc .Pq Event 29H The number of L2 cache read requests from L1 cache and L2 @@ -778,7 +778,7 @@ The number of loads blocked by preceding whose data value is not known. .It Li LOAD_BLOCK.UNTIL_RETIRE .Pq Event 03H , Umask 10H -The numer of load operations that were blocked until retirement. +The number of load operations that were blocked until retirement. .It Li LOAD_HIT_PRE .Pq Event 4CH , Umask 00H The number of load operations that conflicted with an prefetch to the Modified: head/lib/libpmc/pmc.core.3 ============================================================================== --- head/lib/libpmc/pmc.core.3 Sun Aug 23 07:31:10 2009 (r196448) +++ head/lib/libpmc/pmc.core.3 Sun Aug 23 07:32:30 2009 (r196449) @@ -85,13 +85,13 @@ Configure the PMC to increment only if t events measured in a cycle is greater than or equal to .Ar value . .It Li edge -Configure the PMC to count the number of deasserted to asserted +Configure the PMC to count the number of de-asserted to asserted transitions of the conditions expressed by the other qualifiers. If specified, the counter will increment only once whenever a condition becomes true, irrespective of the number of clocks during which the condition remains true. .It Li inv -Invert the sense of comparision when the +Invert the sense of comparison when the .Dq Li cmask qualifier is present, making the counter increment when the number of events per cycle is less than the value specified by the @@ -159,7 +159,7 @@ The default is .Dq Li both . .Pp Events that require a cache coherence qualifier to be specified use an -additional qualifer +additional qualifier .Dq Li cachestate= Ns Ar value , where argument .Ar value @@ -348,8 +348,8 @@ The number of completed partial write tr The number of completed read-for-ownership transactions. .It Li Bus_Trans_WB Op ,agent= Ns Ar agent .Pq Event 67H -The number of completed writeback transactions from the data cache -unit, excluding L2 writebacks. +The number of completed write-back transactions from the data cache +unit, excluding L2 write-backs. .It Li Cycles_Div_Busy .Pq Event 14H , Umask 00H The number of cycles the divider is busy. @@ -393,13 +393,13 @@ The number of cacheable read and write o .It Li Data_Mem_Ref .Pq Event 43H , Umask 01H The number of L1 data reads and writes, both cacheable and -uncacheable. +un-cacheable. .It Li Dbus_Busy Op ,core= Ns Ar core .Pq Event 22H The number of core cycles during which the data bus was busy. .It Li Dbus_Busy_Rd Op ,core= Ns Ar core .Pq Event 23H -The nunber of cycles during which the data bus was busy transferring +The number of cycles during which the data bus was busy transferring data to a core. .It Li Div .Pq Event 13H , Umask 00H @@ -460,7 +460,7 @@ streaming buffers. .It Li ICache_Reads .Pq Event 80H , Umask 00H The number of instruction fetches from the the instruction cache and -streaming buffers counting both cacheable and uncacheable fetches. +streaming buffers counting both cacheable and un-cacheable fetches. .It Li IFU_Mem_Stall .Pq Event 86H , Umask 00H The number of cycles the instruction fetch unit was stalled while @@ -754,7 +754,7 @@ Performance monitoring events for retire .It AE29 DR3 address match on MOVD/MOVQ/MOVNTQ memory store instruction may incorrectly increment performance monitoring count -for saturating simd instructions retired (Event CFH). +for saturating SIMD instructions retired (Event CFH). .It AE33 Hardware prefetch performance monitoring events may be counted inaccurately. Modified: head/lib/libpmc/pmc.iaf.3 ============================================================================== --- head/lib/libpmc/pmc.iaf.3 Sun Aug 23 07:31:10 2009 (r196448) +++ head/lib/libpmc/pmc.iaf.3 Sun Aug 23 07:32:30 2009 (r196449) @@ -73,7 +73,7 @@ Fixed-function PMCs support the followin .It PMC_CAP_WRITE Ta Yes .El .Ss Class Name Prefix -These pmcs are named using a class name prefix of +These PMCs are named using a class name prefix of .Dq Li iaf- . .Ss Event Qualifiers (Fixed Function PMCs) These PMCs support the following modifiers: From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 07:48:12 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14FD0106568B; Sun, 23 Aug 2009 07:48:12 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE1BA8FC17; Sun, 23 Aug 2009 07:48:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N7mBXK050916; Sun, 23 Aug 2009 07:48:11 GMT (envelope-from julian@svn.freebsd.org) Received: (from julian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N7mBB8050912; Sun, 23 Aug 2009 07:48:11 GMT (envelope-from julian@svn.freebsd.org) Message-Id: <200908230748.n7N7mBB8050912@svn.freebsd.org> From: Julian Elischer Date: Sun, 23 Aug 2009 07:48:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196450 - head/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 07:48:12 -0000 Author: julian Date: Sun Aug 23 07:48:11 2009 New Revision: 196450 URL: http://svn.freebsd.org/changeset/base/196450 Log: Add claraifications to the kproc and kthread manpages and link the kthread_create(9) man page to the kproc(9) page as it had migrated and people looking for it may need a hand to find its new name. MFC after: 1 week Modified: head/share/man/man9/Makefile head/share/man/man9/kproc.9 head/share/man/man9/kthread.9 Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sun Aug 23 07:32:30 2009 (r196449) +++ head/share/man/man9/Makefile Sun Aug 23 07:48:11 2009 (r196450) @@ -713,6 +713,7 @@ MLINKS+=kobj.9 DEFINE_CLASS.9 \ kobj.9 kobj_delete.9 \ kobj.9 kobj_init.9 MLINKS+=kproc.9 kproc_create.9 \ + kproc.9 kthread_create.9 \ kproc.9 kproc_exit.9 \ kproc.9 kproc_resume.9 \ kproc.9 kproc_shutdown.9 \ Modified: head/share/man/man9/kproc.9 ============================================================================== --- head/share/man/man9/kproc.9 Sun Aug 23 07:32:30 2009 (r196449) +++ head/share/man/man9/kproc.9 Sun Aug 23 07:48:11 2009 (r196450) @@ -64,6 +64,28 @@ .Fa "int flags" "int pages" "char * procname" "const char *fmt" "..." .Fc .Sh DESCRIPTION +In +.Fx 8.0 , +the +.Fn kthread* 9 +family of functions was renamed to be the +.Fn kproc* 9 +family of functions, as they were misnamed +and actually produced kernel processes. +A new family of +.Em different +.Fn kthread_* 9 +functions was added to produce +.Em real +kernel +.Em threads . +See the +.Xr kthread 9 +man page for more information on those calls. +Also note that the +.Fn kproc_kthread_add 9 +function appears in both pages as its functionality is split. +.Pp The function .Fn kproc_start is used to start Modified: head/share/man/man9/kthread.9 ============================================================================== --- head/share/man/man9/kthread.9 Sun Aug 23 07:32:30 2009 (r196449) +++ head/share/man/man9/kthread.9 Sun Aug 23 07:48:11 2009 (r196450) @@ -65,6 +65,27 @@ .Fa "int flags" "int pages" "char * procname" "const char *fmt" "..." .Fc .Sh DESCRIPTION +In +.Fx 8.0 , +the older family of +.Fn kthread_* 9 +functions was renamed to be the +.Fn kproc_* 9 +family of functions, +as they were previously misnamed +and actually produced kernel processes. +This new family of +.Fn kthread_* 9 +functions was added to produce +.Em real +kernel threads. +See the +.Xr kproc 9 +man page for more information on the renamed calls. +Also note that the +.Fn kproc_kthread_add 9 +function appears in both pages as its functionality is split. +.Pp The function .Fn kthread_start is used to start From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 07:59:29 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 308571065672; Sun, 23 Aug 2009 07:59:29 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 200248FC16; Sun, 23 Aug 2009 07:59:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N7xT4N051167; Sun, 23 Aug 2009 07:59:29 GMT (envelope-from julian@svn.freebsd.org) Received: (from julian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N7xS6g051165; Sun, 23 Aug 2009 07:59:28 GMT (envelope-from julian@svn.freebsd.org) Message-Id: <200908230759.n7N7xS6g051165@svn.freebsd.org> From: Julian Elischer Date: Sun, 23 Aug 2009 07:59:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196451 - head/sys/netinet/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 07:59:29 -0000 Author: julian Date: Sun Aug 23 07:59:28 2009 New Revision: 196451 URL: http://svn.freebsd.org/changeset/base/196451 Log: Fix typo in comment that has been bugging me for days. MFC after: 1 week Modified: head/sys/netinet/ipfw/ip_fw2.c Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Sun Aug 23 07:48:11 2009 (r196450) +++ head/sys/netinet/ipfw/ip_fw2.c Sun Aug 23 07:59:28 2009 (r196451) @@ -4653,7 +4653,7 @@ ipfw_init(void) #endif /* * Other things that are only done the first time. - * (now that we a re cuaranteed of success). + * (now that we a re guaranteed of success). */ ip_fw_ctl_ptr = ipfw_ctl; ip_fw_chk_ptr = ipfw_chk; From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 08:04:40 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 863541065692; Sun, 23 Aug 2009 08:04:40 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 756C98FC1D; Sun, 23 Aug 2009 08:04:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N84eZY051322; Sun, 23 Aug 2009 08:04:40 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N84efJ051317; Sun, 23 Aug 2009 08:04:40 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200908230804.n7N84efJ051317@svn.freebsd.org> From: Ed Schouten Date: Sun, 23 Aug 2009 08:04:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196452 - in head/sys: dev/snp kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 08:04:40 -0000 Author: ed Date: Sun Aug 23 08:04:40 2009 New Revision: 196452 URL: http://svn.freebsd.org/changeset/base/196452 Log: Add ttydisc_rint_simple(). I noticed several drivers in our tree don't actually care about parity and framing, such as pts(4), snp(4) (and my partially finished console driver). Instead of duplicating a lot of code, I think we'd better add a utility function for those drivers to quickly process a buffer of input. Also change pts(4) and snp(4) to use this function. Modified: head/sys/dev/snp/snp.c head/sys/kern/tty_pts.c head/sys/kern/tty_ttydisc.c head/sys/sys/ttydisc.h Modified: head/sys/dev/snp/snp.c ============================================================================== --- head/sys/dev/snp/snp.c Sun Aug 23 07:59:28 2009 (r196451) +++ head/sys/dev/snp/snp.c Sun Aug 23 08:04:40 2009 (r196452) @@ -192,7 +192,7 @@ snp_write(struct cdev *dev, struct uio * { struct snp_softc *ss; struct tty *tp; - int error, len, i; + int error, len; char in[SNP_INPUT_BUFSIZE]; error = devfs_get_cdevpriv((void **)&ss); @@ -223,14 +223,9 @@ snp_write(struct cdev *dev, struct uio * * because we shouldn't bail out when we're running * close to the watermarks. */ - if (ttydisc_can_bypass(tp)) { - ttydisc_rint_bypass(tp, in, len); - } else { - for (i = 0; i < len; i++) - ttydisc_rint(tp, in[i], 0); - } - + ttydisc_rint_simple(tp, in, len); ttydisc_rint_done(tp); + tty_unlock(tp); } Modified: head/sys/kern/tty_pts.c ============================================================================== --- head/sys/kern/tty_pts.c Sun Aug 23 07:59:28 2009 (r196451) +++ head/sys/kern/tty_pts.c Sun Aug 23 08:04:40 2009 (r196452) @@ -215,25 +215,12 @@ ptsdev_write(struct file *fp, struct uio */ MPASS(iblen > 0); do { - if (ttydisc_can_bypass(tp)) { - /* Store data at once. */ - rintlen = ttydisc_rint_bypass(tp, - ibstart, iblen); - ibstart += rintlen; - iblen -= rintlen; - - if (iblen == 0) { - /* All data written. */ - break; - } - } else { - error = ttydisc_rint(tp, *ibstart, 0); - if (error == 0) { - /* Character stored successfully. */ - ibstart++; - iblen--; - continue; - } + rintlen = ttydisc_rint_simple(tp, ibstart, iblen); + ibstart += rintlen; + iblen -= rintlen; + if (iblen == 0) { + /* All data written. */ + break; } /* Maybe the device isn't used anyway. */ Modified: head/sys/kern/tty_ttydisc.c ============================================================================== --- head/sys/kern/tty_ttydisc.c Sun Aug 23 07:59:28 2009 (r196451) +++ head/sys/kern/tty_ttydisc.c Sun Aug 23 08:04:40 2009 (r196452) @@ -1045,6 +1045,22 @@ print: } size_t +ttydisc_rint_simple(struct tty *tp, const void *buf, size_t len) +{ + const char *cbuf; + + if (ttydisc_can_bypass(tp)) + return (ttydisc_rint_bypass(tp, buf, len)); + + for (cbuf = buf; len-- > 0; cbuf++) { + if (ttydisc_rint(tp, *cbuf, 0) != 0) + break; + } + + return (cbuf - (const char *)buf); +} + +size_t ttydisc_rint_bypass(struct tty *tp, const void *buf, size_t len) { size_t ret; Modified: head/sys/sys/ttydisc.h ============================================================================== --- head/sys/sys/ttydisc.h Sun Aug 23 07:59:28 2009 (r196451) +++ head/sys/sys/ttydisc.h Sun Aug 23 08:04:40 2009 (r196452) @@ -52,6 +52,7 @@ void ttydisc_optimize(struct tty *tp); void ttydisc_modem(struct tty *tp, int open); #define ttydisc_can_bypass(tp) ((tp)->t_flags & TF_BYPASS) int ttydisc_rint(struct tty *tp, char c, int flags); +size_t ttydisc_rint_simple(struct tty *tp, const void *buf, size_t len); size_t ttydisc_rint_bypass(struct tty *tp, const void *buf, size_t len); void ttydisc_rint_done(struct tty *tp); size_t ttydisc_rint_poll(struct tty *tp); From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 08:09:42 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F897106564A; Sun, 23 Aug 2009 08:09:42 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 4680D8FC18; Sun, 23 Aug 2009 08:09:42 +0000 (UTC) Received: by palm.hoeg.nl (Postfix, from userid 1000) id F155F1CDC7; Sun, 23 Aug 2009 10:09:40 +0200 (CEST) Date: Sun, 23 Aug 2009 10:09:40 +0200 From: Ed Schouten To: Julian Elischer Message-ID: <20090823080940.GT1292@hoeg.nl> References: <200908230759.n7N7xS6g051165@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Ngz69hoXASxZo3zU" Content-Disposition: inline In-Reply-To: <200908230759.n7N7xS6g051165@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196451 - head/sys/netinet/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 08:09:44 -0000 --Ngz69hoXASxZo3zU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Julian Elischer wrote: > + * (now that we a re guaranteed of success). ^^^^ ;-) --=20 Ed Schouten WWW: http://80386.nl/ --Ngz69hoXASxZo3zU Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkqQ+UQACgkQ52SDGA2eCwUxGQCdFAlTXxbLQpUOpQhTcxx9nYlC XOUAnRiDtE1uJ7XBBEiytqSuNbQm5JhC =btk9 -----END PGP SIGNATURE----- --Ngz69hoXASxZo3zU-- From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 08:35:53 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id A6E94106568E; Sun, 23 Aug 2009 08:35:53 +0000 (UTC) Date: Sun, 23 Aug 2009 08:35:53 +0000 From: Alexey Dokuchaev To: Joseph Koshy Message-ID: <20090823083553.GB14817@FreeBSD.org> References: <200908230619.n7N6J2Wx048749@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <200908230619.n7N6J2Wx048749@svn.freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196440 - head/lib/libpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 08:35:53 -0000 On Sun, Aug 23, 2009 at 06:19:02AM +0000, Joseph Koshy wrote: > Author: jkoshy > Date: Sun Aug 23 06:19:02 2009 > New Revision: 196440 > URL: http://svn.freebsd.org/changeset/base/196440 > > Log: > Correct grammar. > > -CPUs are named using small integers from zero uptil, but > +CPUs are named using small integers from zero until, but I guess "up to" is also more appropriate here instead of "until". ./danfe From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 08:49:32 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0A641065672; Sun, 23 Aug 2009 08:49:32 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F94E8FC0A; Sun, 23 Aug 2009 08:49:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N8nWma052242; Sun, 23 Aug 2009 08:49:32 GMT (envelope-from julian@svn.freebsd.org) Received: (from julian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N8nWjB052240; Sun, 23 Aug 2009 08:49:32 GMT (envelope-from julian@svn.freebsd.org) Message-Id: <200908230849.n7N8nWjB052240@svn.freebsd.org> From: Julian Elischer Date: Sun, 23 Aug 2009 08:49:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196453 - head/sys/netinet/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 08:49:32 -0000 Author: julian Date: Sun Aug 23 08:49:32 2009 New Revision: 196453 URL: http://svn.freebsd.org/changeset/base/196453 Log: Fix another typo right next to the previous one, that amazingly, I did not see before. MFC after: 1 week Modified: head/sys/netinet/ipfw/ip_fw2.c Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Sun Aug 23 08:04:40 2009 (r196452) +++ head/sys/netinet/ipfw/ip_fw2.c Sun Aug 23 08:49:32 2009 (r196453) @@ -4653,7 +4653,7 @@ ipfw_init(void) #endif /* * Other things that are only done the first time. - * (now that we a re guaranteed of success). + * (now that we are guaranteed of success). */ ip_fw_ctl_ptr = ipfw_ctl; ip_fw_chk_ptr = ipfw_chk; From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 09:28:14 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23315106564A; Sun, 23 Aug 2009 09:28:13 +0000 (UTC) (envelope-from marck@rinet.ru) Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68]) by mx1.freebsd.org (Postfix) with ESMTP id 68D558FC08; Sun, 23 Aug 2009 09:28:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by woozle.rinet.ru (8.14.3/8.14.3) with ESMTP id n7N9SBvw032919; Sun, 23 Aug 2009 13:28:11 +0400 (MSD) (envelope-from marck@rinet.ru) Date: Sun, 23 Aug 2009 13:28:11 +0400 (MSD) From: Dmitry Morozovsky To: Ken Smith In-Reply-To: <200908230633.n7N6Xg4a049220@svn.freebsd.org> Message-ID: References: <200908230633.n7N6Xg4a049220@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) X-NCC-RegID: ru.rinet X-OpenPGP-Key-ID: 6B691B03 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (woozle.rinet.ru [0.0.0.0]); Sun, 23 Aug 2009 13:28:11 +0400 (MSD) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r196443 - stable/8/share/examples/cvsup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 09:28:14 -0000 Ken, another small glitch: On Sun, 23 Aug 2009, Ken Smith wrote: KS> Modified: stable/8/share/examples/cvsup/stable-supfile KS> ============================================================================== KS> --- stable/8/share/examples/cvsup/stable-supfile Sun Aug 23 06:30:14 2009 (r196442) KS> +++ stable/8/share/examples/cvsup/stable-supfile Sun Aug 23 06:33:42 2009 (r196443) KS> @@ -69,7 +69,7 @@ KS> # The following line is for 7-stable. If you want 6-stable, 5-stable, ~~~~~~~~~~~~ KS> # 4-stable, 3-stable, or 2.2-stable, change to "RELENG_6", "RELENG_5", KS> # "RELENG_4", "RELENG_3", or "RELENG_2_2" respectively. KS> -*default release=cvs tag=RELENG_7 KS> +*default release=cvs tag=RELENG_8 KS> *default delete use-rel-suffix KS> KS> # If you seem to be limited by CPU rather than network or disk bandwidth, try -- Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: marck@FreeBSD.org ] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------ From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 09:55:07 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 141D4106568E; Sun, 23 Aug 2009 09:55:07 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 030958FC16; Sun, 23 Aug 2009 09:55:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N9t6rM053501; Sun, 23 Aug 2009 09:55:06 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N9t6Go053499; Sun, 23 Aug 2009 09:55:06 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200908230955.n7N9t6Go053499@svn.freebsd.org> From: Rui Paulo Date: Sun, 23 Aug 2009 09:55:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196454 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 09:55:07 -0000 Author: rpaulo Date: Sun Aug 23 09:55:06 2009 New Revision: 196454 URL: http://svn.freebsd.org/changeset/base/196454 Log: Constify prime numbers. Modified: head/sys/kern/kern_subr.c Modified: head/sys/kern/kern_subr.c ============================================================================== --- head/sys/kern/kern_subr.c Sun Aug 23 08:49:32 2009 (r196453) +++ head/sys/kern/kern_subr.c Sun Aug 23 09:55:06 2009 (r196454) @@ -419,9 +419,9 @@ hashdestroy(void *vhashtbl, struct mallo free(hashtbl, type); } -static int primes[] = { 1, 13, 31, 61, 127, 251, 509, 761, 1021, 1531, 2039, - 2557, 3067, 3583, 4093, 4603, 5119, 5623, 6143, 6653, - 7159, 7673, 8191, 12281, 16381, 24571, 32749 }; +static const int primes[] = { 1, 13, 31, 61, 127, 251, 509, 761, 1021, 1531, + 2039, 2557, 3067, 3583, 4093, 4603, 5119, 5623, 6143, + 6653, 7159, 7673, 8191, 12281, 16381, 24571, 32749 }; #define NPRIMES (sizeof(primes) / sizeof(primes[0])) /* From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 09:58:07 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E95E106568B; Sun, 23 Aug 2009 09:58:07 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D8118FC12; Sun, 23 Aug 2009 09:58:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7N9w66C053579; Sun, 23 Aug 2009 09:58:06 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7N9w6AJ053577; Sun, 23 Aug 2009 09:58:06 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200908230958.n7N9w6AJ053577@svn.freebsd.org> From: Rui Paulo Date: Sun, 23 Aug 2009 09:58:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196455 - head/sys/dev/asmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 09:58:07 -0000 Author: rpaulo Date: Sun Aug 23 09:58:06 2009 New Revision: 196455 URL: http://svn.freebsd.org/changeset/base/196455 Log: Make dev.asmc.N.light.control writable by everyone. Submitted by: Patrick Lamaiziere MFC after: 1 week Modified: head/sys/dev/asmc/asmc.c Modified: head/sys/dev/asmc/asmc.c ============================================================================== --- head/sys/dev/asmc/asmc.c Sun Aug 23 09:55:06 2009 (r196454) +++ head/sys/dev/asmc/asmc.c Sun Aug 23 09:58:06 2009 (r196455) @@ -419,7 +419,8 @@ asmc_attach(device_t dev) SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sc->sc_light_tree), - OID_AUTO, "control", CTLTYPE_INT | CTLFLAG_RW, + OID_AUTO, "control", + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_ANYBODY, dev, 0, model->smc_light_control, "I", "Keyboard backlight brightness control"); } From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 11:22:47 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 132DD106568E; Sun, 23 Aug 2009 11:22:47 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 015B98FC14; Sun, 23 Aug 2009 11:22:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NBMk0N059358; Sun, 23 Aug 2009 11:22:46 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NBMkJq059355; Sun, 23 Aug 2009 11:22:46 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908231122.n7NBMkJq059355@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 23 Aug 2009 11:22:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196456 - head/sys/cddl/compat/opensolaris/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 11:22:47 -0000 Author: pjd Date: Sun Aug 23 11:22:46 2009 New Revision: 196456 URL: http://svn.freebsd.org/changeset/base/196456 Log: - Give minclsyspri and maxclsyspri real values (consulted with kmacy). - Honour 'pri' argument for thread_create(). Modified: head/sys/cddl/compat/opensolaris/sys/mutex.h head/sys/cddl/compat/opensolaris/sys/proc.h Modified: head/sys/cddl/compat/opensolaris/sys/mutex.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/mutex.h Sun Aug 23 09:58:06 2009 (r196455) +++ head/sys/cddl/compat/opensolaris/sys/mutex.h Sun Aug 23 11:22:46 2009 (r196456) @@ -32,9 +32,9 @@ #ifdef _KERNEL #include -#include #include #include_next +#include #include typedef enum { Modified: head/sys/cddl/compat/opensolaris/sys/proc.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/proc.h Sun Aug 23 09:58:06 2009 (r196455) +++ head/sys/cddl/compat/opensolaris/sys/proc.h Sun Aug 23 11:22:46 2009 (r196456) @@ -34,13 +34,16 @@ #include_next #include #include +#include +#include +#include #include #ifdef _KERNEL #define CPU curcpu -#define minclsyspri 0 -#define maxclsyspri 0 +#define minclsyspri PRIBIO +#define maxclsyspri PVM #define max_ncpus mp_ncpus #define boot_max_ncpus mp_ncpus @@ -58,6 +61,7 @@ static __inline kthread_t * thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg, size_t len, proc_t *pp, int state, pri_t pri) { + kthread_t *td; proc_t *p; int error; @@ -70,7 +74,15 @@ thread_create(caddr_t stk, size_t stksiz error = kproc_create(proc, arg, &p, 0, stksize / PAGE_SIZE, "solthread %p", proc); - return (error == 0 ? FIRST_THREAD_IN_PROC(p) : NULL); + if (error != 0) + td = NULL; + else { + td = FIRST_THREAD_IN_PROC(p); + thread_lock(td); + sched_prio(td, pri); + thread_unlock(td); + } + return (td); } #define thread_exit() kproc_exit(0) From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 11:27:08 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F7B3106568F; Sun, 23 Aug 2009 11:27:08 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8DC658FC16; Sun, 23 Aug 2009 11:27:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NBR82T059470; Sun, 23 Aug 2009 11:27:08 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NBR8Dp059467; Sun, 23 Aug 2009 11:27:08 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908231127.n7NBR8Dp059467@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 23 Aug 2009 11:27:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196457 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 11:27:08 -0000 Author: pjd Date: Sun Aug 23 11:27:08 2009 New Revision: 196457 URL: http://svn.freebsd.org/changeset/base/196457 Log: Set priority of vdev_geom threads and zvol threads to PRIBIO. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Aug 23 11:22:46 2009 (r196456) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Aug 23 11:27:08 2009 (r196457) @@ -194,6 +194,10 @@ vdev_geom_worker(void *arg) zio_t *zio; struct bio *bp; + thread_lock(curthread); + sched_prio(curthread, PRIBIO); + thread_unlock(curthread); + ctx = arg; for (;;) { mtx_lock(&ctx->gc_queue_mtx); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sun Aug 23 11:22:46 2009 (r196456) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sun Aug 23 11:27:08 2009 (r196457) @@ -402,6 +402,10 @@ zvol_worker(void *arg) zvol_state_t *zv; struct bio *bp; + thread_lock(curthread); + sched_prio(curthread, PRIBIO); + thread_unlock(curthread); + zv = arg; for (;;) { mtx_lock(&zv->zv_queue_mtx); From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 11:33:48 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E386106568C; Sun, 23 Aug 2009 11:33:48 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B1448FC43; Sun, 23 Aug 2009 11:33:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NBXlhs059631; Sun, 23 Aug 2009 11:33:47 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NBXl5D059625; Sun, 23 Aug 2009 11:33:47 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908231133.n7NBXl5D059625@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sun, 23 Aug 2009 11:33:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196458 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 11:33:48 -0000 Author: pjd Date: Sun Aug 23 11:33:46 2009 New Revision: 196458 URL: http://svn.freebsd.org/changeset/base/196458 Log: - Hide ZFS kernel threads under zfskern process. - Use better (shorter) threads names: 'zvol:worker zvol/tank/vol00' -> 'zvol tank/vol00' 'vdev:worker da0' -> 'vdev da0' Modified: head/sys/cddl/compat/opensolaris/sys/proc.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c head/sys/cddl/contrib/opensolaris/uts/common/sys/callb.h Modified: head/sys/cddl/compat/opensolaris/sys/proc.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/proc.h Sun Aug 23 11:27:08 2009 (r196457) +++ head/sys/cddl/compat/opensolaris/sys/proc.h Sun Aug 23 11:33:46 2009 (r196458) @@ -57,12 +57,13 @@ typedef struct thread kthread_t; typedef struct thread *kthread_id_t; typedef struct proc proc_t; +extern struct proc *zfsproc; + static __inline kthread_t * thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg, size_t len, proc_t *pp, int state, pri_t pri) { - kthread_t *td; - proc_t *p; + kthread_t *td = NULL; int error; /* @@ -71,13 +72,11 @@ thread_create(caddr_t stk, size_t stksiz ASSERT(stk == NULL); ASSERT(len == 0); ASSERT(state == TS_RUN); + ASSERT(pp == &p0); - error = kproc_create(proc, arg, &p, 0, stksize / PAGE_SIZE, - "solthread %p", proc); - if (error != 0) - td = NULL; - else { - td = FIRST_THREAD_IN_PROC(p); + error = kproc_kthread_add(proc, arg, &zfsproc, &td, 0, + stksize / PAGE_SIZE, "zfskern", "solthread %p", proc); + if (error == 0) { thread_lock(td); sched_prio(td, pri); thread_unlock(td); @@ -85,7 +84,7 @@ thread_create(caddr_t stk, size_t stksiz return (td); } -#define thread_exit() kproc_exit(0) +#define thread_exit() kthread_exit() #endif /* _KERNEL */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Aug 23 11:27:08 2009 (r196457) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Sun Aug 23 11:33:46 2009 (r196458) @@ -207,7 +207,7 @@ vdev_geom_worker(void *arg) ctx->gc_state = 2; wakeup_one(&ctx->gc_state); mtx_unlock(&ctx->gc_queue_mtx); - kproc_exit(0); + kthread_exit(); } msleep(&ctx->gc_queue, &ctx->gc_queue_mtx, PRIBIO | PDROP, "vgeom:io", 0); @@ -534,8 +534,8 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi vd->vdev_tsd = ctx; pp = cp->provider; - kproc_create(vdev_geom_worker, ctx, NULL, 0, 0, "vdev:worker %s", - pp->name); + kproc_kthread_add(vdev_geom_worker, ctx, &zfsproc, NULL, 0, 0, + "zfskern", "vdev %s", pp->name); /* * Determine the actual size of the device. Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Aug 23 11:27:08 2009 (r196457) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sun Aug 23 11:33:46 2009 (r196458) @@ -3057,6 +3057,7 @@ zfsdev_fini(void) } static struct root_hold_token *zfs_root_token; +struct proc *zfsproc; uint_t zfs_fsyncer_key; extern uint_t rrw_tsd_key; Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sun Aug 23 11:27:08 2009 (r196457) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sun Aug 23 11:33:46 2009 (r196458) @@ -415,7 +415,7 @@ zvol_worker(void *arg) zv->zv_state = 2; wakeup(&zv->zv_state); mtx_unlock(&zv->zv_queue_mtx); - kproc_exit(0); + kthread_exit(); } msleep(&zv->zv_queue, &zv->zv_queue_mtx, PRIBIO | PDROP, "zvol:io", 0); @@ -828,7 +828,8 @@ zvol_create_minor(const char *name, majo bioq_init(&zv->zv_queue); mtx_init(&zv->zv_queue_mtx, "zvol", NULL, MTX_DEF); zv->zv_state = 0; - kproc_create(zvol_worker, zv, NULL, 0, 0, "zvol:worker %s", pp->name); + kproc_kthread_add(zvol_worker, zv, &zfsproc, NULL, 0, 0, "zfskern", + "zvol %s", pp->name + strlen(ZVOL_DEV_DIR) + 1); zvol_minors++; end: Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/callb.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/callb.h Sun Aug 23 11:27:08 2009 (r196457) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/callb.h Sun Aug 23 11:33:46 2009 (r196458) @@ -135,8 +135,6 @@ typedef struct callb_cpr { #define CALLB_CPR_INIT(cp, lockp, func, name) { \ strlcpy(curthread->td_name, (name), \ sizeof(curthread->td_name)); \ - strlcpy(curthread->td_proc->p_comm, (name), \ - sizeof(curthread->td_proc->p_comm)); \ bzero((caddr_t)(cp), sizeof (callb_cpr_t)); \ (cp)->cc_lockp = lockp; \ (cp)->cc_id = callb_add(func, (void *)(cp), \ From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 12:23:25 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4076D106568E; Sun, 23 Aug 2009 12:23:25 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F66F8FC18; Sun, 23 Aug 2009 12:23:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NCNPab060681; Sun, 23 Aug 2009 12:23:25 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NCNPqd060679; Sun, 23 Aug 2009 12:23:25 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200908231223.n7NCNPqd060679@svn.freebsd.org> From: Ed Schouten Date: Sun, 23 Aug 2009 12:23:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196459 - head/gnu/usr.bin/patch X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 12:23:25 -0000 Author: ed Date: Sun Aug 23 12:23:24 2009 New Revision: 196459 URL: http://svn.freebsd.org/changeset/base/196459 Log: Add support for diffs generated by Perforce. It basically picks the filenames from the "====" line and strips off the # revision number. Modified: head/gnu/usr.bin/patch/pch.c Modified: head/gnu/usr.bin/patch/pch.c ============================================================================== --- head/gnu/usr.bin/patch/pch.c Sun Aug 23 11:33:46 2009 (r196458) +++ head/gnu/usr.bin/patch/pch.c Sun Aug 23 12:23:24 2009 (r196459) @@ -211,6 +211,25 @@ there_is_another_patch(void) return TRUE; } +static char * +p4_savestr(char *str) +{ + char *t, *h; + + /* Leading whitespace. */ + while (isspace((unsigned char)*str)) + str++; + + /* Remove the file revision number. */ + for (t = str, h = NULL; *t != '\0' && !isspace((unsigned char)*t); t++) + if (*t == '#') + h = t; + if (h != NULL) + *h = '\0'; + + return savestr(str); +} + /* * Determine what kind of diff is in the remaining part of the patch file. */ @@ -298,6 +317,11 @@ intuit_diff_type(void) free(revision); revision = Nullch; } + } else if (strnEQ(s, "==== ", 5)) { + /* Perforce-style diffs. */ + if ((t = strstr(s + 5, " - ")) != NULL) + newtmp = p4_savestr(t + 3); + oldtmp = p4_savestr(s + 5); } if ((!diff_type || diff_type == ED_DIFF) && first_command_line >= 0L && From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 12:44:16 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B494106568C; Sun, 23 Aug 2009 12:44:16 +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 E43D88FC08; Sun, 23 Aug 2009 12:44:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NCiFkx061098; Sun, 23 Aug 2009 12:44:15 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NCiFgc061095; Sun, 23 Aug 2009 12:44:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200908231244.n7NCiFgc061095@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 23 Aug 2009 12:44:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196460 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 12:44:16 -0000 Author: kib Date: Sun Aug 23 12:44:15 2009 New Revision: 196460 URL: http://svn.freebsd.org/changeset/base/196460 Log: Fix the conformance of poll(2) for sockets after r195423 by returning POLLHUP instead of POLLIN for several cases. Now, the tools/regression/poll results for FreeBSD are closer to that of the Solaris and Linux. Also, improve the POSIX conformance by explicitely clearing POLLOUT when POLLHUP is reported in pollscan(), making the fix global. Submitted by: bde Reviewed by: rwatson MFC after: 1 week Modified: head/sys/kern/sys_generic.c head/sys/kern/uipc_socket.c Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Sun Aug 23 12:23:24 2009 (r196459) +++ head/sys/kern/sys_generic.c Sun Aug 23 12:44:15 2009 (r196460) @@ -1228,6 +1228,13 @@ pollscan(td, fds, nfd) selfdalloc(td, fds); fds->revents = fo_poll(fp, fds->events, td->td_ucred, td); + /* + * POSIX requires POLLOUT to be never + * set simultaneously with POLLHUP. + */ + if ((fds->revents & POLLHUP) != 0) + fds->revents &= ~POLLOUT; + if (fds->revents != 0) n++; } Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Sun Aug 23 12:23:24 2009 (r196459) +++ head/sys/kern/uipc_socket.c Sun Aug 23 12:44:15 2009 (r196460) @@ -2898,13 +2898,11 @@ sopoll_generic(struct socket *so, int ev if (so->so_oobmark || (so->so_rcv.sb_state & SBS_RCVATMARK)) revents |= events & (POLLPRI | POLLRDBAND); - if ((events & POLLINIGNEOF) == 0) { - if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { - revents |= events & (POLLIN | POLLRDNORM); - if (so->so_snd.sb_state & SBS_CANTSENDMORE) - revents |= POLLHUP; - } - } + if ((events & POLLINIGNEOF) == 0) + if (so->so_rcv.sb_state & SBS_CANTRCVMORE) + revents |= POLLHUP; + if (so->so_snd.sb_state & SBS_CANTSENDMORE) + revents |= POLLHUP; if (revents == 0) { if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) { From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 13:58:26 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2DC26106568D; Sun, 23 Aug 2009 13:58:26 +0000 (UTC) (envelope-from simon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01FAD8FC1E; Sun, 23 Aug 2009 13:58:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NDwPLY062542; Sun, 23 Aug 2009 13:58:25 GMT (envelope-from simon@svn.freebsd.org) Received: (from simon@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NDwPNf062541; Sun, 23 Aug 2009 13:58:25 GMT (envelope-from simon@svn.freebsd.org) Message-Id: <200908231358.n7NDwPNf062541@svn.freebsd.org> From: "Simon L. Nielsen" Date: Sun, 23 Aug 2009 13:58:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-crypto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196461 - in vendor-crypto/openssl/dist: crypto/pqueue ssl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 13:58:26 -0000 Author: simon Date: Sun Aug 23 13:58:25 2009 New Revision: 196461 URL: http://svn.freebsd.org/changeset/base/196461 Log: Import DTLS fix from upstream OpenSSL 0.9.8 branch: Fix memory consumption bug with "future epoch" DTLS records. Note that this will not get FreeBSD Security Advisory as DTLS is experimental in OpenSSL. Security: CVE-2009-1377 Obtained from: OpenSSL CVS http://cvs.openssl.org/chngview?cn=18187 Modified: vendor-crypto/openssl/dist/crypto/pqueue/pqueue.c vendor-crypto/openssl/dist/crypto/pqueue/pqueue.h vendor-crypto/openssl/dist/ssl/d1_pkt.c Modified: vendor-crypto/openssl/dist/crypto/pqueue/pqueue.c ============================================================================== --- vendor-crypto/openssl/dist/crypto/pqueue/pqueue.c Sun Aug 23 12:44:15 2009 (r196460) +++ vendor-crypto/openssl/dist/crypto/pqueue/pqueue.c Sun Aug 23 13:58:25 2009 (r196461) @@ -234,3 +234,17 @@ pqueue_next(pitem **item) return ret; } + +int +pqueue_size(pqueue_s *pq) +{ + pitem *item = pq->items; + int count = 0; + + while(item != NULL) + { + count++; + item = item->next; + } + return count; +} Modified: vendor-crypto/openssl/dist/crypto/pqueue/pqueue.h ============================================================================== --- vendor-crypto/openssl/dist/crypto/pqueue/pqueue.h Sun Aug 23 12:44:15 2009 (r196460) +++ vendor-crypto/openssl/dist/crypto/pqueue/pqueue.h Sun Aug 23 13:58:25 2009 (r196461) @@ -91,5 +91,6 @@ pitem *pqueue_iterator(pqueue pq); pitem *pqueue_next(piterator *iter); void pqueue_print(pqueue pq); +int pqueue_size(pqueue pq); #endif /* ! HEADER_PQUEUE_H */ Modified: vendor-crypto/openssl/dist/ssl/d1_pkt.c ============================================================================== --- vendor-crypto/openssl/dist/ssl/d1_pkt.c Sun Aug 23 12:44:15 2009 (r196460) +++ vendor-crypto/openssl/dist/ssl/d1_pkt.c Sun Aug 23 13:58:25 2009 (r196461) @@ -167,6 +167,10 @@ dtls1_buffer_record(SSL *s, record_pqueu DTLS1_RECORD_DATA *rdata; pitem *item; + /* Limit the size of the queue to prevent DOS attacks */ + if (pqueue_size(queue->q) >= 100) + return 0; + rdata = OPENSSL_malloc(sizeof(DTLS1_RECORD_DATA)); item = pitem_new(priority, rdata); if (rdata == NULL || item == NULL) From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 14:12:01 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86A32106568E; Sun, 23 Aug 2009 14:12:01 +0000 (UTC) (envelope-from simon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 74E408FC08; Sun, 23 Aug 2009 14:12:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NEC1Ki062847; Sun, 23 Aug 2009 14:12:01 GMT (envelope-from simon@svn.freebsd.org) Received: (from simon@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NEC1Fw062845; Sun, 23 Aug 2009 14:12:01 GMT (envelope-from simon@svn.freebsd.org) Message-Id: <200908231412.n7NEC1Fw062845@svn.freebsd.org> From: "Simon L. Nielsen" Date: Sun, 23 Aug 2009 14:12:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-crypto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196462 - vendor-crypto/openssl/dist/ssl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 14:12:01 -0000 Author: simon Date: Sun Aug 23 14:12:01 2009 New Revision: 196462 URL: http://svn.freebsd.org/changeset/base/196462 Log: Import DTLS fix from upstream OpenSSL 0.9.8 branch: Fix fragment handling memory leak. Note that this will not get FreeBSD Security Advisory as DTLS is experimental in OpenSSL. Security: CVE-2009-1378 Obtained from: OpenSSL CVS http://cvs.openssl.org/filediff?f=openssl/ssl/d1_both.c&v1=1.4.2.13&v2=1.4.2.15 Modified: vendor-crypto/openssl/dist/ssl/d1_both.c Modified: vendor-crypto/openssl/dist/ssl/d1_both.c ============================================================================== --- vendor-crypto/openssl/dist/ssl/d1_both.c Sun Aug 23 13:58:25 2009 (r196461) +++ vendor-crypto/openssl/dist/ssl/d1_both.c Sun Aug 23 14:12:01 2009 (r196462) @@ -561,7 +561,16 @@ dtls1_process_out_of_seq_message(SSL *s, if ((msg_hdr->frag_off+frag_len) > msg_hdr->msg_len) goto err; - if (msg_hdr->seq <= s->d1->handshake_read_seq) + /* Try to find item in queue, to prevent duplicate entries */ + pq_64bit_init(&seq64); + pq_64bit_assign_word(&seq64, msg_hdr->seq); + item = pqueue_find(s->d1->buffered_messages, seq64); + pq_64bit_free(&seq64); + + /* Discard the message if sequence number was already there, is + * too far in the future or the fragment is already in the queue */ + if (msg_hdr->seq <= s->d1->handshake_read_seq || + msg_hdr->seq > s->d1->handshake_read_seq + 10 || item != NULL) { unsigned char devnull [256]; From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 14:14:56 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ABEF6106568C; Sun, 23 Aug 2009 14:14:56 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id 41C0E8FC0C; Sun, 23 Aug 2009 14:14:56 +0000 (UTC) Received: from c122-106-152-1.carlnfd1.nsw.optusnet.com.au (c122-106-152-1.carlnfd1.nsw.optusnet.com.au [122.106.152.1]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n7NEEg7W027211 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 24 Aug 2009 00:14:45 +1000 Date: Mon, 24 Aug 2009 00:14:42 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Ed Schouten In-Reply-To: <20090823080940.GT1292@hoeg.nl> Message-ID: <20090823230300.Q38728@delplex.bde.org> References: <200908230759.n7N7xS6g051165@svn.freebsd.org> <20090823080940.GT1292@hoeg.nl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Julian Elischer Subject: Re: svn commit: r196451 - head/sys/netinet/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 14:14:56 -0000 On Sun, 23 Aug 2009, Ed Schouten wrote: > * Julian Elischer wrote: >> + * (now that we a re guaranteed of success). > ^^^^ > > ;-) At least 5 more commits are needed at this rate to fix the comment. % /* % * Other things that are only done the first time. ^ (1) ^ (2) % * (now that we a re guaranteed of success). ^^^^ (3) ^^ (4) % */ (1) remove syntax error ("." in the middle of a pseudo-sentence (2) fix line break (don't format for 60-column terminals) (3) as above (4) remove syntax error (5) either remove the comment, or change it so that it says something that is useful or at least correct. This is an especially initial init function, so of course it does things that are done the first time, and other comments in it describe the onlyness of this better. This function always succeeds, so its success is guaranteed throughout the function, not just in the lines following this comment. 100 or so commits at this rate would be needed to fix other style bugs in this function: % % % 3 extra blank lines before the function. % /**************** Non-KNF block comment. % * Stuff that must be initialised only on boot or module load Strange (English?) spelling of "initialized". Sentence not terminated with a ".". % */ % int % ipfw_init(void) % { % int error = 0; This variable is not really used. Initialization in declaration. This mainly obfuscates the non-use of the variable. % % ipfw_dyn_rule_zone = uma_zcreate("IPFW dynamic rule", % sizeof(ipfw_dyn_rule), NULL, NULL, NULL, NULL, % UMA_ALIGN_PTR, 0); Bogus line splitting for the second split (the split is long before needed, and in fact is not needed). % Extra blank line % IPFW_DYN_LOCK_INIT(); Minor obfuscation. This macro is only used once. % /* % * Only print out this stuff the first time around, % * when called from the sysinit code. % */ Missing blank line before the comment. KNF doesn't really allow this either, but if there are to be blank lines in functions then they belong before blocks of code (and all blocks of code should begin with a comment). Comment adds less than nothing. This is an especially initial init function, so of course it does stuff that is only done the first time, not just this printf, and this is better described earlier. % printf("ipfw2 " % #ifdef INET6 % "(+ipv6) " % #endif % "initialized, divert %s, nat %s, " % "rule-based forwarding " % #ifdef IPFIREWALL_FORWARD % "enabled, " % #else % "disabled, " % #endif % "default to %s, logging ", % #ifdef IPDIVERT % "enabled", % #else % "loadable", % #endif % #ifdef IPFIREWALL_NAT % "enabled", % #else % "loadable", % #endif % default_to_accept ? "accept" : "deny"); I hate using C90 string concatenation to obfuscate messages, but don't see anything better here. % Extra blank line. This would normally be correct before a block comment, but here the block comment breaks the block -- to the extent that the previous comment is useful, its scope doesn't end here -- the "block" consistes of all the printfs. % /* % * Note: V_xxx variables can be accessed here but the iattach() % * may not have been called yet for the VIMGE case. % * Tuneables will have been processed. % */ Grammar error "the iattach()". Should be plain iattach in KNF. I prefer iattach(). Could be "the iattach() function to be as verbose as man pages. Semantic error "may" (should be "might"). Spelling error "VIMGE". Possible spelling error "Tuneables". ispell gives only tunable, "tune able" and "tune-able". % if (V_fw_verbose == 0) % printf("disabled\n"); % else if (V_verbose_limit == 0) % printf("unlimited\n"); % else % printf("limited to %d packets/entry by default\n", % V_verbose_limit); This is an extension of the previous printed, with a completely different style. It uses separate printfs instead of combining everything using complicated logic involving ifdefs and the ?: operator. This is probably better. With the second style, the newline should be in a separate printf too. The printfs are too verbose (especially the last one), so they might give too-long lines in output, but a single line is best for a log message. % % /* % * Other things that are only done the first time. % * (now that we a re guaranteed of success). % */ See above. % ip_fw_ctl_ptr = ipfw_ctl; % ip_fw_chk_ptr = ipfw_chk; Missing blank line. The above comment and its block end before the return statement. % return (error); This is an obfuscation of "return (0);". Old versions of this function sometimes failed, so the "(now we a re cuaranteed success)" (sic) comment would have applied to them, but they didn't have the comment. They needed the `error' variable, but they were missing the obfuscatory initialization of it to 0 and the obfuscatory return of it (they just returned 0 here). % } Bruce From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 14:15:29 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06B1B1065691; Sun, 23 Aug 2009 14:15:29 +0000 (UTC) (envelope-from simon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E98428FC24; Sun, 23 Aug 2009 14:15:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NEFSxK062944; Sun, 23 Aug 2009 14:15:28 GMT (envelope-from simon@svn.freebsd.org) Received: (from simon@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NEFSwr062942; Sun, 23 Aug 2009 14:15:28 GMT (envelope-from simon@svn.freebsd.org) Message-Id: <200908231415.n7NEFSwr062942@svn.freebsd.org> From: "Simon L. Nielsen" Date: Sun, 23 Aug 2009 14:15:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-crypto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196463 - vendor-crypto/openssl/dist/ssl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 14:15:29 -0000 Author: simon Date: Sun Aug 23 14:15:28 2009 New Revision: 196463 URL: http://svn.freebsd.org/changeset/base/196463 Log: Import DTLS fix from upstream OpenSSL 0.9.8 branch: Do not access freed data structure. Note that this will not get FreeBSD Security Advisory as DTLS is experimental in OpenSSL. Security: CVE-2009-1379 Obtained from: OpenSSL CVS http://cvs.openssl.org/chngview?cn=18156 Modified: vendor-crypto/openssl/dist/ssl/d1_both.c Modified: vendor-crypto/openssl/dist/ssl/d1_both.c ============================================================================== --- vendor-crypto/openssl/dist/ssl/d1_both.c Sun Aug 23 14:12:01 2009 (r196462) +++ vendor-crypto/openssl/dist/ssl/d1_both.c Sun Aug 23 14:15:28 2009 (r196463) @@ -519,6 +519,7 @@ dtls1_retrieve_buffered_fragment(SSL *s, if ( s->d1->handshake_read_seq == frag->msg_header.seq) { + unsigned long frag_len = frag->msg_header.frag_len; pqueue_pop(s->d1->buffered_messages); al=dtls1_preprocess_fragment(s,&frag->msg_header,max); @@ -536,7 +537,7 @@ dtls1_retrieve_buffered_fragment(SSL *s, if (al==0) { *ok = 1; - return frag->msg_header.frag_len; + return frag_len; } ssl3_send_alert(s,SSL3_AL_FATAL,al); From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 14:27:47 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 039E9106568B; Sun, 23 Aug 2009 14:27:47 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E698A8FC08; Sun, 23 Aug 2009 14:27:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NERkhw063297; Sun, 23 Aug 2009 14:27:46 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NERkJX063295; Sun, 23 Aug 2009 14:27:46 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200908231427.n7NERkJX063295@svn.freebsd.org> From: Robert Noland Date: Sun, 23 Aug 2009 14:27:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196464 - head/sys/dev/drm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 14:27:47 -0000 Author: rnoland Date: Sun Aug 23 14:27:46 2009 New Revision: 196464 URL: http://svn.freebsd.org/changeset/base/196464 Log: Clean up the locking in drm_alloc_resource() MFC after: 2 weeks Modified: head/sys/dev/drm/drm_bufs.c Modified: head/sys/dev/drm/drm_bufs.c ============================================================================== --- head/sys/dev/drm/drm_bufs.c Sun Aug 23 14:15:28 2009 (r196463) +++ head/sys/dev/drm/drm_bufs.c Sun Aug 23 14:27:46 2009 (r196464) @@ -45,27 +45,35 @@ __FBSDID("$FreeBSD$"); */ static int drm_alloc_resource(struct drm_device *dev, int resource) { + struct resource *res; + int rid; + + DRM_SPINLOCK_ASSERT(&dev->dev_lock); + if (resource >= DRM_MAX_PCI_RESOURCE) { DRM_ERROR("Resource %d too large\n", resource); return 1; } - DRM_UNLOCK(); if (dev->pcir[resource] != NULL) { - DRM_LOCK(); return 0; } - dev->pcirid[resource] = PCIR_BAR(resource); - dev->pcir[resource] = bus_alloc_resource_any(dev->device, - SYS_RES_MEMORY, &dev->pcirid[resource], RF_SHAREABLE); + DRM_UNLOCK(); + rid = PCIR_BAR(resource); + res = bus_alloc_resource_any(dev->device, SYS_RES_MEMORY, &rid, + RF_SHAREABLE); DRM_LOCK(); - - if (dev->pcir[resource] == NULL) { + if (res == NULL) { DRM_ERROR("Couldn't find resource 0x%x\n", resource); return 1; } + if (dev->pcir[resource] == NULL) { + dev->pcirid[resource] = rid; + dev->pcir[resource] = res; + } + return 0; } From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 14:31:20 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B86D4106568C; Sun, 23 Aug 2009 14:31:20 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A6EBA8FC08; Sun, 23 Aug 2009 14:31:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NEVKTv063410; Sun, 23 Aug 2009 14:31:20 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NEVKv0063405; Sun, 23 Aug 2009 14:31:20 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200908231431.n7NEVKv0063405@svn.freebsd.org> From: Robert Noland Date: Sun, 23 Aug 2009 14:31:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196465 - head/sys/dev/drm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 14:31:20 -0000 Author: rnoland Date: Sun Aug 23 14:31:20 2009 New Revision: 196465 URL: http://svn.freebsd.org/changeset/base/196465 Log: Clean up the handling of device minors Submitted by: Ed MFC after: 2 weeks Modified: head/sys/dev/drm/drmP.h head/sys/dev/drm/drm_drv.c head/sys/dev/drm/drm_fops.c head/sys/dev/drm/drm_sysctl.c Modified: head/sys/dev/drm/drmP.h ============================================================================== --- head/sys/dev/drm/drmP.h Sun Aug 23 14:27:46 2009 (r196464) +++ head/sys/dev/drm/drmP.h Sun Aug 23 14:31:20 2009 (r196465) @@ -416,7 +416,6 @@ struct drm_file { struct drm_device *dev; int authenticated; int master; - int minor; pid_t pid; uid_t uid; drm_magic_t magic; Modified: head/sys/dev/drm/drm_drv.c ============================================================================== --- head/sys/dev/drm/drm_drv.c Sun Aug 23 14:27:46 2009 (r196464) +++ head/sys/dev/drm/drm_drv.c Sun Aug 23 14:31:20 2009 (r196465) @@ -53,9 +53,6 @@ static void drm_unload(struct drm_device static drm_pci_id_list_t *drm_find_description(int vendor, int device, drm_pci_id_list_t *idlist); -#define DRIVER_SOFTC(unit) \ - ((struct drm_device *)devclass_get_softc(drm_devclass, unit)) - MODULE_VERSION(drm, 1); MODULE_DEPEND(drm, agp, 1, 1, 1); MODULE_DEPEND(drm, pci, 1, 1, 1); @@ -210,11 +207,12 @@ int drm_attach(device_t kdev, drm_pci_id dev->device = kdev; #endif dev->devnode = make_dev(&drm_cdevsw, - unit, + 0, DRM_DEV_UID, DRM_DEV_GID, DRM_DEV_MODE, "dri/card%d", unit); + dev->devnode->si_drv1 = dev; #if __FreeBSD_version >= 700053 dev->pci_domain = pci_get_domain(dev->device); @@ -606,7 +604,7 @@ int drm_open(struct cdev *kdev, int flag struct drm_device *dev = NULL; int retcode = 0; - dev = DRIVER_SOFTC(dev2unit(kdev)); + dev = kdev->si_drv1; DRM_DEBUG("open_count = %d\n", dev->open_count); Modified: head/sys/dev/drm/drm_fops.c ============================================================================== --- head/sys/dev/drm/drm_fops.c Sun Aug 23 14:27:46 2009 (r196464) +++ head/sys/dev/drm/drm_fops.c Sun Aug 23 14:31:20 2009 (r196465) @@ -44,14 +44,13 @@ int drm_open_helper(struct cdev *kdev, i struct drm_device *dev) { struct drm_file *priv; - int m = dev2unit(kdev); int retcode; if (flags & O_EXCL) return EBUSY; /* No exclusive opens */ dev->flags = flags; - DRM_DEBUG("pid = %d, minor = %d\n", DRM_CURRENTPID, m); + DRM_DEBUG("pid = %d, device = %s\n", DRM_CURRENTPID, devtoname(kdev)); priv = malloc(sizeof(*priv), DRM_MEM_FILES, M_NOWAIT | M_ZERO); if (priv == NULL) { @@ -68,7 +67,6 @@ int drm_open_helper(struct cdev *kdev, i priv->dev = dev; priv->uid = p->td_ucred->cr_svuid; priv->pid = p->td_proc->p_pid; - priv->minor = m; priv->ioctl_count = 0; /* for compatibility root is always authenticated */ Modified: head/sys/dev/drm/drm_sysctl.c ============================================================================== --- head/sys/dev/drm/drm_sysctl.c Sun Aug 23 14:27:46 2009 (r196464) +++ head/sys/dev/drm/drm_sysctl.c Sun Aug 23 14:31:20 2009 (r196465) @@ -298,12 +298,13 @@ static int drm_clients_info DRM_SYSCTL_H DRM_UNLOCK(); - DRM_SYSCTL_PRINT("\na dev pid uid magic ioctls\n"); + DRM_SYSCTL_PRINT( + "\na dev pid uid magic ioctls\n"); for (i = 0; i < privcount; i++) { priv = &tempprivs[i]; - DRM_SYSCTL_PRINT("%c %3d %5d %5d %10u %10lu\n", + DRM_SYSCTL_PRINT("%c %-12s %5d %5d %10u %10lu\n", priv->authenticated ? 'y' : 'n', - priv->minor, + devtoname(priv->dev->devnode), priv->pid, priv->uid, priv->magic, From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 14:33:14 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 194051065728; Sun, 23 Aug 2009 14:33:14 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3074E8FC26; Sun, 23 Aug 2009 14:33:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NEXD9P063489; Sun, 23 Aug 2009 14:33:13 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NEXDE5063486; Sun, 23 Aug 2009 14:33:13 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200908231433.n7NEXDE5063486@svn.freebsd.org> From: Robert Noland Date: Sun, 23 Aug 2009 14:33:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196466 - head/sys/dev/drm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 14:33:14 -0000 Author: rnoland Date: Sun Aug 23 14:33:12 2009 New Revision: 196466 URL: http://svn.freebsd.org/changeset/base/196466 Log: Add a read only sysctl tracking the hw.drm.msi tunable. MFC after: 2 weeks Modified: head/sys/dev/drm/drmP.h head/sys/dev/drm/drm_drv.c Modified: head/sys/dev/drm/drmP.h ============================================================================== --- head/sys/dev/drm/drmP.h Sun Aug 23 14:31:20 2009 (r196465) +++ head/sys/dev/drm/drmP.h Sun Aug 23 14:33:12 2009 (r196466) @@ -148,6 +148,8 @@ MALLOC_DECLARE(DRM_MEM_CTXBITMAP); MALLOC_DECLARE(DRM_MEM_SGLISTS); MALLOC_DECLARE(DRM_MEM_DRAWABLE); +SYSCTL_DECL(_hw_drm); + #define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8) /* Internal types and structures */ Modified: head/sys/dev/drm/drm_drv.c ============================================================================== --- head/sys/dev/drm/drm_drv.c Sun Aug 23 14:31:20 2009 (r196465) +++ head/sys/dev/drm/drm_drv.c Sun Aug 23 14:33:12 2009 (r196466) @@ -133,6 +133,9 @@ static struct cdevsw drm_cdevsw = { static int drm_msi = 1; /* Enable by default. */ TUNABLE_INT("hw.drm.msi", &drm_msi); +SYSCTL_NODE(_hw, OID_AUTO, drm, CTLFLAG_RW, NULL, "DRM device"); +SYSCTL_INT(_hw_drm, OID_AUTO, msi, CTLFLAG_RDTUN, &drm_msi, 1, + "Enable MSI interrupts for drm devices"); static struct drm_msi_blacklist_entry drm_msi_blacklist[] = { {0x8086, 0x2772}, /* Intel i945G */ \ From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 14:39:16 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59B761065693; Sun, 23 Aug 2009 14:39:16 +0000 (UTC) (envelope-from simon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E6CC8FC1A; Sun, 23 Aug 2009 14:39:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NEdG8m063637; Sun, 23 Aug 2009 14:39:16 GMT (envelope-from simon@svn.freebsd.org) Received: (from simon@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NEdGp5063635; Sun, 23 Aug 2009 14:39:16 GMT (envelope-from simon@svn.freebsd.org) Message-Id: <200908231439.n7NEdGp5063635@svn.freebsd.org> From: "Simon L. Nielsen" Date: Sun, 23 Aug 2009 14:39:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-crypto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196467 - vendor-crypto/openssl/dist/ssl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 14:39:16 -0000 Author: simon Date: Sun Aug 23 14:39:15 2009 New Revision: 196467 URL: http://svn.freebsd.org/changeset/base/196467 Log: Import DTLS fix from upstream OpenSSL 0.9.8 branch: Fix DTLS fragment bug - out-of-sequence message handling which could result in NULL pointer dereference in dtls1_process_out_of_seq_message(). Note that this will not get FreeBSD Security Advisory as DTLS is experimental in OpenSSL. Security: CVE-2009-1387 Obtained from: OpenSSL CVS http://cvs.openssl.org/chngview?cn=17958 Modified: vendor-crypto/openssl/dist/ssl/d1_both.c Modified: vendor-crypto/openssl/dist/ssl/d1_both.c ============================================================================== --- vendor-crypto/openssl/dist/ssl/d1_both.c Sun Aug 23 14:33:12 2009 (r196466) +++ vendor-crypto/openssl/dist/ssl/d1_both.c Sun Aug 23 14:39:15 2009 (r196467) @@ -585,30 +585,31 @@ dtls1_process_out_of_seq_message(SSL *s, } } - frag = dtls1_hm_fragment_new(frag_len); - if ( frag == NULL) - goto err; + if (frag_len) + { + frag = dtls1_hm_fragment_new(frag_len); + if ( frag == NULL) + goto err; - memcpy(&(frag->msg_header), msg_hdr, sizeof(*msg_hdr)); + memcpy(&(frag->msg_header), msg_hdr, sizeof(*msg_hdr)); - if (frag_len) - { - /* read the body of the fragment (header has already been read */ + /* read the body of the fragment (header has already been read) */ i = s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE, frag->fragment,frag_len,0); if (i<=0 || (unsigned long)i!=frag_len) goto err; - } - pq_64bit_init(&seq64); - pq_64bit_assign_word(&seq64, msg_hdr->seq); + pq_64bit_init(&seq64); + pq_64bit_assign_word(&seq64, msg_hdr->seq); - item = pitem_new(seq64, frag); - pq_64bit_free(&seq64); - if ( item == NULL) - goto err; + item = pitem_new(seq64, frag); + pq_64bit_free(&seq64); + if ( item == NULL) + goto err; + + pqueue_insert(s->d1->buffered_messages, item); + } - pqueue_insert(s->d1->buffered_messages, item); return DTLS1_HM_FRAGMENT_RETRY; err: From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 14:39:27 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7614F106568C; Sun, 23 Aug 2009 14:39:27 +0000 (UTC) (envelope-from jeremie@le-hen.org) Received: from smtp1-g21.free.fr (smtp1-g21.free.fr [212.27.42.1]) by mx1.freebsd.org (Postfix) with ESMTP id D49468FC21; Sun, 23 Aug 2009 14:39:23 +0000 (UTC) Received: from smtp1-g21.free.fr (localhost [127.0.0.1]) by smtp1-g21.free.fr (Postfix) with ESMTP id C202F9400BC; Sun, 23 Aug 2009 16:39:18 +0200 (CEST) Received: from endor.tataz.chchile.org (tataz.chchile.org [82.233.239.98]) by smtp1-g21.free.fr (Postfix) with ESMTP id D32D29400C2; Sun, 23 Aug 2009 16:39:15 +0200 (CEST) Received: from felucia.tataz.chchile.org (felucia.tataz.chchile.org [192.168.1.9]) by endor.tataz.chchile.org (Postfix) with ESMTP id CE3FC36313; Sun, 23 Aug 2009 14:38:40 +0000 (UTC) Received: by felucia.tataz.chchile.org (Postfix, from userid 1000) id B41C6A14DD; Sun, 23 Aug 2009 14:38:40 +0000 (UTC) Date: Sun, 23 Aug 2009 16:38:40 +0200 From: Jeremie Le Hen To: Scott Long Message-ID: <20090823143840.GD61707@felucia.tataz.chchile.org> References: <200908132318.n7DNIjvO015601@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200908132318.n7DNIjvO015601@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196200 - in head: etc/mtree include sys/dev/mfi usr.sbin usr.sbin/mfiutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 14:39:27 -0000 Hi, On Thu, Aug 13, 2009 at 11:18:45PM +0000, Scott Long wrote: > Author: scottl > Date: Thu Aug 13 23:18:45 2009 > New Revision: 196200 > URL: http://svn.freebsd.org/changeset/base/196200 > > Log: > ntroduce mfiutil, a basic utility for managing LSI SAS-RAID & Dell > PERC5/6 controllers. Controller, array, and drive status can be > checked, basic attributes can be changed, and arrays and spares can > be created and deleted. Controller firmware can also be flashed. > > This does not replace MegaCLI, found in ports, as that is officially > sanctioned and supported by LSI and includes vastly more > functionality. However, mfiutil is open source and guaranteed to > provide basic functionality, which can be especially useful if you > have a problem and can't get MegaCLI to work. > > Approved by: re > Obtained from: Yahoo! Inc. Thanks for this work. Wouldn't it be more reasonable to use a standard suffix for all dedicated admin utility such as vidcontrol, memcontrol, kbdcontrol: % 59# find /bin /sbin /usr/bin /usr/sbin -name \*control | wc -l % 25 % 60# find /bin /sbin /usr/bin /usr/sbin -name \*config | wc -l % 13 Once 8.0-RELEASE is out, the name will be more difficult to change. Regards, -- Jeremie Le Hen < jeremie at le-hen dot org >< ttz at chchile dot org > From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 14:44:52 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D51E106568C; Sun, 23 Aug 2009 14:44:52 +0000 (UTC) (envelope-from simon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 724788FC0C; Sun, 23 Aug 2009 14:44:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NEiqsd063826; Sun, 23 Aug 2009 14:44:52 GMT (envelope-from simon@svn.freebsd.org) Received: (from simon@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NEiqcB063825; Sun, 23 Aug 2009 14:44:52 GMT (envelope-from simon@svn.freebsd.org) Message-Id: <200908231444.n7NEiqcB063825@svn.freebsd.org> From: "Simon L. Nielsen" Date: Sun, 23 Aug 2009 14:44:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor-crypto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196468 - vendor-crypto/openssl/0.9.8k-dtls-fixes X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 14:44:52 -0000 Author: simon Date: Sun Aug 23 14:44:51 2009 New Revision: 196468 URL: http://svn.freebsd.org/changeset/base/196468 Log: Tag 0.9.8k wtih dtls-fixes. Added: vendor-crypto/openssl/0.9.8k-dtls-fixes/ - copied from r196467, vendor-crypto/openssl/dist/ From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 14:48:25 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DA58106568D; Sun, 23 Aug 2009 14:48:25 +0000 (UTC) (envelope-from jkoshy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8CB628FC08; Sun, 23 Aug 2009 14:48:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NEmPWf063939; Sun, 23 Aug 2009 14:48:25 GMT (envelope-from jkoshy@svn.freebsd.org) Received: (from jkoshy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NEmPix063937; Sun, 23 Aug 2009 14:48:25 GMT (envelope-from jkoshy@svn.freebsd.org) Message-Id: <200908231448.n7NEmPix063937@svn.freebsd.org> From: Joseph Koshy Date: Sun, 23 Aug 2009 14:48:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196469 - head/lib/libpmc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 14:48:25 -0000 Author: jkoshy Date: Sun Aug 23 14:48:25 2009 New Revision: 196469 URL: http://svn.freebsd.org/changeset/base/196469 Log: Use a more appropriate choice of words. Submitted by: danfe Modified: head/lib/libpmc/pmc.3 Modified: head/lib/libpmc/pmc.3 ============================================================================== --- head/lib/libpmc/pmc.3 Sun Aug 23 14:44:51 2009 (r196468) +++ head/lib/libpmc/pmc.3 Sun Aug 23 14:48:25 2009 (r196469) @@ -262,7 +262,7 @@ CPU is running unprivileged code. The ability to write to performance counters. .El .Ss CPU Naming Conventions -CPUs are named using small integers from zero until, but +CPUs are named using small integers from zero up to, but excluding, the value returned by function .Fn pmc_ncpu . On platforms supporting sparsely numbered CPUs not all the numbers in From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 14:55:58 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C410106568C; Sun, 23 Aug 2009 14:55:58 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 49E738FC17; Sun, 23 Aug 2009 14:55:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NEtwfI064142; Sun, 23 Aug 2009 14:55:58 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NEtvav064138; Sun, 23 Aug 2009 14:55:57 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200908231455.n7NEtvav064138@svn.freebsd.org> From: Robert Noland Date: Sun, 23 Aug 2009 14:55:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196470 - in head/sys: conf dev/drm modules/drm/radeon X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 14:55:58 -0000 Author: rnoland Date: Sun Aug 23 14:55:57 2009 New Revision: 196470 URL: http://svn.freebsd.org/changeset/base/196470 Log: Add kernel support for Radeon R6/7xx 3D. You will still need Mesa from git and possibly an updated DDX driver, but this is working fairly well now. MFC after: 2 weeks Added: head/sys/dev/drm/r600_blit.c (contents, props changed) head/sys/dev/drm/radeon_cs.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/drm/r600_cp.c head/sys/dev/drm/radeon_cp.c head/sys/dev/drm/radeon_drm.h head/sys/dev/drm/radeon_drv.h head/sys/dev/drm/radeon_state.c head/sys/modules/drm/radeon/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Aug 23 14:48:25 2009 (r196469) +++ head/sys/conf/files Sun Aug 23 14:55:57 2009 (r196470) @@ -845,8 +845,10 @@ dev/drm/r128_irq.c optional r128drm dev/drm/r128_state.c optional r128drm \ compile-with "${NORMAL_C} -finline-limit=13500" dev/drm/r300_cmdbuf.c optional radeondrm +dev/drm/r600_blit.c optional radeondrm dev/drm/r600_cp.c optional radeondrm dev/drm/radeon_cp.c optional radeondrm +dev/drm/radeon_cs.c optional radeondrm dev/drm/radeon_drv.c optional radeondrm dev/drm/radeon_irq.c optional radeondrm dev/drm/radeon_mem.c optional radeondrm Added: head/sys/dev/drm/r600_blit.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/drm/r600_blit.c Sun Aug 23 14:55:57 2009 (r196470) @@ -0,0 +1,1986 @@ +/*- + * Copyright 2009 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Alex Deucher + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "dev/drm/drmP.h" +#include "dev/drm/drm.h" +#include "dev/drm/radeon_drm.h" +#include "dev/drm/radeon_drv.h" + +static u32 r6xx_default_state[] = +{ + 0xc0002400, + 0x00000000, + 0xc0012800, + 0x80000000, + 0x80000000, + 0xc0004600, + 0x00000016, + 0xc0016800, + 0x00000010, + 0x00028000, + 0xc0016800, + 0x00000010, + 0x00008000, + 0xc0016800, + 0x00000542, + 0x07000003, + 0xc0016800, + 0x000005c5, + 0x00000000, + 0xc0016800, + 0x00000363, + 0x00000000, + 0xc0016800, + 0x0000060c, + 0x82000000, + 0xc0016800, + 0x0000060e, + 0x01020204, + 0xc0016f00, + 0x00000000, + 0x00000000, + 0xc0016f00, + 0x00000001, + 0x00000000, + 0xc0096900, + 0x0000022a, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xc0016900, + 0x00000004, + 0x00000000, + 0xc0016900, + 0x0000000a, + 0x00000000, + 0xc0016900, + 0x0000000b, + 0x00000000, + 0xc0016900, + 0x0000010c, + 0x00000000, + 0xc0016900, + 0x0000010d, + 0x00000000, + 0xc0016900, + 0x00000200, + 0x00000000, + 0xc0016900, + 0x00000343, + 0x00000060, + 0xc0016900, + 0x00000344, + 0x00000040, + 0xc0016900, + 0x00000351, + 0x0000aa00, + 0xc0016900, + 0x00000104, + 0x00000000, + 0xc0016900, + 0x0000010e, + 0x00000000, + 0xc0046900, + 0x00000105, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xc0036900, + 0x00000109, + 0x00000000, + 0x00000000, + 0x00000000, + 0xc0046900, + 0x0000030c, + 0x01000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xc0046900, + 0x00000048, + 0x3f800000, + 0x00000000, + 0x3f800000, + 0x3f800000, + 0xc0016900, + 0x0000008e, + 0x0000000f, + 0xc0016900, + 0x00000080, + 0x00000000, + 0xc0016900, + 0x00000083, + 0x0000ffff, + 0xc0016900, + 0x00000084, + 0x00000000, + 0xc0016900, + 0x00000085, + 0x20002000, + 0xc0016900, + 0x00000086, + 0x00000000, + 0xc0016900, + 0x00000087, + 0x20002000, + 0xc0016900, + 0x00000088, + 0x00000000, + 0xc0016900, + 0x00000089, + 0x20002000, + 0xc0016900, + 0x0000008a, + 0x00000000, + 0xc0016900, + 0x0000008b, + 0x20002000, + 0xc0016900, + 0x0000008c, + 0x00000000, + 0xc0016900, + 0x00000094, + 0x80000000, + 0xc0016900, + 0x00000095, + 0x20002000, + 0xc0026900, + 0x000000b4, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x00000096, + 0x80000000, + 0xc0016900, + 0x00000097, + 0x20002000, + 0xc0026900, + 0x000000b6, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x00000098, + 0x80000000, + 0xc0016900, + 0x00000099, + 0x20002000, + 0xc0026900, + 0x000000b8, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x0000009a, + 0x80000000, + 0xc0016900, + 0x0000009b, + 0x20002000, + 0xc0026900, + 0x000000ba, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x0000009c, + 0x80000000, + 0xc0016900, + 0x0000009d, + 0x20002000, + 0xc0026900, + 0x000000bc, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x0000009e, + 0x80000000, + 0xc0016900, + 0x0000009f, + 0x20002000, + 0xc0026900, + 0x000000be, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000a0, + 0x80000000, + 0xc0016900, + 0x000000a1, + 0x20002000, + 0xc0026900, + 0x000000c0, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000a2, + 0x80000000, + 0xc0016900, + 0x000000a3, + 0x20002000, + 0xc0026900, + 0x000000c2, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000a4, + 0x80000000, + 0xc0016900, + 0x000000a5, + 0x20002000, + 0xc0026900, + 0x000000c4, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000a6, + 0x80000000, + 0xc0016900, + 0x000000a7, + 0x20002000, + 0xc0026900, + 0x000000c6, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000a8, + 0x80000000, + 0xc0016900, + 0x000000a9, + 0x20002000, + 0xc0026900, + 0x000000c8, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000aa, + 0x80000000, + 0xc0016900, + 0x000000ab, + 0x20002000, + 0xc0026900, + 0x000000ca, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000ac, + 0x80000000, + 0xc0016900, + 0x000000ad, + 0x20002000, + 0xc0026900, + 0x000000cc, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000ae, + 0x80000000, + 0xc0016900, + 0x000000af, + 0x20002000, + 0xc0026900, + 0x000000ce, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000b0, + 0x80000000, + 0xc0016900, + 0x000000b1, + 0x20002000, + 0xc0026900, + 0x000000d0, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000b2, + 0x80000000, + 0xc0016900, + 0x000000b3, + 0x20002000, + 0xc0026900, + 0x000000d2, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x00000293, + 0x00004010, + 0xc0016900, + 0x00000300, + 0x00000000, + 0xc0016900, + 0x00000301, + 0x00000000, + 0xc0016900, + 0x00000312, + 0xffffffff, + 0xc0016900, + 0x00000307, + 0x00000000, + 0xc0016900, + 0x00000308, + 0x00000000, + 0xc0016900, + 0x00000283, + 0x00000000, + 0xc0016900, + 0x00000292, + 0x00000000, + 0xc0066900, + 0x0000010f, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xc0016900, + 0x00000206, + 0x00000000, + 0xc0016900, + 0x00000207, + 0x00000000, + 0xc0016900, + 0x00000208, + 0x00000000, + 0xc0046900, + 0x00000303, + 0x3f800000, + 0x3f800000, + 0x3f800000, + 0x3f800000, + 0xc0016900, + 0x00000205, + 0x00000004, + 0xc0016900, + 0x00000280, + 0x00000000, + 0xc0016900, + 0x00000281, + 0x00000000, + 0xc0016900, + 0x0000037e, + 0x00000000, + 0xc0016900, + 0x00000382, + 0x00000000, + 0xc0016900, + 0x00000380, + 0x00000000, + 0xc0016900, + 0x00000383, + 0x00000000, + 0xc0016900, + 0x00000381, + 0x00000000, + 0xc0016900, + 0x00000282, + 0x00000008, + 0xc0016900, + 0x00000302, + 0x0000002d, + 0xc0016900, + 0x0000037f, + 0x00000000, + 0xc0016900, + 0x000001b2, + 0x00000000, + 0xc0016900, + 0x000001b6, + 0x00000000, + 0xc0016900, + 0x000001b7, + 0x00000000, + 0xc0016900, + 0x000001b8, + 0x00000000, + 0xc0016900, + 0x000001b9, + 0x00000000, + 0xc0016900, + 0x00000225, + 0x00000000, + 0xc0016900, + 0x00000229, + 0x00000000, + 0xc0016900, + 0x00000237, + 0x00000000, + 0xc0016900, + 0x00000100, + 0x00000800, + 0xc0016900, + 0x00000101, + 0x00000000, + 0xc0016900, + 0x00000102, + 0x00000000, + 0xc0016900, + 0x000002a8, + 0x00000000, + 0xc0016900, + 0x000002a9, + 0x00000000, + 0xc0016900, + 0x00000103, + 0x00000000, + 0xc0016900, + 0x00000284, + 0x00000000, + 0xc0016900, + 0x00000290, + 0x00000000, + 0xc0016900, + 0x00000285, + 0x00000000, + 0xc0016900, + 0x00000286, + 0x00000000, + 0xc0016900, + 0x00000287, + 0x00000000, + 0xc0016900, + 0x00000288, + 0x00000000, + 0xc0016900, + 0x00000289, + 0x00000000, + 0xc0016900, + 0x0000028a, + 0x00000000, + 0xc0016900, + 0x0000028b, + 0x00000000, + 0xc0016900, + 0x0000028c, + 0x00000000, + 0xc0016900, + 0x0000028d, + 0x00000000, + 0xc0016900, + 0x0000028e, + 0x00000000, + 0xc0016900, + 0x0000028f, + 0x00000000, + 0xc0016900, + 0x000002a1, + 0x00000000, + 0xc0016900, + 0x000002a5, + 0x00000000, + 0xc0016900, + 0x000002ac, + 0x00000000, + 0xc0016900, + 0x000002ad, + 0x00000000, + 0xc0016900, + 0x000002ae, + 0x00000000, + 0xc0016900, + 0x000002c8, + 0x00000000, + 0xc0016900, + 0x00000206, + 0x00000100, + 0xc0016900, + 0x00000204, + 0x00010000, + 0xc0036e00, + 0x00000000, + 0x00000012, + 0x00000000, + 0x00000000, + 0xc0016900, + 0x0000008f, + 0x0000000f, + 0xc0016900, + 0x000001e8, + 0x00000001, + 0xc0016900, + 0x00000202, + 0x00cc0000, + 0xc0016900, + 0x00000205, + 0x00000244, + 0xc0016900, + 0x00000203, + 0x00000210, + 0xc0016900, + 0x000001b1, + 0x00000000, + 0xc0016900, + 0x00000185, + 0x00000000, + 0xc0016900, + 0x000001b3, + 0x00000001, + 0xc0016900, + 0x000001b4, + 0x00000000, + 0xc0016900, + 0x00000191, + 0x00000b00, + 0xc0016900, + 0x000001b5, + 0x00000000, +}; + +static u32 r7xx_default_state[] = +{ + 0xc0012800, + 0x80000000, + 0x80000000, + 0xc0004600, + 0x00000016, + 0xc0016800, + 0x00000010, + 0x00028000, + 0xc0016800, + 0x00000010, + 0x00008000, + 0xc0016800, + 0x00000542, + 0x07000002, + 0xc0016800, + 0x000005c5, + 0x00000000, + 0xc0016800, + 0x00000363, + 0x00004000, + 0xc0016800, + 0x0000060c, + 0x00000000, + 0xc0016800, + 0x0000060e, + 0x00420204, + 0xc0016f00, + 0x00000000, + 0x00000000, + 0xc0016f00, + 0x00000001, + 0x00000000, + 0xc0096900, + 0x0000022a, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xc0016900, + 0x00000004, + 0x00000000, + 0xc0016900, + 0x0000000a, + 0x00000000, + 0xc0016900, + 0x0000000b, + 0x00000000, + 0xc0016900, + 0x0000010c, + 0x00000000, + 0xc0016900, + 0x0000010d, + 0x00000000, + 0xc0016900, + 0x00000200, + 0x00000000, + 0xc0016900, + 0x00000343, + 0x00000060, + 0xc0016900, + 0x00000344, + 0x00000000, + 0xc0016900, + 0x00000351, + 0x0000aa00, + 0xc0016900, + 0x00000104, + 0x00000000, + 0xc0016900, + 0x0000010e, + 0x00000000, + 0xc0046900, + 0x00000105, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xc0046900, + 0x0000030c, + 0x01000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xc0016900, + 0x0000008e, + 0x0000000f, + 0xc0016900, + 0x00000080, + 0x00000000, + 0xc0016900, + 0x00000083, + 0x0000ffff, + 0xc0016900, + 0x00000084, + 0x00000000, + 0xc0016900, + 0x00000085, + 0x20002000, + 0xc0016900, + 0x00000086, + 0x00000000, + 0xc0016900, + 0x00000087, + 0x20002000, + 0xc0016900, + 0x00000088, + 0x00000000, + 0xc0016900, + 0x00000089, + 0x20002000, + 0xc0016900, + 0x0000008a, + 0x00000000, + 0xc0016900, + 0x0000008b, + 0x20002000, + 0xc0016900, + 0x0000008c, + 0xaaaaaaaa, + 0xc0016900, + 0x00000094, + 0x80000000, + 0xc0016900, + 0x00000095, + 0x20002000, + 0xc0026900, + 0x000000b4, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x00000096, + 0x80000000, + 0xc0016900, + 0x00000097, + 0x20002000, + 0xc0026900, + 0x000000b6, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x00000098, + 0x80000000, + 0xc0016900, + 0x00000099, + 0x20002000, + 0xc0026900, + 0x000000b8, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x0000009a, + 0x80000000, + 0xc0016900, + 0x0000009b, + 0x20002000, + 0xc0026900, + 0x000000ba, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x0000009c, + 0x80000000, + 0xc0016900, + 0x0000009d, + 0x20002000, + 0xc0026900, + 0x000000bc, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x0000009e, + 0x80000000, + 0xc0016900, + 0x0000009f, + 0x20002000, + 0xc0026900, + 0x000000be, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000a0, + 0x80000000, + 0xc0016900, + 0x000000a1, + 0x20002000, + 0xc0026900, + 0x000000c0, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000a2, + 0x80000000, + 0xc0016900, + 0x000000a3, + 0x20002000, + 0xc0026900, + 0x000000c2, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000a4, + 0x80000000, + 0xc0016900, + 0x000000a5, + 0x20002000, + 0xc0026900, + 0x000000c4, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000a6, + 0x80000000, + 0xc0016900, + 0x000000a7, + 0x20002000, + 0xc0026900, + 0x000000c6, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000a8, + 0x80000000, + 0xc0016900, + 0x000000a9, + 0x20002000, + 0xc0026900, + 0x000000c8, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000aa, + 0x80000000, + 0xc0016900, + 0x000000ab, + 0x20002000, + 0xc0026900, + 0x000000ca, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000ac, + 0x80000000, + 0xc0016900, + 0x000000ad, + 0x20002000, + 0xc0026900, + 0x000000cc, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000ae, + 0x80000000, + 0xc0016900, + 0x000000af, + 0x20002000, + 0xc0026900, + 0x000000ce, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000b0, + 0x80000000, + 0xc0016900, + 0x000000b1, + 0x20002000, + 0xc0026900, + 0x000000d0, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x000000b2, + 0x80000000, + 0xc0016900, + 0x000000b3, + 0x20002000, + 0xc0026900, + 0x000000d2, + 0x00000000, + 0x3f800000, + 0xc0016900, + 0x00000293, + 0x00514000, + 0xc0016900, + 0x00000300, + 0x00000000, + 0xc0016900, + 0x00000301, + 0x00000000, + 0xc0016900, + 0x00000312, + 0xffffffff, + 0xc0016900, + 0x00000307, + 0x00000000, + 0xc0016900, + 0x00000308, + 0x00000000, + 0xc0016900, + 0x00000283, + 0x00000000, + 0xc0016900, + 0x00000292, + 0x00000000, + 0xc0066900, + 0x0000010f, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + 0xc0016900, + 0x00000206, + 0x00000000, + 0xc0016900, + 0x00000207, + 0x00000000, + 0xc0016900, + 0x00000208, + 0x00000000, + 0xc0046900, + 0x00000303, + 0x3f800000, + 0x3f800000, + 0x3f800000, + 0x3f800000, + 0xc0016900, + 0x00000205, + 0x00000004, + 0xc0016900, + 0x00000280, + 0x00000000, + 0xc0016900, + 0x00000281, + 0x00000000, + 0xc0016900, + 0x0000037e, + 0x00000000, + 0xc0016900, + 0x00000382, + 0x00000000, + 0xc0016900, + 0x00000380, + 0x00000000, + 0xc0016900, + 0x00000383, + 0x00000000, + 0xc0016900, + 0x00000381, + 0x00000000, + 0xc0016900, + 0x00000282, + 0x00000008, + 0xc0016900, + 0x00000302, + 0x0000002d, + 0xc0016900, + 0x0000037f, + 0x00000000, + 0xc0016900, + 0x000001b2, + 0x00000001, + 0xc0016900, + 0x000001b6, + 0x00000000, + 0xc0016900, + 0x000001b7, + 0x00000000, + 0xc0016900, + 0x000001b8, + 0x00000000, + 0xc0016900, + 0x000001b9, + 0x00000000, + 0xc0016900, + 0x00000225, + 0x00000000, + 0xc0016900, + 0x00000229, + 0x00000000, + 0xc0016900, + 0x00000237, + 0x00000000, + 0xc0016900, + 0x00000100, + 0x00000800, + 0xc0016900, + 0x00000101, + 0x00000000, + 0xc0016900, + 0x00000102, + 0x00000000, + 0xc0016900, + 0x000002a8, + 0x00000000, + 0xc0016900, + 0x000002a9, + 0x00000000, + 0xc0016900, + 0x00000103, + 0x00000000, + 0xc0016900, + 0x00000284, + 0x00000000, + 0xc0016900, + 0x00000290, + 0x00000000, + 0xc0016900, + 0x00000285, + 0x00000000, + 0xc0016900, + 0x00000286, + 0x00000000, + 0xc0016900, + 0x00000287, + 0x00000000, + 0xc0016900, + 0x00000288, + 0x00000000, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 15:02:58 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9124106568D; Sun, 23 Aug 2009 15:02:58 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 97B4B8FC08; Sun, 23 Aug 2009 15:02:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NF2wrR064332; Sun, 23 Aug 2009 15:02:58 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NF2w1C064327; Sun, 23 Aug 2009 15:02:58 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200908231502.n7NF2w1C064327@svn.freebsd.org> From: Robert Noland Date: Sun, 23 Aug 2009 15:02:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196471 - head/sys/dev/drm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 15:02:58 -0000 Author: rnoland Date: Sun Aug 23 15:02:58 2009 New Revision: 196471 URL: http://svn.freebsd.org/changeset/base/196471 Log: Add GET_PARAM support for Z pipes. This is needed for occulsion queries on rv530 chips. MFC after: 2 weeks Modified: head/sys/dev/drm/radeon_cp.c head/sys/dev/drm/radeon_drm.h head/sys/dev/drm/radeon_drv.h head/sys/dev/drm/radeon_state.c Modified: head/sys/dev/drm/radeon_cp.c ============================================================================== --- head/sys/dev/drm/radeon_cp.c Sun Aug 23 14:55:57 2009 (r196470) +++ head/sys/dev/drm/radeon_cp.c Sun Aug 23 15:02:58 2009 (r196471) @@ -408,6 +408,15 @@ static void radeon_init_pipes(drm_radeon { uint32_t gb_tile_config, gb_pipe_sel = 0; + if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV530) { + uint32_t z_pipe_sel = RADEON_READ(RV530_GB_PIPE_SELECT2); + if ((z_pipe_sel & 3) == 3) + dev_priv->num_z_pipes = 2; + else + dev_priv->num_z_pipes = 1; + } else + dev_priv->num_z_pipes = 1; + /* RS4xx/RS6xx/R4xx/R5xx */ if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R420) { gb_pipe_sel = RADEON_READ(R400_GB_PIPE_SELECT); Modified: head/sys/dev/drm/radeon_drm.h ============================================================================== --- head/sys/dev/drm/radeon_drm.h Sun Aug 23 14:55:57 2009 (r196470) +++ head/sys/dev/drm/radeon_drm.h Sun Aug 23 15:02:58 2009 (r196471) @@ -688,6 +688,8 @@ typedef struct drm_radeon_indirect { #define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */ #define RADEON_PARAM_FB_LOCATION 14 /* FB location */ #define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */ +#define RADEON_PARAM_DEVICE_ID 16 +#define RADEON_PARAM_NUM_Z_PIPES 17 /* num Z pipes */ typedef struct drm_radeon_getparam { int param; Modified: head/sys/dev/drm/radeon_drv.h ============================================================================== --- head/sys/dev/drm/radeon_drv.h Sun Aug 23 14:55:57 2009 (r196470) +++ head/sys/dev/drm/radeon_drv.h Sun Aug 23 15:02:58 2009 (r196471) @@ -102,9 +102,11 @@ __FBSDID("$FreeBSD$"); * 1.27- Add support for IGP GART * 1.28- Add support for VBL on CRTC2 * 1.29- R500 3D cmd buffer support + * 1.30- Add support for occlusion queries + * 1.31- Add support for num Z pipes from GET_PARAM */ #define DRIVER_MAJOR 1 -#define DRIVER_MINOR 29 +#define DRIVER_MINOR 31 #define DRIVER_PATCHLEVEL 0 /* @@ -368,6 +370,7 @@ typedef struct drm_radeon_private { unsigned long fb_aper_offset; int num_gb_pipes; + int num_z_pipes; int track_flush; drm_local_map_t *mmio; @@ -758,6 +761,7 @@ extern int r600_cs_init(struct drm_devic /* pipe config regs */ #define R400_GB_PIPE_SELECT 0x402c +#define RV530_GB_PIPE_SELECT2 0x4124 #define R500_DYN_SCLK_PWMEM_PIPE 0x000d /* PLL */ #define R300_GB_TILE_CONFIG 0x4018 # define R300_ENABLE_TILING (1 << 0) Modified: head/sys/dev/drm/radeon_state.c ============================================================================== --- head/sys/dev/drm/radeon_state.c Sun Aug 23 14:55:57 2009 (r196470) +++ head/sys/dev/drm/radeon_state.c Sun Aug 23 15:02:58 2009 (r196471) @@ -3078,6 +3078,9 @@ static int radeon_cp_getparam(struct drm case RADEON_PARAM_NUM_GB_PIPES: value = dev_priv->num_gb_pipes; break; + case RADEON_PARAM_NUM_Z_PIPES: + value = dev_priv->num_z_pipes; + break; default: DRM_DEBUG("Invalid parameter %d\n", param->param); return -EINVAL; From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 15:10:53 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45E7E106568C for ; Sun, 23 Aug 2009 15:10:53 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id 8D85B8FC0C for ; Sun, 23 Aug 2009 15:10:52 +0000 (UTC) Received: (qmail invoked by alias); 23 Aug 2009 14:44:11 -0000 Received: from p54A3EA49.dip.t-dialin.net (EHLO tron.homeunix.org) [84.163.234.73] by mail.gmx.net (mp001) with SMTP; 23 Aug 2009 16:44:11 +0200 X-Authenticated: #1673122 X-Provags-ID: V01U2FsdGVkX18KgyUaFhkKd3JDB0oTi0AhcNzAvrgs+E36xrSoEQ 9KeTrZ8yckbcoa Message-ID: <4A9155BA.9020808@gmx.de> Date: Sun, 23 Aug 2009 16:44:10 +0200 From: Christoph Mallon User-Agent: Thunderbird 2.0.0.23 (X11/20090823) MIME-Version: 1.0 To: Bruce Evans References: <200908230759.n7N7xS6g051165@svn.freebsd.org> <20090823080940.GT1292@hoeg.nl> <20090823230300.Q38728@delplex.bde.org> In-Reply-To: <20090823230300.Q38728@delplex.bde.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.72 Cc: svn-src-head@FreeBSD.org, Ed Schouten , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Julian Elischer Subject: Re: svn commit: r196451 - head/sys/netinet/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 15:10:53 -0000 Bruce Evans schrieb: > % */ > % int > % ipfw_init(void) > % { > % int error = 0; > > This variable is not really used. > > Initialization in declaration. This mainly obfuscates the non-use of the > variable. Rather the opposite is true: void f(void) { int error = 0; // GCC warns that error is unused } void g(void) { int error; error = 0; // GCC is silent } In this case it does not help, because error is used. But an assignment halfway down the function definitely would not improve the situation. Christoph From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 15:54:54 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 713381065691; Sun, 23 Aug 2009 15:54:54 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail07.syd.optusnet.com.au (mail07.syd.optusnet.com.au [211.29.132.188]) by mx1.freebsd.org (Postfix) with ESMTP id 062888FC1D; Sun, 23 Aug 2009 15:54:53 +0000 (UTC) Received: from c122-106-152-1.carlnfd1.nsw.optusnet.com.au (c122-106-152-1.carlnfd1.nsw.optusnet.com.au [122.106.152.1]) by mail07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n7NFshUE004184 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 24 Aug 2009 01:54:44 +1000 Date: Mon, 24 Aug 2009 01:54:43 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Christoph Mallon In-Reply-To: <4A9155BA.9020808@gmx.de> Message-ID: <20090824013656.M38813@delplex.bde.org> References: <200908230759.n7N7xS6g051165@svn.freebsd.org> <20090823080940.GT1292@hoeg.nl> <20090823230300.Q38728@delplex.bde.org> <4A9155BA.9020808@gmx.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Ed Schouten , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, Bruce Evans , svn-src-head@FreeBSD.org, Julian Elischer Subject: Re: svn commit: r196451 - head/sys/netinet/ipfw X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 15:54:54 -0000 On Sun, 23 Aug 2009, Christoph Mallon wrote: > Bruce Evans schrieb: >> % */ >> % int >> % ipfw_init(void) >> % { >> % int error = 0; >> >> This variable is not really used. >> >> Initialization in declaration. This mainly obfuscates the non-use of the >> variable. > > Rather the opposite is true: > > void f(void) > { > int error = 0; // GCC warns that error is unused > } > > void g(void) > { > int error; > error = 0; // GCC is silent > } Interesting. A bug in gcc. Even the primitive lint(1) in FreeBSD warns about both (it says "set but not used"; if the variable is not even set, then it says "unused"). > In this case it does not help, because error is used. But an assignment > halfway down the function definitely would not improve the situation. The assignment should be just before the first use of the variable (if the first use is conditional, this may be impossible, but then an initialization at the start of the function would increase the obfuscation). In this case, the first use is in the return statement and it would then be obvious to everyone except the compiler that both the variable and its initialization are bogus: error = 0; return (error); A non-KNF style would put the declaration next to the use. Then the bogusness would be even more obvious: #if __STDC_VERSION__ < 199901 { #endif int error; error = 0; return (error); #if __STDC_VERSION__ < 199901 } #endif Bruce From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 16:04:10 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C30CB106568B; Sun, 23 Aug 2009 16:04:10 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B1F748FC08; Sun, 23 Aug 2009 16:04:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NG4AMx065585; Sun, 23 Aug 2009 16:04:10 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NG4ABo065583; Sun, 23 Aug 2009 16:04:10 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200908231604.n7NG4ABo065583@svn.freebsd.org> From: Sam Leffler Date: Sun, 23 Aug 2009 16:04:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196472 - head/usr.sbin/wpa/wpa_cli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 16:04:10 -0000 Author: sam Date: Sun Aug 23 16:04:10 2009 New Revision: 196472 URL: http://svn.freebsd.org/changeset/base/196472 Log: Enable _DIRENT_HAVE_D_TYPE so wpa_cli scans directories properly for it's unix domain socket. Before this change wpa_cli would take the first file in the directory that was not "." or "..". Submitted by: Brandon Gooch MFC after: 3 days Modified: head/usr.sbin/wpa/wpa_cli/Makefile Modified: head/usr.sbin/wpa/wpa_cli/Makefile ============================================================================== --- head/usr.sbin/wpa/wpa_cli/Makefile Sun Aug 23 15:02:58 2009 (r196471) +++ head/usr.sbin/wpa/wpa_cli/Makefile Sun Aug 23 16:04:10 2009 (r196472) @@ -11,6 +11,8 @@ MAN= wpa_cli.8 CFLAGS+= -DCONFIG_CTRL_IFACE CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX +# enable use of d_type to identify unix domain sockets +CFLAGS+= -D_DIRENT_HAVE_D_TYPE #CFLAGS+= -DCONFIG_READLINE #LDADD+= -ledit -ltermcap From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 16:21:50 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EBFC106568B; Sun, 23 Aug 2009 16:21:50 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D00E8FC26; Sun, 23 Aug 2009 16:21:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NGLo0g065987; Sun, 23 Aug 2009 16:21:50 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NGLoKw065985; Sun, 23 Aug 2009 16:21:50 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200908231621.n7NGLoKw065985@svn.freebsd.org> From: Sam Leffler Date: Sun, 23 Aug 2009 16:21:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196473 - in stable/8/usr.sbin/wpa: . wpa_cli X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 16:21:50 -0000 Author: sam Date: Sun Aug 23 16:21:49 2009 New Revision: 196473 URL: http://svn.freebsd.org/changeset/base/196473 Log: MFC r196472: Enable _DIRENT_HAVE_D_TYPE so wpa_cli scans directories properly for it's unix domain socket. Before this change wpa_cli would take the first file in the directory that was not "." or "..". Approved by: re (rwatson) Modified: stable/8/usr.sbin/wpa/ (props changed) stable/8/usr.sbin/wpa/wpa_cli/Makefile Modified: stable/8/usr.sbin/wpa/wpa_cli/Makefile ============================================================================== --- stable/8/usr.sbin/wpa/wpa_cli/Makefile Sun Aug 23 16:04:10 2009 (r196472) +++ stable/8/usr.sbin/wpa/wpa_cli/Makefile Sun Aug 23 16:21:49 2009 (r196473) @@ -11,6 +11,8 @@ MAN= wpa_cli.8 CFLAGS+= -DCONFIG_CTRL_IFACE CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX +# enable use of d_type to identify unix domain sockets +CFLAGS+= -D_DIRENT_HAVE_D_TYPE #CFLAGS+= -DCONFIG_READLINE #LDADD+= -ledit -ltermcap From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 16:29:48 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 432AF106568C; Sun, 23 Aug 2009 16:29:48 +0000 (UTC) (envelope-from simon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 313938FC16; Sun, 23 Aug 2009 16:29:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NGTmia066173; Sun, 23 Aug 2009 16:29:48 GMT (envelope-from simon@svn.freebsd.org) Received: (from simon@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NGTmZX066168; Sun, 23 Aug 2009 16:29:48 GMT (envelope-from simon@svn.freebsd.org) Message-Id: <200908231629.n7NGTmZX066168@svn.freebsd.org> From: "Simon L. Nielsen" Date: Sun, 23 Aug 2009 16:29:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196474 - in head/crypto/openssl: . crypto/pqueue ssl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 16:29:48 -0000 Author: simon Date: Sun Aug 23 16:29:47 2009 New Revision: 196474 URL: http://svn.freebsd.org/changeset/base/196474 Log: Merge DTLS fixes from vendor-crypto/openssl/dist: - Fix memory consumption bug with "future epoch" DTLS records. - Fix fragment handling memory leak. - Do not access freed data structure. - Fix DTLS fragment bug - out-of-sequence message handling which could result in NULL pointer dereference in dtls1_process_out_of_seq_message(). Note that this will not get FreeBSD Security Advisory as DTLS is experimental in OpenSSL. MFC after: 1 week Security: CVE-2009-1377 CVE-2009-1378 CVE-2009-1379 CVE-2009-1387 Modified: head/crypto/openssl/ (props changed) head/crypto/openssl/crypto/pqueue/pqueue.c head/crypto/openssl/crypto/pqueue/pqueue.h head/crypto/openssl/ssl/d1_both.c head/crypto/openssl/ssl/d1_pkt.c Modified: head/crypto/openssl/crypto/pqueue/pqueue.c ============================================================================== --- head/crypto/openssl/crypto/pqueue/pqueue.c Sun Aug 23 16:21:49 2009 (r196473) +++ head/crypto/openssl/crypto/pqueue/pqueue.c Sun Aug 23 16:29:47 2009 (r196474) @@ -234,3 +234,17 @@ pqueue_next(pitem **item) return ret; } + +int +pqueue_size(pqueue_s *pq) +{ + pitem *item = pq->items; + int count = 0; + + while(item != NULL) + { + count++; + item = item->next; + } + return count; +} Modified: head/crypto/openssl/crypto/pqueue/pqueue.h ============================================================================== --- head/crypto/openssl/crypto/pqueue/pqueue.h Sun Aug 23 16:21:49 2009 (r196473) +++ head/crypto/openssl/crypto/pqueue/pqueue.h Sun Aug 23 16:29:47 2009 (r196474) @@ -91,5 +91,6 @@ pitem *pqueue_iterator(pqueue pq); pitem *pqueue_next(piterator *iter); void pqueue_print(pqueue pq); +int pqueue_size(pqueue pq); #endif /* ! HEADER_PQUEUE_H */ Modified: head/crypto/openssl/ssl/d1_both.c ============================================================================== --- head/crypto/openssl/ssl/d1_both.c Sun Aug 23 16:21:49 2009 (r196473) +++ head/crypto/openssl/ssl/d1_both.c Sun Aug 23 16:29:47 2009 (r196474) @@ -519,6 +519,7 @@ dtls1_retrieve_buffered_fragment(SSL *s, if ( s->d1->handshake_read_seq == frag->msg_header.seq) { + unsigned long frag_len = frag->msg_header.frag_len; pqueue_pop(s->d1->buffered_messages); al=dtls1_preprocess_fragment(s,&frag->msg_header,max); @@ -536,7 +537,7 @@ dtls1_retrieve_buffered_fragment(SSL *s, if (al==0) { *ok = 1; - return frag->msg_header.frag_len; + return frag_len; } ssl3_send_alert(s,SSL3_AL_FATAL,al); @@ -561,7 +562,16 @@ dtls1_process_out_of_seq_message(SSL *s, if ((msg_hdr->frag_off+frag_len) > msg_hdr->msg_len) goto err; - if (msg_hdr->seq <= s->d1->handshake_read_seq) + /* Try to find item in queue, to prevent duplicate entries */ + pq_64bit_init(&seq64); + pq_64bit_assign_word(&seq64, msg_hdr->seq); + item = pqueue_find(s->d1->buffered_messages, seq64); + pq_64bit_free(&seq64); + + /* Discard the message if sequence number was already there, is + * too far in the future or the fragment is already in the queue */ + if (msg_hdr->seq <= s->d1->handshake_read_seq || + msg_hdr->seq > s->d1->handshake_read_seq + 10 || item != NULL) { unsigned char devnull [256]; @@ -575,30 +585,31 @@ dtls1_process_out_of_seq_message(SSL *s, } } - frag = dtls1_hm_fragment_new(frag_len); - if ( frag == NULL) - goto err; + if (frag_len) + { + frag = dtls1_hm_fragment_new(frag_len); + if ( frag == NULL) + goto err; - memcpy(&(frag->msg_header), msg_hdr, sizeof(*msg_hdr)); + memcpy(&(frag->msg_header), msg_hdr, sizeof(*msg_hdr)); - if (frag_len) - { - /* read the body of the fragment (header has already been read */ + /* read the body of the fragment (header has already been read) */ i = s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE, frag->fragment,frag_len,0); if (i<=0 || (unsigned long)i!=frag_len) goto err; - } - pq_64bit_init(&seq64); - pq_64bit_assign_word(&seq64, msg_hdr->seq); + pq_64bit_init(&seq64); + pq_64bit_assign_word(&seq64, msg_hdr->seq); - item = pitem_new(seq64, frag); - pq_64bit_free(&seq64); - if ( item == NULL) - goto err; + item = pitem_new(seq64, frag); + pq_64bit_free(&seq64); + if ( item == NULL) + goto err; + + pqueue_insert(s->d1->buffered_messages, item); + } - pqueue_insert(s->d1->buffered_messages, item); return DTLS1_HM_FRAGMENT_RETRY; err: Modified: head/crypto/openssl/ssl/d1_pkt.c ============================================================================== --- head/crypto/openssl/ssl/d1_pkt.c Sun Aug 23 16:21:49 2009 (r196473) +++ head/crypto/openssl/ssl/d1_pkt.c Sun Aug 23 16:29:47 2009 (r196474) @@ -167,6 +167,10 @@ dtls1_buffer_record(SSL *s, record_pqueu DTLS1_RECORD_DATA *rdata; pitem *item; + /* Limit the size of the queue to prevent DOS attacks */ + if (pqueue_size(queue->q) >= 100) + return 0; + rdata = OPENSSL_malloc(sizeof(DTLS1_RECORD_DATA)); item = pitem_new(priority, rdata); if (rdata == NULL || item == NULL) From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 17:00:16 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 923C91065691; Sun, 23 Aug 2009 17:00:16 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7FAC88FC22; Sun, 23 Aug 2009 17:00:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NH0Gh5066877; Sun, 23 Aug 2009 17:00:16 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NH0GmC066870; Sun, 23 Aug 2009 17:00:16 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <200908231700.n7NH0GmC066870@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sun, 23 Aug 2009 17:00:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196475 - in head: contrib/traceroute usr.sbin/traceroute6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 17:00:16 -0000 Author: ume Date: Sun Aug 23 17:00:16 2009 New Revision: 196475 URL: http://svn.freebsd.org/changeset/base/196475 Log: - Add AS lookup functionality to traceroute6(8) as well. - Support for IPv6 transport for AS lookup. - Introduce $RA_SERVER to set whois server. - Support for 4 byte ASN. - ANSIfy function declaration in as.c. Tested by: IHANet folks. Modified: head/contrib/traceroute/as.c head/contrib/traceroute/as.h head/contrib/traceroute/traceroute.c head/usr.sbin/traceroute6/Makefile head/usr.sbin/traceroute6/traceroute6.8 head/usr.sbin/traceroute6/traceroute6.c Modified: head/contrib/traceroute/as.c ============================================================================== --- head/contrib/traceroute/as.c Sun Aug 23 16:29:47 2009 (r196474) +++ head/contrib/traceroute/as.c Sun Aug 23 17:00:16 2009 (r196475) @@ -63,55 +63,42 @@ struct aslookup { }; void * -as_setup(server) - char *server; +as_setup(char *server) { struct aslookup *asn; - struct hostent *he = NULL; - struct servent *se; - struct sockaddr_in in; + struct addrinfo hints, *res0, *res; FILE *f; - int s; + int s, error; if (server == NULL) + server = getenv("RA_SERVER"); + if (server == NULL) server = DEFAULT_AS_SERVER; - (void)memset(&in, 0, sizeof(in)); - in.sin_family = AF_INET; - in.sin_len = sizeof(in); - if ((se = getservbyname("whois", "tcp")) == NULL) { + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + error = getaddrinfo(server, "whois", &hints, &res0); + if (error == EAI_SERVICE) { warnx("warning: whois/tcp service not found"); - in.sin_port = ntohs(43); - } else - in.sin_port = se->s_port; - - if (inet_aton(server, &in.sin_addr) == 0 && - ((he = gethostbyname(server)) == NULL || - he->h_addr == NULL)) { - warnx("%s: %s", server, hstrerror(h_errno)); - return (NULL); + error = getaddrinfo(server, "43", &hints, &res0); } - - if ((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) { - warn("socket"); + if (error != 0) { + warnx("%s: %s", server, gai_strerror(error)); return (NULL); } - do { - if (he != NULL) { - memcpy(&in.sin_addr, he->h_addr, he->h_length); - he->h_addr_list++; - } - if (connect(s, (struct sockaddr *)&in, sizeof(in)) == 0) + for (res = res0; res; res = res->ai_next) { + s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + if (s < 0) + continue; + if (connect(s, res->ai_addr, res->ai_addrlen) >= 0) break; - if (he == NULL || he->h_addr == NULL) { - close(s); - s = -1; - break; - } - } while (1); - - if (s == -1) { + close(s); + s = -1; + } + freeaddrinfo(res0); + if (s < 0) { warn("connect"); return (NULL); } @@ -137,23 +124,23 @@ as_setup(server) return (asn); } -int -as_lookup(_asn, addr) - void *_asn; - struct in_addr *addr; +unsigned int +as_lookup(void *_asn, char *addr, sa_family_t family) { struct aslookup *asn = _asn; char buf[1024]; - int as, rc, dlen; + unsigned int as; + int rc, dlen, plen; - as = rc = dlen = 0; - (void)fprintf(asn->as_f, "!r%s/32,l\n", inet_ntoa(*addr)); + as = 0; + rc = dlen = 0; + plen = (family == AF_INET6) ? 128 : 32; + (void)fprintf(asn->as_f, "!r%s/%d,l\n", addr, plen); (void)fflush(asn->as_f); #ifdef AS_DEBUG_FILE if (asn->as_debug) { - (void)fprintf(asn->as_debug, ">> !r%s/32,l\n", - inet_ntoa(*addr)); + (void)fprintf(asn->as_debug, ">> !r%s/%d,l\n", addr, plen); (void)fflush(asn->as_debug); } #endif /* AS_DEBUG_FILE */ @@ -182,7 +169,7 @@ as_lookup(_asn, addr) } #endif /* AS_DEBUG_FILE */ break; - case 'C': + case 'C': case 'D': case 'E': case 'F': @@ -209,7 +196,7 @@ as_lookup(_asn, addr) /* origin line is the interesting bit */ if (as == 0 && strncasecmp(buf, "origin:", 7) == 0) { - sscanf(buf + 7, " AS%d", &as); + sscanf(buf + 7, " AS%u", &as); #ifdef AS_DEBUG_FILE if (asn->as_debug) { (void)fprintf(asn->as_debug, "as: %d\n", as); @@ -223,8 +210,7 @@ as_lookup(_asn, addr) } void -as_shutdown(_asn) - void *_asn; +as_shutdown(void *_asn) { struct aslookup *asn = _asn; Modified: head/contrib/traceroute/as.h ============================================================================== --- head/contrib/traceroute/as.h Sun Aug 23 16:29:47 2009 (r196474) +++ head/contrib/traceroute/as.h Sun Aug 23 17:00:16 2009 (r196475) @@ -37,6 +37,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -void *as_setup __P((char *)); -int as_lookup __P((void *, struct in_addr *)); -void as_shutdown __P((void *)); +void *as_setup(char *); +unsigned int as_lookup(void *, char *, sa_family_t); +void as_shutdown(void *); Modified: head/contrib/traceroute/traceroute.c ============================================================================== --- head/contrib/traceroute/traceroute.c Sun Aug 23 16:29:47 2009 (r196474) +++ head/contrib/traceroute/traceroute.c Sun Aug 23 17:00:16 2009 (r196475) @@ -1477,19 +1477,21 @@ print(register u_char *buf, register int { register struct ip *ip; register int hlen; + char addr[INET_ADDRSTRLEN]; ip = (struct ip *) buf; hlen = ip->ip_hl << 2; cc -= hlen; + strlcpy(addr, inet_ntoa(from->sin_addr), sizeof(addr)); + if (as_path) - Printf(" [AS%d]", as_lookup(asn, &from->sin_addr)); + Printf(" [AS%u]", as_lookup(asn, addr, AF_INET)); if (nflag) - Printf(" %s", inet_ntoa(from->sin_addr)); + Printf(" %s", addr); else - Printf(" %s (%s)", inetname(from->sin_addr), - inet_ntoa(from->sin_addr)); + Printf(" %s (%s)", inetname(from->sin_addr), addr); if (verbose) Printf(" %d bytes to %s", cc, inet_ntoa (ip->ip_dst)); Modified: head/usr.sbin/traceroute6/Makefile ============================================================================== --- head/usr.sbin/traceroute6/Makefile Sun Aug 23 16:29:47 2009 (r196474) +++ head/usr.sbin/traceroute6/Makefile Sun Aug 23 17:00:16 2009 (r196475) @@ -13,12 +13,17 @@ # A PARTICULAR PURPOSE. # $FreeBSD$ +TRACEROUTE_DISTDIR?= ${.CURDIR}/../../contrib/traceroute +.PATH: ${TRACEROUTE_DISTDIR} + PROG= traceroute6 MAN= traceroute6.8 +SRCS= as.c traceroute6.c BINOWN= root BINMODE= 4555 CFLAGS+= -DIPSEC -DUSE_RFC2292BIS -DHAVE_POLL +CFLAGS+= -I${.CURDIR} -I${TRACEROUTE_DISTDIR} -I. DPADD= ${LIBIPSEC} LDADD= -lipsec Modified: head/usr.sbin/traceroute6/traceroute6.8 ============================================================================== --- head/usr.sbin/traceroute6/traceroute6.8 Sun Aug 23 16:29:47 2009 (r196474) +++ head/usr.sbin/traceroute6/traceroute6.8 Sun Aug 23 17:00:16 2009 (r196475) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 17, 1998 +.Dd August 24, 2009 .Dt TRACEROUTE6 8 .Os .\" @@ -40,7 +40,7 @@ .Sh SYNOPSIS .Nm .Bk -words -.Op Fl dIlnNrvU +.Op Fl adIlnNrvU .Ek .Bk -words .Op Fl f Ar firsthop @@ -64,6 +64,9 @@ .Op Fl w Ar waittime .Ek .Bk -words +.Op Fl A Ar as_server +.Ek +.Bk -words .Ar target .Op Ar datalen .Ek @@ -84,6 +87,10 @@ after the destination host name. .Pp Other options are: .Bl -tag -width Ds +.It Fl a +Turn on AS# lookups for each hop encountered. +.It Fl A Ar as_server +Turn on AS# lookups and use the given server instead of the default. .It Fl d Debug mode. .It Fl f Ar firsthop Modified: head/usr.sbin/traceroute6/traceroute6.c ============================================================================== --- head/usr.sbin/traceroute6/traceroute6.c Sun Aug 23 16:29:47 2009 (r196474) +++ head/usr.sbin/traceroute6/traceroute6.c Sun Aug 23 17:00:16 2009 (r196475) @@ -282,6 +282,8 @@ static const char rcsid[] = #include #endif +#include "as.h" + #define DUMMY_PORT 10010 #define MAXPACKET 65535 /* max ip packet size */ @@ -359,6 +361,9 @@ int waittime = 5; /* time to wait for r int nflag; /* print addresses numerically */ int useproto = IPPROTO_UDP; /* protocol to use to send packet */ int lflag; /* print both numerical address & hostname */ +int as_path; /* print as numbers for each hop */ +char *as_server = NULL; +void *asn; int main(argc, argv) @@ -411,8 +416,15 @@ main(argc, argv) seq = 0; - while ((ch = getopt(argc, argv, "df:g:Ilm:nNp:q:rs:Uvw:")) != -1) + while ((ch = getopt(argc, argv, "aA:df:g:Ilm:nNp:q:rs:Uvw:")) != -1) switch (ch) { + case 'a': + as_path = 1; + break; + case 'A': + as_path = 1; + as_server = optarg; + break; case 'd': options |= SO_DEBUG; break; @@ -867,6 +879,17 @@ main(argc, argv) srcport = ntohs(Src.sin6_port); } + if (as_path) { + asn = as_setup(as_server); + if (asn == NULL) { + fprintf(stderr, + "traceroute6: as_setup failed, AS# lookups" + " disabled\n"); + (void)fflush(stderr); + as_path = 0; + } + } + /* * Message to users */ @@ -948,6 +971,8 @@ main(argc, argv) exit(0); } } + if (as_path) + as_shutdown(asn); exit(0); } @@ -1361,6 +1386,8 @@ print(mhdr, cc) if (getnameinfo((struct sockaddr *)from, from->sin6_len, hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0) strlcpy(hbuf, "invalid", sizeof(hbuf)); + if (as_path) + printf(" [AS%u]", as_lookup(asn, hbuf, AF_INET6)); if (nflag) printf(" %s", hbuf); else if (lflag) From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 18:15:14 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D2B2106568E; Sun, 23 Aug 2009 18:15:14 +0000 (UTC) (envelope-from ivoras@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6CB2E8FC1A; Sun, 23 Aug 2009 18:15:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NIFENf068735; Sun, 23 Aug 2009 18:15:14 GMT (envelope-from ivoras@svn.freebsd.org) Received: (from ivoras@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NIFEq5068734; Sun, 23 Aug 2009 18:15:14 GMT (envelope-from ivoras@svn.freebsd.org) Message-Id: <200908231815.n7NIFEq5068734@svn.freebsd.org> From: Ivan Voras Date: Sun, 23 Aug 2009 18:15:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196476 - head/sbin/geom/class/label X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 18:15:14 -0000 Author: ivoras Date: Sun Aug 23 18:15:13 2009 New Revision: 196476 URL: http://svn.freebsd.org/changeset/base/196476 Log: Remove (c) line. Requested by: pjd Approved by: gnn (mentor) MFC after: 1 month Modified: head/sbin/geom/class/label/glabel.8 Modified: head/sbin/geom/class/label/glabel.8 ============================================================================== --- head/sbin/geom/class/label/glabel.8 Sun Aug 23 17:00:16 2009 (r196475) +++ head/sbin/geom/class/label/glabel.8 Sun Aug 23 18:15:13 2009 (r196476) @@ -1,5 +1,4 @@ .\" Copyright (c) 2004-2005 Pawel Jakub Dawidek -.\" Copyright (c) 2008-2009 Ivan Voras .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 18:18:10 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1AA21065692; Sun, 23 Aug 2009 18:18:10 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-bw0-f206.google.com (mail-bw0-f206.google.com [209.85.218.206]) by mx1.freebsd.org (Postfix) with ESMTP id AE6618FC19; Sun, 23 Aug 2009 18:18:09 +0000 (UTC) Received: by bwz2 with SMTP id 2so1090625bwz.43 for ; Sun, 23 Aug 2009 11:18:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=XIDEZz6I+8WnegdMGaRHbC3d4gLnWPa7PUcb5wFFsTM=; b=BM/zSQvEhFDeppg/k/ZvgAt8F1q5CdrGpJ2oUto7GoMyZ5kb7NBHXb1AkOKGVwin+k XSH6aaxUKsbhgqLhRp1SdYpMK6ii29SAoCQgh0zO7M+UGjF8/GlWUTwDD0Kx5OH1cTw5 8j8GBQGba+kepxqh3IBsVejxjQhQ5L/dsAxkM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=pQJ6wwRoKnkBshgkFpXyiLld3Czg2E3P56R/4uBZaxQiEOS82HFwjV6+IchNNpVlWV wb74kcUDr3fS28sDFP7HzX+EBZGF3dJc56i3hOhmlIIeOnxAypoQ3rPCo6HjEqYhpxC4 CTUEY/wKVQFkdTBURkXZkRdc2v9zzlqEWMT48= MIME-Version: 1.0 Received: by 10.102.149.9 with SMTP id w9mr1438097mud.77.1251051488359; Sun, 23 Aug 2009 11:18:08 -0700 (PDT) In-Reply-To: <200908222344.n7MNibQZ040298@svn.freebsd.org> References: <200908222344.n7MNibQZ040298@svn.freebsd.org> Date: Sun, 23 Aug 2009 22:18:08 +0400 Message-ID: From: pluknet To: Ken Smith Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196432 - in head: . gnu/usr.bin/groff/tmac release sys/conf sys/sys usr.sbin/pkg_install/add X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 18:18:10 -0000 2009/8/23 Ken Smith : > Author: kensmith > Date: Sat Aug 22 23:44:37 2009 > New Revision: 196432 > URL: http://svn.freebsd.org/changeset/base/196432 > > Log: > =A0Make head 9.0-CURRENT in preparation for lifting code freeze. > > =A0Approved by: =A0re (implicit) > > Modified: > =A0head/UPDATING > =A0head/gnu/usr.bin/groff/tmac/mdoc.local > =A0head/release/Makefile > =A0head/sys/conf/newvers.sh > =A0head/sys/sys/param.h > =A0head/usr.sbin/pkg_install/add/main.c > [...] > Modified: head/usr.sbin/pkg_install/add/main.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.sbin/pkg_install/add/main.c =A0 =A0 =A0 =A0Sat Aug 22 09:17:= 49 2009 =A0 =A0 =A0 =A0(r196431) > +++ head/usr.sbin/pkg_install/add/main.c =A0 =A0 =A0 =A0Sat Aug 22 23:44:= 37 2009 =A0 =A0 =A0 =A0(r196432) > @@ -82,13 +82,15 @@ struct { > =A0 =A0 =A0 =A0{ 700000, 700099, "/packages-7.0-release" }, > =A0 =A0 =A0 =A0{ 701000, 701099, "/packages-7.1-release" }, > =A0 =A0 =A0 =A0{ 702000, 702099, "/packages-7.2-release" }, > + =A0 =A0 =A0 { 800000, 800499, "/packages-8.0-release" }, > =A0 =A0 =A0 =A0{ 300000, 399000, "/packages-3-stable" }, > =A0 =A0 =A0 =A0{ 400000, 499000, "/packages-4-stable" }, > =A0 =A0 =A0 =A0{ 502100, 502128, "/packages-5-current" }, > =A0 =A0 =A0 =A0{ 503100, 599000, "/packages-5-stable" }, > =A0 =A0 =A0 =A0{ 600100, 699000, "/packages-6-stable" }, > =A0 =A0 =A0 =A0{ 700100, 799000, "/packages-7-stable" }, > - =A0 =A0 =A0 { 800000, 899000, "/packages-8-current" }, > + =A0 =A0 =A0 { 800000, 899000, "/packages-8-stable" }, > + =A0 =A0 =A0 { 900000, 999000, "/packages-9-current" }, The last chunk should probably be: - { 800000, 899000, "/packages-8-current" }, + { 800500, 899000, "/packages-8-stable" }, + { 900000, 999000, "/packages-9-current" }, which also agrees to 196115 change (in stable/8). --=20 wbr, pluknet From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 18:28:59 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0440C1065690; Sun, 23 Aug 2009 18:28:59 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E829B8FC1C; Sun, 23 Aug 2009 18:28:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NISwv4069037; Sun, 23 Aug 2009 18:28:58 GMT (envelope-from antoine@svn.freebsd.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NISwmi069035; Sun, 23 Aug 2009 18:28:58 GMT (envelope-from antoine@svn.freebsd.org) Message-Id: <200908231828.n7NISwmi069035@svn.freebsd.org> From: Antoine Brodin Date: Sun, 23 Aug 2009 18:28:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196477 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 18:28:59 -0000 Author: antoine Date: Sun Aug 23 18:28:58 2009 New Revision: 196477 URL: http://svn.freebsd.org/changeset/base/196477 Log: ObsoleteFiles.inc: kthread_create(9) was resurrected as a mlink to kproc(9) Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sun Aug 23 18:15:13 2009 (r196476) +++ head/ObsoleteFiles.inc Sun Aug 23 18:28:58 2009 (r196477) @@ -803,8 +803,6 @@ OLD_FILES+=rescue/bsdlabel OLD_FILES+=rescue/fdisk OLD_FILES+=rescue/gpt .endif -# 20071026: kthread(9)/kproc(9) API changes -OLD_FILES+=usr/share/man/man9/kthread_create.9.gz # 20071025: rc.d/nfslocking superceeded by rc.d/lockd and rc.d/statd OLD_FILES+=etc/rc.d/nfslocking # 20070930: rename of cached to nscd From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 19:37:27 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B35B7106568D; Sun, 23 Aug 2009 19:37:27 +0000 (UTC) (envelope-from stb@lassitu.de) Received: from koef.zs64.net (koef.zs64.net [212.12.50.230]) by mx1.freebsd.org (Postfix) with ESMTP id 4E9C98FC18; Sun, 23 Aug 2009 19:37:26 +0000 (UTC) Received: from localhost by koef.zs64.net (8.14.3/8.14.3) with ESMTP id n7NJJY2X029840 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sun, 23 Aug 2009 21:19:35 +0200 (CEST) (envelope-from stb@lassitu.de) (authenticated as stb) Message-Id: <76094077-6E36-45DF-B717-3C7884377A89@lassitu.de> From: Stefan Bethke To: Jeremie Le Hen In-Reply-To: <20090823143840.GD61707@felucia.tataz.chchile.org> Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Date: Sun, 23 Aug 2009 21:19:34 +0200 References: <200908132318.n7DNIjvO015601@svn.freebsd.org> <20090823143840.GD61707@felucia.tataz.chchile.org> X-Mailer: Apple Mail (2.936) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Scott Long Subject: Re: svn commit: r196200 - in head: etc/mtree include sys/dev/mfi usr.sbin usr.sbin/mfiutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 19:37:27 -0000 Am 23.08.2009 um 16:38 schrieb Jeremie Le Hen: > Wouldn't it be more reasonable to use a standard > suffix for all dedicated admin utility such as vidcontrol, memcontrol, > kbdcontrol: > > % 59# find /bin /sbin /usr/bin /usr/sbin -name \*control | wc -l > % 25 > % 60# find /bin /sbin /usr/bin /usr/sbin -name \*config | wc -l > % 13 $ find /bin /sbin /usr/bin /usr/sbin -name \*ctl | wc -l 12 $ find /bin /sbin /usr/bin /usr/sbin -name \*cfg | wc -l 1 $ find /bin /sbin /usr/bin /usr/sbin -name \*util | wc -l 3 I'm afraid that train's left long ago. Stefan -- Stefan Bethke Fon +49 151 14070811 From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 19:52:47 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CDDDE10656DA; Sun, 23 Aug 2009 19:52:47 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BDD268FC21; Sun, 23 Aug 2009 19:52:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NJql1w070674; Sun, 23 Aug 2009 19:52:47 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NJqlFg070672; Sun, 23 Aug 2009 19:52:47 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200908231952.n7NJqlFg070672@svn.freebsd.org> From: Doug Barton Date: Sun, 23 Aug 2009 19:52:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196478 - head/etc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 19:52:47 -0000 Author: dougb Date: Sun Aug 23 19:52:47 2009 New Revision: 196478 URL: http://svn.freebsd.org/changeset/base/196478 Log: Prior to the dire warning about values of network_interfaces other than AUTO the biggest mistake users made was leaving lo0 off the list. Since lo0 is effectively mandatory, check for it and add it to the list if it's not there. Modified: head/etc/network.subr Modified: head/etc/network.subr ============================================================================== --- head/etc/network.subr Sun Aug 23 18:28:58 2009 (r196477) +++ head/etc/network.subr Sun Aug 23 19:52:47 2009 (r196478) @@ -727,6 +727,13 @@ list_net_interfaces() ;; *) _tmplist="${network_interfaces} ${cloned_interfaces}" + + # lo0 is effectively mandatory, so help prevent foot-shooting + # + case "$_tmplist" in + lo0*|*lo0|*' lo0 '*) ;; # This is fine, do nothing + *) _tmplist="lo0 ${_tmplist}" ;; + esac ;; esac From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 19:54:37 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2FAD7106568B; Sun, 23 Aug 2009 19:54:37 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F68D8FC13; Sun, 23 Aug 2009 19:54:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NJsb9I070741; Sun, 23 Aug 2009 19:54:37 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NJsbQU070739; Sun, 23 Aug 2009 19:54:37 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <200908231954.n7NJsbQU070739@svn.freebsd.org> From: Olivier Houchard Date: Sun, 23 Aug 2009 19:54:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196479 - head/sys/arm/xscale/ixp425 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 19:54:37 -0000 Author: cognet Date: Sun Aug 23 19:54:36 2009 New Revision: 196479 URL: http://svn.freebsd.org/changeset/base/196479 Log: No need to remove the same flag multiple times. Modified: head/sys/arm/xscale/ixp425/ixdp425_pci.c Modified: head/sys/arm/xscale/ixp425/ixdp425_pci.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixdp425_pci.c Sun Aug 23 19:52:47 2009 (r196478) +++ head/sys/arm/xscale/ixp425/ixdp425_pci.c Sun Aug 23 19:54:36 2009 (r196479) @@ -62,12 +62,12 @@ ixp425_md_attach(device_t dev) /* PCI Reset Assert */ reg = GPIO_CONF_READ_4(sc, IXP425_GPIO_GPOUTR); reg &= ~(1U << GPIO_PCI_RESET); - GPIO_CONF_WRITE_4(sc, IXP425_GPIO_GPOUTR, reg & ~(1U << GPIO_PCI_RESET)); + GPIO_CONF_WRITE_4(sc, IXP425_GPIO_GPOUTR, reg); /* PCI Clock Disable */ reg = GPIO_CONF_READ_4(sc, IXP425_GPIO_GPCLKR); reg &= ~GPCLKR_MUX14; - GPIO_CONF_WRITE_4(sc, IXP425_GPIO_GPCLKR, reg & ~GPCLKR_MUX14); + GPIO_CONF_WRITE_4(sc, IXP425_GPIO_GPCLKR, reg); /* * set GPIO Direction From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 20:26:10 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F9C7106568C; Sun, 23 Aug 2009 20:26:10 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E9C48FC12; Sun, 23 Aug 2009 20:26:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NKQAGH071427; Sun, 23 Aug 2009 20:26:10 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NKQAxX071421; Sun, 23 Aug 2009 20:26:10 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200908232026.n7NKQAxX071421@svn.freebsd.org> From: Ed Schouten Date: Sun, 23 Aug 2009 20:26:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196480 - in head/sys: conf dev/pty kern modules/pty X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 20:26:10 -0000 Author: ed Date: Sun Aug 23 20:26:09 2009 New Revision: 196480 URL: http://svn.freebsd.org/changeset/base/196480 Log: Allow pty(4) to be loaded as a kld. Unfortunately, the wrappers that are present in pts(4) don't have the mechanics to allow pty(4) to be unloaded safely, so I'm forcing this kld to return EBUSY. This also means we have to enable some extra code in pts(4) unconditionally. Proposed by: rwatson Added: head/sys/dev/pty/ head/sys/dev/pty/pty.c - copied, changed from r196449, head/sys/kern/tty_pty.c head/sys/modules/pty/ head/sys/modules/pty/Makefile (contents, props changed) Deleted: head/sys/kern/tty_pty.c Modified: head/sys/conf/files head/sys/conf/options head/sys/kern/tty_pts.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Aug 23 19:54:36 2009 (r196479) +++ head/sys/conf/files Sun Aug 23 20:26:09 2009 (r196480) @@ -1297,6 +1297,7 @@ dev/ppc/ppc_puc.c optional ppc puc dev/pst/pst-iop.c optional pst dev/pst/pst-pci.c optional pst pci dev/pst/pst-raid.c optional pst +dev/pty/pty.c optional pty dev/puc/puc.c optional puc dev/puc/puc_cfg.c optional puc dev/puc/puc_pccard.c optional puc pccard @@ -2059,7 +2060,6 @@ kern/tty_info.c standard kern/tty_inq.c standard kern/tty_outq.c standard kern/tty_pts.c standard -kern/tty_pty.c optional pty kern/tty_tty.c standard kern/tty_ttydisc.c standard kern/uipc_accf.c optional inet Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Sun Aug 23 19:54:36 2009 (r196479) +++ head/sys/conf/options Sun Aug 23 20:26:09 2009 (r196480) @@ -672,7 +672,6 @@ ISAPNP opt_isa.h DEV_BPF opt_bpf.h DEV_MCA opt_mca.h DEV_CARP opt_carp.h -DEV_PTY opt_tty.h DEV_SPLASH opt_splash.h # EISA support Copied and modified: head/sys/dev/pty/pty.c (from r196449, head/sys/kern/tty_pty.c) ============================================================================== --- head/sys/kern/tty_pty.c Sun Aug 23 07:32:30 2009 (r196449, copy source) +++ head/sys/dev/pty/pty.c Sun Aug 23 20:26:09 2009 (r196480) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -117,11 +118,24 @@ pty_clone(void *arg, struct ucred *cr, c NULL, UID_ROOT, GID_WHEEL, 0666, "%s", name); } -static void -pty_init(void *unused) +static int +pty_modevent(module_t mod, int type, void *data) { - EVENTHANDLER_REGISTER(dev_clone, pty_clone, 0, 1000); + switch(type) { + case MOD_LOAD: + EVENTHANDLER_REGISTER(dev_clone, pty_clone, 0, 1000); + break; + case MOD_SHUTDOWN: + break; + case MOD_UNLOAD: + /* XXX: No unloading support yet. */ + return (EBUSY); + default: + return (EOPNOTSUPP); + } + + return (0); } -SYSINIT(pty, SI_SUB_DRIVERS, SI_ORDER_MIDDLE, pty_init, NULL); +DEV_MODULE(pty, pty_modevent, NULL); Modified: head/sys/kern/tty_pts.c ============================================================================== --- head/sys/kern/tty_pts.c Sun Aug 23 19:54:36 2009 (r196479) +++ head/sys/kern/tty_pts.c Sun Aug 23 20:26:09 2009 (r196480) @@ -30,14 +30,10 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_tty.h" - /* Add compatibility bits for FreeBSD. */ #define PTS_COMPAT -#ifdef DEV_PTY /* Add /dev/ptyXX compat bits. */ #define PTS_EXTERNAL -#endif /* DEV_PTY */ /* Add bits to make Linux binaries work. */ #define PTS_LINUX Added: head/sys/modules/pty/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/pty/Makefile Sun Aug 23 20:26:09 2009 (r196480) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../dev/pty + +KMOD= pty +SRCS= pty.c + +.include From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 20:40:20 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8464106568F; Sun, 23 Aug 2009 20:40:19 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D55168FC13; Sun, 23 Aug 2009 20:40:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NKeJ6L071808; Sun, 23 Aug 2009 20:40:19 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NKeJB9071791; Sun, 23 Aug 2009 20:40:19 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200908232040.n7NKeJB9071791@svn.freebsd.org> From: Robert Watson Date: Sun, 23 Aug 2009 20:40:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196481 - in head/sys: compat/linux contrib/altq/altq kern net netgraph netinet netinet6 netipsec nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 20:40:20 -0000 Author: rwatson Date: Sun Aug 23 20:40:19 2009 New Revision: 196481 URL: http://svn.freebsd.org/changeset/base/196481 Log: Rework global locks for interface list and index management, correcting several critical bugs, including race conditions and lock order issues: Replace the single rwlock, ifnet_lock, with two locks, an rwlock and an sxlock. Either can be held to stablize the lists and indexes, but both are required to write. This allows the list to be held stable in both network interrupt contexts and sleepable user threads across sleeping memory allocations or device driver interactions. As before, writes to the interface list must occur from sleepable contexts. Reviewed by: bz, julian MFC after: 3 days Modified: head/sys/compat/linux/linux_ioctl.c head/sys/contrib/altq/altq/altq_subr.c head/sys/kern/kern_uuid.c head/sys/net/bridgestp.c head/sys/net/if.c head/sys/net/if_llatbl.c head/sys/net/if_var.h head/sys/net/if_vlan.c head/sys/netgraph/ng_gif.c head/sys/netinet/in.c head/sys/netinet6/icmp6.c head/sys/netinet6/in6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/nd6.c head/sys/netipsec/xform_ipip.c head/sys/nfsclient/bootp_subr.c Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/compat/linux/linux_ioctl.c Sun Aug 23 20:40:19 2009 (r196481) @@ -2061,22 +2061,20 @@ linux_ifname(struct ifnet *ifp, char *bu struct ifnet *ifscan; int ethno; + IFNET_RLOCK_ASSERT(); + /* Short-circuit non ethernet interfaces */ if (!IFP_IS_ETH(ifp)) return (strlcpy(buffer, ifp->if_xname, buflen)); /* Determine the (relative) unit number for ethernet interfaces */ ethno = 0; - IFNET_RLOCK(); TAILQ_FOREACH(ifscan, &V_ifnet, if_link) { - if (ifscan == ifp) { - IFNET_RUNLOCK(); + if (ifscan == ifp) return (snprintf(buffer, buflen, "eth%d", ethno)); - } if (IFP_IS_ETH(ifscan)) ethno++; } - IFNET_RUNLOCK(); return (0); } @@ -2177,7 +2175,7 @@ again: valid_len = 0; /* Return all AF_INET addresses of all interfaces */ - IFNET_RLOCK(); /* could sleep XXX */ + IFNET_RLOCK(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { int addrs = 0; Modified: head/sys/contrib/altq/altq/altq_subr.c ============================================================================== --- head/sys/contrib/altq/altq/altq_subr.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/contrib/altq/altq/altq_subr.c Sun Aug 23 20:40:19 2009 (r196481) @@ -462,8 +462,8 @@ tbr_timeout(arg) s = splimp(); #endif #if defined(__FreeBSD__) && (__FreeBSD_version >= 500000) - IFNET_RLOCK(); - VNET_LIST_RLOCK(); + IFNET_RLOCK_NOSLEEP(); + VNET_LIST_RLOCK_NOSLEEP(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); #endif @@ -480,8 +480,8 @@ tbr_timeout(arg) #if defined(__FreeBSD__) && (__FreeBSD_version >= 500000) CURVNET_RESTORE(); } - VNET_LIST_RUNLOCK(); - IFNET_RUNLOCK(); + VNET_LIST_RUNLOCK_NOSLEEP(); + IFNET_RUNLOCK_NOSLEEP(); #endif splx(s); if (active > 0) Modified: head/sys/kern/kern_uuid.c ============================================================================== --- head/sys/kern/kern_uuid.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/kern/kern_uuid.c Sun Aug 23 20:40:19 2009 (r196481) @@ -95,7 +95,7 @@ uuid_node(uint16_t *node) int i; CURVNET_SET(TD_TO_VNET(curthread)); - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { /* Walk the address list */ IF_ADDR_LOCK(ifp); @@ -106,14 +106,14 @@ uuid_node(uint16_t *node) /* Got a MAC address. */ bcopy(LLADDR(sdl), node, UUID_NODE_LEN); IF_ADDR_UNLOCK(ifp); - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); CURVNET_RESTORE(); return; } } IF_ADDR_UNLOCK(ifp); } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); for (i = 0; i < (UUID_NODE_LEN>>1); i++) node[i] = (uint16_t)arc4random(); Modified: head/sys/net/bridgestp.c ============================================================================== --- head/sys/net/bridgestp.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/net/bridgestp.c Sun Aug 23 20:40:19 2009 (r196481) @@ -2019,7 +2019,7 @@ bstp_reinit(struct bstp_state *bs) * not need to be part of the bridge, it just needs to be a unique * value. */ - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (ifp->if_type != IFT_ETHER) continue; @@ -2036,7 +2036,7 @@ bstp_reinit(struct bstp_state *bs) continue; } } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); if (LIST_EMPTY(&bs->bs_bplist) || mif == NULL) { /* Set the bridge and root id (lower bits) to zero */ Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/net/if.c Sun Aug 23 20:40:19 2009 (r196481) @@ -154,14 +154,26 @@ VNET_DEFINE(struct ifgrouphead, ifg_head VNET_DEFINE(int, if_index); static VNET_DEFINE(int, if_indexlim) = 8; -/* Table of ifnet by index. Locked with ifnet_lock. */ +/* Table of ifnet by index. */ static VNET_DEFINE(struct ifindex_entry *, ifindex_table); #define V_if_indexlim VNET(if_indexlim) #define V_ifindex_table VNET(ifindex_table) int ifqmaxlen = IFQ_MAXLEN; -struct rwlock ifnet_lock; + +/* + * The global network interface list (V_ifnet) and related state (such as + * if_index, if_indexlim, and ifindex_table) are protected by an sxlock and + * an rwlock. Either may be acquired shared to stablize the list, but both + * must be acquired writable to modify the list. This model allows us to + * both stablize the interface list during interrupt thread processing, but + * also to stablize it over long-running ioctls, without introducing priority + * inversions and deadlocks. + */ +struct rwlock ifnet_rwlock; +struct sx ifnet_sxlock; + static if_com_alloc_t *if_com_alloc[256]; static if_com_free_t *if_com_free[256]; @@ -188,9 +200,9 @@ ifnet_byindex(u_short idx) { struct ifnet *ifp; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); ifp = ifnet_byindex_locked(idx); - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (ifp); } @@ -199,19 +211,19 @@ ifnet_byindex_ref(u_short idx) { struct ifnet *ifp; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); ifp = ifnet_byindex_locked(idx); if (ifp == NULL || (ifp->if_flags & IFF_DYING)) { - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (NULL); } if_ref(ifp); - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (ifp); } static void -ifnet_setbyindex(u_short idx, struct ifnet *ifp) +ifnet_setbyindex_locked(u_short idx, struct ifnet *ifp) { IFNET_WLOCK_ASSERT(); @@ -219,16 +231,25 @@ ifnet_setbyindex(u_short idx, struct ifn V_ifindex_table[idx].ife_ifnet = ifp; } +static void +ifnet_setbyindex(u_short idx, struct ifnet *ifp) +{ + + IFNET_WLOCK(); + ifnet_setbyindex_locked(idx, ifp); + IFNET_WUNLOCK(); +} + struct ifaddr * ifaddr_byindex(u_short idx) { struct ifaddr *ifa; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); ifa = ifnet_byindex_locked(idx)->if_addr; if (ifa != NULL) ifa_ref(ifa); - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (ifa); } @@ -361,9 +382,7 @@ if_alloc(u_char type) ifq_init(&ifp->if_snd, ifp); refcount_init(&ifp->if_refcount, 1); /* Index reference. */ - IFNET_WLOCK(); ifnet_setbyindex(ifp->if_index, ifp); - IFNET_WUNLOCK(); return (ifp); } @@ -383,7 +402,7 @@ if_free_internal(struct ifnet *ifp) KASSERT(ifp == ifnet_byindex_locked(ifp->if_index), ("%s: freeing unallocated ifnet", ifp->if_xname)); - ifnet_setbyindex(ifp->if_index, NULL); + ifnet_setbyindex_locked(ifp->if_index, NULL); while (V_if_index > 0 && ifnet_byindex_locked(V_if_index) == NULL) V_if_index--; IFNET_WUNLOCK(); @@ -855,11 +874,14 @@ if_vmove(struct ifnet *ifp, struct vnet if_detach_internal(ifp, 1); /* - * Unlink the ifnet from ifindex_table[] in current vnet, - * and shrink the if_index for that vnet if possible. + * Unlink the ifnet from ifindex_table[] in current vnet, and shrink + * the if_index for that vnet if possible. + * + * NOTE: IFNET_WLOCK/IFNET_WUNLOCK() are assumed to be unvirtualized, + * or we'd lock on one vnet and unlock on another. */ IFNET_WLOCK(); - ifnet_setbyindex(ifp->if_index, NULL); + ifnet_setbyindex_locked(ifp->if_index, NULL); while (V_if_index > 0 && ifnet_byindex_locked(V_if_index) == NULL) V_if_index--; IFNET_WUNLOCK(); @@ -886,7 +908,7 @@ if_vmove(struct ifnet *ifp, struct vnet V_if_index = ifp->if_index; if (V_if_index >= V_if_indexlim) if_grow(); - ifnet_setbyindex(ifp->if_index, ifp); + ifnet_setbyindex_locked(ifp->if_index, ifp); IFNET_WUNLOCK(); if_attach_internal(ifp, 1); @@ -1368,7 +1390,7 @@ ifa_ifwithaddr_internal(struct sockaddr struct ifnet *ifp; struct ifaddr *ifa; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { @@ -1395,7 +1417,7 @@ ifa_ifwithaddr_internal(struct sockaddr } ifa = NULL; done: - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (ifa); } @@ -1423,7 +1445,7 @@ ifa_ifwithbroadaddr(struct sockaddr *add struct ifnet *ifp; struct ifaddr *ifa; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { @@ -1442,7 +1464,7 @@ ifa_ifwithbroadaddr(struct sockaddr *add } ifa = NULL; done: - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (ifa); } @@ -1456,7 +1478,7 @@ ifa_ifwithdstaddr(struct sockaddr *addr) struct ifnet *ifp; struct ifaddr *ifa; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if ((ifp->if_flags & IFF_POINTOPOINT) == 0) continue; @@ -1475,7 +1497,7 @@ ifa_ifwithdstaddr(struct sockaddr *addr) } ifa = NULL; done: - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (ifa); } @@ -1508,7 +1530,7 @@ ifa_ifwithnet(struct sockaddr *addr) * we find one, as we release the IF_ADDR_LOCK() that kept it stable * when we move onto the next interface. */ - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { @@ -1584,7 +1606,7 @@ next: continue; ifa = ifa_maybe; ifa_maybe = NULL; done: - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); if (ifa_maybe != NULL) ifa_free(ifa_maybe); return (ifa); @@ -1863,7 +1885,7 @@ if_slowtimo(void *arg) int s = splimp(); VNET_LIST_RLOCK_NOSLEEP(); - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { @@ -1874,7 +1896,7 @@ if_slowtimo(void *arg) } CURVNET_RESTORE(); } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); VNET_LIST_RUNLOCK_NOSLEEP(); splx(s); timeout(if_slowtimo, (void *)0, hz / IFNET_SLOWHZ); @@ -1889,7 +1911,7 @@ ifunit_ref(const char *name) { struct ifnet *ifp; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (strncmp(name, ifp->if_xname, IFNAMSIZ) == 0 && !(ifp->if_flags & IFF_DYING)) @@ -1897,7 +1919,7 @@ ifunit_ref(const char *name) } if (ifp != NULL) if_ref(ifp); - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (ifp); } @@ -1906,12 +1928,12 @@ ifunit(const char *name) { struct ifnet *ifp; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (strncmp(name, ifp->if_xname, IFNAMSIZ) == 0) break; } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (ifp); } @@ -2521,7 +2543,7 @@ again: max_len = 0; valid_len = 0; - IFNET_RLOCK(); /* could sleep XXX */ + IFNET_RLOCK(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { int addrs; @@ -2846,13 +2868,13 @@ if_delmulti(struct ifnet *ifp, struct so #ifdef INVARIANTS struct ifnet *oifp; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(oifp, &V_ifnet, if_link) if (ifp == oifp) break; if (ifp != oifp) ifp = NULL; - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); KASSERT(ifp != NULL, ("%s: ifnet went away", __func__)); #endif @@ -2895,7 +2917,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifm } else { struct ifnet *oifp; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(oifp, &V_ifnet, if_link) if (ifp == oifp) break; @@ -2903,7 +2925,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifm printf("%s: ifnet %p disappeared\n", __func__, ifp); ifp = NULL; } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); } #endif /* Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/net/if_llatbl.c Sun Aug 23 20:40:19 2009 (r196481) @@ -200,14 +200,14 @@ lltable_prefix_free(int af, struct socka { struct lltable *llt; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); SLIST_FOREACH(llt, &lltables, llt_link) { if (llt->llt_af != af) continue; llt->llt_prefix_free(llt, prefix, mask); } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); } @@ -300,13 +300,13 @@ lla_rt_output(struct rt_msghdr *rtm, str } /* XXX linked list may be too expensive */ - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); SLIST_FOREACH(llt, &lltables, llt_link) { if (llt->llt_af == dst->sa_family && llt->llt_ifp == ifp) break; } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); KASSERT(llt != NULL, ("Yep, ugly hacks are bad\n")); if (flags && LLE_CREATE) Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/net/if_var.h Sun Aug 23 20:40:19 2009 (r196481) @@ -85,6 +85,7 @@ struct vnet; #include /* XXX */ #include /* XXX */ #include /* XXX */ +#include /* XXX */ #include /* XXX */ #include @@ -754,14 +755,39 @@ struct ifmultiaddr { #ifdef _KERNEL -extern struct rwlock ifnet_lock; -#define IFNET_LOCK_INIT() \ - rw_init_flags(&ifnet_lock, "ifnet", RW_RECURSE) -#define IFNET_WLOCK() rw_wlock(&ifnet_lock) -#define IFNET_WUNLOCK() rw_wunlock(&ifnet_lock) -#define IFNET_WLOCK_ASSERT() rw_assert(&ifnet_lock, RA_LOCKED) -#define IFNET_RLOCK() rw_rlock(&ifnet_lock) -#define IFNET_RUNLOCK() rw_runlock(&ifnet_lock) +extern struct rwlock ifnet_rwlock; +extern struct sx ifnet_sxlock; + +#define IFNET_LOCK_INIT() do { \ + rw_init_flags(&ifnet_rwlock, "ifnet_rw", RW_RECURSE); \ + sx_init_flags(&ifnet_sxlock, "ifnet_sx", SX_RECURSE); \ +} while(0) + +#define IFNET_WLOCK() do { \ + sx_xlock(&ifnet_sxlock); \ + rw_wlock(&ifnet_rwlock); \ +} while (0) + +#define IFNET_WUNLOCK() do { \ + rw_wunlock(&ifnet_rwlock); \ + sx_xunlock(&ifnet_sxlock); \ +} while (0) + +/* + * To assert the ifnet lock, you must know not only whether it's for read or + * write, but also whether it was acquired with sleep support or not. + */ +#define IFNET_RLOCK_ASSERT() sx_assert(&ifnet_sxlock, SA_SLOCKED) +#define IFNET_RLOCK_NOSLEEP_ASSERT() rw_assert(&ifnet_rwlock, RA_RLOCKED) +#define IFNET_WLOCK_ASSERT() do { \ + sx_assert(&ifnet_sxlock, SA_XLOCKED); \ + rw_assert(&ifnet_rwlock, RA_WLOCKED); \ +} while (0) + +#define IFNET_RLOCK() sx_slock(&ifnet_sxlock) +#define IFNET_RLOCK_NOSLEEP() rw_rlock(&ifnet_rwlock) +#define IFNET_RUNLOCK() sx_sunlock(&ifnet_sxlock) +#define IFNET_RUNLOCK_NOSLEEP() rw_runlock(&ifnet_rwlock) /* * Look up an ifnet given its index; the _ref variant also acquires a Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/net/if_vlan.c Sun Aug 23 20:40:19 2009 (r196481) @@ -580,7 +580,7 @@ vlan_clone_match_ethertag(struct if_clon int t = 0; /* Check for . style interface names. */ - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (ifp->if_type != IFT_ETHER) continue; @@ -598,7 +598,7 @@ vlan_clone_match_ethertag(struct if_clon *tag = t; break; } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (ifp); } Modified: head/sys/netgraph/ng_gif.c ============================================================================== --- head/sys/netgraph/ng_gif.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/netgraph/ng_gif.c Sun Aug 23 20:40:19 2009 (r196481) @@ -560,7 +560,7 @@ ng_gif_mod_event(module_t mod, int event ng_gif_input_orphan_p = ng_gif_input_orphan; /* Create nodes for any already-existing gif interfaces */ - VNET_LIST_RLOCK_NOSLEEP(); + VNET_LIST_RLOCK(); IFNET_RLOCK(); VNET_FOREACH(vnet_iter) { CURVNET_SET_QUIET(vnet_iter); /* XXX revisit quiet */ @@ -571,7 +571,7 @@ ng_gif_mod_event(module_t mod, int event CURVNET_RESTORE(); } IFNET_RUNLOCK(); - VNET_LIST_RUNLOCK_NOSLEEP(); + VNET_LIST_RUNLOCK(); break; case MOD_UNLOAD: Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/netinet/in.c Sun Aug 23 20:40:19 2009 (r196481) @@ -1407,12 +1407,7 @@ in_lltable_dump(struct lltable *llt, str } arpc; int error, i; - /* XXXXX - * current IFNET_RLOCK() is mapped to IFNET_WLOCK() - * so it is okay to use this ASSERT, change it when - * IFNET lock is finalized - */ - IFNET_WLOCK_ASSERT(); + IFNET_RLOCK_ASSERT(); error = 0; for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/netinet6/icmp6.c Sun Aug 23 20:40:19 2009 (r196481) @@ -1705,7 +1705,7 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, st } } - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); for (ifp = TAILQ_FIRST(&V_ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { addrsofif = 0; IF_ADDR_LOCK(ifp); @@ -1762,13 +1762,13 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, st IF_ADDR_UNLOCK(ifp); if (iffound) { *ifpp = ifp; - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (addrsofif); } addrs += addrsofif; } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (addrs); } @@ -1789,7 +1789,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *n if (ifp0 == NULL && !(niflags & NI_NODEADDR_FLAG_ALL)) return (0); /* needless to copy */ - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); again: for (; ifp; ifp = TAILQ_NEXT(ifp, if_list)) { @@ -1854,7 +1854,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *n * Set the truncate flag and return. */ nni6->ni_flags |= NI_NODEADDR_FLAG_TRUNCATE; - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (copied); } @@ -1907,7 +1907,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *n goto again; } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return (copied); } Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/netinet6/in6.c Sun Aug 23 20:40:19 2009 (r196481) @@ -2234,7 +2234,7 @@ in6_setmaxmtu(void) unsigned long maxmtu = 0; struct ifnet *ifp; - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); for (ifp = TAILQ_FIRST(&V_ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { /* this function can be called during ifnet initialization */ @@ -2244,7 +2244,7 @@ in6_setmaxmtu(void) IN6_LINKMTU(ifp) > maxmtu) maxmtu = IN6_LINKMTU(ifp); } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); if (maxmtu) /* update only when maxmtu is positive */ V_in6_maxmtu = maxmtu; } @@ -2495,12 +2495,7 @@ in6_lltable_dump(struct lltable *llt, st } ndpc; int i, error; - /* XXXXX - * current IFNET_RLOCK() is mapped to IFNET_WLOCK() - * so it is okay to use this ASSERT, change it when - * IFNET lock is finalized - */ - IFNET_WLOCK_ASSERT(); + IFNET_RLOCK_ASSERT(); error = 0; for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/netinet6/in6_ifattach.c Sun Aug 23 20:40:19 2009 (r196481) @@ -398,7 +398,7 @@ get_ifid(struct ifnet *ifp0, struct ifne } /* next, try to get it from some other hardware interface */ - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); for (ifp = V_ifnet.tqh_first; ifp; ifp = ifp->if_list.tqe_next) { if (ifp == ifp0) continue; @@ -413,11 +413,11 @@ get_ifid(struct ifnet *ifp0, struct ifne nd6log((LOG_DEBUG, "%s: borrow interface identifier from %s\n", if_name(ifp0), if_name(ifp))); - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); goto success; } } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); /* last resort: get from random number source */ if (get_rand_ifid(ifp, in6) == 0) { Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/netinet6/nd6.c Sun Aug 23 20:40:19 2009 (r196481) @@ -1662,7 +1662,7 @@ nd6_slowtimo(void *arg) callout_reset(&V_nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz, nd6_slowtimo, curvnet); - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); for (ifp = TAILQ_FIRST(&V_ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) { nd6if = ND_IFINFO(ifp); @@ -1678,7 +1678,7 @@ nd6_slowtimo(void *arg) nd6if->reachable = ND_COMPUTE_RTIME(nd6if->basereachable); } } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); CURVNET_RESTORE(); } Modified: head/sys/netipsec/xform_ipip.c ============================================================================== --- head/sys/netipsec/xform_ipip.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/netipsec/xform_ipip.c Sun Aug 23 20:40:19 2009 (r196481) @@ -303,7 +303,7 @@ _ipip_input(struct mbuf *m, int iphlen, if ((m->m_pkthdr.rcvif == NULL || !(m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK)) && V_ipip_allow != 2) { - IFNET_RLOCK(); + IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { #ifdef INET @@ -318,7 +318,7 @@ _ipip_input(struct mbuf *m, int iphlen, ipo->ip_src.s_addr) { V_ipipstat.ipips_spoof++; m_freem(m); - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return; } } @@ -335,7 +335,7 @@ _ipip_input(struct mbuf *m, int iphlen, if (IN6_ARE_ADDR_EQUAL(&sin6->sin6_addr, &ip6->ip6_src)) { V_ipipstat.ipips_spoof++; m_freem(m); - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); return; } @@ -343,7 +343,7 @@ _ipip_input(struct mbuf *m, int iphlen, #endif /* INET6 */ } } - IFNET_RUNLOCK(); + IFNET_RUNLOCK_NOSLEEP(); } /* Statistics */ Modified: head/sys/nfsclient/bootp_subr.c ============================================================================== --- head/sys/nfsclient/bootp_subr.c Sun Aug 23 20:26:09 2009 (r196480) +++ head/sys/nfsclient/bootp_subr.c Sun Aug 23 20:40:19 2009 (r196481) @@ -389,7 +389,7 @@ bootpboot_p_iflist(void) struct ifaddr *ifa; printf("Interface list:\n"); - IFNET_RLOCK(); /* could sleep, but okay for debugging XXX */ + IFNET_RLOCK(); for (ifp = TAILQ_FIRST(&V_ifnet); ifp != NULL; ifp = TAILQ_NEXT(ifp, if_link)) { From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 21:00:21 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB969106568B; Sun, 23 Aug 2009 21:00:21 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB2EF8FC0C; Sun, 23 Aug 2009 21:00:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NL0Lir072223; Sun, 23 Aug 2009 21:00:21 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NL0L1Z072221; Sun, 23 Aug 2009 21:00:21 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200908232100.n7NL0L1Z072221@svn.freebsd.org> From: Robert Watson Date: Sun, 23 Aug 2009 21:00:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196482 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 21:00:22 -0000 Author: rwatson Date: Sun Aug 23 21:00:21 2009 New Revision: 196482 URL: http://svn.freebsd.org/changeset/base/196482 Log: Rather than using IFNET_RLOCK() when iterating over (and modifying) the ifnet list during if_ef load, directly acquire the ifnet_sxlock exclusively. That way when if_alloc() recurses the lock, it's a write recursion rather than a read->write recursion. This code structure is arguably a bug, so add a comment indicating that this is the case. Post-8.0, we should fix this, but this commit resolves panic-on-load for if_ef. Discussed with: bz, julian Reported by: phk MFC after: 3 days Modified: head/sys/net/if_ef.c Modified: head/sys/net/if_ef.c ============================================================================== --- head/sys/net/if_ef.c Sun Aug 23 20:40:19 2009 (r196481) +++ head/sys/net/if_ef.c Sun Aug 23 21:00:21 2009 (r196482) @@ -492,7 +492,20 @@ ef_load(void) VNET_LIST_RLOCK(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); - IFNET_RLOCK(); + + /* + * XXXRW: The following loop walks the ifnet list while + * modifying it, something not well-supported by ifnet + * locking. To avoid lock upgrade/recursion issues, manually + * acquire a write lock of ifnet_sxlock here, rather than a + * read lock, so that when if_alloc() recurses the lock, we + * don't panic. This structure, in which if_ef automatically + * attaches to all ethernet interfaces, should be replaced + * with a model like that found in if_vlan, in which + * interfaces are explicitly configured, which would avoid + * this (and other) problems. + */ + sx_xlock(&ifnet_sxlock); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (ifp->if_type != IFT_ETHER) continue; EFDEBUG("Found interface %s\n", ifp->if_xname); @@ -523,7 +536,7 @@ ef_load(void) efcount++; SLIST_INSERT_HEAD(&efdev, efl, el_next); } - IFNET_RUNLOCK(); + sx_xunlock(&ifnet_sxlock); CURVNET_RESTORE(); } VNET_LIST_RUNLOCK(); From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 21:09:48 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50F44106568C; Sun, 23 Aug 2009 21:09:48 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F2638FC17; Sun, 23 Aug 2009 21:09:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NL9k4r072429; Sun, 23 Aug 2009 21:09:46 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NL9khk072422; Sun, 23 Aug 2009 21:09:46 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200908232109.n7NL9khk072422@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 23 Aug 2009 21:09:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196483 - in head: bin/sh tools/regression/bin/sh/execution X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 21:09:48 -0000 Author: jilles Date: Sun Aug 23 21:09:46 2009 New Revision: 196483 URL: http://svn.freebsd.org/changeset/base/196483 Log: sh: Fix crash when undefining or redefining a currently executing function. Add a reference count to function definitions. Memory may leak if multiple SIGINTs arrive in interactive mode, this will be fixed later by changing SIGINT handling. PR: bin/137640 Added: head/tools/regression/bin/sh/execution/func1.0 (contents, props changed) Modified: head/bin/sh/eval.c head/bin/sh/exec.c head/bin/sh/exec.h head/bin/sh/mknodes.c head/bin/sh/nodes.c.pat Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Sun Aug 23 21:00:21 2009 (r196482) +++ head/bin/sh/eval.c Sun Aug 23 21:09:46 2009 (r196483) @@ -785,6 +785,7 @@ evalcommand(union node *cmd, int flags, INTOFF; savelocalvars = localvars; localvars = NULL; + reffunc(cmdentry.u.func); INTON; savehandler = handler; if (setjmp(jmploc.loc)) { @@ -794,6 +795,7 @@ evalcommand(union node *cmd, int flags, freeparam(&shellparam); shellparam = saveparam; } + unreffunc(cmdentry.u.func); poplocalvars(); localvars = savelocalvars; handler = savehandler; @@ -805,11 +807,12 @@ evalcommand(union node *cmd, int flags, funcnest++; exitstatus = oexitstatus; if (flags & EV_TESTED) - evaltree(cmdentry.u.func, EV_TESTED); + evaltree(&cmdentry.u.func->n, EV_TESTED); else - evaltree(cmdentry.u.func, 0); + evaltree(&cmdentry.u.func->n, 0); funcnest--; INTOFF; + unreffunc(cmdentry.u.func); poplocalvars(); localvars = savelocalvars; freeparam(&shellparam); Modified: head/bin/sh/exec.c ============================================================================== --- head/bin/sh/exec.c Sun Aug 23 21:00:21 2009 (r196482) +++ head/bin/sh/exec.c Sun Aug 23 21:09:46 2009 (r196483) @@ -286,7 +286,7 @@ printentry(struct tblentry *cmdp, int ve out1fmt("function %s", cmdp->cmdname); if (verbose) { INTOFF; - name = commandtext(cmdp->param.func); + name = commandtext(&cmdp->param.func->n); out1c(' '); out1str(name); ckfree(name); @@ -583,7 +583,7 @@ deletefuncs(void) while ((cmdp = *pp) != NULL) { if (cmdp->cmdtype == CMDFUNCTION) { *pp = cmdp->next; - freefunc(cmdp->param.func); + unreffunc(cmdp->param.func); ckfree(cmdp); } else { pp = &cmdp->next; @@ -670,7 +670,7 @@ addcmdentry(char *name, struct cmdentry INTOFF; cmdp = cmdlookup(name, 1); if (cmdp->cmdtype == CMDFUNCTION) { - freefunc(cmdp->param.func); + unreffunc(cmdp->param.func); } cmdp->cmdtype = entry->cmdtype; cmdp->param = entry->u; @@ -705,7 +705,7 @@ unsetfunc(char *name) struct tblentry *cmdp; if ((cmdp = cmdlookup(name, 0)) != NULL && cmdp->cmdtype == CMDFUNCTION) { - freefunc(cmdp->param.func); + unreffunc(cmdp->param.func); delete_cmd_entry(); return (0); } Modified: head/bin/sh/exec.h ============================================================================== --- head/bin/sh/exec.h Sun Aug 23 21:00:21 2009 (r196482) +++ head/bin/sh/exec.h Sun Aug 23 21:09:46 2009 (r196483) @@ -46,11 +46,12 @@ enum { TYPECMD_TYPE /* type */ }; +union node; struct cmdentry { int cmdtype; union param { int index; - union node *func; + struct funcdef *func; } u; int special; }; Modified: head/bin/sh/mknodes.c ============================================================================== --- head/bin/sh/mknodes.c Sun Aug 23 21:00:21 2009 (r196482) +++ head/bin/sh/mknodes.c Sun Aug 23 21:09:46 2009 (r196483) @@ -248,8 +248,13 @@ output(char *file) fputs("\tstruct nodelist *next;\n", hfile); fputs("\tunion node *n;\n", hfile); fputs("};\n\n\n", hfile); - fputs("union node *copyfunc(union node *);\n", hfile); - fputs("void freefunc(union node *);\n", hfile); + fputs("struct funcdef {\n", hfile); + fputs("\tunsigned int refcount;\n", hfile); + fputs("\tunion node n;\n", hfile); + fputs("};\n\n\n", hfile); + fputs("struct funcdef *copyfunc(union node *);\n", hfile); + fputs("void reffunc(struct funcdef *);\n", hfile); + fputs("void unreffunc(struct funcdef *);\n", hfile); fputs(writer, cfile); while (fgets(line, sizeof line, patfile) != NULL) { Modified: head/bin/sh/nodes.c.pat ============================================================================== --- head/bin/sh/nodes.c.pat Sun Aug 23 21:00:21 2009 (r196482) +++ head/bin/sh/nodes.c.pat Sun Aug 23 21:09:46 2009 (r196483) @@ -35,6 +35,7 @@ #include #include +#include /* * Routine for dealing with parsed shell commands. */ @@ -65,17 +66,22 @@ STATIC char *nodesavestr(char *); * Make a copy of a parse tree. */ -union node * +struct funcdef * copyfunc(union node *n) { + struct funcdef *fn; + if (n == NULL) return NULL; - funcblocksize = 0; + funcblocksize = offsetof(struct funcdef, n); funcstringsize = 0; calcsize(n); - funcblock = ckmalloc(funcblocksize + funcstringsize); - funcstring = (char *)funcblock + funcblocksize; - return copynode(n); + fn = ckmalloc(funcblocksize + funcstringsize); + fn->refcount = 1; + funcblock = (char *)fn + offsetof(struct funcdef, n); + funcstring = (char *)fn + funcblocksize; + copynode(n); + return fn; } @@ -144,14 +150,25 @@ nodesavestr(char *s) } +void +reffunc(struct funcdef *fn) +{ + fn->refcount++; +} + /* - * Free a parse tree. + * Decrement the reference count of a function definition, freeing it + * if it falls to 0. */ void -freefunc(union node *n) +unreffunc(struct funcdef *fn) { - if (n) - ckfree(n); + if (fn) { + fn->refcount--; + if (fn->refcount > 0) + return; + ckfree(fn); + } } Added: head/tools/regression/bin/sh/execution/func1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/func1.0 Sun Aug 23 21:09:46 2009 (r196483) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +MALLOC_OPTIONS=J sh -c 'g() { g() { :; }; :; }; g' && +MALLOC_OPTIONS=J sh -c 'g() { unset -f g; :; }; g' From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 21:38:02 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A997106568E; Sun, 23 Aug 2009 21:38:02 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id 9508B8FC1D; Sun, 23 Aug 2009 21:38:01 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 488AB35A836; Sun, 23 Aug 2009 23:38:00 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 34B3D228CD; Sun, 23 Aug 2009 23:38:00 +0200 (CEST) Date: Sun, 23 Aug 2009 23:38:00 +0200 From: Jilles Tjoelker To: Konstantin Belousov Message-ID: <20090823213759.GA55039@stack.nl> References: <200908231244.n7NCiFgc061095@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="n8g4imXOkfNTN/H1" Content-Disposition: inline In-Reply-To: <200908231244.n7NCiFgc061095@svn.freebsd.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196460 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 21:38:02 -0000 --n8g4imXOkfNTN/H1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, Aug 23, 2009 at 12:44:15PM +0000, Konstantin Belousov wrote: > Author: kib > Date: Sun Aug 23 12:44:15 2009 > New Revision: 196460 > URL: http://svn.freebsd.org/changeset/base/196460 > Log: > Fix the conformance of poll(2) for sockets after r195423 by > returning POLLHUP instead of POLLIN for several cases. Now, the > tools/regression/poll results for FreeBSD are closer to that of the > Solaris and Linux. > Also, improve the POSIX conformance by explicitely clearing POLLOUT > when POLLHUP is reported in pollscan(), making the fix global. > Submitted by: bde > Reviewed by: rwatson > MFC after: 1 week > Modified: > head/sys/kern/sys_generic.c > head/sys/kern/uipc_socket.c > Modified: head/sys/kern/sys_generic.c > ============================================================================== > --- head/sys/kern/sys_generic.c Sun Aug 23 12:23:24 2009 (r196459) > +++ head/sys/kern/sys_generic.c Sun Aug 23 12:44:15 2009 (r196460) > @@ -1228,6 +1228,13 @@ pollscan(td, fds, nfd) > selfdalloc(td, fds); > fds->revents = fo_poll(fp, fds->events, > td->td_ucred, td); > + /* > + * POSIX requires POLLOUT to be never > + * set simultaneously with POLLHUP. > + */ > + if ((fds->revents & POLLHUP) != 0) > + fds->revents &= ~POLLOUT; > + > if (fds->revents != 0) > n++; > } This looks useful. > Modified: head/sys/kern/uipc_socket.c > ============================================================================== > --- head/sys/kern/uipc_socket.c Sun Aug 23 12:23:24 2009 (r196459) > +++ head/sys/kern/uipc_socket.c Sun Aug 23 12:44:15 2009 (r196460) > @@ -2898,13 +2898,11 @@ sopoll_generic(struct socket *so, int ev > if (so->so_oobmark || (so->so_rcv.sb_state & SBS_RCVATMARK)) > revents |= events & (POLLPRI | POLLRDBAND); > > - if ((events & POLLINIGNEOF) == 0) { > - if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { > - revents |= events & (POLLIN | POLLRDNORM); > - if (so->so_snd.sb_state & SBS_CANTSENDMORE) > - revents |= POLLHUP; > - } > - } > + if ((events & POLLINIGNEOF) == 0) > + if (so->so_rcv.sb_state & SBS_CANTRCVMORE) > + revents |= POLLHUP; > + if (so->so_snd.sb_state & SBS_CANTSENDMORE) > + revents |= POLLHUP; > > if (revents == 0) { > if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) { This sets POLLHUP when either of the directions has shut down, instead of the entire connection. This breaks use of select and poll with shutdown(2): * sending some data, shutdown(SHUT_WR) then polling for input * (the other side for the above) receiving some data, getting EOF on that direction then polling for output * a paranoid HTTP-like server that wants to wait for the client to close the read end after shutting down the write end Either some data is lost or the program busy-waits for the data. I think the POLLHUP setting before this commit was correct for sockets: POLLHUP is set if both directions are closed/error. An EOF that only affects one direction sets the corresponding POLLIN/POLLOUT so that the EOF becomes known but the other direction can still be used normally. (The POSIX spec explicitly describes something like this for POLLIN (zero length message) although it erroneously restricts it to STREAMS files only; the POLLOUT case has to be derived from the fact that the read end should still work normally but the EOF should be notified.) I think poll on fifos should instead be fixed by closing the half-connection corresponding to writing from fi_readsock to fi_writesock. I have tried this out, see attached patch. With the patch, pipepoll only gives "expected POLLHUP; got POLLIN | POLLHUP" errors and an error in fifo case 6b caused by our distinction between new and old readers. tools/regression/poll does not test shutdown(2) interaction, so it does not find this problem. -- Jilles Tjoelker --n8g4imXOkfNTN/H1 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="poll-fifo.patch" Index: sys/kern/uipc_socket.c =================================================================== --- sys/kern/uipc_socket.c (revision 196469) +++ sys/kern/uipc_socket.c (working copy) @@ -2898,11 +2898,13 @@ if (so->so_oobmark || (so->so_rcv.sb_state & SBS_RCVATMARK)) revents |= events & (POLLPRI | POLLRDBAND); - if ((events & POLLINIGNEOF) == 0) - if (so->so_rcv.sb_state & SBS_CANTRCVMORE) - revents |= POLLHUP; - if (so->so_snd.sb_state & SBS_CANTSENDMORE) - revents |= POLLHUP; + if ((events & POLLINIGNEOF) == 0) { + if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { + revents |= events & (POLLIN | POLLRDNORM); + if (so->so_snd.sb_state & SBS_CANTSENDMORE) + revents |= POLLHUP; + } + } if (revents == 0) { if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) { Index: sys/fs/fifofs/fifo_vnops.c =================================================================== --- sys/fs/fifofs/fifo_vnops.c (revision 196459) +++ sys/fs/fifofs/fifo_vnops.c (working copy) @@ -193,6 +193,10 @@ goto fail2; fip->fi_writesock = wso; error = soconnect2(wso, rso); + if (error == 0) + error = soshutdown(rso, SHUT_WR); + if (error == 0) + error = soshutdown(wso, SHUT_RD); if (error) { (void)soclose(wso); fail2: --n8g4imXOkfNTN/H1-- From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 22:49:17 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1B24106568D; Sun, 23 Aug 2009 22:49:17 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (skuns.zoral.com.ua [91.193.166.194]) by mx1.freebsd.org (Postfix) with ESMTP id 65C718FC18; Sun, 23 Aug 2009 22:49:17 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n7NMn29q031914 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 24 Aug 2009 01:49:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n7NMn20K064468; Mon, 24 Aug 2009 01:49:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n7NMn2RW064467; Mon, 24 Aug 2009 01:49:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 24 Aug 2009 01:49:02 +0300 From: Kostik Belousov To: Jilles Tjoelker Message-ID: <20090823224902.GK9623@deviant.kiev.zoral.com.ua> References: <200908231244.n7NCiFgc061095@svn.freebsd.org> <20090823213759.GA55039@stack.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="NSWmqrgMASeejWAY" Content-Disposition: inline In-Reply-To: <20090823213759.GA55039@stack.nl> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196460 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 22:49:17 -0000 --NSWmqrgMASeejWAY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Aug 23, 2009 at 11:38:00PM +0200, Jilles Tjoelker wrote: > On Sun, Aug 23, 2009 at 12:44:15PM +0000, Konstantin Belousov wrote: > > Author: kib > > Date: Sun Aug 23 12:44:15 2009 > > New Revision: 196460 > > URL: http://svn.freebsd.org/changeset/base/196460 >=20 > > Log: > > Fix the conformance of poll(2) for sockets after r195423 by > > returning POLLHUP instead of POLLIN for several cases. Now, the > > tools/regression/poll results for FreeBSD are closer to that of the > > Solaris and Linux. >=20 > > Also, improve the POSIX conformance by explicitely clearing POLLOUT > > when POLLHUP is reported in pollscan(), making the fix global. >=20 > > Submitted by: bde > > Reviewed by: rwatson > > MFC after: 1 week =2E.. > > Modified: head/sys/kern/uipc_socket.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/kern/uipc_socket.c Sun Aug 23 12:23:24 2009 (r196459) > > +++ head/sys/kern/uipc_socket.c Sun Aug 23 12:44:15 2009 (r196460) > > @@ -2898,13 +2898,11 @@ sopoll_generic(struct socket *so, int ev > > if (so->so_oobmark || (so->so_rcv.sb_state & SBS_RCVATMARK)) > > revents |=3D events & (POLLPRI | POLLRDBAND); > > =20 > > - if ((events & POLLINIGNEOF) =3D=3D 0) { > > - if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { > > - revents |=3D events & (POLLIN | POLLRDNORM); > > - if (so->so_snd.sb_state & SBS_CANTSENDMORE) > > - revents |=3D POLLHUP; > > - } > > - } > > + if ((events & POLLINIGNEOF) =3D=3D 0) > > + if (so->so_rcv.sb_state & SBS_CANTRCVMORE) > > + revents |=3D POLLHUP; > > + if (so->so_snd.sb_state & SBS_CANTSENDMORE) > > + revents |=3D POLLHUP; > > =20 > > if (revents =3D=3D 0) { > > if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) { >=20 > This sets POLLHUP when either of the directions has shut down, instead > of the entire connection. This breaks use of select and poll with > shutdown(2): >=20 > * sending some data, shutdown(SHUT_WR) then polling for input > * (the other side for the above) receiving some data, getting EOF on > that direction then polling for output > * a paranoid HTTP-like server that wants to wait for the client to close > the read end after shutting down the write end >=20 > Either some data is lost or the program busy-waits for the data. Exactly this situation concerned me and Robert. >=20 > I think the POLLHUP setting before this commit was correct for sockets: > POLLHUP is set if both directions are closed/error. An EOF that only > affects one direction sets the corresponding POLLIN/POLLOUT so that the > EOF becomes known but the other direction can still be used normally. >=20 > (The POSIX spec explicitly describes something like this for POLLIN > (zero length message) although it erroneously restricts it to STREAMS > files only; the POLLOUT case has to be derived from the fact that the > read end should still work normally but the EOF should be notified.) >=20 > I think poll on fifos should instead be fixed by closing the > half-connection corresponding to writing from fi_readsock to > fi_writesock. I have tried this out, see attached patch. With the patch, > pipepoll only gives "expected POLLHUP; got POLLIN | POLLHUP" errors and > an error in fifo case 6b caused by our distinction between new and old > readers. This sounds right. Please go ahead. >=20 > tools/regression/poll does not test shutdown(2) interaction, so it does > not find this problem. >=20 > --=20 > Jilles Tjoelker --NSWmqrgMASeejWAY Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkqRx10ACgkQC3+MBN1Mb4hgBwCfTY08i+d4EXvg/r+7J/QTqyTI whYAoOx7xZlC5rYB6bKMQJJXpOudmsEP =z2Kx -----END PGP SIGNATURE----- --NSWmqrgMASeejWAY-- From owner-svn-src-all@FreeBSD.ORG Sun Aug 23 23:37:54 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B3AA106568B; Sun, 23 Aug 2009 23:37:54 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 69CD08FC0A; Sun, 23 Aug 2009 23:37:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7NNbsja075345; Sun, 23 Aug 2009 23:37:54 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7NNbslF075344; Sun, 23 Aug 2009 23:37:54 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <200908232337.n7NNbslF075344@svn.freebsd.org> From: Olivier Houchard Date: Sun, 23 Aug 2009 23:37:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196484 - head/sys/arm/arm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2009 23:37:54 -0000 Author: cognet Date: Sun Aug 23 23:37:53 2009 New Revision: 196484 URL: http://svn.freebsd.org/changeset/base/196484 Log: KDB needs , so move it under #ifdef KDB. While I'm there, remove dead code, we will never support acorn26. Modified: head/sys/arm/arm/undefined.c Modified: head/sys/arm/arm/undefined.c ============================================================================== --- head/sys/arm/arm/undefined.c Sun Aug 23 21:09:46 2009 (r196483) +++ head/sys/arm/arm/undefined.c Sun Aug 23 23:37:53 2009 (r196484) @@ -82,11 +82,10 @@ __FBSDID("$FreeBSD$"); #ifdef DDB #include -#include #endif -#ifdef acorn26 -#include +#ifdef KDB +#include #endif static int gdb_trapper(u_int, u_int, struct trapframe *, int); From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 01:15:38 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44EF7106568D; Mon, 24 Aug 2009 01:15:38 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id CFEEF8FC12; Mon, 24 Aug 2009 01:15:37 +0000 (UTC) Received: from c122-106-152-1.carlnfd1.nsw.optusnet.com.au (c122-106-152-1.carlnfd1.nsw.optusnet.com.au [122.106.152.1]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n7O1FX6f023430 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 24 Aug 2009 11:15:35 +1000 Date: Mon, 24 Aug 2009 11:15:33 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Jilles Tjoelker In-Reply-To: <20090823213759.GA55039@stack.nl> Message-ID: <20090824093730.V39303@delplex.bde.org> References: <200908231244.n7NCiFgc061095@svn.freebsd.org> <20090823213759.GA55039@stack.nl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Konstantin Belousov Subject: Re: svn commit: r196460 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 01:15:38 -0000 On Sun, 23 Aug 2009, Jilles Tjoelker wrote: > On Sun, Aug 23, 2009 at 12:44:15PM +0000, Konstantin Belousov wrote: > ... >> Modified: head/sys/kern/uipc_socket.c >> ============================================================================== >> --- head/sys/kern/uipc_socket.c Sun Aug 23 12:23:24 2009 (r196459) >> +++ head/sys/kern/uipc_socket.c Sun Aug 23 12:44:15 2009 (r196460) >> @@ -2898,13 +2898,11 @@ sopoll_generic(struct socket *so, int ev >> if (so->so_oobmark || (so->so_rcv.sb_state & SBS_RCVATMARK)) >> revents |= events & (POLLPRI | POLLRDBAND); >> >> - if ((events & POLLINIGNEOF) == 0) { >> - if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { >> - revents |= events & (POLLIN | POLLRDNORM); >> - if (so->so_snd.sb_state & SBS_CANTSENDMORE) >> - revents |= POLLHUP; >> - } >> - } >> + if ((events & POLLINIGNEOF) == 0) >> + if (so->so_rcv.sb_state & SBS_CANTRCVMORE) >> + revents |= POLLHUP; >> + if (so->so_snd.sb_state & SBS_CANTSENDMORE) >> + revents |= POLLHUP; >> >> if (revents == 0) { >> if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) { > > This sets POLLHUP when either of the directions has shut down, instead > of the entire connection. This breaks use of select and poll with > shutdown(2): We already knew about this in general, but not its details. > * sending some data, shutdown(SHUT_WR) then polling for input > * (the other side for the above) receiving some data, getting EOF on > that direction then polling for output This could possibly be fixed by not breaking things perfectly to POSIX spec, and keep returning POLLOUT with POLLHUP. We already return POLLIN with POLLHUP. This state is meaningful and supported by POSIX. It means that hangup has occurred but there is queued input. The current problem shows that the state { POLLOUT with POLLHUP } is also meaningful, although it is forbidden by POSIX. It should mean that hangup has occurred (for the read direction only) but output is still possible. > * a paranoid HTTP-like server that wants to wait for the client to close > the read end after shutting down the write end > > Either some data is lost or the program busy-waits for the data. And it would wait forever if the client fails to tell it after failing in polling for output? I can't see any way to fix this short of uncombining the EOFs again. Setting POLLHUP would at best reduce to busy-waiting since poll() would always return immediately due to the POLLHUP. > I think the POLLHUP setting before this commit was correct for sockets: > POLLHUP is set if both directions are closed/error. An EOF that only > affects one direction sets the corresponding POLLIN/POLLOUT so that the > EOF becomes known but the other direction can still be used normally. > > (The POSIX spec explicitly describes something like this for POLLIN > (zero length message) although it erroneously restricts it to STREAMS > files only; the POLLOUT case has to be derived from the fact that the > read end should still work normally but the EOF should be notified.) I thought that the zero-length message part of the spec just requires poll() to not block if read() would return EOF. If done in all cases of EOF, this makes POLLHUP almost useless for at least fifos. If done only in special cases, then no one, especially POSIX, knows when it is done. Note that POSIX has much better wording for requiring select() on a read descriptor to not block if read() would return EOF. This makes select() useless for detecting certain state changes involving EOF on at least fifos, and previous rounds of "fixes" in this area (about 6 years ago) broke it away from POSIX. The POLLINIGNEOF stuff is a failed attempt to avoid breaking select() in this way while making poll() more useful. > I think poll on fifos should instead be fixed by closing the > half-connection corresponding to writing from fi_readsock to > fi_writesock. I have tried this out, see attached patch. Interesting. I wonder what the corresponding magic for socketpair() and the 4.4BSD implementation of pipes is (I couldn't find any shutdown() there, and with fully bidirectional pipes or sockets it is unclear how EOF can ever be detected, since a r/w descriptor can always talk to itself). > With the patch, > pipepoll only gives "expected POLLHUP; got POLLIN | POLLHUP" errors and > an error in fifo case 6b caused by our distinction between new and old > readers. 6b tests more breakage to POSIX spec. Another thing to decide is whether to do this. Could someone test this on newer versions of Linux? I use a hackish kernel change (essentially, throw away the distinction by corrupting the generation count) to pass this test. > tools/regression/poll does not test shutdown(2) interaction, so it does > not find this problem. More tests would be welcome. I have only a few hackish ones for POLLOUT. Bruce From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 03:04:13 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2DE6106568B; Mon, 24 Aug 2009 03:04:13 +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 E18D18FC1D; Mon, 24 Aug 2009 03:04:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7O34Dp5079584; Mon, 24 Aug 2009 03:04:13 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7O34DFo079582; Mon, 24 Aug 2009 03:04:13 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200908240304.n7O34DFo079582@svn.freebsd.org> From: Ken Smith Date: Mon, 24 Aug 2009 03:04:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196485 - head/usr.sbin/pkg_install/add X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 03:04:14 -0000 Author: kensmith Date: Mon Aug 24 03:04:13 2009 New Revision: 196485 URL: http://svn.freebsd.org/changeset/base/196485 Log: Oops. Needed to adjust a little bit more of the line for packages-8-stable now that we're prepping for 8.0's release. Submitted by: pluknet at gmail dot com Pointy hat: kensmith Modified: head/usr.sbin/pkg_install/add/main.c Modified: head/usr.sbin/pkg_install/add/main.c ============================================================================== --- head/usr.sbin/pkg_install/add/main.c Sun Aug 23 23:37:53 2009 (r196484) +++ head/usr.sbin/pkg_install/add/main.c Mon Aug 24 03:04:13 2009 (r196485) @@ -89,7 +89,7 @@ struct { { 503100, 599000, "/packages-5-stable" }, { 600100, 699000, "/packages-6-stable" }, { 700100, 799000, "/packages-7-stable" }, - { 800000, 899000, "/packages-8-stable" }, + { 800500, 899000, "/packages-8-stable" }, { 900000, 999000, "/packages-9-current" }, { 0, 9999999, "/packages-current" }, { 0, 0, NULL } From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 03:07:06 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A38A4106568D; Mon, 24 Aug 2009 03:07:06 +0000 (UTC) (envelope-from kensmith@cse.Buffalo.EDU) Received: from phoebe.cse.buffalo.edu (phoebe.cse.buffalo.edu [128.205.32.89]) by mx1.freebsd.org (Postfix) with ESMTP id EC4818FC19; Mon, 24 Aug 2009 03:07:05 +0000 (UTC) Received: from [128.205.32.76] (bauer.cse.buffalo.edu [128.205.32.76]) (authenticated bits=0) by phoebe.cse.buffalo.edu (8.14.1/8.13.7) with ESMTP id n7O36ww9039408 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 23 Aug 2009 23:07:05 -0400 (EDT) (envelope-from kensmith@cse.buffalo.edu) From: Ken Smith To: pluknet In-Reply-To: References: <200908222344.n7MNibQZ040298@svn.freebsd.org> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-EdtZV2PY5pGE2DxWv5qQ" Organization: U. Buffalo CSE Department Date: Sun, 23 Aug 2009 23:06:58 -0400 Message-Id: <1251083218.21032.0.camel@bauer.cse.buffalo.edu> Mime-Version: 1.0 X-Mailer: Evolution 2.24.5 FreeBSD GNOME Team Port X-DCC--Metrics: phoebe.cse.buffalo.edu 1336; Body=0 Fuz1=0 Fuz2=0 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Ken Smith Subject: Re: svn commit: r196432 - in head: . gnu/usr.bin/groff/tmac release sys/conf sys/sys usr.sbin/pkg_install/add X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 03:07:06 -0000 --=-EdtZV2PY5pGE2DxWv5qQ Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Sun, 2009-08-23 at 22:18 +0400, pluknet wrote: > The last chunk should probably be: > - { 800000, 899000, "/packages-8-current" }, > + { 800500, 899000, "/packages-8-stable" }, > + { 900000, 999000, "/packages-9-current" }, >=20 > which also agrees to 196115 change (in stable/8). Thanks, fixed. --=20 Ken Smith - From there to here, from here to | kensmith@cse.buffalo.edu there, funny things are everywhere. | - Theodore Geisel | --=-EdtZV2PY5pGE2DxWv5qQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEABECAAYFAkqSA8oACgkQ/G14VSmup/YFJACePThxBFoGNfgyiwDtD7wvwo2g Zq0AoIL3sMx6652CFQhkeVVowzyrF3se =aXc3 -----END PGP SIGNATURE----- --=-EdtZV2PY5pGE2DxWv5qQ-- From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 03:49:38 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76811106568C; Mon, 24 Aug 2009 03:49:38 +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 6446C8FC08; Mon, 24 Aug 2009 03:49:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7O3ncdQ080858; Mon, 24 Aug 2009 03:49:38 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7O3ncfi080857; Mon, 24 Aug 2009 03:49:38 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200908240349.n7O3ncfi080857@svn.freebsd.org> From: Ken Smith Date: Mon, 24 Aug 2009 03:49: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: r196486 - stable/8/share/examples/cvsup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 03:49:38 -0000 Author: kensmith Date: Mon Aug 24 03:49:37 2009 New Revision: 196486 URL: http://svn.freebsd.org/changeset/base/196486 Log: Update the comment for RELENG_8 too. Submitted by: Dmitry Morozovsky Approved by: re (implicit) Modified: stable/8/share/examples/cvsup/stable-supfile Modified: stable/8/share/examples/cvsup/stable-supfile ============================================================================== --- stable/8/share/examples/cvsup/stable-supfile Mon Aug 24 03:04:13 2009 (r196485) +++ stable/8/share/examples/cvsup/stable-supfile Mon Aug 24 03:49:37 2009 (r196486) @@ -66,9 +66,10 @@ *default host=CHANGE_THIS.FreeBSD.org *default base=/var/db *default prefix=/usr -# The following line is for 7-stable. If you want 6-stable, 5-stable, -# 4-stable, 3-stable, or 2.2-stable, change to "RELENG_6", "RELENG_5", -# "RELENG_4", "RELENG_3", or "RELENG_2_2" respectively. +# The following line is for 8-stable. If you want 7-stable, 6-stable, +# 5-stable, 4-stable, 3-stable, or 2.2-stable, change to "RELENG_7", +# "RELENG_6", "RELENG_5", "RELENG_4", "RELENG_3", or "RELENG_2_2" +# respectively. *default release=cvs tag=RELENG_8 *default delete use-rel-suffix From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 04:57:49 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 858E1106564A; Mon, 24 Aug 2009 04:57:49 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 748C28FC18; Mon, 24 Aug 2009 04:57:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7O4vn6w082198; Mon, 24 Aug 2009 04:57:49 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7O4vn9E082196; Mon, 24 Aug 2009 04:57:49 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <200908240457.n7O4vn9E082196@svn.freebsd.org> From: Alfred Perlstein Date: Mon, 24 Aug 2009 04:57:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196487 - head/sys/dev/sound/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 04:57:49 -0000 Author: alfred Date: Mon Aug 24 04:57:48 2009 New Revision: 196487 URL: http://svn.freebsd.org/changeset/base/196487 Log: Remove redundant Giant reference. Giant will be dropped automatically when the mutex argument is NULL. Reported by: Various people Submitted by: hps Modified: head/sys/dev/sound/usb/uaudio.c Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Mon Aug 24 03:49:37 2009 (r196486) +++ head/sys/dev/sound/usb/uaudio.c Mon Aug 24 04:57:48 2009 (r196487) @@ -2958,7 +2958,7 @@ uaudio_mixer_get(struct usb_device *udev USETW(req.wIndex, mc->wIndex); USETW(req.wLength, len); - err = usbd_do_request(udev, &Giant, &req, data); + err = usbd_do_request(udev, NULL, &req, data); if (err) { DPRINTF("err=%s\n", usbd_errstr(err)); return (0); @@ -3081,7 +3081,7 @@ uaudio_set_speed(struct usb_device *udev data[1] = speed >> 8; data[2] = speed >> 16; - return (usbd_do_request(udev, &Giant, &req, data)); + return (usbd_do_request(udev, NULL, &req, data)); } static int From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 04:58:12 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E17C106568F; Mon, 24 Aug 2009 04:58:12 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0CE9B8FC14; Mon, 24 Aug 2009 04:58:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7O4wB8S082243; Mon, 24 Aug 2009 04:58:11 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7O4wB27082241; Mon, 24 Aug 2009 04:58:11 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <200908240458.n7O4wB27082241@svn.freebsd.org> From: Alfred Perlstein Date: Mon, 24 Aug 2009 04:58:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196488 - head/sys/dev/usb/controller X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 04:58:12 -0000 Author: alfred Date: Mon Aug 24 04:58:11 2009 New Revision: 196488 URL: http://svn.freebsd.org/changeset/base/196488 Log: - allow disabling "root_mount_hold()" by setting a sysctl/tunable at boot - remove some redundant initial explore code Submitted by: hps Modified: head/sys/dev/usb/controller/usb_controller.c Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Mon Aug 24 04:57:48 2009 (r196487) +++ head/sys/dev/usb/controller/usb_controller.c Mon Aug 24 04:58:11 2009 (r196488) @@ -67,7 +67,6 @@ static device_attach_t usb_attach; static device_detach_t usb_detach; static void usb_attach_sub(device_t, struct usb_bus *); -static void usb_post_init(void *); /* static variables */ @@ -84,8 +83,6 @@ TUNABLE_INT("hw.usb.no_boot_wait", &usb_ SYSCTL_INT(_hw_usb, OID_AUTO, no_boot_wait, CTLFLAG_RDTUN, &usb_no_boot_wait, 0, "No device enumerate waiting at boot."); -static uint8_t usb_post_init_called = 0; - static devclass_t usb_devclass; static device_method_t usb_methods[] = { @@ -142,12 +139,8 @@ usb_attach(device_t dev) bus->bus_roothold = root_mount_hold(device_get_nameunit(dev)); } - if (usb_post_init_called) { - mtx_lock(&Giant); - usb_attach_sub(dev, bus); - mtx_unlock(&Giant); - usb_needs_explore(bus, 1); - } + usb_attach_sub(dev, bus); + return (0); /* return success */ } @@ -226,22 +219,24 @@ usb_bus_explore(struct usb_proc_msg *pm) /* avoid zero, hence that is memory default */ bus->driver_added_refcount = 1; } - USB_BUS_UNLOCK(bus); - mtx_lock(&Giant); + /* + * The following three lines of code are only here to + * recover from DDB: + */ + usb_proc_rewakeup(&bus->control_xfer_proc); + usb_proc_rewakeup(&bus->giant_callback_proc); + usb_proc_rewakeup(&bus->non_giant_callback_proc); + + USB_BUS_UNLOCK(bus); /* * First update the USB power state! */ usb_bus_powerd(bus); - /* - * Explore the Root USB HUB. This call can sleep, - * exiting Giant, which is actually Giant. - */ - (udev->hub->explore) (udev); - - mtx_unlock(&Giant); + /* Explore the Root USB HUB. */ + (udev->hub->explore) (udev); USB_BUS_LOCK(bus); } if (bus->bus_roothold != NULL) { @@ -269,10 +264,10 @@ usb_bus_detach(struct usb_proc_msg *pm) device_set_softc(dev, NULL); USB_BUS_UNLOCK(bus); - mtx_lock(&Giant); - /* detach children first */ + mtx_lock(&Giant); bus_generic_detach(dev); + mtx_unlock(&Giant); /* * Free USB Root device, but not any sub-devices, hence they @@ -281,7 +276,6 @@ usb_bus_detach(struct usb_proc_msg *pm) usb_free_device(udev, USB_UNCFG_FLAG_FREE_EP0); - mtx_unlock(&Giant); USB_BUS_LOCK(bus); /* clear bdev variable last */ bus->bdev = NULL; @@ -297,6 +291,12 @@ usb_power_wdog(void *arg) usb_callout_reset(&bus->power_wdog, 4 * hz, usb_power_wdog, arg); + /* + * The following line of code is only here to recover from + * DDB: + */ + usb_proc_rewakeup(&bus->explore_proc); /* recover from DDB */ + USB_BUS_UNLOCK(bus); usb_bus_power_update(bus); @@ -350,7 +350,6 @@ usb_bus_attach(struct usb_proc_msg *pm) } USB_BUS_UNLOCK(bus); - mtx_lock(&Giant); /* XXX not required by USB */ /* default power_mask value */ bus->hw_power_state = @@ -383,7 +382,6 @@ usb_bus_attach(struct usb_proc_msg *pm) err = USB_ERR_NOMEM; } - mtx_unlock(&Giant); USB_BUS_LOCK(bus); if (err) { @@ -401,17 +399,18 @@ usb_bus_attach(struct usb_proc_msg *pm) /*------------------------------------------------------------------------* * usb_attach_sub * - * This function creates a thread which runs the USB attach code. It - * is factored out, hence it can be called at two different places in - * time. During bootup this function is called from - * "usb_post_init". During hot-plug it is called directly from the - * "usb_attach()" method. + * This function creates a thread which runs the USB attach code. *------------------------------------------------------------------------*/ static void usb_attach_sub(device_t dev, struct usb_bus *bus) { const char *pname = device_get_nameunit(dev); + mtx_lock(&Giant); + if (usb_devclass_ptr == NULL) + usb_devclass_ptr = devclass_find("usbus"); + mtx_unlock(&Giant); + /* Initialise USB process messages */ bus->explore_msg[0].hdr.pm_callback = &usb_bus_explore; bus->explore_msg[0].bus = bus; @@ -454,55 +453,12 @@ usb_attach_sub(device_t dev, struct usb_ /* ignore */ } USB_BUS_UNLOCK(bus); - } -} - -/*------------------------------------------------------------------------* - * usb_post_init - * - * This function is called to attach all USB busses that were found - * during bootup. - *------------------------------------------------------------------------*/ -static void -usb_post_init(void *arg) -{ - struct usb_bus *bus; - devclass_t dc; - device_t dev; - int max; - int n; - mtx_lock(&Giant); - - usb_devclass_ptr = devclass_find("usbus"); - - dc = usb_devclass_ptr; - if (dc) { - max = devclass_get_maxunit(dc) + 1; - for (n = 0; n != max; n++) { - dev = devclass_get_device(dc, n); - if (dev && device_is_attached(dev)) { - bus = device_get_ivars(dev); - if (bus) { - mtx_lock(&Giant); - usb_attach_sub(dev, bus); - mtx_unlock(&Giant); - } - } - } - } else { - DPRINTFN(0, "no devclass\n"); + /* Do initial explore */ + usb_needs_explore(bus, 1); } - usb_post_init_called = 1; - - /* explore all USB busses in parallell */ - - usb_needs_explore_all(); - - mtx_unlock(&Giant); } -SYSINIT(usb_post_init, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, usb_post_init, NULL); SYSUNINIT(usb_bus_unload, SI_SUB_KLD, SI_ORDER_ANY, usb_bus_unload, NULL); /*------------------------------------------------------------------------* From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 04:58:42 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71AE4106568F; Mon, 24 Aug 2009 04:58:42 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 604418FC17; Mon, 24 Aug 2009 04:58:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7O4wgQP082291; Mon, 24 Aug 2009 04:58:42 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7O4wgcE082289; Mon, 24 Aug 2009 04:58:42 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <200908240458.n7O4wgcE082289@svn.freebsd.org> From: Alfred Perlstein Date: Mon, 24 Aug 2009 04:58:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196489 - head/sys/dev/usb/input X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 04:58:42 -0000 Author: alfred Date: Mon Aug 24 04:58:42 2009 New Revision: 196489 URL: http://svn.freebsd.org/changeset/base/196489 Log: - patch for cordump slowdown. Avoid using DELAY(1000) when no keys are pressed. - Reported by: Various people - add sysctl to disable keyboard led control request - Reported by: Yoshihiro Ota - Save system CPU usage: Patch to stop keyboard timer when no keys are pressed. Submitted by: hps MFC after: 3 days Modified: head/sys/dev/usb/input/ukbd.c Modified: head/sys/dev/usb/input/ukbd.c ============================================================================== --- head/sys/dev/usb/input/ukbd.c Mon Aug 24 04:58:11 2009 (r196488) +++ head/sys/dev/usb/input/ukbd.c Mon Aug 24 04:58:42 2009 (r196489) @@ -96,10 +96,14 @@ __FBSDID("$FreeBSD$"); #if USB_DEBUG static int ukbd_debug = 0; +static int ukbd_no_leds = 0; SYSCTL_NODE(_hw_usb, OID_AUTO, ukbd, CTLFLAG_RW, 0, "USB ukbd"); SYSCTL_INT(_hw_usb_ukbd, OID_AUTO, debug, CTLFLAG_RW, &ukbd_debug, 0, "Debug level"); +SYSCTL_INT(_hw_usb_ukbd, OID_AUTO, no_leds, CTLFLAG_RW, + &ukbd_no_leds, 0, "Disables setting of keyboard leds"); + #endif #define UPROTO_BOOT_KEYBOARD 1 @@ -165,6 +169,7 @@ struct ukbd_softc { #define UKBD_FLAG_APPLE_EJECT 0x0040 #define UKBD_FLAG_APPLE_FN 0x0080 #define UKBD_FLAG_APPLE_SWAP 0x0100 +#define UKBD_FLAG_TIMER_RUNNING 0x0200 int32_t sc_mode; /* input mode (K_XLATE,K_RAW,K_CODE) */ int32_t sc_state; /* shift/lock key state */ @@ -279,6 +284,25 @@ static device_attach_t ukbd_attach; static device_detach_t ukbd_detach; static device_resume_t ukbd_resume; +static uint8_t +ukbd_any_key_pressed(struct ukbd_softc *sc) +{ + uint8_t i; + uint8_t j; + + for (j = i = 0; i < UKBD_NKEYCODE; i++) + j |= sc->sc_odata.keycode[i]; + + return (j ? 1 : 0); +} + +static void +ukbd_start_timer(struct ukbd_softc *sc) +{ + sc->sc_flags |= UKBD_FLAG_TIMER_RUNNING; + usb_callout_reset(&sc->sc_callout, hz / 40, &ukbd_timeout, sc); +} + static void ukbd_put_key(struct ukbd_softc *sc, uint32_t key) { @@ -308,11 +332,15 @@ ukbd_do_poll(struct ukbd_softc *sc, uint usbd_transfer_poll(sc->sc_xfer, UKBD_N_TRANSFER); - DELAY(1000); /* delay 1 ms */ + /* Delay-optimised support for repetition of keys */ - sc->sc_time_ms++; + if (ukbd_any_key_pressed(sc)) { + /* a key is pressed - need timekeeping */ + DELAY(1000); - /* support repetition of keys: */ + /* 1 millisecond has passed */ + sc->sc_time_ms += 1; + } ukbd_interrupt(sc); @@ -470,7 +498,11 @@ ukbd_timeout(void *arg) } ukbd_interrupt(sc); - usb_callout_reset(&sc->sc_callout, hz / 40, &ukbd_timeout, sc); + if (ukbd_any_key_pressed(sc)) { + ukbd_start_timer(sc); + } else { + sc->sc_flags &= ~UKBD_FLAG_TIMER_RUNNING; + } } static uint8_t @@ -582,6 +614,12 @@ ukbd_intr_callback(struct usb_xfer *xfer } ukbd_interrupt(sc); + + if (!(sc->sc_flags & UKBD_FLAG_TIMER_RUNNING)) { + if (ukbd_any_key_pressed(sc)) { + ukbd_start_timer(sc); + } + } } case USB_ST_SETUP: tr_setup: @@ -613,6 +651,11 @@ ukbd_set_leds_callback(struct usb_xfer * uint8_t buf[2]; struct ukbd_softc *sc = usbd_xfer_softc(xfer); +#if USB_DEBUG + if (ukbd_no_leds) + return; +#endif + switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: case USB_ST_SETUP: @@ -647,11 +690,11 @@ ukbd_set_leds_callback(struct usb_xfer * usbd_xfer_set_frames(xfer, 2); usbd_transfer_submit(xfer); } - return; + break; default: /* Error */ DPRINTFN(0, "error=%s\n", usbd_errstr(error)); - return; + break; } } @@ -745,8 +788,6 @@ ukbd_attach(device_t dev) uint16_t n; uint16_t hid_len; - mtx_assert(&Giant, MA_OWNED); - kbd_init_struct(kbd, UKBD_DRIVER_NAME, KB_OTHER, unit, 0, 0, 0); kbd->kb_data = (void *)sc; @@ -831,7 +872,7 @@ ukbd_attach(device_t dev) } /* ignore if SETIDLE fails, hence it is not crucial */ - err = usbd_req_set_idle(sc->sc_udev, &Giant, sc->sc_iface_index, 0, 0); + err = usbd_req_set_idle(sc->sc_udev, NULL, sc->sc_iface_index, 0, 0); ukbd_ioctl(kbd, KDSETLED, (caddr_t)&sc->sc_state); @@ -862,9 +903,6 @@ ukbd_attach(device_t dev) usbd_transfer_start(sc->sc_xfer[UKBD_INTR_DT]); - /* start the timer */ - - ukbd_timeout(sc); mtx_unlock(&Giant); return (0); /* success */ @@ -879,8 +917,6 @@ ukbd_detach(device_t dev) struct ukbd_softc *sc = device_get_softc(dev); int error; - mtx_assert(&Giant, MA_OWNED); - DPRINTF("\n"); if (sc->sc_flags & UKBD_FLAG_POLLING) { @@ -927,8 +963,6 @@ ukbd_resume(device_t dev) { struct ukbd_softc *sc = device_get_softc(dev); - mtx_assert(&Giant, MA_OWNED); - ukbd_clear_state(&sc->sc_kbd); return (0); @@ -945,7 +979,6 @@ ukbd_configure(int flags) static int ukbd__probe(int unit, void *arg, int flags) { - mtx_assert(&Giant, MA_OWNED); return (ENXIO); } @@ -953,7 +986,6 @@ ukbd__probe(int unit, void *arg, int fla static int ukbd_init(int unit, keyboard_t **kbdp, void *arg, int flags) { - mtx_assert(&Giant, MA_OWNED); return (ENXIO); } @@ -961,7 +993,6 @@ ukbd_init(int unit, keyboard_t **kbdp, v static int ukbd_test_if(keyboard_t *kbd) { - mtx_assert(&Giant, MA_OWNED); return (0); } @@ -969,7 +1000,6 @@ ukbd_test_if(keyboard_t *kbd) static int ukbd_term(keyboard_t *kbd) { - mtx_assert(&Giant, MA_OWNED); return (ENXIO); } @@ -977,7 +1007,6 @@ ukbd_term(keyboard_t *kbd) static int ukbd_intr(keyboard_t *kbd, void *arg) { - mtx_assert(&Giant, MA_OWNED); return (0); } @@ -985,7 +1014,6 @@ ukbd_intr(keyboard_t *kbd, void *arg) static int ukbd_lock(keyboard_t *kbd, int lock) { - mtx_assert(&Giant, MA_OWNED); return (1); } @@ -1004,7 +1032,6 @@ ukbd_enable(keyboard_t *kbd) mtx_unlock(&Giant); return (retval); } - mtx_assert(&Giant, MA_OWNED); KBD_ACTIVATE(kbd); return (0); } @@ -1021,7 +1048,6 @@ ukbd_disable(keyboard_t *kbd) mtx_unlock(&Giant); return (retval); } - mtx_assert(&Giant, MA_OWNED); KBD_DEACTIVATE(kbd); return (0); } @@ -1050,7 +1076,6 @@ ukbd_check(keyboard_t *kbd) if (!mtx_owned(&Giant)) return (0); } - mtx_assert(&Giant, MA_OWNED); #ifdef UKBD_EMULATE_ATSCANCODE if (sc->sc_buffered_char[0]) { @@ -1086,7 +1111,6 @@ ukbd_check_char(keyboard_t *kbd) if (!mtx_owned(&Giant)) return (0); } - mtx_assert(&Giant, MA_OWNED); if ((sc->sc_composed_char > 0) && (!(sc->sc_flags & UKBD_FLAG_COMPOSE))) { @@ -1125,7 +1149,6 @@ ukbd_read(keyboard_t *kbd, int wait) if (!mtx_owned(&Giant)) return (-1); } - mtx_assert(&Giant, MA_OWNED); #ifdef UKBD_EMULATE_ATSCANCODE if (sc->sc_buffered_char[0]) { @@ -1190,7 +1213,6 @@ ukbd_read_char(keyboard_t *kbd, int wait if (!mtx_owned(&Giant)) return (NOKEY); } - mtx_assert(&Giant, MA_OWNED); next_code: @@ -1393,7 +1415,6 @@ ukbd_ioctl(keyboard_t *kbd, u_long cmd, */ return (EINVAL); } - mtx_assert(&Giant, MA_OWNED); switch (cmd) { case KDGKBMODE: /* get keyboard mode */ @@ -1527,7 +1548,6 @@ ukbd_clear_state(keyboard_t *kbd) if (!mtx_owned(&Giant)) { return; /* XXX */ } - mtx_assert(&Giant, MA_OWNED); sc->sc_flags &= ~(UKBD_FLAG_COMPOSE | UKBD_FLAG_POLLING); sc->sc_state &= LOCK_MASK; /* preserve locking key state */ @@ -1547,7 +1567,6 @@ ukbd_clear_state(keyboard_t *kbd) static int ukbd_get_state(keyboard_t *kbd, void *buf, size_t len) { - mtx_assert(&Giant, MA_OWNED); return (len == 0) ? 1 : -1; } @@ -1555,7 +1574,6 @@ ukbd_get_state(keyboard_t *kbd, void *bu static int ukbd_set_state(keyboard_t *kbd, void *buf, size_t len) { - mtx_assert(&Giant, MA_OWNED); return (EINVAL); } @@ -1572,7 +1590,6 @@ ukbd_poll(keyboard_t *kbd, int on) mtx_unlock(&Giant); return (retval); } - mtx_assert(&Giant, MA_OWNED); if (on) { sc->sc_flags |= UKBD_FLAG_POLLING; From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 04:59:09 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ACBDB106568C; Mon, 24 Aug 2009 04:59:09 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 828D58FC14; Mon, 24 Aug 2009 04:59:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7O4x9SW082340; Mon, 24 Aug 2009 04:59:09 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7O4x9Ht082337; Mon, 24 Aug 2009 04:59:09 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <200908240459.n7O4x9Ht082337@svn.freebsd.org> From: Alfred Perlstein Date: Mon, 24 Aug 2009 04:59:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196490 - in head/sys/dev/usb: misc storage X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 04:59:09 -0000 Author: alfred Date: Mon Aug 24 04:59:09 2009 New Revision: 196490 URL: http://svn.freebsd.org/changeset/base/196490 Log: - FIFO's are always opened separately in read and write direction even if the actual device is opened for read and write. Fix fflags check so that the UFM and URIO drivers work. Reported by: Krassimir Slavchev Submitted by: hps Modified: head/sys/dev/usb/misc/ufm.c head/sys/dev/usb/storage/urio.c Modified: head/sys/dev/usb/misc/ufm.c ============================================================================== --- head/sys/dev/usb/misc/ufm.c Mon Aug 24 04:58:42 2009 (r196489) +++ head/sys/dev/usb/misc/ufm.c Mon Aug 24 04:59:09 2009 (r196490) @@ -86,11 +86,9 @@ static device_attach_t ufm_attach; static device_detach_t ufm_detach; static usb_fifo_ioctl_t ufm_ioctl; -static usb_fifo_open_t ufm_open; static struct usb_fifo_methods ufm_fifo_methods = { .f_ioctl = &ufm_ioctl, - .f_open = &ufm_open, .basename[0] = "ufm", }; @@ -179,15 +177,6 @@ ufm_detach(device_t dev) } static int -ufm_open(struct usb_fifo *dev, int fflags) -{ - if ((fflags & (FWRITE | FREAD)) != (FWRITE | FREAD)) { - return (EACCES); - } - return (0); -} - -static int ufm_do_req(struct ufm_softc *sc, uint8_t request, uint16_t value, uint16_t index, uint8_t *retbuf) { @@ -315,6 +304,10 @@ ufm_ioctl(struct usb_fifo *fifo, u_long struct ufm_softc *sc = usb_fifo_softc(fifo); int error = 0; + if ((fflags & (FWRITE | FREAD)) != (FWRITE | FREAD)) { + return (EACCES); + } + switch (cmd) { case FM_SET_FREQ: error = ufm_set_freq(sc, addr); Modified: head/sys/dev/usb/storage/urio.c ============================================================================== --- head/sys/dev/usb/storage/urio.c Mon Aug 24 04:58:42 2009 (r196489) +++ head/sys/dev/usb/storage/urio.c Mon Aug 24 04:59:09 2009 (r196490) @@ -390,9 +390,6 @@ urio_open(struct usb_fifo *fifo, int ffl { struct urio_softc *sc = usb_fifo_softc(fifo); - if ((fflags & (FWRITE | FREAD)) != (FWRITE | FREAD)) { - return (EACCES); - } if (fflags & FREAD) { /* clear stall first */ mtx_lock(&sc->sc_mtx); From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 05:00:08 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE63510656BE; Mon, 24 Aug 2009 05:00:08 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC6C68FC27; Mon, 24 Aug 2009 05:00:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7O507TD082422; Mon, 24 Aug 2009 05:00:07 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7O507h0082420; Mon, 24 Aug 2009 05:00:07 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <200908240500.n7O507h0082420@svn.freebsd.org> From: Alfred Perlstein Date: Mon, 24 Aug 2009 05:00:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196491 - head/sys/dev/usb/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 05:00:09 -0000 Author: alfred Date: Mon Aug 24 05:00:07 2009 New Revision: 196491 URL: http://svn.freebsd.org/changeset/base/196491 Log: We used force all of the GPIO pins low first and then enable the ones we want. This has been changed to better match the ADMtek's reference design to avoid setting the power-down configuration line of the PHY at the same time it is reset. Submitted by: John Hood via hps Modified: head/sys/dev/usb/net/if_aue.c Modified: head/sys/dev/usb/net/if_aue.c ============================================================================== --- head/sys/dev/usb/net/if_aue.c Mon Aug 24 04:59:09 2009 (r196490) +++ head/sys/dev/usb/net/if_aue.c Mon Aug 24 05:00:07 2009 (r196491) @@ -484,7 +484,7 @@ aue_miibus_writereg(device_t dev, int ph } if (i == AUE_TIMEOUT) - device_printf(sc->sc_ue.ue_dev, "MII read timed out\n"); + device_printf(sc->sc_ue.ue_dev, "MII write timed out\n"); if (!locked) AUE_UNLOCK(sc); @@ -603,11 +603,14 @@ aue_reset(struct aue_softc *sc) * to set the GPIO pins high so that the PHY(s) will * be enabled. * - * Note: We force all of the GPIO pins low first, *then* - * enable the ones we want. + * NOTE: We used to force all of the GPIO pins low first and then + * enable the ones we want. This has been changed to better + * match the ADMtek's reference design to avoid setting the + * power-down configuration line of the PHY at the same time + * it is reset. */ - aue_csr_write_1(sc, AUE_GPIO0, AUE_GPIO_OUT0|AUE_GPIO_SEL0); - aue_csr_write_1(sc, AUE_GPIO0, AUE_GPIO_OUT0|AUE_GPIO_SEL0|AUE_GPIO_SEL1); + aue_csr_write_1(sc, AUE_GPIO0, AUE_GPIO_SEL0|AUE_GPIO_SEL1); + aue_csr_write_1(sc, AUE_GPIO0, AUE_GPIO_SEL0|AUE_GPIO_SEL1|AUE_GPIO_OUT0); if (sc->sc_flags & AUE_FLAG_LSYS) { /* Grrr. LinkSys has to be different from everyone else. */ From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 05:00:33 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A743C1065692; Mon, 24 Aug 2009 05:00:33 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 967528FC1B; Mon, 24 Aug 2009 05:00:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7O50XBb082472; Mon, 24 Aug 2009 05:00:33 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7O50XZA082470; Mon, 24 Aug 2009 05:00:33 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <200908240500.n7O50XZA082470@svn.freebsd.org> From: Alfred Perlstein Date: Mon, 24 Aug 2009 05:00:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196492 - head/sys/dev/usb/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 05:00:33 -0000 Author: alfred Date: Mon Aug 24 05:00:33 2009 New Revision: 196492 URL: http://svn.freebsd.org/changeset/base/196492 Log: - fix CDC ethernet matching order so that the match flags get correct. Reported by: Juergen Lock Submitted by: hps Modified: head/sys/dev/usb/net/if_cdce.c Modified: head/sys/dev/usb/net/if_cdce.c ============================================================================== --- head/sys/dev/usb/net/if_cdce.c Mon Aug 24 05:00:07 2009 (r196491) +++ head/sys/dev/usb/net/if_cdce.c Mon Aug 24 05:00:33 2009 (r196492) @@ -197,9 +197,6 @@ static const struct usb_ether_methods cd }; static const struct usb_device_id cdce_devs[] = { - {USB_IF_CSI(UICLASS_CDC, UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL, 0)}, - {USB_IF_CSI(UICLASS_CDC, UISUBCLASS_MOBILE_DIRECT_LINE_MODEL, 0)}, - {USB_VPI(USB_VENDOR_ACERLABS, USB_PRODUCT_ACERLABS_M5632, CDCE_FLAG_NO_UNION)}, {USB_VPI(USB_VENDOR_AMBIT, USB_PRODUCT_AMBIT_NTL_250, CDCE_FLAG_NO_UNION)}, {USB_VPI(USB_VENDOR_COMPAQ, USB_PRODUCT_COMPAQ_IPAQLINUX, CDCE_FLAG_NO_UNION)}, @@ -213,6 +210,9 @@ static const struct usb_device_id cdce_d {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLA300, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLC700, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLC750, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, + + {USB_IF_CSI(UICLASS_CDC, UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL, 0)}, + {USB_IF_CSI(UICLASS_CDC, UISUBCLASS_MOBILE_DIRECT_LINE_MODEL, 0)}, }; static int From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 05:01:06 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61E05106568B; Mon, 24 Aug 2009 05:01:06 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 511C98FC08; Mon, 24 Aug 2009 05:01:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7O516wM082527; Mon, 24 Aug 2009 05:01:06 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7O516sV082524; Mon, 24 Aug 2009 05:01:06 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <200908240501.n7O516sV082524@svn.freebsd.org> From: Alfred Perlstein Date: Mon, 24 Aug 2009 05:01:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196493 - in head/sys/dev/usb: . serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 05:01:06 -0000 Author: alfred Date: Mon Aug 24 05:01:06 2009 New Revision: 196493 URL: http://svn.freebsd.org/changeset/base/196493 Log: - Fix false positive uipaq probe Reported by: Alexander Motin Submitted by: hps Modified: head/sys/dev/usb/serial/uipaq.c head/sys/dev/usb/usb.h Modified: head/sys/dev/usb/serial/uipaq.c ============================================================================== --- head/sys/dev/usb/serial/uipaq.c Mon Aug 24 05:00:33 2009 (r196492) +++ head/sys/dev/usb/serial/uipaq.c Mon Aug 24 05:01:06 2009 (r196493) @@ -1103,6 +1103,10 @@ uipaq_probe(device_t dev) if (uaa->info.bIfaceIndex != UIPAQ_IFACE_INDEX) { return (ENXIO); } + if (uaa->info.bInterfaceClass == UICLASS_IAD) { + DPRINTF("IAD detected - not UIPAQ serial device\n"); + return (ENXIO); + } return (usbd_lookup_id_by_uaa(uipaq_devs, sizeof(uipaq_devs), uaa)); } Modified: head/sys/dev/usb/usb.h ============================================================================== --- head/sys/dev/usb/usb.h Mon Aug 24 05:00:33 2009 (r196492) +++ head/sys/dev/usb/usb.h Mon Aug 24 05:01:06 2009 (r196493) @@ -484,6 +484,8 @@ typedef struct usb_interface_assoc_descr #define UISUBCLASS_RF 0x01 #define UIPROTO_BLUETOOTH 0x01 +#define UICLASS_IAD 0xEF /* Interface Association Descriptor */ + #define UICLASS_APPL_SPEC 0xfe #define UISUBCLASS_FIRMWARE_DOWNLOAD 1 #define UISUBCLASS_IRDA 2 From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 05:01:41 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB58E1065672; Mon, 24 Aug 2009 05:01:40 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA4148FC16; Mon, 24 Aug 2009 05:01:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7O51exA082573; Mon, 24 Aug 2009 05:01:40 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7O51e3W082571; Mon, 24 Aug 2009 05:01:40 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <200908240501.n7O51e3W082571@svn.freebsd.org> From: Alfred Perlstein Date: Mon, 24 Aug 2009 05:01:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196494 - head/sys/dev/usb/serial X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 05:01:41 -0000 Author: alfred Date: Mon Aug 24 05:01:40 2009 New Revision: 196494 URL: http://svn.freebsd.org/changeset/base/196494 Log: - fix uvisor support, mostly correct buffer sizes used. - correct device info flag for SONY Cli NR70V Reported by: Marc Fonvieille Submitted by: hps Modified: head/sys/dev/usb/serial/uvisor.c Modified: head/sys/dev/usb/serial/uvisor.c ============================================================================== --- head/sys/dev/usb/serial/uvisor.c Mon Aug 24 05:01:06 2009 (r196493) +++ head/sys/dev/usb/serial/uvisor.c Mon Aug 24 05:01:40 2009 (r196494) @@ -95,7 +95,15 @@ SYSCTL_INT(_hw_usb_uvisor, OID_AUTO, deb #define UVISOR_CONFIG_INDEX 0 #define UVISOR_IFACE_INDEX 0 -#define UVISOR_BUFSIZE 1024 /* bytes */ + +/* + * The following buffer sizes are hardcoded due to the way the Palm + * firmware works. It looks like the device is not short terminating + * the data transferred. + */ +#define UVISORIBUFSIZE 0 /* Use wMaxPacketSize */ +#define UVISOROBUFSIZE 32 /* bytes */ +#define UVISOROFRAMES 32 /* units */ /* From the Linux driver */ /* @@ -208,7 +216,8 @@ static const struct usb_config uvisor_co .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, - .bufsize = UVISOR_BUFSIZE, /* bytes */ + .bufsize = UVISOROBUFSIZE * UVISOROFRAMES, + .frames = UVISOROFRAMES, .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, .callback = &uvisor_write_callback, }, @@ -217,7 +226,7 @@ static const struct usb_config uvisor_co .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, - .bufsize = UVISOR_BUFSIZE, /* bytes */ + .bufsize = UVISORIBUFSIZE, .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, .callback = &uvisor_read_callback, }, @@ -270,7 +279,7 @@ static const struct usb_device_id uvisor {USB_VPI(USB_VENDOR_PALM, USB_PRODUCT_PALM_ZIRE31, UVISOR_FLAG_PALM4)}, {USB_VPI(USB_VENDOR_SAMSUNG, USB_PRODUCT_SAMSUNG_I500, UVISOR_FLAG_PALM4)}, {USB_VPI(USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_40, 0)}, - {USB_VPI(USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_41, UVISOR_FLAG_PALM4)}, + {USB_VPI(USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_41, 0)}, {USB_VPI(USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_S360, UVISOR_FLAG_PALM4)}, {USB_VPI(USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_NX60, UVISOR_FLAG_PALM4)}, {USB_VPI(USB_VENDOR_SONY, USB_PRODUCT_SONY_CLIE_35, UVISOR_FLAG_PALM35)}, @@ -375,7 +384,6 @@ uvisor_init(struct uvisor_softc *sc, str struct uvisor_connection_info coninfo; struct uvisor_palm_connection_info pconinfo; uint16_t actlen; - uWord wAvail; uint8_t buffer[256]; if (sc->sc_flag & UVISOR_FLAG_VISOR) { @@ -496,6 +504,9 @@ uvisor_init(struct uvisor_softc *sc, str goto done; } } +#if 0 + uWord wAvail; + DPRINTF("getting available bytes\n"); req.bmRequestType = UT_READ_VENDOR_ENDPOINT; req.bRequest = UVISOR_REQUEST_BYTES_AVAILABLE; @@ -507,6 +518,7 @@ uvisor_init(struct uvisor_softc *sc, str goto done; } DPRINTF("avail=%d\n", UGETW(wAvail)); +#endif DPRINTF("done\n"); done: @@ -579,19 +591,31 @@ uvisor_write_callback(struct usb_xfer *x struct uvisor_softc *sc = usbd_xfer_softc(xfer); struct usb_page_cache *pc; uint32_t actlen; + uint8_t x; switch (USB_GET_STATE(xfer)) { case USB_ST_SETUP: case USB_ST_TRANSFERRED: tr_setup: - pc = usbd_xfer_get_frame(xfer, 0); - if (ucom_get_data(&sc->sc_ucom, pc, 0, - UVISOR_BUFSIZE, &actlen)) { + for (x = 0; x != UVISOROFRAMES; x++) { + + usbd_xfer_set_frame_offset(xfer, + x * UVISOROBUFSIZE, x); - usbd_xfer_set_frame_len(xfer, 0, actlen); + pc = usbd_xfer_get_frame(xfer, x); + if (ucom_get_data(&sc->sc_ucom, pc, 0, + UVISOROBUFSIZE, &actlen)) { + usbd_xfer_set_frame_len(xfer, x, actlen); + } else { + break; + } + } + /* check for data */ + if (x != 0) { + usbd_xfer_set_frames(xfer, x); usbd_transfer_submit(xfer); } - return; + break; default: /* Error */ if (error != USB_ERR_CANCELLED) { @@ -599,7 +623,7 @@ tr_setup: usbd_xfer_set_stall(xfer); goto tr_setup; } - return; + break; } } From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 05:02:36 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E870C106568C; Mon, 24 Aug 2009 05:02:36 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D75AC8FC13; Mon, 24 Aug 2009 05:02:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7O52a6s082633; Mon, 24 Aug 2009 05:02:36 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7O52ara082630; Mon, 24 Aug 2009 05:02:36 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <200908240502.n7O52ara082630@svn.freebsd.org> From: Alfred Perlstein Date: Mon, 24 Aug 2009 05:02:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196495 - in head/sys/dev/usb: . storage X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 05:02:37 -0000 Author: alfred Date: Mon Aug 24 05:02:36 2009 New Revision: 196495 URL: http://svn.freebsd.org/changeset/base/196495 Log: Add mass storage quirks. PR: usb/137138,usb/137226,usb/137789,usb/135372 Submitted by: hps Modified: head/sys/dev/usb/storage/umass.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/storage/umass.c ============================================================================== --- head/sys/dev/usb/storage/umass.c Mon Aug 24 05:01:40 2009 (r196494) +++ head/sys/dev/usb/storage/umass.c Mon Aug 24 05:02:36 2009 (r196495) @@ -412,6 +412,10 @@ static const struct umass_devdescr umass UMASS_PROTO_DEFAULT, NO_SYNCHRONIZE_CACHE }, + {USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_SDCR_6335, RID_WILDCARD, + UMASS_PROTO_DEFAULT, + NO_TEST_UNIT_READY | NO_SYNCHRONIZE_CACHE + }, {USB_VENDOR_ALCOR, USB_PRODUCT_ALCOR_AU6390, RID_WILDCARD, UMASS_PROTO_DEFAULT, NO_SYNCHRONIZE_CACHE @@ -733,6 +737,10 @@ static const struct umass_devdescr umass UMASS_PROTO_UFI, NO_QUIRKS }, + { USB_VENDOR_PHILIPS, USB_PRODUCT_PHILIPS_SPE3030CC, RID_WILDCARD, + UMASS_PROTO_DEFAULT, + NO_SYNCHRONIZE_CACHE + }, {USB_VENDOR_PLEXTOR, USB_PRODUCT_PLEXTOR_40_12_40U, RID_WILDCARD, UMASS_PROTO_SCSI | UMASS_PROTO_BBB, NO_TEST_UNIT_READY @@ -893,6 +901,10 @@ static const struct umass_devdescr umass UMASS_PROTO_UFI | UMASS_PROTO_CBI, NO_QUIRKS }, + {USB_VENDOR_TECLAST, USB_PRODUCT_TECLAST_TLC300, RID_WILDCARD, + UMASS_PROTO_DEFAULT, + NO_TEST_UNIT_READY | NO_SYNCHRONIZE_CACHE + }, {USB_VENDOR_TREK, USB_PRODUCT_TREK_MEMKEY, RID_WILDCARD, UMASS_PROTO_SCSI | UMASS_PROTO_BBB, NO_INQUIRY @@ -965,6 +977,10 @@ static const struct umass_devdescr umass UMASS_PROTO_SCSI | UMASS_PROTO_BBB, NO_SYNCHRONIZE_CACHE }, + {USB_VENDOR_ASUS, USB_PRODUCT_ASUS_GMSC, RID_WILDCARD, + UMASS_PROTO_DEFAULT, + NO_SYNCHRONIZE_CACHE + }, {VID_EOT, PID_EOT, RID_EOT, 0, 0} }; Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Mon Aug 24 05:01:40 2009 (r196494) +++ head/sys/dev/usb/usbdevs Mon Aug 24 05:02:36 2009 (r196495) @@ -360,6 +360,7 @@ vendor SMC 0x0707 Standard Microsystems vendor PUTERCOM 0x0708 Putercom vendor MCT 0x0711 MCT vendor IMATION 0x0718 Imation +vendor TECLAST 0x071b Teclast vendor SONYERICSSON 0x0731 Sony Ericsson vendor EICON 0x0734 Eicon Networks vendor SYNTECH 0x0745 Syntech Information @@ -585,6 +586,7 @@ vendor NETGEAR3 0x1385 Netgear vendor BALTECH 0x13ad Baltech vendor CISCOLINKSYS 0x13b1 Cisco-Linksys vendor SHARK 0x13d2 Shark +vendor EMTEC 0x13fe Emtec vendor NOVATEL 0x1410 Novatel Wireless vendor MERLIN 0x1416 Merlin vendor WISTRONNEWEB 0x1435 Wistron NeWeb @@ -820,6 +822,7 @@ product AKS USBHASP 0x0001 USB-HASP 0.0 /* Alcor Micro, Inc. products */ product ALCOR2 KBD_HUB 0x2802 Kbd Hub +product ALCOR SDCR_6335 0x6335 SD/MMC Card Reader product ALCOR TRANSCEND 0x6387 Transcend JetFlash Drive product ALCOR MA_KBD_HUB 0x9213 MacAlly Kbd Hub product ALCOR AU9814 0x9215 AU9814 Hub @@ -861,6 +864,12 @@ product APC UPS 0x0002 Uninterruptible /* Apple Computer products */ product APPLE EXT_KBD 0x020c Apple Extended USB Keyboard +product APPLE KBD_TP_ANSI 0x0223 Apple Internal Keyboard/Trackpad (Wellspring/ANSI) +product APPLE KBD_TP_ISO 0x0224 Apple Internal Keyboard/Trackpad (Wellspring/ISO) +product APPLE KBD_TP_JIS 0x0225 Apple Internal Keyboard/Trackpad (Wellspring/JIS) +product APPLE KBD_TP_ANSI2 0x0230 Apple Internal Keyboard/Trackpad (Wellspring2/ANSI) +product APPLE KBD_TP_ISO2 0x0231 Apple Internal Keyboard/Trackpad (Wellspring2/ISO) +product APPLE KBD_TP_JIS2 0x0232 Apple Internal Keyboard/Trackpad (Wellspring2/JIS) product APPLE OPTMOUSE 0x0302 Optical mouse product APPLE MIGHTYMOUSE 0x0304 Mighty Mouse product APPLE EXT_KBD_HUB 0x1003 Hub in Apple Extended USB Keyboard @@ -902,6 +911,7 @@ product ASUS RT2573_1 0x1723 RT2573 product ASUS RT2573_2 0x1724 RT2573 product ASUS LCM 0x1726 LCM display product ASUS P535 0x420f ASUS P535 PDA +product ASUS GMSC 0x422f ASUS Generic Mass Storage /* ATen products */ product ATEN UC1284 0x2001 Parallel printer @@ -1971,6 +1981,7 @@ product PHILIPS HUB 0x0201 hub product PHILIPS PCA646VC 0x0303 PCA646VC PC Camera product PHILIPS PCVC680K 0x0308 PCVC680K Vesta Pro PC Camera product PHILIPS DSS150 0x0471 DSS 150 Digital Speaker System +product PHILIPS SPE3030CC 0x083a USB 2.0 External Disk product PHILIPS SNU5600 0x1236 SNU5600 product PHILIPS UM10016 0x1552 ISP 1581 Hi-Speed USB MPEG2 Encoder Reference Kit product PHILIPS DIVAUSB 0x1801 DIVA USB mp3 player @@ -2345,6 +2356,9 @@ product SUN KBD_HUB 0x100e Kbd Hub /* Super Top products */ product SUPERTOP IDE 0x6600 USB-IDE +/* Teclast products */ +product TECLAST TLC300 0x3203 USB Media Player + /* Supra products */ product DIAMOND2 SUPRAEXPRESS56K 0x07da Supra Express 56K modem product DIAMOND2 SUPRA2890 0x0b4a SupraMax 2890 56K Modem From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 05:03:31 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43DBA106568C; Mon, 24 Aug 2009 05:03:31 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3375D8FC20; Mon, 24 Aug 2009 05:03:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7O53V7A082686; Mon, 24 Aug 2009 05:03:31 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7O53VCd082684; Mon, 24 Aug 2009 05:03:31 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <200908240503.n7O53VCd082684@svn.freebsd.org> From: Alfred Perlstein Date: Mon, 24 Aug 2009 05:03:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196496 - head/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 05:03:31 -0000 Author: alfred Date: Mon Aug 24 05:03:30 2009 New Revision: 196496 URL: http://svn.freebsd.org/changeset/base/196496 Log: Add a reminder comment to optimize bus_dmamap_sync calls. Submitted by: hps Modified: head/sys/dev/usb/usb_busdma.c Modified: head/sys/dev/usb/usb_busdma.c ============================================================================== --- head/sys/dev/usb/usb_busdma.c Mon Aug 24 05:02:36 2009 (r196495) +++ head/sys/dev/usb/usb_busdma.c Mon Aug 24 05:03:30 2009 (r196496) @@ -679,6 +679,12 @@ usb_pc_cpu_invalidate(struct usb_page_ca /* nothing has been loaded into this page cache! */ return; } + + /* + * TODO: We currently do XXX_POSTREAD and XXX_PREREAD at the + * same time, but in the future we should try to isolate the + * different cases to optimise the code. --HPS + */ bus_dmamap_sync(pc->tag, pc->map, BUS_DMASYNC_POSTREAD); bus_dmamap_sync(pc->tag, pc->map, BUS_DMASYNC_PREREAD); } From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 05:03:59 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6FEC1065691; Mon, 24 Aug 2009 05:03:59 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A662F8FC19; Mon, 24 Aug 2009 05:03:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7O53xrn082729; Mon, 24 Aug 2009 05:03:59 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7O53xQ3082727; Mon, 24 Aug 2009 05:03:59 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <200908240503.n7O53xQ3082727@svn.freebsd.org> From: Alfred Perlstein Date: Mon, 24 Aug 2009 05:03:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196497 - head/sys/dev/usb/wlan X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 05:03:59 -0000 Author: alfred Date: Mon Aug 24 05:03:59 2009 New Revision: 196497 URL: http://svn.freebsd.org/changeset/base/196497 Log: Remove redundant locking. Submitted by: hps Modified: head/sys/dev/usb/wlan/if_upgt.c Modified: head/sys/dev/usb/wlan/if_upgt.c ============================================================================== --- head/sys/dev/usb/wlan/if_upgt.c Mon Aug 24 05:03:30 2009 (r196496) +++ head/sys/dev/usb/wlan/if_upgt.c Mon Aug 24 05:03:59 2009 (r196497) @@ -465,7 +465,6 @@ upgt_ioctl(struct ifnet *ifp, u_long cmd switch (cmd) { case SIOCSIFFLAGS: - mtx_lock(&Giant); if (ifp->if_flags & IFF_UP) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) { if ((ifp->if_flags ^ sc->sc_if_flags) & @@ -482,7 +481,6 @@ upgt_ioctl(struct ifnet *ifp, u_long cmd sc->sc_if_flags = ifp->if_flags; if (startall) ieee80211_start_all(ic); - mtx_unlock(&Giant); break; case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &ic->ic_media, cmd); From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 05:05:38 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A34A2106568B; Mon, 24 Aug 2009 05:05:38 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 91D328FC13; Mon, 24 Aug 2009 05:05:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7O55cda082813; Mon, 24 Aug 2009 05:05:38 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7O55cOB082804; Mon, 24 Aug 2009 05:05:38 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <200908240505.n7O55cOB082804@svn.freebsd.org> From: Alfred Perlstein Date: Mon, 24 Aug 2009 05:05:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196498 - head/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 05:05:38 -0000 Author: alfred Date: Mon Aug 24 05:05:38 2009 New Revision: 196498 URL: http://svn.freebsd.org/changeset/base/196498 Log: - Patch to allow USB controller to resume operation after being polled. - Remove the need for Giant from the USB HUB driver. - Leave device unconfigured instead of disabling the USB port when Huawei Autoinstall disk detection triggers. This should fix problems that the Huawei device is not detected after Autoinstall eject is issued. - Reported by: Nikolay Antsiferov - Fix memory use after free race for USB character devices. - Reported by: Lucius Windschuh - Factor out the enumeration lock into three functions to make the coming newbus lock conversion more easy. - usbd_enum_lock - usbd_enum_unlock - usbd_enum_is_locked Submitted by: hps Modified: head/sys/dev/usb/usb_dev.c head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_device.h head/sys/dev/usb/usb_handle_request.c head/sys/dev/usb/usb_hub.c head/sys/dev/usb/usb_process.c head/sys/dev/usb/usb_process.h head/sys/dev/usb/usb_transfer.c Modified: head/sys/dev/usb/usb_dev.c ============================================================================== --- head/sys/dev/usb/usb_dev.c Mon Aug 24 05:03:59 2009 (r196497) +++ head/sys/dev/usb/usb_dev.c Mon Aug 24 05:05:38 2009 (r196498) @@ -217,7 +217,7 @@ usb_ref_device(struct usb_cdev_privdata * We need to grab the sx-lock before grabbing the * FIFO refs to avoid deadlock at detach! */ - sx_xlock(cpd->udev->default_sx + 1); + usbd_enum_lock(cpd->udev); mtx_lock(&usb_ref_lock); @@ -275,14 +275,12 @@ usb_ref_device(struct usb_cdev_privdata } mtx_unlock(&usb_ref_lock); - if (crd->is_uref) { - mtx_lock(&Giant); /* XXX */ - } return (0); error: if (crd->is_uref) { - sx_unlock(cpd->udev->default_sx + 1); + usbd_enum_unlock(cpd->udev); + if (--(cpd->udev->refcount) == 0) { cv_signal(cpd->udev->default_cv + 1); } @@ -334,10 +332,9 @@ usb_unref_device(struct usb_cdev_privdat DPRINTFN(2, "cpd=%p is_uref=%d\n", cpd, crd->is_uref); - if (crd->is_uref) { - mtx_unlock(&Giant); /* XXX */ - sx_unlock(cpd->udev->default_sx + 1); - } + if (crd->is_uref) + usbd_enum_unlock(cpd->udev); + mtx_lock(&usb_ref_lock); if (crd->is_read) { if (--(crd->rxfifo->refcount) == 0) { @@ -1042,9 +1039,9 @@ usb_ioctl(struct cdev *dev, u_long cmd, * reference if we need it! */ err = usb_ref_device(cpd, &refs, 0 /* no uref */ ); - if (err) { + if (err) return (ENXIO); - } + fflags = cpd->fflags; f = NULL; /* set default value */ Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Mon Aug 24 05:03:59 2009 (r196497) +++ head/sys/dev/usb/usb_device.c Mon Aug 24 05:05:38 2009 (r196498) @@ -402,11 +402,11 @@ usb_unconfigure(struct usb_device *udev, uint8_t do_unlock; /* automatic locking */ - if (sx_xlocked(udev->default_sx + 1)) { + if (usbd_enum_is_locked(udev)) { do_unlock = 0; } else { do_unlock = 1; - sx_xlock(udev->default_sx + 1); + usbd_enum_lock(udev); } /* detach all interface drivers */ @@ -442,9 +442,8 @@ usb_unconfigure(struct usb_device *udev, udev->curr_config_no = USB_UNCONFIG_NO; udev->curr_config_index = USB_UNCONFIG_INDEX; - if (do_unlock) { - sx_unlock(udev->default_sx + 1); - } + if (do_unlock) + usbd_enum_unlock(udev); } /*------------------------------------------------------------------------* @@ -472,11 +471,11 @@ usbd_set_config_index(struct usb_device DPRINTFN(6, "udev=%p index=%d\n", udev, index); /* automatic locking */ - if (sx_xlocked(udev->default_sx + 1)) { + if (usbd_enum_is_locked(udev)) { do_unlock = 0; } else { do_unlock = 1; - sx_xlock(udev->default_sx + 1); + usbd_enum_lock(udev); } usb_unconfigure(udev, USB_UNCFG_FLAG_FREE_SUBDEV); @@ -585,9 +584,8 @@ done: if (err) { usb_unconfigure(udev, USB_UNCFG_FLAG_FREE_SUBDEV); } - if (do_unlock) { - sx_unlock(udev->default_sx + 1); - } + if (do_unlock) + usbd_enum_unlock(udev); return (err); } @@ -823,11 +821,11 @@ usbd_set_alt_interface_index(struct usb_ uint8_t do_unlock; /* automatic locking */ - if (sx_xlocked(udev->default_sx + 1)) { + if (usbd_enum_is_locked(udev)) { do_unlock = 0; } else { do_unlock = 1; - sx_xlock(udev->default_sx + 1); + usbd_enum_lock(udev); } if (iface == NULL) { err = USB_ERR_INVAL; @@ -863,9 +861,9 @@ usbd_set_alt_interface_index(struct usb_ iface->idesc->bAlternateSetting); done: - if (do_unlock) { - sx_unlock(udev->default_sx + 1); - } + if (do_unlock) + usbd_enum_unlock(udev); + return (err); } @@ -1230,11 +1228,11 @@ usb_probe_and_attach(struct usb_device * return (USB_ERR_INVAL); } /* automatic locking */ - if (sx_xlocked(udev->default_sx + 1)) { + if (usbd_enum_is_locked(udev)) { do_unlock = 0; } else { do_unlock = 1; - sx_xlock(udev->default_sx + 1); + usbd_enum_lock(udev); } if (udev->curr_config_index == USB_UNCONFIG_INDEX) { @@ -1315,9 +1313,9 @@ usb_probe_and_attach(struct usb_device * } } done: - if (do_unlock) { - sx_unlock(udev->default_sx + 1); - } + if (do_unlock) + usbd_enum_unlock(udev); + return (0); } @@ -1779,7 +1777,8 @@ repeat_set_config: } } else if (usb_test_huawei_autoinst_p(udev, &uaa) == 0) { DPRINTFN(0, "Found Huawei auto-install disk!\n"); - err = USB_ERR_STALLED; /* fake an error */ + /* leave device unconfigured */ + usb_unconfigure(udev, USB_UNCFG_FLAG_FREE_SUBDEV); } } else { err = 0; /* set success */ @@ -1902,15 +1901,18 @@ static void usb_cdev_free(struct usb_device *udev) { struct usb_fs_privdata* pd; + struct cdev* pcdev; DPRINTFN(2, "Freeing device nodes\n"); while ((pd = LIST_FIRST(&udev->pd_list)) != NULL) { KASSERT(pd->cdev->si_drv1 == pd, ("privdata corrupt")); - destroy_dev_sched_cb(pd->cdev, usb_cdev_cleanup, pd); + pcdev = pd->cdev; pd->cdev = NULL; LIST_REMOVE(pd, pd_next); + if (pcdev != NULL) + destroy_dev_sched_cb(pcdev, usb_cdev_cleanup, pd); } } @@ -2448,3 +2450,37 @@ usbd_device_attached(struct usb_device * { return (udev->state > USB_STATE_DETACHED); } + +/* The following function locks enumerating the given USB device. */ + +void +usbd_enum_lock(struct usb_device *udev) +{ + sx_xlock(udev->default_sx + 1); + /* + * NEWBUS LOCK NOTE: We should check if any parent SX locks + * are locked before locking Giant. Else the lock can be + * locked multiple times. + */ + mtx_lock(&Giant); +} + +/* The following function unlocks enumerating the given USB device. */ + +void +usbd_enum_unlock(struct usb_device *udev) +{ + mtx_unlock(&Giant); + sx_xunlock(udev->default_sx + 1); +} + +/* + * The following function checks the enumerating lock for the given + * USB device. + */ + +uint8_t +usbd_enum_is_locked(struct usb_device *udev) +{ + return (sx_xlocked(udev->default_sx + 1)); +} Modified: head/sys/dev/usb/usb_device.h ============================================================================== --- head/sys/dev/usb/usb_device.h Mon Aug 24 05:03:59 2009 (r196497) +++ head/sys/dev/usb/usb_device.h Mon Aug 24 05:05:38 2009 (r196498) @@ -211,5 +211,8 @@ uint8_t usb_peer_can_wakeup(struct usb_d struct usb_endpoint *usb_endpoint_foreach(struct usb_device *udev, struct usb_endpoint *ep); void usb_set_device_state(struct usb_device *udev, enum usb_dev_state state); +void usbd_enum_lock(struct usb_device *); +void usbd_enum_unlock(struct usb_device *); +uint8_t usbd_enum_is_locked(struct usb_device *); #endif /* _USB_DEVICE_H_ */ Modified: head/sys/dev/usb/usb_handle_request.c ============================================================================== --- head/sys/dev/usb/usb_handle_request.c Mon Aug 24 05:03:59 2009 (r196497) +++ head/sys/dev/usb/usb_handle_request.c Mon Aug 24 05:05:38 2009 (r196498) @@ -152,8 +152,8 @@ usb_handle_set_config(struct usb_xfer *x * attach: */ USB_XFER_UNLOCK(xfer); - mtx_lock(&Giant); /* XXX */ - sx_xlock(udev->default_sx + 1); + + usbd_enum_lock(udev); if (conf_no == USB_UNCONFIG_NO) { conf_no = USB_UNCONFIG_INDEX; @@ -176,8 +176,7 @@ usb_handle_set_config(struct usb_xfer *x goto done; } done: - mtx_unlock(&Giant); /* XXX */ - sx_unlock(udev->default_sx + 1); + usbd_enum_unlock(udev); USB_XFER_LOCK(xfer); return (err); } @@ -190,19 +189,19 @@ usb_check_alt_setting(struct usb_device usb_error_t err = 0; /* automatic locking */ - if (sx_xlocked(udev->default_sx + 1)) { + if (usbd_enum_is_locked(udev)) { do_unlock = 0; } else { do_unlock = 1; - sx_xlock(udev->default_sx + 1); + usbd_enum_lock(udev); } if (alt_index >= usbd_get_no_alts(udev->cdesc, iface->idesc)) err = USB_ERR_INVAL; - if (do_unlock) { - sx_unlock(udev->default_sx + 1); - } + if (do_unlock) + usbd_enum_unlock(udev); + return (err); } @@ -236,8 +235,8 @@ usb_handle_iface_request(struct usb_xfer * attach: */ USB_XFER_UNLOCK(xfer); - mtx_lock(&Giant); /* XXX */ - sx_xlock(udev->default_sx + 1); + + usbd_enum_lock(udev); error = ENXIO; @@ -353,20 +352,17 @@ tr_repeat: goto tr_stalled; } tr_valid: - mtx_unlock(&Giant); - sx_unlock(udev->default_sx + 1); + usbd_enum_unlock(udev); USB_XFER_LOCK(xfer); return (0); tr_short: - mtx_unlock(&Giant); - sx_unlock(udev->default_sx + 1); + usbd_enum_unlock(udev); USB_XFER_LOCK(xfer); return (USB_ERR_SHORT_XFER); tr_stalled: - mtx_unlock(&Giant); - sx_unlock(udev->default_sx + 1); + usbd_enum_unlock(udev); USB_XFER_LOCK(xfer); return (USB_ERR_STALLED); } Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Mon Aug 24 05:03:59 2009 (r196497) +++ head/sys/dev/usb/usb_hub.c Mon Aug 24 05:05:38 2009 (r196498) @@ -96,6 +96,7 @@ struct uhub_current_state { struct uhub_softc { struct uhub_current_state sc_st;/* current state */ device_t sc_dev; /* base device */ + struct mtx sc_mtx; /* our mutex */ struct usb_device *sc_udev; /* USB device */ struct usb_xfer *sc_xfer[UHUB_N_TRANSFER]; /* interrupt xfer */ uint8_t sc_flags; @@ -428,7 +429,6 @@ repeat: mode = USB_MODE_HOST; /* need to create a new child */ - child = usb_alloc_device(sc->sc_dev, udev->bus, udev, udev->depth + 1, portno - 1, portno, speed, mode); if (child == NULL) { @@ -691,6 +691,8 @@ uhub_attach(device_t dev) sc->sc_udev = udev; sc->sc_dev = dev; + mtx_init(&sc->sc_mtx, "USB HUB mutex", NULL, MTX_DEF); + snprintf(sc->sc_name, sizeof(sc->sc_name), "%s", device_get_nameunit(dev)); @@ -774,7 +776,7 @@ uhub_attach(device_t dev) } else { /* normal HUB */ err = usbd_transfer_setup(udev, &iface_index, sc->sc_xfer, - uhub_config, UHUB_N_TRANSFER, sc, &Giant); + uhub_config, UHUB_N_TRANSFER, sc, &sc->sc_mtx); } if (err) { DPRINTFN(0, "cannot setup interrupt transfer, " @@ -850,9 +852,9 @@ uhub_attach(device_t dev) /* Start the interrupt endpoint, if any */ if (sc->sc_xfer[0] != NULL) { - USB_XFER_LOCK(sc->sc_xfer[0]); + mtx_lock(&sc->sc_mtx); usbd_transfer_start(sc->sc_xfer[0]); - USB_XFER_UNLOCK(sc->sc_xfer[0]); + mtx_unlock(&sc->sc_mtx); } /* Enable automatic power save on all USB HUBs */ @@ -868,6 +870,9 @@ error: free(udev->hub, M_USBDEV); udev->hub = NULL; } + + mtx_destroy(&sc->sc_mtx); + return (ENXIO); } @@ -908,6 +913,9 @@ uhub_detach(device_t dev) free(hub, M_USBDEV); sc->sc_udev->hub = NULL; + + mtx_destroy(&sc->sc_mtx); + return (0); } @@ -1775,10 +1783,13 @@ usb_dev_resume_peer(struct usb_device *u /* always update hardware power! */ (bus->methods->set_hw_power) (bus); } - sx_xlock(udev->default_sx + 1); + + usbd_enum_lock(udev); + /* notify all sub-devices about resume */ err = usb_suspend_resume(udev, 0); - sx_unlock(udev->default_sx + 1); + + usbd_enum_unlock(udev); /* check if peer has wakeup capability */ if (usb_peer_can_wakeup(udev)) { @@ -1844,10 +1855,12 @@ repeat: } } - sx_xlock(udev->default_sx + 1); + usbd_enum_lock(udev); + /* notify all sub-devices about suspend */ err = usb_suspend_resume(udev, 1); - sx_unlock(udev->default_sx + 1); + + usbd_enum_unlock(udev); if (usb_peer_can_wakeup(udev)) { /* allow device to do remote wakeup */ Modified: head/sys/dev/usb/usb_process.c ============================================================================== --- head/sys/dev/usb/usb_process.c Mon Aug 24 05:03:59 2009 (r196497) +++ head/sys/dev/usb/usb_process.c Mon Aug 24 05:05:38 2009 (r196498) @@ -448,3 +448,29 @@ usb_proc_drain(struct usb_process *up) } mtx_unlock(up->up_mtx); } + +/*------------------------------------------------------------------------* + * usb_proc_rewakeup + * + * This function is called to re-wakeup the the given USB + * process. This usually happens after that the USB system has been in + * polling mode, like during a panic. This function must be called + * having "up->up_mtx" locked. + *------------------------------------------------------------------------*/ +void +usb_proc_rewakeup(struct usb_process *up) +{ + /* check if not initialised */ + if (up->up_mtx == NULL) + return; + /* check if gone */ + if (up->up_gone) + return; + + mtx_assert(up->up_mtx, MA_OWNED); + + if (up->up_msleep == 0) { + /* re-wakeup */ + cv_signal(&up->up_cv); + } +} Modified: head/sys/dev/usb/usb_process.h ============================================================================== --- head/sys/dev/usb/usb_process.h Mon Aug 24 05:03:59 2009 (r196497) +++ head/sys/dev/usb/usb_process.h Mon Aug 24 05:05:38 2009 (r196498) @@ -75,5 +75,6 @@ void usb_proc_drain(struct usb_process * void usb_proc_mwait(struct usb_process *up, void *pm0, void *pm1); void usb_proc_free(struct usb_process *up); void *usb_proc_msignal(struct usb_process *up, void *pm0, void *pm1); +void usb_proc_rewakeup(struct usb_process *up); #endif /* _USB_PROCESS_H_ */ Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Mon Aug 24 05:03:59 2009 (r196497) +++ head/sys/dev/usb/usb_transfer.c Mon Aug 24 05:05:38 2009 (r196498) @@ -2907,13 +2907,9 @@ usbd_transfer_poll(struct usb_xfer **ppx } /* Make sure cv_signal() and cv_broadcast() is not called */ - udev->bus->control_xfer_proc.up_dsleep = 0; udev->bus->control_xfer_proc.up_msleep = 0; - udev->bus->explore_proc.up_dsleep = 0; udev->bus->explore_proc.up_msleep = 0; - udev->bus->giant_callback_proc.up_dsleep = 0; udev->bus->giant_callback_proc.up_msleep = 0; - udev->bus->non_giant_callback_proc.up_dsleep = 0; udev->bus->non_giant_callback_proc.up_msleep = 0; /* poll USB hardware */ From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 06:22:50 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E12D106568E for ; Mon, 24 Aug 2009 06:22:50 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id B8C668FC1C for ; Mon, 24 Aug 2009 06:22:49 +0000 (UTC) Received: (qmail invoked by alias); 24 Aug 2009 06:22:48 -0000 Received: from p54A3ECAA.dip.t-dialin.net (EHLO tron.homeunix.org) [84.163.236.170] by mail.gmx.net (mp035) with SMTP; 24 Aug 2009 08:22:48 +0200 X-Authenticated: #1673122 X-Provags-ID: V01U2FsdGVkX1+8r1h79268A/y+QhFq6IyRYJ+99yDHBWZY1WTW1N wiQMhHUyIDB/tt Message-ID: <4A9231B7.9070204@gmx.de> Date: Mon, 24 Aug 2009 08:22:47 +0200 From: Christoph Mallon User-Agent: Thunderbird 2.0.0.23 (X11/20090823) MIME-Version: 1.0 To: Doug Barton References: <200908231952.n7NJqlFg070672@svn.freebsd.org> In-Reply-To: <200908231952.n7NJqlFg070672@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.5 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196478 - head/etc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 06:22:50 -0000 Doug Barton schrieb: > Author: dougb > Date: Sun Aug 23 19:52:47 2009 > New Revision: 196478 > URL: http://svn.freebsd.org/changeset/base/196478 > > Log: > Prior to the dire warning about values of network_interfaces other than > AUTO the biggest mistake users made was leaving lo0 off the list. Since > lo0 is effectively mandatory, check for it and add it to the list if > it's not there. > > Modified: > head/etc/network.subr > > Modified: head/etc/network.subr > ============================================================================== > --- head/etc/network.subr Sun Aug 23 18:28:58 2009 (r196477) > +++ head/etc/network.subr Sun Aug 23 19:52:47 2009 (r196478) > @@ -727,6 +727,13 @@ list_net_interfaces() > ;; > *) > _tmplist="${network_interfaces} ${cloned_interfaces}" > + > + # lo0 is effectively mandatory, so help prevent foot-shooting > + # > + case "$_tmplist" in > + lo0*|*lo0|*' lo0 '*) ;; # This is fine, do nothing Doesn't this also match malo0? IMO the test should be lo0|'lo0 '*|*' lo0'|*' lo0 '*. Christoph From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 08:27:42 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C78E81065693; Mon, 24 Aug 2009 08:27:42 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B74E48FC13; Mon, 24 Aug 2009 08:27:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7O8RgYK086897; Mon, 24 Aug 2009 08:27:42 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7O8Rgf0086895; Mon, 24 Aug 2009 08:27:42 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200908240827.n7O8Rgf0086895@svn.freebsd.org> From: Ed Schouten Date: Mon, 24 Aug 2009 08:27:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196499 - head/sys/dev/xen/console X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 08:27:43 -0000 Author: ed Date: Mon Aug 24 08:27:42 2009 New Revision: 196499 URL: http://svn.freebsd.org/changeset/base/196499 Log: Cleanups to the Xen console driver: - Use CONSOLE_DRIVER() instead of the deprecated CONS_DRIVER() declaration. - This means we cannot use cn_checkc anymore, which is supposed to do the same as cn_getc nowadays. Remove the cn_getc implementation (that was never being called) and rename cn_checkc to cn_getc. - Don't run-time patch cn_putc, but add the logic to xc_cnputc(). This means I could do some cleanups to our console code... Tested by: nobody on hackers@ Modified: head/sys/dev/xen/console/console.c Modified: head/sys/dev/xen/console/console.c ============================================================================== --- head/sys/dev/xen/console/console.c Mon Aug 24 05:05:38 2009 (r196498) +++ head/sys/dev/xen/console/console.c Mon Aug 24 08:27:42 2009 (r196499) @@ -45,17 +45,15 @@ static int xc_mute; static void xcons_force_flush(void); static void xencons_priv_interrupt(void *); -static cn_probe_t xccnprobe; -static cn_init_t xccninit; -static cn_getc_t xccngetc; -static cn_putc_t xccnputc; -static cn_putc_t xccnputc_dom0; -static cn_checkc_t xccncheckc; +static cn_probe_t xc_cnprobe; +static cn_init_t xc_cninit; +static cn_term_t xc_cnterm; +static cn_getc_t xc_cngetc; +static cn_putc_t xc_cnputc; #define XC_POLLTIME (hz/10) -CONS_DRIVER(xc, xccnprobe, xccninit, NULL, xccngetc, - xccncheckc, xccnputc, NULL); +CONSOLE_DRIVER(xc); static int xen_console_up; static boolean_t xc_start_needed; @@ -105,7 +103,7 @@ static struct ttydevsw xc_ttydevsw = { }; static void -xccnprobe(struct consdev *cp) +xc_cnprobe(struct consdev *cp) { cp->cn_pri = CN_REMOTE; sprintf(cp->cn_name, "%s0", driver_name); @@ -113,37 +111,19 @@ xccnprobe(struct consdev *cp) static void -xccninit(struct consdev *cp) +xc_cninit(struct consdev *cp) { CN_LOCK_INIT(cn_mtx,"XCONS LOCK"); } -int -xccngetc(struct consdev *dev) -{ - int c; - if (xc_mute) - return 0; - do { - if ((c = xccncheckc(dev)) == -1) { -#ifdef KDB - if (!kdb_active) -#endif - /* - * Polling without sleeping in Xen - * doesn't work well. Sleeping gives - * other things like clock a chance to - * run - */ - tsleep(&cn_mtx, PWAIT | PCATCH, - "console sleep", XC_POLLTIME); - } - } while(c == -1); - return c; + +static void +xc_cnterm(struct consdev *cp) +{ } -int -xccncheckc(struct consdev *dev) +static int +xc_cngetc(struct consdev *dev) { int ret = (xc_mute ? 0 : -1); @@ -162,17 +142,27 @@ xccncheckc(struct consdev *dev) } static void -xccnputc(struct consdev *dev, int c) +xc_cnputc_domu(struct consdev *dev, int c) { xcons_putc(c); } static void -xccnputc_dom0(struct consdev *dev, int c) +xc_cnputc_dom0(struct consdev *dev, int c) { HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&c); } +static void +xc_cnputc(struct consdev *dev, int c) +{ + + if (xen_start_info->flags & SIF_INITDOMAIN) + xc_cnputc_dom0(dev, c); + else + xc_cnputc_domu(dev, c); +} + extern int db_active; static boolean_t xcons_putc(int c) @@ -226,10 +216,6 @@ xc_attach(device_t dev) { int error; - if (xen_start_info->flags & SIF_INITDOMAIN) { - xc_consdev.cn_putc = xccnputc_dom0; - } - xccons = tty_alloc(&xc_ttydevsw, NULL); tty_makedev(xccons, NULL, "xc%r", 0); @@ -388,7 +374,7 @@ xc_timeout(void *v) tp = (struct tty *)v; tty_lock(tp); - while ((c = xccncheckc(NULL)) != -1) + while ((c = xc_cngetc(NULL)) != -1) ttydisc_rint(tp, c, 0); if (xc_start_needed) { From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 09:17:02 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20B7F106568B; Mon, 24 Aug 2009 09:17:02 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0FF5D8FC18; Mon, 24 Aug 2009 09:17:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7O9H1X8087954; Mon, 24 Aug 2009 09:17:01 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7O9H1WV087952; Mon, 24 Aug 2009 09:17:01 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200908240917.n7O9H1WV087952@svn.freebsd.org> From: Ed Schouten Date: Mon, 24 Aug 2009 09:17:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196500 - head/usr.sbin/kbdcontrol X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 09:17:02 -0000 Author: ed Date: Mon Aug 24 09:17:01 2009 New Revision: 196500 URL: http://svn.freebsd.org/changeset/base/196500 Log: Unhardcode 0x100 inside kbdcontrol. In preparation for Unicode support for the keyboard layer, we'd better get rid of all the hardcoded 0x100/0xff constants in kbdcontrol. Instead, add a flag called SPECIAL stored in the top bit of the integer. Adding Unicode support is very simple now; just change u_char map[] to u_int map[] in keyent_t, change the bounds checking in kbdcontrol to 0x1FFFFF and modify the ioctls to allow loading these new keymaps. Modified: head/usr.sbin/kbdcontrol/kbdcontrol.c Modified: head/usr.sbin/kbdcontrol/kbdcontrol.c ============================================================================== --- head/usr.sbin/kbdcontrol/kbdcontrol.c Mon Aug 24 08:27:42 2009 (r196499) +++ head/usr.sbin/kbdcontrol/kbdcontrol.c Mon Aug 24 09:17:01 2009 (r196500) @@ -55,6 +55,8 @@ __FBSDID("$FreeBSD$"); #define PASTE 0xa3 /* paste from cut-paste buffer */ #endif +#define SPECIAL 0x80000000 + char ctrl_names[32][4] = { "nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel", "bs ", "ht ", "nl ", "vt ", "ff ", "cr ", "so ", "si ", @@ -180,77 +182,77 @@ get_entry(void) { switch ((token = yylex())) { case TNOP: - return NOP | 0x100; + return NOP | SPECIAL; case TLSH: - return LSH | 0x100; + return LSH | SPECIAL; case TRSH: - return RSH | 0x100; + return RSH | SPECIAL; case TCLK: - return CLK | 0x100; + return CLK | SPECIAL; case TNLK: - return NLK | 0x100; + return NLK | SPECIAL; case TSLK: - return SLK | 0x100; + return SLK | SPECIAL; case TBTAB: - return BTAB | 0x100; + return BTAB | SPECIAL; case TLALT: - return LALT | 0x100; + return LALT | SPECIAL; case TLCTR: - return LCTR | 0x100; + return LCTR | SPECIAL; case TNEXT: - return NEXT | 0x100; + return NEXT | SPECIAL; case TPREV: - return PREV | 0x100; + return PREV | SPECIAL; case TRCTR: - return RCTR | 0x100; + return RCTR | SPECIAL; case TRALT: - return RALT | 0x100; + return RALT | SPECIAL; case TALK: - return ALK | 0x100; + return ALK | SPECIAL; case TASH: - return ASH | 0x100; + return ASH | SPECIAL; case TMETA: - return META | 0x100; + return META | SPECIAL; case TRBT: - return RBT | 0x100; + return RBT | SPECIAL; case TDBG: - return DBG | 0x100; + return DBG | SPECIAL; case TSUSP: - return SUSP | 0x100; + return SUSP | SPECIAL; case TSPSC: - return SPSC | 0x100; + return SPSC | SPECIAL; case TPANIC: - return PNC | 0x100; + return PNC | SPECIAL; case TLSHA: - return LSHA | 0x100; + return LSHA | SPECIAL; case TRSHA: - return RSHA | 0x100; + return RSHA | SPECIAL; case TLCTRA: - return LCTRA | 0x100; + return LCTRA | SPECIAL; case TRCTRA: - return RCTRA | 0x100; + return RCTRA | SPECIAL; case TLALTA: - return LALTA | 0x100; + return LALTA | SPECIAL; case TRALTA: - return RALTA | 0x100; + return RALTA | SPECIAL; case THALT: - return HALT | 0x100; + return HALT | SPECIAL; case TPDWN: - return PDWN | 0x100; + return PDWN | SPECIAL; case TPASTE: - return PASTE | 0x100; + return PASTE | SPECIAL; case TACC: if (ACC(number) > L_ACC) return -1; - return ACC(number) | 0x100; + return ACC(number) | SPECIAL; case TFUNC: if (F(number) > L_FN) return -1; - return F(number) | 0x100; + return F(number) | SPECIAL; case TSCRN: if (S(number) > L_SCR) return -1; - return S(number) | 0x100; + return S(number) | SPECIAL; case TLET: return (unsigned char)letter; case TNUM: @@ -310,9 +312,9 @@ get_key_definition_line(keymap_t *map) for (i=0; ikey[scancode].spcl |= (0x80 >> i); - map->key[scancode].map[i] = def & 0xFF; + map->key[scancode].map[i] = def & ~SPECIAL; } /* get lock state key def */ if ((token = yylex()) != TFLAG) @@ -386,101 +388,101 @@ get_accent_definition_line(accentmap_t * void print_entry(FILE *fp, int value) { - int val = value & 0xFF; + int val = value & ~SPECIAL; switch (value) { - case NOP | 0x100: + case NOP | SPECIAL: fprintf(fp, " nop "); break; - case LSH | 0x100: + case LSH | SPECIAL: fprintf(fp, " lshift"); break; - case RSH | 0x100: + case RSH | SPECIAL: fprintf(fp, " rshift"); break; - case CLK | 0x100: + case CLK | SPECIAL: fprintf(fp, " clock "); break; - case NLK | 0x100: + case NLK | SPECIAL: fprintf(fp, " nlock "); break; - case SLK | 0x100: + case SLK | SPECIAL: fprintf(fp, " slock "); break; - case BTAB | 0x100: + case BTAB | SPECIAL: fprintf(fp, " btab "); break; - case LALT | 0x100: + case LALT | SPECIAL: fprintf(fp, " lalt "); break; - case LCTR | 0x100: + case LCTR | SPECIAL: fprintf(fp, " lctrl "); break; - case NEXT | 0x100: + case NEXT | SPECIAL: fprintf(fp, " nscr "); break; - case PREV | 0x100: + case PREV | SPECIAL: fprintf(fp, " pscr "); break; - case RCTR | 0x100: + case RCTR | SPECIAL: fprintf(fp, " rctrl "); break; - case RALT | 0x100: + case RALT | SPECIAL: fprintf(fp, " ralt "); break; - case ALK | 0x100: + case ALK | SPECIAL: fprintf(fp, " alock "); break; - case ASH | 0x100: + case ASH | SPECIAL: fprintf(fp, " ashift"); break; - case META | 0x100: + case META | SPECIAL: fprintf(fp, " meta "); break; - case RBT | 0x100: + case RBT | SPECIAL: fprintf(fp, " boot "); break; - case DBG | 0x100: + case DBG | SPECIAL: fprintf(fp, " debug "); break; - case SUSP | 0x100: + case SUSP | SPECIAL: fprintf(fp, " susp "); break; - case SPSC | 0x100: + case SPSC | SPECIAL: fprintf(fp, " saver "); break; - case PNC | 0x100: + case PNC | SPECIAL: fprintf(fp, " panic "); break; - case LSHA | 0x100: + case LSHA | SPECIAL: fprintf(fp, " lshifta"); break; - case RSHA | 0x100: + case RSHA | SPECIAL: fprintf(fp, " rshifta"); break; - case LCTRA | 0x100: + case LCTRA | SPECIAL: fprintf(fp, " lctrla"); break; - case RCTRA | 0x100: + case RCTRA | SPECIAL: fprintf(fp, " rctrla"); break; - case LALTA | 0x100: + case LALTA | SPECIAL: fprintf(fp, " lalta "); break; - case RALTA | 0x100: + case RALTA | SPECIAL: fprintf(fp, " ralta "); break; - case HALT | 0x100: + case HALT | SPECIAL: fprintf(fp, " halt "); break; - case PDWN | 0x100: + case PDWN | SPECIAL: fprintf(fp, " pdwn "); break; - case PASTE | 0x100: + case PASTE | SPECIAL: fprintf(fp, " paste "); break; default: - if (value & 0x100) { + if (value & SPECIAL) { if (val >= F_FN && val <= L_FN) fprintf(fp, " fkey%02d", val - F_FN + 1); else if (val >= F_SCR && val <= L_SCR) @@ -521,7 +523,7 @@ print_key_definition_line(FILE *fp, int /* print key definitions */ for (i=0; ispcl & (0x80 >> i)) - print_entry(fp, key->map[i] | 0x100); + print_entry(fp, key->map[i] | SPECIAL); else print_entry(fp, key->map[i]); } @@ -587,8 +589,8 @@ print_accent_definition_line(FILE *fp, i void dump_entry(int value) { - if (value & 0x100) { - value &= 0x00ff; + if (value & SPECIAL) { + value &= ~SPECIAL; switch (value) { case NOP: printf(" NOP, "); @@ -719,7 +721,7 @@ dump_key_definition(char *name, keymap_t printf("/*%02x*/{{", i); for (j = 0; j < NUM_STATES; j++) { if (keymap->key[i].spcl & (0x80 >> j)) - dump_entry(keymap->key[i].map[j] | 0x100); + dump_entry(keymap->key[i].map[j] | SPECIAL); else dump_entry(keymap->key[i].map[j]); } From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 10:03:41 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B902C106568C; Mon, 24 Aug 2009 10:03:41 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A8D7E8FC1A; Mon, 24 Aug 2009 10:03:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OA3fmR089057; Mon, 24 Aug 2009 10:03:41 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OA3fi2089055; Mon, 24 Aug 2009 10:03:41 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <200908241003.n7OA3fi2089055@svn.freebsd.org> From: Marko Zec Date: Mon, 24 Aug 2009 10:03:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196501 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 10:03:41 -0000 Author: zec Date: Mon Aug 24 10:03:41 2009 New Revision: 196501 URL: http://svn.freebsd.org/changeset/base/196501 Log: When registering a protocol to an existing protocol domain via pf_proto_register(), iterate over all existing vnets to call protosw_init() and thus the appropriate .pr_init() handler in the context of each vnet. NB in the future we probably want to separate pr_init() handlers into two, i.e. per-vnet and global, functions. This change has no impact on nooptions VIMAGE builds. Approved by: re (rwatson), julian (mentor) MFC after: 3 days Modified: head/sys/kern/uipc_domain.c Modified: head/sys/kern/uipc_domain.c ============================================================================== --- head/sys/kern/uipc_domain.c Mon Aug 24 09:17:01 2009 (r196500) +++ head/sys/kern/uipc_domain.c Mon Aug 24 10:03:41 2009 (r196501) @@ -336,6 +336,7 @@ found: int pf_proto_register(int family, struct protosw *npr) { + VNET_ITERATOR_DECL(vnet_iter); struct domain *dp; struct protosw *pr, *fpr; @@ -391,7 +392,13 @@ found: mtx_unlock(&dom_mtx); /* Initialize and activate the protocol. */ - protosw_init(fpr); + VNET_LIST_RLOCK(); + VNET_FOREACH(vnet_iter) { + CURVNET_SET_QUIET(vnet_iter); + protosw_init(fpr); + CURVNET_RESTORE(); + } + VNET_LIST_RUNLOCK(); return (0); } From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 10:06:04 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48F35106568E; Mon, 24 Aug 2009 10:06:04 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 384DA8FC16; Mon, 24 Aug 2009 10:06:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OA62Z2089138; Mon, 24 Aug 2009 10:06:02 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OA62Px089135; Mon, 24 Aug 2009 10:06:02 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <200908241006.n7OA62Px089135@svn.freebsd.org> From: Marko Zec Date: Mon, 24 Aug 2009 10:06:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196502 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 10:06:04 -0000 Author: zec Date: Mon Aug 24 10:06:02 2009 New Revision: 196502 URL: http://svn.freebsd.org/changeset/base/196502 Log: Introduce a div_destroy() function which takes over per-vnet cleanup tasks from the existing modevent / MOD_UNLOAD handler, and register div_destroy() in protosw as per-vnet .pr_destroy() handler for options VIMAGE builds. In nooptions VIMAGE builds, div_destroy() will be invoked from the modevent handler, resulting in effectively identical operation as it was prior this change. div_destroy() also tears down hashtables used by ipdivert, which were previously left behind on ipdivert kldunloads. For options VIMAGE builds only, temporarily disable kldunloading of ipdivert, because without introducing additional locking logic it is impossible to atomically check whether all ipdivert instances in all vnets are idle, and proceed with cleanup without opening a race window for a vnet to open an ipdivert socket while ipdivert tear-down is in progress. While here, staticize div_init(), because it is not used outside of ip_divert.c. In cooperation with: julian Approved by: re (rwatson), julian (mentor) MFC after: 3 days Modified: head/sys/netinet/ip_divert.c head/sys/netinet/ip_divert.h Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Mon Aug 24 10:03:41 2009 (r196501) +++ head/sys/netinet/ip_divert.c Mon Aug 24 10:06:02 2009 (r196502) @@ -125,6 +125,8 @@ static VNET_DEFINE(struct inpcbinfo, div static u_long div_sendspace = DIVSNDQ; /* XXX sysctl ? */ static u_long div_recvspace = DIVRCVQ; /* XXX sysctl ? */ +static eventhandler_tag ip_divert_event_tag; + /* * Initialize divert connection block queue. */ @@ -152,7 +154,7 @@ div_inpcb_fini(void *mem, int size) INP_LOCK_DESTROY(inp); } -void +static void div_init(void) { @@ -174,8 +176,17 @@ div_init(void) NULL, NULL, div_inpcb_init, div_inpcb_fini, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); uma_zone_set_max(V_divcbinfo.ipi_zone, maxsockets); - EVENTHANDLER_REGISTER(maxsockets_change, div_zone_change, - NULL, EVENTHANDLER_PRI_ANY); +} + +static void +div_destroy(void) +{ + + INP_INFO_LOCK_DESTROY(&V_divcbinfo); + uma_zdestroy(V_divcbinfo.ipi_zone); + hashdestroy(V_divcbinfo.ipi_hashbase, M_PCB, V_divcbinfo.ipi_hashmask); + hashdestroy(V_divcbinfo.ipi_porthashbase, M_PCB, + V_divcbinfo.ipi_porthashmask); } /* @@ -709,6 +720,9 @@ struct protosw div_protosw = { .pr_ctlinput = div_ctlinput, .pr_ctloutput = ip_ctloutput, .pr_init = div_init, +#ifdef VIMAGE + .pr_destroy = div_destroy, +#endif .pr_usrreqs = &div_usrreqs }; @@ -716,7 +730,9 @@ static int div_modevent(module_t mod, int type, void *unused) { int err = 0; +#ifndef VIMAGE int n; +#endif switch (type) { case MOD_LOAD: @@ -726,7 +742,11 @@ div_modevent(module_t mod, int type, voi * a true IP protocol that goes over the wire. */ err = pf_proto_register(PF_INET, &div_protosw); + if (err != 0) + return (err); ip_divert_ptr = divert_packet; + ip_divert_event_tag = EVENTHANDLER_REGISTER(maxsockets_change, + div_zone_change, NULL, EVENTHANDLER_PRI_ANY); break; case MOD_QUIESCE: /* @@ -737,6 +757,10 @@ div_modevent(module_t mod, int type, voi err = EPERM; break; case MOD_UNLOAD: +#ifdef VIMAGE + err = EPERM; + break; +#else /* * Forced unload. * @@ -758,9 +782,10 @@ div_modevent(module_t mod, int type, voi ip_divert_ptr = NULL; err = pf_proto_unregister(PF_INET, IPPROTO_DIVERT, SOCK_RAW); INP_INFO_WUNLOCK(&V_divcbinfo); - INP_INFO_LOCK_DESTROY(&V_divcbinfo); - uma_zdestroy(V_divcbinfo.ipi_zone); + div_destroy(); + EVENTHANDLER_DEREGISTER(maxsockets_change, ip_divert_event_tag); break; +#endif /* !VIMAGE */ default: err = EOPNOTSUPP; break; Modified: head/sys/netinet/ip_divert.h ============================================================================== --- head/sys/netinet/ip_divert.h Mon Aug 24 10:03:41 2009 (r196501) +++ head/sys/netinet/ip_divert.h Mon Aug 24 10:06:02 2009 (r196502) @@ -83,7 +83,6 @@ divert_find_info(struct mbuf *m) typedef void ip_divert_packet_t(struct mbuf *m, int incoming); extern ip_divert_packet_t *ip_divert_ptr; -extern void div_init(void); extern void div_input(struct mbuf *, int); extern void div_ctlinput(int, struct sockaddr *, void *); #endif /* _NETINET_IP_DIVERT_H_ */ From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 10:09:30 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B2D3106568F; Mon, 24 Aug 2009 10:09:30 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 899AF8FC18; Mon, 24 Aug 2009 10:09:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OA9UHj089234; Mon, 24 Aug 2009 10:09:30 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OA9UqT089224; Mon, 24 Aug 2009 10:09:30 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <200908241009.n7OA9UqT089224@svn.freebsd.org> From: Marko Zec Date: Mon, 24 Aug 2009 10:09:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196503 - in head/sys: fs/nfsclient nfsclient rpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 10:09:30 -0000 Author: zec Date: Mon Aug 24 10:09:30 2009 New Revision: 196503 URL: http://svn.freebsd.org/changeset/base/196503 Log: Fix NFS panics with options VIMAGE kernels by apropriately setting curvnet context inside the RPC code. Temporarily set td's cred to mount's cred before calling socreate() via __rpc_nconf2socket(). Submitted by: rmacklem (in part) Reviewed by: rmacklem, rwatson Discussed with: dfr, bz Approved by: re (rwatson), julian (mentor) MFC after: 3 days Modified: head/sys/fs/nfsclient/nfs_clvnops.c head/sys/nfsclient/nfs_vnops.c head/sys/rpc/clnt_dg.c head/sys/rpc/clnt_rc.c head/sys/rpc/clnt_vc.c head/sys/rpc/rpc_generic.c head/sys/rpc/svc_dg.c head/sys/rpc/svc_generic.c head/sys/rpc/svc_vc.c Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Mon Aug 24 10:06:02 2009 (r196502) +++ head/sys/fs/nfsclient/nfs_clvnops.c Mon Aug 24 10:09:30 2009 (r196503) @@ -1405,8 +1405,8 @@ again: } mtx_unlock(&dnp->n_mtx); - CURVNET_SET(P_TO_VNET(&proc0)); #ifdef INET + CURVNET_SET(CRED_TO_VNET(cnp->cn_cred)); IN_IFADDR_RLOCK(); if (!TAILQ_EMPTY(&V_in_ifaddrhead)) cverf.lval[0] = IA_SIN(TAILQ_FIRST(&V_in_ifaddrhead))->sin_addr.s_addr; @@ -1415,9 +1415,9 @@ again: cverf.lval[0] = create_verf; #ifdef INET IN_IFADDR_RUNLOCK(); + CURVNET_RESTORE(); #endif cverf.lval[1] = ++create_verf; - CURVNET_RESTORE(); error = nfsrpc_create(dvp, cnp->cn_nameptr, cnp->cn_namelen, vap, cverf, fmode, cnp->cn_cred, cnp->cn_thread, &dnfsva, &nfsva, &nfhp, &attrflag, &dattrflag, NULL); Modified: head/sys/nfsclient/nfs_vnops.c ============================================================================== --- head/sys/nfsclient/nfs_vnops.c Mon Aug 24 10:06:02 2009 (r196502) +++ head/sys/nfsclient/nfs_vnops.c Mon Aug 24 10:09:30 2009 (r196503) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1552,6 +1553,7 @@ again: *tl = txdr_unsigned(NFSV3CREATE_EXCLUSIVE); tl = nfsm_build(u_int32_t *, NFSX_V3CREATEVERF); #ifdef INET + CURVNET_SET(CRED_TO_VNET(cnp->cn_cred)); IN_IFADDR_RLOCK(); if (!TAILQ_EMPTY(&V_in_ifaddrhead)) *tl++ = IA_SIN(TAILQ_FIRST(&V_in_ifaddrhead))->sin_addr.s_addr; @@ -1560,6 +1562,7 @@ again: *tl++ = create_verf; #ifdef INET IN_IFADDR_RUNLOCK(); + CURVNET_RESTORE(); #endif *tl = ++create_verf; } else { Modified: head/sys/rpc/clnt_dg.c ============================================================================== --- head/sys/rpc/clnt_dg.c Mon Aug 24 10:06:02 2009 (r196502) +++ head/sys/rpc/clnt_dg.c Mon Aug 24 10:09:30 2009 (r196503) @@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include @@ -197,11 +199,14 @@ clnt_dg_create( return (NULL); } + CURVNET_SET(so->so_vnet); if (!__rpc_socket2sockinfo(so, &si)) { rpc_createerr.cf_stat = RPC_TLIERROR; rpc_createerr.cf_error.re_errno = 0; + CURVNET_RESTORE(); return (NULL); } + CURVNET_RESTORE(); /* * Find the receive and the send size Modified: head/sys/rpc/clnt_rc.c ============================================================================== --- head/sys/rpc/clnt_rc.c Mon Aug 24 10:06:02 2009 (r196502) +++ head/sys/rpc/clnt_rc.c Mon Aug 24 10:09:30 2009 (r196503) @@ -175,15 +175,16 @@ clnt_reconnect_connect(CLIENT *cl) rc->rc_connecting = TRUE; mtx_unlock(&rc->rc_lock); + oldcred = td->td_ucred; + td->td_ucred = rc->rc_ucred; so = __rpc_nconf2socket(rc->rc_nconf); if (!so) { stat = rpc_createerr.cf_stat = RPC_TLIERROR; rpc_createerr.cf_error.re_errno = 0; + td->td_ucred = oldcred; goto out; } - oldcred = td->td_ucred; - td->td_ucred = rc->rc_ucred; if (rc->rc_privport) bindresvport(so, NULL); Modified: head/sys/rpc/clnt_vc.c ============================================================================== --- head/sys/rpc/clnt_vc.c Mon Aug 24 10:06:02 2009 (r196502) +++ head/sys/rpc/clnt_vc.c Mon Aug 24 10:09:30 2009 (r196503) @@ -70,6 +70,9 @@ __FBSDID("$FreeBSD$"); #include #include #include + +#include + #include #include @@ -217,8 +220,11 @@ clnt_vc_create( } } - if (!__rpc_socket2sockinfo(so, &si)) + CURVNET_SET(so->so_vnet); + if (!__rpc_socket2sockinfo(so, &si)) { + CURVNET_RESTORE(); goto err; + } if (so->so_proto->pr_flags & PR_CONNREQUIRED) { bzero(&sopt, sizeof(sopt)); @@ -239,6 +245,7 @@ clnt_vc_create( sopt.sopt_valsize = sizeof(one); sosetopt(so, &sopt); } + CURVNET_RESTORE(); ct->ct_closeit = FALSE; Modified: head/sys/rpc/rpc_generic.c ============================================================================== --- head/sys/rpc/rpc_generic.c Mon Aug 24 10:06:02 2009 (r196502) +++ head/sys/rpc/rpc_generic.c Mon Aug 24 10:09:30 2009 (r196503) @@ -56,6 +56,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include @@ -822,6 +824,7 @@ bindresvport(struct socket *so, struct s sa->sa_len = salen; if (*portp == 0) { + CURVNET_SET(so->so_vnet); bzero(&opt, sizeof(opt)); opt.sopt_dir = SOPT_GET; opt.sopt_level = proto; @@ -829,12 +832,15 @@ bindresvport(struct socket *so, struct s opt.sopt_val = &old; opt.sopt_valsize = sizeof(old); error = sogetopt(so, &opt); - if (error) + if (error) { + CURVNET_RESTORE(); goto out; + } opt.sopt_dir = SOPT_SET; opt.sopt_val = &portlow; error = sosetopt(so, &opt); + CURVNET_RESTORE(); if (error) goto out; } @@ -845,7 +851,9 @@ bindresvport(struct socket *so, struct s if (error) { opt.sopt_dir = SOPT_SET; opt.sopt_val = &old; + CURVNET_SET(so->so_vnet); sosetopt(so, &opt); + CURVNET_RESTORE(); } } out: Modified: head/sys/rpc/svc_dg.c ============================================================================== --- head/sys/rpc/svc_dg.c Mon Aug 24 10:06:02 2009 (r196502) +++ head/sys/rpc/svc_dg.c Mon Aug 24 10:09:30 2009 (r196503) @@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include @@ -101,8 +103,10 @@ svc_dg_create(SVCPOOL *pool, struct sock struct sockaddr* sa; int error; + CURVNET_SET(so->so_vnet); if (!__rpc_socket2sockinfo(so, &si)) { printf(svc_dg_str, svc_dg_err1); + CURVNET_RESTORE(); return (NULL); } /* @@ -112,6 +116,7 @@ svc_dg_create(SVCPOOL *pool, struct sock recvsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsize); if ((sendsize == 0) || (recvsize == 0)) { printf(svc_dg_str, svc_dg_err2); + CURVNET_RESTORE(); return (NULL); } @@ -124,6 +129,7 @@ svc_dg_create(SVCPOOL *pool, struct sock xprt->xp_ops = &svc_dg_ops; error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa); + CURVNET_RESTORE(); if (error) goto freedata; Modified: head/sys/rpc/svc_generic.c ============================================================================== --- head/sys/rpc/svc_generic.c Mon Aug 24 10:06:02 2009 (r196502) +++ head/sys/rpc/svc_generic.c Mon Aug 24 10:09:30 2009 (r196503) @@ -60,6 +60,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -228,11 +230,14 @@ svc_tli_create( /* * It is an open socket. Get the transport info. */ + CURVNET_SET(so->so_vnet); if (!__rpc_socket2sockinfo(so, &si)) { printf( "svc_tli_create: could not get transport information\n"); + CURVNET_RESTORE(); return (NULL); } + CURVNET_RESTORE(); } /* @@ -259,7 +264,9 @@ svc_tli_create( "svc_tli_create: could not bind to requested address\n"); goto freedata; } + CURVNET_SET(so->so_vnet); solisten(so, (int)bindaddr->qlen, curthread); + CURVNET_RESTORE(); } } Modified: head/sys/rpc/svc_vc.c ============================================================================== --- head/sys/rpc/svc_vc.c Mon Aug 24 10:06:02 2009 (r196502) +++ head/sys/rpc/svc_vc.c Mon Aug 24 10:09:30 2009 (r196503) @@ -58,6 +58,9 @@ __FBSDID("$FreeBSD$"); #include #include #include + +#include + #include #include @@ -151,9 +154,12 @@ svc_vc_create(SVCPOOL *pool, struct sock xprt->xp_p2 = NULL; xprt->xp_ops = &svc_vc_rendezvous_ops; + CURVNET_SET(so->so_vnet); error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa); - if (error) + if (error) { + CURVNET_RESTORE(); goto cleanup_svc_vc_create; + } memcpy(&xprt->xp_ltaddr, sa, sa->sa_len); free(sa, M_SONAME); @@ -161,6 +167,7 @@ svc_vc_create(SVCPOOL *pool, struct sock xprt_register(xprt); solisten(so, SOMAXCONN, curthread); + CURVNET_RESTORE(); SOCKBUF_LOCK(&so->so_rcv); xprt->xp_upcallset = 1; @@ -193,9 +200,12 @@ svc_vc_create_conn(SVCPOOL *pool, struct opt.sopt_name = SO_KEEPALIVE; opt.sopt_val = &one; opt.sopt_valsize = sizeof(one); + CURVNET_SET(so->so_vnet); error = sosetopt(so, &opt); - if (error) + if (error) { + CURVNET_RESTORE(); return (NULL); + } if (so->so_proto->pr_protocol == IPPROTO_TCP) { bzero(&opt, sizeof(struct sockopt)); @@ -205,9 +215,12 @@ svc_vc_create_conn(SVCPOOL *pool, struct opt.sopt_val = &one; opt.sopt_valsize = sizeof(one); error = sosetopt(so, &opt); - if (error) + if (error) { + CURVNET_RESTORE(); return (NULL); + } } + CURVNET_RESTORE(); cd = mem_alloc(sizeof(*cd)); cd->strm_stat = XPRT_IDLE; @@ -625,8 +638,10 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms uio.uio_td = curthread; m = NULL; rcvflag = MSG_DONTWAIT; + CURVNET_SET(xprt->xp_socket->so_vnet); error = soreceive(xprt->xp_socket, NULL, &uio, &m, NULL, &rcvflag); + CURVNET_RESTORE(); if (error == EWOULDBLOCK) { /* From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 10:14:10 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13686106568D; Mon, 24 Aug 2009 10:14:10 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 036F78FC25; Mon, 24 Aug 2009 10:14:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OAE9HP089370; Mon, 24 Aug 2009 10:14:09 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OAE96O089368; Mon, 24 Aug 2009 10:14:09 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <200908241014.n7OAE96O089368@svn.freebsd.org> From: Marko Zec Date: Mon, 24 Aug 2009 10:14:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196504 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 10:14:10 -0000 Author: zec Date: Mon Aug 24 10:14:09 2009 New Revision: 196504 URL: http://svn.freebsd.org/changeset/base/196504 Log: When moving ifnets from one vnet to another, and the ifnet has ifaddresses of AF_LINK type which thus have an embedded if_index "backpointer", we must update that if_index backpointer to reflect the new if_index that our ifnet just got assigned. This change affects only options VIMAGE builds. Submitted by: bz Reviewed by: bz Approved by: re (rwatson), julian (mentor) Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Mon Aug 24 10:09:30 2009 (r196503) +++ head/sys/net/if.c Mon Aug 24 10:14:09 2009 (r196504) @@ -589,6 +589,21 @@ if_attach_internal(struct ifnet *ifp, in /* Reliably crash if used uninitialized. */ ifp->if_broadcastaddr = NULL; } +#ifdef VIMAGE + else { + /* + * Update the interface index in the link layer address + * of the interface. + */ + for (ifa = ifp->if_addr; ifa != NULL; + ifa = TAILQ_NEXT(ifa, ifa_link)) { + if (ifa->ifa_addr->sa_family == AF_LINK) { + sdl = (struct sockaddr_dl *)ifa->ifa_addr; + sdl->sdl_index = ifp->if_index; + } + } + } +#endif IFNET_WLOCK(); TAILQ_INSERT_TAIL(&V_ifnet, ifp, if_link); From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 10:16:19 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59DD6106568F; Mon, 24 Aug 2009 10:16:19 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 49E158FC0A; Mon, 24 Aug 2009 10:16:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OAGJwi089460; Mon, 24 Aug 2009 10:16:19 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OAGJop089458; Mon, 24 Aug 2009 10:16:19 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <200908241016.n7OAGJop089458@svn.freebsd.org> From: Marko Zec Date: Mon, 24 Aug 2009 10:16:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196505 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 10:16:19 -0000 Author: zec Date: Mon Aug 24 10:16:19 2009 New Revision: 196505 URL: http://svn.freebsd.org/changeset/base/196505 Log: When "jail -c vnet" request fails, the current code actually creates and leaves behind an orphaned vnet. This change ensures that such vnets get released. This change affects only options VIMAGE builds. Submitted by: jamie Discussed with: bz Approved by: re (rwatson), julian (mentor) MFC after: 3 days Modified: head/sys/kern/kern_jail.c Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Mon Aug 24 10:14:09 2009 (r196504) +++ head/sys/kern/kern_jail.c Mon Aug 24 10:16:19 2009 (r196505) @@ -2456,7 +2456,7 @@ prison_deref(struct prison *pr, int flag sx_downgrade(&allprison_lock); #ifdef VIMAGE - if (pr->pr_flags & PR_VNET) + if (pr->pr_vnet != ppr->pr_vnet) vnet_destroy(pr->pr_vnet); #endif if (pr->pr_root != NULL) { From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 10:29:56 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC7AD106564A; Mon, 24 Aug 2009 10:29:56 +0000 (UTC) (envelope-from zec@icir.org) Received: from labs3.cc.fer.hr (labs3.cc.fer.hr [161.53.72.21]) by mx1.freebsd.org (Postfix) with ESMTP id 633578FC14; Mon, 24 Aug 2009 10:29:56 +0000 (UTC) Received: from sluga.fer.hr (sluga.cc.fer.hr [161.53.72.14]) by labs3.cc.fer.hr (8.13.8+Sun/8.12.10) with ESMTP id n7OAI1HK014047; Mon, 24 Aug 2009 12:18:08 +0200 (CEST) Received: from localhost ([161.53.19.8]) by sluga.fer.hr with Microsoft SMTPSVC(6.0.3790.3959); Mon, 24 Aug 2009 12:18:01 +0200 From: Marko Zec To: src-committers@freebsd.org Date: Mon, 24 Aug 2009 12:17:58 +0200 User-Agent: KMail/1.9.10 References: <200908241014.n7OAE96O089368@svn.freebsd.org> In-Reply-To: <200908241014.n7OAE96O089368@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200908241217.58632.zec@icir.org> X-OriginalArrivalTime: 24 Aug 2009 10:18:01.0659 (UTC) FILETIME=[291EA0B0:01CA24A4] Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r196504 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 10:29:56 -0000 On Monday 24 August 2009 12:14:09 Marko Zec wrote: > Author: zec > Date: Mon Aug 24 10:14:09 2009 > New Revision: 196504 > URL: http://svn.freebsd.org/changeset/base/196504 > > Log: > When moving ifnets from one vnet to another, and the ifnet > has ifaddresses of AF_LINK type which thus have an embedded > if_index "backpointer", we must update that if_index backpointer > to reflect the new if_index that our ifnet just got assigned. > > This change affects only options VIMAGE builds. > > Submitted by: bz > Reviewed by: bz > Approved by: re (rwatson), julian (mentor) Missing: MFC after: 3 days > Modified: > head/sys/net/if.c > > Modified: head/sys/net/if.c > =========================================================================== >=== --- head/sys/net/if.c Mon Aug 24 10:09:30 2009 (r196503) > +++ head/sys/net/if.c Mon Aug 24 10:14:09 2009 (r196504) > @@ -589,6 +589,21 @@ if_attach_internal(struct ifnet *ifp, in > /* Reliably crash if used uninitialized. */ > ifp->if_broadcastaddr = NULL; > } > +#ifdef VIMAGE > + else { > + /* > + * Update the interface index in the link layer address > + * of the interface. > + */ > + for (ifa = ifp->if_addr; ifa != NULL; > + ifa = TAILQ_NEXT(ifa, ifa_link)) { > + if (ifa->ifa_addr->sa_family == AF_LINK) { > + sdl = (struct sockaddr_dl *)ifa->ifa_addr; > + sdl->sdl_index = ifp->if_index; > + } > + } > + } > +#endif > > IFNET_WLOCK(); > TAILQ_INSERT_TAIL(&V_ifnet, ifp, if_link); From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 10:53:30 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE91C106568D; Mon, 24 Aug 2009 10:53:30 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BDD308FC1A; Mon, 24 Aug 2009 10:53:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OArUJN092669; Mon, 24 Aug 2009 10:53:30 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OArUhX092666; Mon, 24 Aug 2009 10:53:30 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200908241053.n7OArUhX092666@svn.freebsd.org> From: Ed Schouten Date: Mon, 24 Aug 2009 10:53:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196506 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 10:53:30 -0000 Author: ed Date: Mon Aug 24 10:53:30 2009 New Revision: 196506 URL: http://svn.freebsd.org/changeset/base/196506 Log: Allow multiple console devices per driver without insane code duplication. Say, a driver wants to have multiple console devices to pick from, you would normally write down something like this: CONSOLE_DRIVER(dev1); CONSOLE_DRIVER(dev2); Unfortunately, this means that you have to declare 10 cn routines, instead of 5. It also isn't possible to initialize cn_arg on beforehand. I noticed this restriction when I was implementing some of the console bits for my vt(4) driver in my newcons branch. I have a single set of cn routines (termcn_*) which are shared by all vt(4) console devices. In order to solve this, I'm adding a separate consdev_ops structure, which contains all the function pointers. This structure is referenced through consdev's cn_ops field. While there, I'm removing CONS_DRIVER() and cn_checkc, which have been deprecated for years. They weren't used throughout the source, until the Xen console driver showed up. CONSOLE_DRIVER() has been changed to do the right thing. It now declares both the consdev and consdev_ops structure and ties them together. In other words: this change doesn't change the KPI for drivers that used the regular way of declaring console devices. If drivers want to use multiple console devices, they can do this as follows: static const struct consdev_ops mydriver_cnops = { .cn_probe = mydriver_cnprobe, ... }; static struct mydriver_softc cons0_softc = { ... }; CONSOLE_DEVICE(cons0, mydriver_cnops, &cons0_softc); static struct mydriver_softc cons1_softc = { ... }; CONSOLE_DEVICE(cons1, mydriver_cnops, &cons1_softc); Obtained from: //depot/user/ed/newcons/... Modified: head/sys/kern/kern_cons.c head/sys/sys/cons.h Modified: head/sys/kern/kern_cons.c ============================================================================== --- head/sys/kern/kern_cons.c Mon Aug 24 10:16:19 2009 (r196505) +++ head/sys/kern/kern_cons.c Mon Aug 24 10:53:30 2009 (r196506) @@ -124,9 +124,10 @@ cninit(void) SET_FOREACH(list, cons_set) { cn = *list; cnremove(cn); - if (cn->cn_probe == NULL) + /* Skip cons_consdev. */ + if (cn->cn_ops == NULL) continue; - cn->cn_probe(cn); + cn->cn_ops->cn_probe(cn); if (cn->cn_pri == CN_DEAD) continue; if (best_cn == NULL || cn->cn_pri > best_cn->cn_pri) @@ -135,14 +136,14 @@ cninit(void) /* * Initialize console, and attach to it. */ - cn->cn_init(cn); + cn->cn_ops->cn_init(cn); cnadd(cn); } } if (best_cn == NULL) return; if ((boothowto & RB_MULTIPLE) == 0) { - best_cn->cn_init(best_cn); + best_cn->cn_ops->cn_init(best_cn); cnadd(best_cn); } if (boothowto & RB_PAUSE) @@ -218,7 +219,7 @@ cnremove(struct consdev *cn) * freed after the system has initialized. */ if (cn->cn_term != NULL) - cn->cn_term(cn); + cn->cn_ops->cn_term(cn); #endif return; } @@ -371,13 +372,9 @@ cncheckc(void) STAILQ_FOREACH(cnd, &cn_devlist, cnd_next) { cn = cnd->cnd_cn; if (!kdb_active || !(cn->cn_flags & CN_FLAG_NODEBUG)) { - if (cn->cn_checkc != NULL) - c = cn->cn_checkc(cn); - else - c = cn->cn_getc(cn); - if (c != -1) { + c = cn->cn_ops->cn_getc(cn); + if (c != -1) return (c); - } } } return (-1); @@ -396,8 +393,8 @@ cnputc(int c) cn = cnd->cnd_cn; if (!kdb_active || !(cn->cn_flags & CN_FLAG_NODEBUG)) { if (c == '\n') - cn->cn_putc(cn, '\r'); - cn->cn_putc(cn, c); + cn->cn_ops->cn_putc(cn, '\r'); + cn->cn_ops->cn_putc(cn, c); } } if (console_pausing && c == '\n' && !kdb_active) { Modified: head/sys/sys/cons.h ============================================================================== --- head/sys/sys/cons.h Mon Aug 24 10:16:19 2009 (r196505) +++ head/sys/sys/cons.h Mon Aug 24 10:53:30 2009 (r196506) @@ -45,10 +45,9 @@ typedef void cn_probe_t(struct consdev * typedef void cn_init_t(struct consdev *); typedef void cn_term_t(struct consdev *); typedef int cn_getc_t(struct consdev *); -typedef int cn_checkc_t(struct consdev *); typedef void cn_putc_t(struct consdev *, int); -struct consdev { +struct consdev_ops { cn_probe_t *cn_probe; /* probe hardware and fill in consdev info */ cn_init_t *cn_init; @@ -57,10 +56,13 @@ struct consdev { /* turn off as console */ cn_getc_t *cn_getc; /* kernel getchar interface */ - cn_checkc_t *cn_checkc; - /* kernel "return char if available" interface */ cn_putc_t *cn_putc; /* kernel putchar interface */ +}; + +struct consdev { + const struct consdev_ops *cn_ops; + /* console device operations. */ short cn_pri; /* pecking order; the higher the better */ void *cn_arg; /* drivers method argument */ int cn_flags; /* capabilities of this console */ @@ -83,21 +85,22 @@ struct consdev { extern struct msgbuf consmsgbuf; /* Message buffer for constty. */ extern struct tty *constty; /* Temporary virtual console. */ -#define CONS_DRIVER(name, probe, init, term, getc, checkc, putc, dbctl) \ - static struct consdev name##_consdev = { \ - probe, init, term, getc, checkc, putc \ +#define CONSOLE_DEVICE(name, ops, arg) \ + static struct consdev name = { \ + .cn_ops = &ops, \ + .cn_arg = (arg), \ }; \ - DATA_SET(cons_set, name##_consdev) + DATA_SET(cons_set, name) -#define CONSOLE_DRIVER(name) \ - static struct consdev name##_consdev = { \ +#define CONSOLE_DRIVER(name) \ + static const struct consdev_ops name##_consdev_ops = { \ .cn_probe = name##_cnprobe, \ .cn_init = name##_cninit, \ .cn_term = name##_cnterm, \ .cn_getc = name##_cngetc, \ .cn_putc = name##_cnputc, \ }; \ - DATA_SET(cons_set, name##_consdev) + CONSOLE_DEVICE(name##_consdev, name##_consdev_ops, NULL) /* Other kernel entry points. */ void cninit(void); From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 11:13:33 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B4A310656A3; Mon, 24 Aug 2009 11:13:33 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 29DB08FC1C; Mon, 24 Aug 2009 11:13:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OBDX82093151; Mon, 24 Aug 2009 11:13:33 GMT (envelope-from rrs@svn.freebsd.org) Received: (from rrs@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OBDXW6093149; Mon, 24 Aug 2009 11:13:33 GMT (envelope-from rrs@svn.freebsd.org) Message-Id: <200908241113.n7OBDXW6093149@svn.freebsd.org> From: Randall Stewart Date: Mon, 24 Aug 2009 11:13:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196507 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 11:13:33 -0000 Author: rrs Date: Mon Aug 24 11:13:32 2009 New Revision: 196507 URL: http://svn.freebsd.org/changeset/base/196507 Log: This fixes two bugs in the NR-Sack code: 1) When calculating the table offset for sliding the sack array, the two byte values must be "ored" together in order for us to do the correct sliding of the arrays. 2) We were NOT properly doing CC and other changes to things only NR-Sacked. The solution here is to make a separate function that will actually do both CC/updates and free things if its NR sack'd. This actually shrinks out common code from three places (much better). MFC after: 3 days Modified: head/sys/netinet/sctp_indata.c Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Mon Aug 24 10:53:30 2009 (r196506) +++ head/sys/netinet/sctp_indata.c Mon Aug 24 11:13:32 2009 (r196507) @@ -2525,6 +2525,7 @@ sctp_sack_check(struct sctp_tcb *stcb, i */ struct sctp_association *asoc; int at; + uint8_t comb_byte; int last_all_ones = 0; int slide_from, slide_end, lgap, distance; @@ -2555,7 +2556,6 @@ sctp_sack_check(struct sctp_tcb *stcb, i memcpy(aux_array, asoc->mapping_array, 64); /* EY do the same for nr_mapping_array */ if (SCTP_BASE_SYSCTL(sctp_nr_sack_on_off) && asoc->peer_supports_nr_sack) { - if (asoc->nr_mapping_array_size != asoc->mapping_array_size) { /* * printf("\nEY-IN sack_check method: \nEY-" "The @@ -2582,13 +2582,18 @@ sctp_sack_check(struct sctp_tcb *stcb, i */ at = 0; for (slide_from = 0; slide_from < stcb->asoc.mapping_array_size; slide_from++) { - - if (asoc->mapping_array[slide_from] == 0xff) { + /* + * We must combine the renegable and non-renegable arrays + * here to form a unified view of what is acked right now + * (since they are kept separate + */ + comb_byte = asoc->mapping_array[slide_from] | asoc->nr_mapping_array[slide_from]; + if (comb_byte == 0xff) { at += 8; last_all_ones = 1; } else { /* there is a 0 bit */ - at += sctp_map_lookup_tab[asoc->mapping_array[slide_from]]; + at += sctp_map_lookup_tab[comb_byte]; last_all_ones = 0; break; } @@ -3182,6 +3187,235 @@ sctp_process_data(struct mbuf **mm, int return (0); } +static int +sctp_process_segment_range(struct sctp_tcb *stcb, struct sctp_tmit_chunk **p_tp1, uint32_t last_tsn, + uint16_t frag_strt, uint16_t frag_end, int nr_sacking, + int *num_frs, + uint32_t * biggest_newly_acked_tsn, + uint32_t * this_sack_lowest_newack, + int *ecn_seg_sums) +{ + struct sctp_tmit_chunk *tp1; + unsigned int theTSN; + int j, wake_him = 0; + + /* Recover the tp1 we last saw */ + tp1 = *p_tp1; + if (tp1 == NULL) { + tp1 = TAILQ_FIRST(&stcb->asoc.sent_queue); + } + for (j = frag_strt; j <= frag_end; j++) { + theTSN = j + last_tsn; + while (tp1) { + if (tp1->rec.data.doing_fast_retransmit) + (*num_frs) += 1; + + /*- + * CMT: CUCv2 algorithm. For each TSN being + * processed from the sent queue, track the + * next expected pseudo-cumack, or + * rtx_pseudo_cumack, if required. Separate + * cumack trackers for first transmissions, + * and retransmissions. + */ + if ((tp1->whoTo->find_pseudo_cumack == 1) && (tp1->sent < SCTP_DATAGRAM_RESEND) && + (tp1->snd_count == 1)) { + tp1->whoTo->pseudo_cumack = tp1->rec.data.TSN_seq; + tp1->whoTo->find_pseudo_cumack = 0; + } + if ((tp1->whoTo->find_rtx_pseudo_cumack == 1) && (tp1->sent < SCTP_DATAGRAM_RESEND) && + (tp1->snd_count > 1)) { + tp1->whoTo->rtx_pseudo_cumack = tp1->rec.data.TSN_seq; + tp1->whoTo->find_rtx_pseudo_cumack = 0; + } + if (tp1->rec.data.TSN_seq == theTSN) { + if (tp1->sent != SCTP_DATAGRAM_UNSENT) { + /*- + * must be held until + * cum-ack passes + */ + /*- + * ECN Nonce: Add the nonce + * value to the sender's + * nonce sum + */ + if (tp1->sent < SCTP_DATAGRAM_RESEND) { + /*- + * If it is less than RESEND, it is + * now no-longer in flight. + * Higher values may already be set + * via previous Gap Ack Blocks... + * i.e. ACKED or RESEND. + */ + if (compare_with_wrap(tp1->rec.data.TSN_seq, + *biggest_newly_acked_tsn, MAX_TSN)) { + *biggest_newly_acked_tsn = tp1->rec.data.TSN_seq; + } + /*- + * CMT: SFR algo (and HTNA) - set + * saw_newack to 1 for dest being + * newly acked. update + * this_sack_highest_newack if + * appropriate. + */ + if (tp1->rec.data.chunk_was_revoked == 0) + tp1->whoTo->saw_newack = 1; + + if (compare_with_wrap(tp1->rec.data.TSN_seq, + tp1->whoTo->this_sack_highest_newack, + MAX_TSN)) { + tp1->whoTo->this_sack_highest_newack = + tp1->rec.data.TSN_seq; + } + /*- + * CMT DAC algo: also update + * this_sack_lowest_newack + */ + if (*this_sack_lowest_newack == 0) { + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SACK_LOGGING_ENABLE) { + sctp_log_sack(*this_sack_lowest_newack, + last_tsn, + tp1->rec.data.TSN_seq, + 0, + 0, + SCTP_LOG_TSN_ACKED); + } + *this_sack_lowest_newack = tp1->rec.data.TSN_seq; + } + /*- + * CMT: CUCv2 algorithm. If (rtx-)pseudo-cumack for corresp + * dest is being acked, then we have a new (rtx-)pseudo-cumack. Set + * new_(rtx_)pseudo_cumack to TRUE so that the cwnd for this dest can be + * updated. Also trigger search for the next expected (rtx-)pseudo-cumack. + * Separate pseudo_cumack trackers for first transmissions and + * retransmissions. + */ + if (tp1->rec.data.TSN_seq == tp1->whoTo->pseudo_cumack) { + if (tp1->rec.data.chunk_was_revoked == 0) { + tp1->whoTo->new_pseudo_cumack = 1; + } + tp1->whoTo->find_pseudo_cumack = 1; + } + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) { + sctp_log_cwnd(stcb, tp1->whoTo, tp1->rec.data.TSN_seq, SCTP_CWND_LOG_FROM_SACK); + } + if (tp1->rec.data.TSN_seq == tp1->whoTo->rtx_pseudo_cumack) { + if (tp1->rec.data.chunk_was_revoked == 0) { + tp1->whoTo->new_pseudo_cumack = 1; + } + tp1->whoTo->find_rtx_pseudo_cumack = 1; + } + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SACK_LOGGING_ENABLE) { + sctp_log_sack(*biggest_newly_acked_tsn, + last_tsn, + tp1->rec.data.TSN_seq, + frag_strt, + frag_end, + SCTP_LOG_TSN_ACKED); + } + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FLIGHT_LOGGING_ENABLE) { + sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_GAP, + tp1->whoTo->flight_size, + tp1->book_size, + (uintptr_t) tp1->whoTo, + tp1->rec.data.TSN_seq); + } + sctp_flight_size_decrease(tp1); + sctp_total_flight_decrease(stcb, tp1); + + tp1->whoTo->net_ack += tp1->send_size; + if (tp1->snd_count < 2) { + /*- + * True non-retransmited chunk + */ + tp1->whoTo->net_ack2 += tp1->send_size; + + /*- + * update RTO too ? + */ + if (tp1->do_rtt) { + tp1->whoTo->RTO = + sctp_calculate_rto(stcb, + &stcb->asoc, + tp1->whoTo, + &tp1->sent_rcv_time, + sctp_align_safe_nocopy); + tp1->do_rtt = 0; + } + } + } + if (tp1->sent <= SCTP_DATAGRAM_RESEND) { + (*ecn_seg_sums) += tp1->rec.data.ect_nonce; + (*ecn_seg_sums) &= SCTP_SACK_NONCE_SUM; + if (compare_with_wrap(tp1->rec.data.TSN_seq, + stcb->asoc.this_sack_highest_gap, + MAX_TSN)) { + stcb->asoc.this_sack_highest_gap = + tp1->rec.data.TSN_seq; + } + if (tp1->sent == SCTP_DATAGRAM_RESEND) { + sctp_ucount_decr(stcb->asoc.sent_queue_retran_cnt); +#ifdef SCTP_AUDITING_ENABLED + sctp_audit_log(0xB2, + (stcb->asoc.sent_queue_retran_cnt & 0x000000ff)); +#endif + } + } + /*- + * All chunks NOT UNSENT fall through here and are marked + * (leave PR-SCTP ones that are to skip alone though) + */ + if (tp1->sent != SCTP_FORWARD_TSN_SKIP) + tp1->sent = SCTP_DATAGRAM_MARKED; + + if (tp1->rec.data.chunk_was_revoked) { + /* deflate the cwnd */ + tp1->whoTo->cwnd -= tp1->book_size; + tp1->rec.data.chunk_was_revoked = 0; + } + /* NR Sack code here */ + if (nr_sacking) { + if (tp1->sent != SCTP_FORWARD_TSN_SKIP) + tp1->sent = SCTP_DATAGRAM_NR_MARKED; + /* + * TAILQ_REMOVE(&asoc->sent_q + * ueue, tp1, sctp_next); + */ + if (tp1->data) { + /* + * sa_ignore + * NO_NULL_CHK + */ + sctp_free_bufspace(stcb, &stcb->asoc, tp1, 1); + sctp_m_freem(tp1->data); + } + tp1->data = NULL; + /* asoc->sent_queue_cnt--; */ + /* + * sctp_free_a_chunk(stcb, + * tp1); + */ + wake_him++; + } + } + break; + } /* if (tp1->TSN_seq == theTSN) */ + if (compare_with_wrap(tp1->rec.data.TSN_seq, theTSN, + MAX_TSN)) + break; + + tp1 = TAILQ_NEXT(tp1, sctp_next); + } /* end while (tp1) */ + /* In case the fragments were not in order we must reset */ + if (tp1 == NULL) { + tp1 = TAILQ_FIRST(&stcb->asoc.sent_queue); + } + } /* end for (j = fragStart */ + *p_tp1 = tp1; + return (wake_him); /* Return value only used for nr-sack */ +} + + static void sctp_handle_segments(struct mbuf *m, int *offset, struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_sack_chunk *ch, uint32_t last_tsn, uint32_t * biggest_tsn_acked, @@ -3194,8 +3428,7 @@ sctp_handle_segments(struct mbuf *m, int struct sctp_sack *sack; struct sctp_gap_ack_block *frag, block; struct sctp_tmit_chunk *tp1; - int i, j; - unsigned int theTSN; + int i; int num_frs = 0; uint16_t frag_strt, frag_end, primary_flag_set; @@ -3263,214 +3496,9 @@ sctp_handle_segments(struct mbuf *m, int } last_frag_high = frag_end + last_tsn; } - for (j = frag_strt; j <= frag_end; j++) { - theTSN = j + last_tsn; - while (tp1) { - if (tp1->rec.data.doing_fast_retransmit) - num_frs++; - - /* - * CMT: CUCv2 algorithm. For each TSN being - * processed from the sent queue, track the - * next expected pseudo-cumack, or - * rtx_pseudo_cumack, if required. Separate - * cumack trackers for first transmissions, - * and retransmissions. - */ - if ((tp1->whoTo->find_pseudo_cumack == 1) && (tp1->sent < SCTP_DATAGRAM_RESEND) && - (tp1->snd_count == 1)) { - tp1->whoTo->pseudo_cumack = tp1->rec.data.TSN_seq; - tp1->whoTo->find_pseudo_cumack = 0; - } - if ((tp1->whoTo->find_rtx_pseudo_cumack == 1) && (tp1->sent < SCTP_DATAGRAM_RESEND) && - (tp1->snd_count > 1)) { - tp1->whoTo->rtx_pseudo_cumack = tp1->rec.data.TSN_seq; - tp1->whoTo->find_rtx_pseudo_cumack = 0; - } - if (tp1->rec.data.TSN_seq == theTSN) { - if (tp1->sent != SCTP_DATAGRAM_UNSENT) { - /* - * must be held until - * cum-ack passes - */ - /* - * ECN Nonce: Add the nonce - * value to the sender's - * nonce sum - */ - if (tp1->sent < SCTP_DATAGRAM_RESEND) { - /*- - * If it is less than RESEND, it is - * now no-longer in flight. - * Higher values may already be set - * via previous Gap Ack Blocks... - * i.e. ACKED or RESEND. - */ - if (compare_with_wrap(tp1->rec.data.TSN_seq, - *biggest_newly_acked_tsn, MAX_TSN)) { - *biggest_newly_acked_tsn = tp1->rec.data.TSN_seq; - } - /* - * CMT: SFR algo - * (and HTNA) - set - * saw_newack to 1 - * for dest being - * newly acked. - * update - * this_sack_highest_ - * newack if - * appropriate. - */ - if (tp1->rec.data.chunk_was_revoked == 0) - tp1->whoTo->saw_newack = 1; - - if (compare_with_wrap(tp1->rec.data.TSN_seq, - tp1->whoTo->this_sack_highest_newack, - MAX_TSN)) { - tp1->whoTo->this_sack_highest_newack = - tp1->rec.data.TSN_seq; - } - /* - * CMT DAC algo: - * also update - * this_sack_lowest_n - * ewack - */ - if (*this_sack_lowest_newack == 0) { - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SACK_LOGGING_ENABLE) { - sctp_log_sack(*this_sack_lowest_newack, - last_tsn, - tp1->rec.data.TSN_seq, - 0, - 0, - SCTP_LOG_TSN_ACKED); - } - *this_sack_lowest_newack = tp1->rec.data.TSN_seq; - } - /* - * CMT: CUCv2 - * algorithm. If - * (rtx-)pseudo-cumac - * k for corresp - * dest is being - * acked, then we - * have a new - * (rtx-)pseudo-cumac - * k. Set - * new_(rtx_)pseudo_c - * umack to TRUE so - * that the cwnd for - * this dest can be - * updated. Also - * trigger search - * for the next - * expected - * (rtx-)pseudo-cumac - * k. Separate - * pseudo_cumack - * trackers for - * first - * transmissions and - * retransmissions. - */ - if (tp1->rec.data.TSN_seq == tp1->whoTo->pseudo_cumack) { - if (tp1->rec.data.chunk_was_revoked == 0) { - tp1->whoTo->new_pseudo_cumack = 1; - } - tp1->whoTo->find_pseudo_cumack = 1; - } - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) { - sctp_log_cwnd(stcb, tp1->whoTo, tp1->rec.data.TSN_seq, SCTP_CWND_LOG_FROM_SACK); - } - if (tp1->rec.data.TSN_seq == tp1->whoTo->rtx_pseudo_cumack) { - if (tp1->rec.data.chunk_was_revoked == 0) { - tp1->whoTo->new_pseudo_cumack = 1; - } - tp1->whoTo->find_rtx_pseudo_cumack = 1; - } - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SACK_LOGGING_ENABLE) { - sctp_log_sack(*biggest_newly_acked_tsn, - last_tsn, - tp1->rec.data.TSN_seq, - frag_strt, - frag_end, - SCTP_LOG_TSN_ACKED); - } - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FLIGHT_LOGGING_ENABLE) { - sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_GAP, - tp1->whoTo->flight_size, - tp1->book_size, - (uintptr_t) tp1->whoTo, - tp1->rec.data.TSN_seq); - } - sctp_flight_size_decrease(tp1); - sctp_total_flight_decrease(stcb, tp1); - - tp1->whoTo->net_ack += tp1->send_size; - if (tp1->snd_count < 2) { - /* - * True - * non-retran - * smited - * chunk */ - tp1->whoTo->net_ack2 += tp1->send_size; - - /* - * update RTO - * too ? */ - if (tp1->do_rtt) { - tp1->whoTo->RTO = - sctp_calculate_rto(stcb, - asoc, - tp1->whoTo, - &tp1->sent_rcv_time, - sctp_align_safe_nocopy); - tp1->do_rtt = 0; - } - } - } - if (tp1->sent <= SCTP_DATAGRAM_RESEND) { - (*ecn_seg_sums) += tp1->rec.data.ect_nonce; - (*ecn_seg_sums) &= SCTP_SACK_NONCE_SUM; - if (compare_with_wrap(tp1->rec.data.TSN_seq, - asoc->this_sack_highest_gap, - MAX_TSN)) { - asoc->this_sack_highest_gap = - tp1->rec.data.TSN_seq; - } - if (tp1->sent == SCTP_DATAGRAM_RESEND) { - sctp_ucount_decr(asoc->sent_queue_retran_cnt); -#ifdef SCTP_AUDITING_ENABLED - sctp_audit_log(0xB2, - (asoc->sent_queue_retran_cnt & 0x000000ff)); -#endif - } - } - /* - * All chunks NOT UNSENT - * fall through here and are - * marked (leave PR-SCTP - * ones that are to skip - * alone though) - */ - if (tp1->sent != SCTP_FORWARD_TSN_SKIP) - tp1->sent = SCTP_DATAGRAM_MARKED; - - if (tp1->rec.data.chunk_was_revoked) { - /* deflate the cwnd */ - tp1->whoTo->cwnd -= tp1->book_size; - tp1->rec.data.chunk_was_revoked = 0; - } - } - break; - } /* if (tp1->TSN_seq == theTSN) */ - if (compare_with_wrap(tp1->rec.data.TSN_seq, theTSN, - MAX_TSN)) - break; - - tp1 = TAILQ_NEXT(tp1, sctp_next); - } /* end while (tp1) */ - } /* end for (j = fragStart */ + sctp_process_segment_range(stcb, &tp1, last_tsn, frag_strt, frag_end, + 0, &num_frs, biggest_newly_acked_tsn, + this_sack_lowest_newack, ecn_seg_sums); frag = (struct sctp_gap_ack_block *)sctp_m_getptr(m, *offset, sizeof(struct sctp_gap_ack_block), (uint8_t *) & block); *offset += sizeof(block); @@ -6855,9 +6883,8 @@ sctp_handle_nr_sack_segments(struct mbuf struct sctp_gap_ack_block *frag, block; struct sctp_nr_gap_ack_block *nr_frag, nr_block; struct sctp_tmit_chunk *tp1; - uint32_t i, j; + uint32_t i; int wake_him = 0; - uint32_t theTSN; int num_frs = 0; uint16_t frag_strt, frag_end, primary_flag_set; @@ -6932,213 +6959,9 @@ sctp_handle_nr_sack_segments(struct mbuf } last_frag_high = frag_end + last_tsn; } - for (j = frag_strt; j <= frag_end; j++) { - theTSN = j + last_tsn; - while (tp1) { - if (tp1->rec.data.doing_fast_retransmit) - num_frs++; - - /* - * CMT: CUCv2 algorithm. For each TSN being - * processed from the sent queue, track the - * next expected pseudo-cumack, or - * rtx_pseudo_cumack, if required. Separate - * cumack trackers for first transmissions, - * and retransmissions. - */ - if ((tp1->whoTo->find_pseudo_cumack == 1) && (tp1->sent < SCTP_DATAGRAM_RESEND) && - (tp1->snd_count == 1)) { - tp1->whoTo->pseudo_cumack = tp1->rec.data.TSN_seq; - tp1->whoTo->find_pseudo_cumack = 0; - } - if ((tp1->whoTo->find_rtx_pseudo_cumack == 1) && (tp1->sent < SCTP_DATAGRAM_RESEND) && - (tp1->snd_count > 1)) { - tp1->whoTo->rtx_pseudo_cumack = tp1->rec.data.TSN_seq; - tp1->whoTo->find_rtx_pseudo_cumack = 0; - } - if (tp1->rec.data.TSN_seq == theTSN) { - if (tp1->sent != SCTP_DATAGRAM_UNSENT) { - /* - * must be held until - * cum-ack passes - */ - /* - * ECN Nonce: Add the nonce - * value to the sender's - * nonce sum - */ - if (tp1->sent < SCTP_DATAGRAM_RESEND) { - /*- - * If it is less than RESEND, it is - * now no-longer in flight. - * Higher values may already be set - * via previous Gap Ack Blocks... - * i.e. ACKED or RESEND. - */ - if (compare_with_wrap(tp1->rec.data.TSN_seq, - *biggest_newly_acked_tsn, MAX_TSN)) { - *biggest_newly_acked_tsn = tp1->rec.data.TSN_seq; - } - /* - * CMT: SFR algo - * (and HTNA) - set - * saw_newack to 1 - * for dest being - * newly acked. - * update - * this_sack_highest_ - * newack if - * appropriate. - */ - if (tp1->rec.data.chunk_was_revoked == 0) - tp1->whoTo->saw_newack = 1; - - if (compare_with_wrap(tp1->rec.data.TSN_seq, - tp1->whoTo->this_sack_highest_newack, - MAX_TSN)) { - tp1->whoTo->this_sack_highest_newack = - tp1->rec.data.TSN_seq; - } - /* - * CMT DAC algo: - * also update - * this_sack_lowest_n - * ewack - */ - if (*this_sack_lowest_newack == 0) { - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SACK_LOGGING_ENABLE) { - sctp_log_sack(*this_sack_lowest_newack, - last_tsn, - tp1->rec.data.TSN_seq, - 0, - 0, - SCTP_LOG_TSN_ACKED); - } - *this_sack_lowest_newack = tp1->rec.data.TSN_seq; - } - /* - * CMT: CUCv2 - * algorithm. If - * (rtx-)pseudo-cumac - * k for corresp - * dest is being - * acked, then we - * have a new - * (rtx-)pseudo-cumac - * k. Set - * new_(rtx_)pseudo_c - * umack to TRUE so - * that the cwnd for - * this dest can be - * updated. Also - * trigger search - * for the next - * expected - * (rtx-)pseudo-cumac - * k. Separate - * pseudo_cumack - * trackers for - * first - * transmissions and - * retransmissions. - */ - if (tp1->rec.data.TSN_seq == tp1->whoTo->pseudo_cumack) { - if (tp1->rec.data.chunk_was_revoked == 0) { - tp1->whoTo->new_pseudo_cumack = 1; - } - tp1->whoTo->find_pseudo_cumack = 1; - } - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_CWND_LOGGING_ENABLE) { - sctp_log_cwnd(stcb, tp1->whoTo, tp1->rec.data.TSN_seq, SCTP_CWND_LOG_FROM_SACK); - } - if (tp1->rec.data.TSN_seq == tp1->whoTo->rtx_pseudo_cumack) { - if (tp1->rec.data.chunk_was_revoked == 0) { - tp1->whoTo->new_pseudo_cumack = 1; - } - tp1->whoTo->find_rtx_pseudo_cumack = 1; - } - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_SACK_LOGGING_ENABLE) { - sctp_log_sack(*biggest_newly_acked_tsn, - last_tsn, - tp1->rec.data.TSN_seq, - frag_strt, - frag_end, - SCTP_LOG_TSN_ACKED); - } - if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FLIGHT_LOGGING_ENABLE) { - sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_GAP, - tp1->whoTo->flight_size, - tp1->book_size, - (uintptr_t) tp1->whoTo, - tp1->rec.data.TSN_seq); - } - sctp_flight_size_decrease(tp1); - sctp_total_flight_decrease(stcb, tp1); - - tp1->whoTo->net_ack += tp1->send_size; - if (tp1->snd_count < 2) { - /* - * True - * non-retran - * smited - * chunk - */ - tp1->whoTo->net_ack2 += tp1->send_size; - - /* - * update - * RTO too ? - */ - if (tp1->do_rtt) { - tp1->whoTo->RTO = - sctp_calculate_rto(stcb, - asoc, - tp1->whoTo, - &tp1->sent_rcv_time, - sctp_align_safe_nocopy); - tp1->do_rtt = 0; - } - } - } - if (tp1->sent <= SCTP_DATAGRAM_RESEND) { - (*ecn_seg_sums) += tp1->rec.data.ect_nonce; - (*ecn_seg_sums) &= SCTP_SACK_NONCE_SUM; - if (compare_with_wrap(tp1->rec.data.TSN_seq, - asoc->this_sack_highest_gap, - MAX_TSN)) { - asoc->this_sack_highest_gap = - tp1->rec.data.TSN_seq; - } - if (tp1->sent == SCTP_DATAGRAM_RESEND) { - sctp_ucount_decr(asoc->sent_queue_retran_cnt); -#ifdef SCTP_AUDITING_ENABLED - sctp_audit_log(0xB2, - (asoc->sent_queue_retran_cnt & 0x000000ff)); -#endif - } - } - /* - * All chunks NOT UNSENT - * fall through here and are - * marked - */ - if (tp1->sent != SCTP_FORWARD_TSN_SKIP) - tp1->sent = SCTP_DATAGRAM_NR_MARKED; - if (tp1->rec.data.chunk_was_revoked) { - /* deflate the cwnd */ - tp1->whoTo->cwnd -= tp1->book_size; - tp1->rec.data.chunk_was_revoked = 0; - } - } - break; - } /* if (tp1->TSN_seq == theTSN) */ - if (compare_with_wrap(tp1->rec.data.TSN_seq, theTSN, - MAX_TSN)) - break; - - tp1 = TAILQ_NEXT(tp1, sctp_next); - } /* end while (tp1) */ - } /* end for (j = fragStart */ + sctp_process_segment_range(stcb, &tp1, last_tsn, frag_strt, frag_end, + 0, &num_frs, biggest_newly_acked_tsn, + this_sack_lowest_newack, ecn_seg_sums); frag = (struct sctp_gap_ack_block *)sctp_m_getptr(m, *offset, sizeof(struct sctp_gap_ack_block), (uint8_t *) & block); *offset += sizeof(block); @@ -7164,6 +6987,8 @@ sctp_handle_nr_sack_segments(struct mbuf } tp1 = NULL; last_nr_frag_high = 0; + /* Reset to beginning for the nr_sack section */ + tp1 = TAILQ_FIRST(&asoc->sent_queue); for (i = 0; i < num_nr_seg; i++) { @@ -7207,45 +7032,15 @@ sctp_handle_nr_sack_segments(struct mbuf } last_nr_frag_high = nr_frag_end + last_tsn; } - - for (j = nr_frag_strt + last_tsn; (compare_with_wrap((nr_frag_end + last_tsn), j, MAX_TSN)); j++) { - while (tp1) { - if (tp1->rec.data.TSN_seq == j) { - if (tp1->sent != SCTP_DATAGRAM_UNSENT) { - if (tp1->sent != SCTP_FORWARD_TSN_SKIP) - tp1->sent = SCTP_DATAGRAM_NR_MARKED; - /* - * TAILQ_REMOVE(&asoc->sent_q - * ueue, tp1, sctp_next); - */ - if (tp1->data) { - /* - * sa_ignore - * NO_NULL_CHK - */ - sctp_free_bufspace(stcb, asoc, tp1, 1); - sctp_m_freem(tp1->data); - } - tp1->data = NULL; - /* asoc->sent_queue_cnt--; */ - /* - * sctp_free_a_chunk(stcb, - * tp1); - */ - wake_him++; - } - break; - } /* if (tp1->TSN_seq == j) */ - if (compare_with_wrap(tp1->rec.data.TSN_seq, j, - MAX_TSN)) - break; - tp1 = TAILQ_NEXT(tp1, sctp_next); - } /* end while (tp1) */ - - } /* end for (j = nrFragStart */ + num_frs = 0; + wake_him = sctp_process_segment_range(stcb, &tp1, last_tsn, + nr_frag_strt, nr_frag_end, 1, + &num_frs, biggest_newly_acked_tsn, + this_sack_lowest_newack, ecn_seg_sums); nr_frag = (struct sctp_nr_gap_ack_block *)sctp_m_getptr(m, *offset, - sizeof(struct sctp_nr_gap_ack_block), (uint8_t *) & nr_block); + sizeof(struct sctp_nr_gap_ack_block), + (uint8_t *) & nr_block); *offset += sizeof(nr_block); if (nr_frag == NULL) { break; From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 11:16:45 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BF31106568E; Mon, 24 Aug 2009 11:16:45 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 118A08FC08; Mon, 24 Aug 2009 11:16:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OBGiGw093254; Mon, 24 Aug 2009 11:16:44 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OBGi2j093252; Mon, 24 Aug 2009 11:16:44 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200908241116.n7OBGi2j093252@svn.freebsd.org> From: Ed Schouten Date: Mon, 24 Aug 2009 11:16:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196508 - head/lib/libc/stdlib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 11:16:45 -0000 Author: ed Date: Mon Aug 24 11:16:44 2009 New Revision: 196508 URL: http://svn.freebsd.org/changeset/base/196508 Log: Our implementation of granpt(3) could be valid in the future. When I wrote the pseudo-terminal driver for the MPSAFE TTY code, Robert Watson and I agreed the best way to implement this, would be to let posix_openpt() create a pseudo-terminal with proper permissions in place and let grantpt() and unlockpt() be no-ops. This isn't valid behaviour when looking at the spec. Because I thought it was an elegant solution, I filed a bug report at the Austin Group about this. In their last teleconference, they agreed on this subject. This means that future revisions of POSIX may allow grantpt() and unlockpt() to be no-ops if an open() on /dev/ptmx (if the implementation has such a device) and posix_openpt() already do the right thing. I'd rather put this in the manpage, because simply mentioning we don't comply to any standard makes it look worse than it is. Right now we don't, but at least we took care of it. Approved by: re (kib) MFC after: 3 days Modified: head/lib/libc/stdlib/ptsname.3 Modified: head/lib/libc/stdlib/ptsname.3 ============================================================================== --- head/lib/libc/stdlib/ptsname.3 Mon Aug 24 11:13:32 2009 (r196507) +++ head/lib/libc/stdlib/ptsname.3 Mon Aug 24 11:16:44 2009 (r196508) @@ -134,14 +134,22 @@ The slave pseudo-terminal device could n The .Fn ptsname function conforms to -.St -p1003.1-2001 . +.St -p1003.1-2008 . .Pp This implementation of .Fn grantpt and .Fn unlockpt -does not comply with any standard, because these functions assume the -pseudo-terminal has the correct attributes upon creation. +does not conform to +.St -p1003.1-2008 , +because it depends on +.Xr posix_openpt 2 +to create the pseudo-terminal device with proper permissions in place. +It only validates whether +.Fa fildes +is a valid pseudo-terminal master device. +Future revisions of the specification will likely allow this behaviour, +as stated by the Austin Group. .Sh HISTORY The .Fn grantpt , @@ -150,15 +158,3 @@ and .Fn unlockpt functions appeared in .Fx 5.0 . -.Sh NOTES -The purpose of the -.Fn grantpt -and -.Fn unlockpt -functions has no meaning in -.Fx , -because pseudo-terminals obtained by -.Xr posix_openpt 2 -are created on demand. -Because these devices are created with proper permissions in place, they -are guaranteed to be unused by unprivileged processes. From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 11:46:40 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6BAD106568D; Mon, 24 Aug 2009 11:46:40 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C66418FC22; Mon, 24 Aug 2009 11:46:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OBkeBb093911; Mon, 24 Aug 2009 11:46:40 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OBkejf093909; Mon, 24 Aug 2009 11:46:40 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <200908241146.n7OBkejf093909@svn.freebsd.org> From: Michael Tuexen Date: Mon, 24 Aug 2009 11:46:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196509 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 11:46:40 -0000 Author: tuexen Date: Mon Aug 24 11:46:40 2009 New Revision: 196509 URL: http://svn.freebsd.org/changeset/base/196509 Log: This fixes a bug where the value set by SCTP_PARTIAL_DELIVERY_POINT was not honored, if the socket buffer size was not 4 times that large. Approved by: rrs (mentor) MFC after: 3 days. Modified: head/sys/netinet/sctp_indata.c Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Mon Aug 24 11:16:44 2009 (r196508) +++ head/sys/netinet/sctp_indata.c Mon Aug 24 11:46:40 2009 (r196509) @@ -921,7 +921,7 @@ doit_again: * but should we? */ if (stcb->sctp_socket) { - pd_point = min(SCTP_SB_LIMIT_RCV(stcb->sctp_socket) >> SCTP_PARTIAL_DELIVERY_SHIFT, + pd_point = min(SCTP_SB_LIMIT_RCV(stcb->sctp_socket), stcb->sctp_ep->partial_delivery_point); } else { pd_point = stcb->sctp_ep->partial_delivery_point; @@ -2867,11 +2867,11 @@ doit_again: /* * Before we start though either all of the message should - * be here or 1/4 the socket buffer max or nothing on the + * be here or the socket buffer max or nothing on the * delivery queue and something can be delivered. */ if (stcb->sctp_socket) { - pd_point = min(SCTP_SB_LIMIT_RCV(stcb->sctp_socket) >> SCTP_PARTIAL_DELIVERY_SHIFT, + pd_point = min(SCTP_SB_LIMIT_RCV(stcb->sctp_socket), stcb->sctp_ep->partial_delivery_point); } else { pd_point = stcb->sctp_ep->partial_delivery_point; From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 12:09:12 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1C20106568E; Mon, 24 Aug 2009 12:09:12 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id 3652F8FC14; Mon, 24 Aug 2009 12:09:11 +0000 (UTC) Received: from c122-106-152-1.carlnfd1.nsw.optusnet.com.au (c122-106-152-1.carlnfd1.nsw.optusnet.com.au [122.106.152.1]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n7OC97YO014863 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 24 Aug 2009 22:09:09 +1000 Date: Mon, 24 Aug 2009 22:09:07 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Ed Schouten In-Reply-To: <200908241053.n7OArUhX092666@svn.freebsd.org> Message-ID: <20090824213600.T39644@delplex.bde.org> References: <200908241053.n7OArUhX092666@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r196506 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 12:09:12 -0000 On Mon, 24 Aug 2009, Ed Schouten wrote: > Log: > Allow multiple console devices per driver without insane code duplication. > > Say, a driver wants to have multiple console devices to pick from, you > would normally write down something like this: > > CONSOLE_DRIVER(dev1); > CONSOLE_DRIVER(dev2); > > Unfortunately, this means that you have to declare 10 cn routines, > instead of 5. It also isn't possible to initialize cn_arg on beforehand. > > I noticed this restriction when I was implementing some of the console > bits for my vt(4) driver in my newcons branch. I have a single set of cn > routines (termcn_*) which are shared by all vt(4) console devices. > > In order to solve this, I'm adding a separate consdev_ops structure, > which contains all the function pointers. This structure is referenced > through consdev's cn_ops field. > > While there, I'm removing CONS_DRIVER() and cn_checkc, which have been > deprecated for years. They weren't used throughout the source, until the > Xen console driver showed up. CONSOLE_DRIVER() has been changed to do > the right thing. It now declares both the consdev and consdev_ops > structure and ties them together. In other words: this change doesn't > change the KPI for drivers that used the regular way of declaring > console devices. CONS_DRIVER() was a good interface, unlike CONSOLE_DRIVER(). Removing it completes the bitrot in the support for cn_dbctl, and completes removal of cn_checkc's good name at the driver level. cn_dbctl is still needed to unbreak sysctl's support for ddb (see db_main.c 1.4.2.1, which depends on cn_dbctl's infrastructure not having rotted) and can be used to unbreak polled i/o in all console drivers (not just in ddb mode -- it should have been named cn_ioctl) (see other mail). The higher level cngetc() and cncheckc() are still correctly named, now fully inconsistently with the driver level. Bruce From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 12:49:10 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1EF22106568C; Mon, 24 Aug 2009 12:49:10 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id B4BE38FC0C; Mon, 24 Aug 2009 12:49:09 +0000 (UTC) Received: by palm.hoeg.nl (Postfix, from userid 1000) id D12E51CD58; Mon, 24 Aug 2009 14:49:08 +0200 (CEST) Date: Mon, 24 Aug 2009 14:49:08 +0200 From: Ed Schouten To: Bruce Evans Message-ID: <20090824124908.GF2829@hoeg.nl> References: <200908241053.n7OArUhX092666@svn.freebsd.org> <20090824213600.T39644@delplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Pgaa2uWPnPrfixyx" Content-Disposition: inline In-Reply-To: <20090824213600.T39644@delplex.bde.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r196506 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 12:49:10 -0000 --Pgaa2uWPnPrfixyx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Bruce, * Bruce Evans wrote: > CONS_DRIVER() was a good interface, unlike CONSOLE_DRIVER(). Removing it > completes the bitrot in the support for cn_dbctl, and completes removal > of cn_checkc's good name at the driver level. >=20 > cn_dbctl is still needed to unbreak sysctl's support for ddb (see db_main= =2Ec > 1.4.2.1, which depends on cn_dbctl's infrastructure not having rotted) and > can be used to unbreak polled i/o in all console drivers (not just in ddb > mode -- it should have been named cn_ioctl) (see other mail). >=20 > The higher level cngetc() and cncheckc() are still correctly named, now > fully inconsistently with the driver level. Well, there are lots of things broken in the current implementation. Just take a look at how the cn_term is entirely commented out, only because syscons can't handle it. The only thing I tried to do with those changes, is remove dead code. If someone comes up with patches to properly restore these features, I'd be more than happy to commit them to SVN. --=20 Ed Schouten WWW: http://80386.nl/ --Pgaa2uWPnPrfixyx Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkqSjEQACgkQ52SDGA2eCwWPcwCfYwppIstzj+QV2gRfcJyK0Ofe 7o8An2Pixj/3lmEpY0x/Gn8AvRhqok63 =OIU6 -----END PGP SIGNATURE----- --Pgaa2uWPnPrfixyx-- From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 12:52:06 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42A33106568D; Mon, 24 Aug 2009 12:52:06 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 31BFB8FC12; Mon, 24 Aug 2009 12:52:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OCq6qt095327; Mon, 24 Aug 2009 12:52:06 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OCq6cT095324; Mon, 24 Aug 2009 12:52:06 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200908241252.n7OCq6cT095324@svn.freebsd.org> From: Robert Watson Date: Mon, 24 Aug 2009 12:52:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196510 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 12:52:06 -0000 Author: rwatson Date: Mon Aug 24 12:52:05 2009 New Revision: 196510 URL: http://svn.freebsd.org/changeset/base/196510 Log: Make if_grow static -- it's not used outside of if.c, and with the internals destined to change, it's better if it remains that way. MFC after: 3 days Modified: head/sys/net/if.c head/sys/net/if_var.h Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Mon Aug 24 11:46:40 2009 (r196509) +++ head/sys/net/if.c Mon Aug 24 12:52:05 2009 (r196510) @@ -124,6 +124,7 @@ static void if_attachdomain1(struct ifne static int ifconf(u_long, caddr_t); static void if_freemulti(struct ifmultiaddr *); static void if_init(void *); +static void if_grow(void); static void if_check(void *); static void if_route(struct ifnet *, int flag, int fam); static int if_setflag(struct ifnet *, int, int, int *, int); @@ -297,7 +298,7 @@ VNET_SYSUNINIT(vnet_if_uninit, SI_SUB_IN vnet_if_uninit, NULL); #endif -void +static void if_grow(void) { u_int n; Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Mon Aug 24 11:46:40 2009 (r196509) +++ head/sys/net/if_var.h Mon Aug 24 12:52:05 2009 (r196510) @@ -826,7 +826,6 @@ int if_allmulti(struct ifnet *, int); struct ifnet* if_alloc(u_char); void if_attach(struct ifnet *); void if_dead(struct ifnet *); -void if_grow(void); int if_delmulti(struct ifnet *, struct sockaddr *); void if_delmulti_ifma(struct ifmultiaddr *); void if_detach(struct ifnet *); From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 13:10:56 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A53E106568F; Mon, 24 Aug 2009 13:10:56 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 482F48FC20; Mon, 24 Aug 2009 13:10:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7ODAuLp095758; Mon, 24 Aug 2009 13:10:56 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7ODAu9G095738; Mon, 24 Aug 2009 13:10:56 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200908241310.n7ODAu9G095738@svn.freebsd.org> From: Alexander Leidinger Date: Mon, 24 Aug 2009 13:10:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196511 - head/tools/kerneldoc/subsys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 13:10:56 -0000 Author: netchild Date: Mon Aug 24 13:10:55 2009 New Revision: 196511 URL: http://svn.freebsd.org/changeset/base/196511 Log: - Update config to doxygen 1.5.2 (I use this with 1.5.9). - Add linprocfs and linsysfs to the linuxulator dox. - Take the generated includes from the .m files from a subdirectory instead of putting everything into $(.OBJDIR). This imporves the human readbility of the source directory contents a lot, if you do not create a separate OBJDIR. - Assume UTF-8 encoding for every input file. - Strip the source and dest path from the output, we are not interested in the absolute location on the machine where the docs are created, relative the the root of the FreeBSD source is what interests us. - Exclude .svn directories. - Switch to alphabetic index. - Use one line per INCLUDE_PATH member in the common dox-config. - Bump the __FreeBSD__ version to 9. [MFC: to 8] - Switch from hardcoded .m files to an run-time generated one. Takes a little bit more time to get started with actual work, but at least is more future-proof. If you generate dox for all subsystems, the time to find all .m files in the source is magnitutes lower than producing the docs. - Make the *DEST_PATH overidable from the environment. This allows to produce the output directly in the docroot of a webserver. - Fix the path when telling the user where he can find the API docs. MFC after: 1 month (after 8.0) Modified: head/tools/kerneldoc/subsys/Dependencies head/tools/kerneldoc/subsys/Doxyfile-cam head/tools/kerneldoc/subsys/Doxyfile-crypto head/tools/kerneldoc/subsys/Doxyfile-dev_pci head/tools/kerneldoc/subsys/Doxyfile-dev_sound head/tools/kerneldoc/subsys/Doxyfile-dev_usb head/tools/kerneldoc/subsys/Doxyfile-geom head/tools/kerneldoc/subsys/Doxyfile-kern head/tools/kerneldoc/subsys/Doxyfile-libkern head/tools/kerneldoc/subsys/Doxyfile-linux head/tools/kerneldoc/subsys/Doxyfile-net80211 head/tools/kerneldoc/subsys/Doxyfile-netgraph head/tools/kerneldoc/subsys/Doxyfile-netinet head/tools/kerneldoc/subsys/Doxyfile-netinet6 head/tools/kerneldoc/subsys/Doxyfile-netipsec head/tools/kerneldoc/subsys/Doxyfile-opencrypto head/tools/kerneldoc/subsys/Doxyfile-vm head/tools/kerneldoc/subsys/Makefile head/tools/kerneldoc/subsys/common-Doxyfile Modified: head/tools/kerneldoc/subsys/Dependencies ============================================================================== --- head/tools/kerneldoc/subsys/Dependencies Mon Aug 24 12:52:05 2009 (r196510) +++ head/tools/kerneldoc/subsys/Dependencies Mon Aug 24 13:10:55 2009 (r196511) @@ -6,15 +6,15 @@ $(.OBJDIR)/dev_sound/dev_sound.tag: $(.OBJDIR)/dev_pci/dev_pci.tag \ $(.OBJDIR)/dev_usb/dev_usb.tag \ - $(.OBJDIR)/ac97_if.h \ - $(.OBJDIR)/channel_if.h \ - $(.OBJDIR)/feeder_if.h \ - $(.OBJDIR)/mixer_if.h + $(.OBJDIR)/include/ac97_if.h \ + $(.OBJDIR)/include/channel_if.h \ + $(.OBJDIR)/include/feeder_if.h \ + $(.OBJDIR)/include/mixer_if.h $(.OBJDIR)/dev_usb/dev_usb.tag: $(.OBJDIR)/dev_pci/dev_pci.tag \ - $(.OBJDIR)/usb_if.h + $(.OBJDIR)/include/usb_if.h -$(.OBJDIR)/dev_pci/dev_pci.tag: $(.OBJDIR)/pci_if.h \ - $(.OBJDIR)/pcib_if.h \ - $(.OBJDIR)/bus_if.h +$(.OBJDIR)/dev_pci/dev_pci.tag: $(.OBJDIR)/include/pci_if.h \ + $(.OBJDIR)/include/pcib_if.h \ + $(.OBJDIR)/include/bus_if.h Modified: head/tools/kerneldoc/subsys/Doxyfile-cam ============================================================================== --- head/tools/kerneldoc/subsys/Doxyfile-cam Mon Aug 24 12:52:05 2009 (r196510) +++ head/tools/kerneldoc/subsys/Doxyfile-cam Mon Aug 24 13:10:55 2009 (r196511) @@ -1,4 +1,4 @@ -# Doxyfile 1.4.1 +# Doxyfile 1.5.2 # $FreeBSD$ Modified: head/tools/kerneldoc/subsys/Doxyfile-crypto ============================================================================== --- head/tools/kerneldoc/subsys/Doxyfile-crypto Mon Aug 24 12:52:05 2009 (r196510) +++ head/tools/kerneldoc/subsys/Doxyfile-crypto Mon Aug 24 13:10:55 2009 (r196511) @@ -1,4 +1,4 @@ -# Doxyfile 1.4.1 +# Doxyfile 1.5.2 # $FreeBSD$ Modified: head/tools/kerneldoc/subsys/Doxyfile-dev_pci ============================================================================== --- head/tools/kerneldoc/subsys/Doxyfile-dev_pci Mon Aug 24 12:52:05 2009 (r196510) +++ head/tools/kerneldoc/subsys/Doxyfile-dev_pci Mon Aug 24 13:10:55 2009 (r196511) @@ -1,4 +1,4 @@ -# Doxyfile 1.4.1 +# Doxyfile 1.5.2 # $FreeBSD$ Modified: head/tools/kerneldoc/subsys/Doxyfile-dev_sound ============================================================================== --- head/tools/kerneldoc/subsys/Doxyfile-dev_sound Mon Aug 24 12:52:05 2009 (r196510) +++ head/tools/kerneldoc/subsys/Doxyfile-dev_sound Mon Aug 24 13:10:55 2009 (r196511) @@ -1,4 +1,4 @@ -# Doxyfile 1.4.1 +# Doxyfile 1.5.2 # $FreeBSD$ Modified: head/tools/kerneldoc/subsys/Doxyfile-dev_usb ============================================================================== --- head/tools/kerneldoc/subsys/Doxyfile-dev_usb Mon Aug 24 12:52:05 2009 (r196510) +++ head/tools/kerneldoc/subsys/Doxyfile-dev_usb Mon Aug 24 13:10:55 2009 (r196511) @@ -1,4 +1,4 @@ -# Doxyfile 1.4.1 +# Doxyfile 1.5.2 # $FreeBSD$ Modified: head/tools/kerneldoc/subsys/Doxyfile-geom ============================================================================== --- head/tools/kerneldoc/subsys/Doxyfile-geom Mon Aug 24 12:52:05 2009 (r196510) +++ head/tools/kerneldoc/subsys/Doxyfile-geom Mon Aug 24 13:10:55 2009 (r196511) @@ -1,4 +1,4 @@ -# Doxyfile 1.4.1 +# Doxyfile 1.5.2 # $FreeBSD$ Modified: head/tools/kerneldoc/subsys/Doxyfile-kern ============================================================================== --- head/tools/kerneldoc/subsys/Doxyfile-kern Mon Aug 24 12:52:05 2009 (r196510) +++ head/tools/kerneldoc/subsys/Doxyfile-kern Mon Aug 24 13:10:55 2009 (r196511) @@ -1,4 +1,4 @@ -# Doxyfile 1.4.1 +# Doxyfile 1.5.2 # $FreeBSD$ Modified: head/tools/kerneldoc/subsys/Doxyfile-libkern ============================================================================== --- head/tools/kerneldoc/subsys/Doxyfile-libkern Mon Aug 24 12:52:05 2009 (r196510) +++ head/tools/kerneldoc/subsys/Doxyfile-libkern Mon Aug 24 13:10:55 2009 (r196511) @@ -1,4 +1,4 @@ -# Doxyfile 1.4.1 +# Doxyfile 1.5.2 # $FreeBSD$ Modified: head/tools/kerneldoc/subsys/Doxyfile-linux ============================================================================== --- head/tools/kerneldoc/subsys/Doxyfile-linux Mon Aug 24 12:52:05 2009 (r196510) +++ head/tools/kerneldoc/subsys/Doxyfile-linux Mon Aug 24 13:10:55 2009 (r196511) @@ -1,4 +1,4 @@ -# Doxyfile 1.4.1 +# Doxyfile 1.5.2 # $FreeBSD$ @@ -12,6 +12,8 @@ EXTRACT_ALL = YES # for un # configuration options related to the input files #--------------------------------------------------------------------------- INPUT = $(DOXYGEN_SRC_PATH)/compat/linux \ + $(DOXYGEN_SRC_PATH)/compat/linprocfs \ + $(DOXYGEN_SRC_PATH)/compat/linsysfs \ $(DOXYGEN_LINUX_PATH) $(NOTREVIEWED) GENERATE_TAGFILE = linux/linux.tag Modified: head/tools/kerneldoc/subsys/Doxyfile-net80211 ============================================================================== --- head/tools/kerneldoc/subsys/Doxyfile-net80211 Mon Aug 24 12:52:05 2009 (r196510) +++ head/tools/kerneldoc/subsys/Doxyfile-net80211 Mon Aug 24 13:10:55 2009 (r196511) @@ -1,4 +1,4 @@ -# Doxyfile 1.4.1 +# Doxyfile 1.5.2 # $FreeBSD$ Modified: head/tools/kerneldoc/subsys/Doxyfile-netgraph ============================================================================== --- head/tools/kerneldoc/subsys/Doxyfile-netgraph Mon Aug 24 12:52:05 2009 (r196510) +++ head/tools/kerneldoc/subsys/Doxyfile-netgraph Mon Aug 24 13:10:55 2009 (r196511) @@ -1,4 +1,4 @@ -# Doxyfile 1.4.1 +# Doxyfile 1.5.2 # $FreeBSD$ Modified: head/tools/kerneldoc/subsys/Doxyfile-netinet ============================================================================== --- head/tools/kerneldoc/subsys/Doxyfile-netinet Mon Aug 24 12:52:05 2009 (r196510) +++ head/tools/kerneldoc/subsys/Doxyfile-netinet Mon Aug 24 13:10:55 2009 (r196511) @@ -1,4 +1,4 @@ -# Doxyfile 1.4.1 +# Doxyfile 1.5.2 # $FreeBSD$ Modified: head/tools/kerneldoc/subsys/Doxyfile-netinet6 ============================================================================== --- head/tools/kerneldoc/subsys/Doxyfile-netinet6 Mon Aug 24 12:52:05 2009 (r196510) +++ head/tools/kerneldoc/subsys/Doxyfile-netinet6 Mon Aug 24 13:10:55 2009 (r196511) @@ -1,4 +1,4 @@ -# Doxyfile 1.4.1 +# Doxyfile 1.5.2 # $FreeBSD$ Modified: head/tools/kerneldoc/subsys/Doxyfile-netipsec ============================================================================== --- head/tools/kerneldoc/subsys/Doxyfile-netipsec Mon Aug 24 12:52:05 2009 (r196510) +++ head/tools/kerneldoc/subsys/Doxyfile-netipsec Mon Aug 24 13:10:55 2009 (r196511) @@ -1,4 +1,4 @@ -# Doxyfile 1.4.1 +# Doxyfile 1.5.2 # $FreeBSD$ Modified: head/tools/kerneldoc/subsys/Doxyfile-opencrypto ============================================================================== --- head/tools/kerneldoc/subsys/Doxyfile-opencrypto Mon Aug 24 12:52:05 2009 (r196510) +++ head/tools/kerneldoc/subsys/Doxyfile-opencrypto Mon Aug 24 13:10:55 2009 (r196511) @@ -1,4 +1,4 @@ -# Doxyfile 1.4.1 +# Doxyfile 1.5.2 # $FreeBSD$ Modified: head/tools/kerneldoc/subsys/Doxyfile-vm ============================================================================== --- head/tools/kerneldoc/subsys/Doxyfile-vm Mon Aug 24 12:52:05 2009 (r196510) +++ head/tools/kerneldoc/subsys/Doxyfile-vm Mon Aug 24 13:10:55 2009 (r196511) @@ -1,4 +1,4 @@ -# Doxyfile 1.4.1 +# Doxyfile 1.5.2 # $FreeBSD$ Modified: head/tools/kerneldoc/subsys/Makefile ============================================================================== --- head/tools/kerneldoc/subsys/Makefile Mon Aug 24 12:52:05 2009 (r196510) +++ head/tools/kerneldoc/subsys/Makefile Mon Aug 24 13:10:55 2009 (r196511) @@ -10,49 +10,7 @@ TARGET_ARCH?= ${MACHINE_ARCH} S?=/usr/src/sys LOCALBASE?=/usr/local -MFILES+=dev/acpica/acpi_if.m -MFILES+=dev/ata/ata_if.m -MFILES+=dev/eisa/eisa_if.m -MFILES+=dev/iicbus/iicbb_if.m -MFILES+=dev/iicbus/iicbus_if.m -MFILES+=dev/mii/miibus_if.m -MFILES+=dev/mmc/mmcbr_if.m -MFILES+=dev/mmc/mmcbus_if.m -MFILES+=dev/ofw/ofw_bus_if.m -MFILES+=dev/pccard/card_if.m -MFILES+=dev/pccard/power_if.m -MFILES+=dev/pci/pci_if.m -MFILES+=dev/pci/pcib_if.m -MFILES+=dev/ppbus/ppbus_if.m -MFILES+=dev/scc/scc_if.m -MFILES+=dev/smbus/smbus_if.m -MFILES+=dev/sound/midi/mpu_if.m -MFILES+=dev/sound/midi/mpufoi_if.m -MFILES+=dev/sound/midi/synth_if.m -MFILES+=dev/sound/pcm/ac97_if.m -MFILES+=dev/sound/pcm/channel_if.m -MFILES+=dev/sound/pcm/feeder_if.m -MFILES+=dev/sound/pcm/mixer_if.m -MFILES+=dev/spibus/spibus_if.m -MFILES+=dev/uart/uart_if.m -MFILES+=dev/usb/usb_if.m -MFILES+=geom/part/g_part_if.m -MFILES+=isa/isa_if.m -MFILES+=kern/bus_if.m -MFILES+=kern/clock_if.m -MFILES+=kern/cpufreq_if.m -MFILES+=kern/device_if.m -MFILES+=kern/linker_if.m -MFILES+=kern/serdev_if.m -MFILES+=libkern/iconv_converter_if.m -MFILES+=opencrypto/cryptodev_if.m -MFILES+=pc98/pc98/canbus_if.m -MFILES+=pci/agp_if.m -MFILES+=powerpc/powerpc/mmu_if.m -MFILES+=powerpc/powerpc/pic_if.m -MFILES+=sparc64/pci/ofw_pci_if.m -MFILES+=sun4v/mdesc/mdesc_bus_if.m - +MFILES!= find ${S} -name \*.m | sed -e 's:${S}/::g' HFILES= ${MFILES:T:S/.m$/.h/} AWK?= awk @@ -73,16 +31,16 @@ usage: all: ${ALL} pdf-all:${PDF_ALL} -mfiles: ${HFILES:S/^/${.OBJDIR}\//} +mfiles: ${HFILES:S/^/${.OBJDIR}\/include\//} -DOXYGEN_DEST_PATH= ${.OBJDIR} -DOXYGEN_LATEX_DEST_PATH=${.OBJDIR} -DOXYGEN_PDF_DEST_PATH= ${.OBJDIR} +DOXYGEN_DEST_PATH?= ${.OBJDIR} +DOXYGEN_LATEX_DEST_PATH?=${.OBJDIR} +DOXYGEN_PDF_DEST_PATH?= ${.OBJDIR} -.if exists{${S}/${TARGET_ARCH}/linux} +.if exists(${S}/${TARGET_ARCH}/linux) DOXYGEN_LINUX_PATH= ${S}/${TARGET_ARCH}/linux .endif -.if exists{${S}/${TARGET_ARCH}/linux32} +.if exists(${S}/${TARGET_ARCH}/linux32) DOXYGEN_LINUX_PATH+= ${S}/${TARGET_ARCH}/linux32 .endif @@ -98,13 +56,13 @@ ${.OBJDIR}/${target}/${target}.tag: env DOXYGEN_INCLUDE_PATH=${.CURDIR} \ DOXYGEN_SRC_PATH=${S} \ DOXYGEN_DEST_PATH=${DOXYGEN_DEST_PATH} \ - DOXYGEN_SRC_INCLUDE_PATH="${S}/sys ${S}/../include ${S}/${TARGET_ARCH}/include" \ + DOXYGEN_SRC_INCLUDE_PATH="${S}/sys ${S}/../include ${S}/${TARGET_ARCH}/include ${.OBJDIR}/include" \ DOXYGEN_TARGET_ARCH=${TARGET_ARCH} \ DOXYGEN_LINUX_PATH=${DOXYGEN_LINUX_PATH} \ NOTREVIEWED=${.CURDIR}/notreviewed.dox \ PATH=${LOCALBASE}/bin:${PATH} \ doxygen ${.CURDIR}/Doxyfile-${target} - @echo "API docs for ${target} are now available in ${.OBJDIR}/${target}/." | /usr/bin/fmt + @echo "API docs for ${target} are now available in ${DOXYGEN_DEST_PATH}/${target}/." | /usr/bin/fmt pdf-${target}: ${.OBJDIR}/${target}/${target}.tag @cd ${DOXYGEN_LATEX_DEST_PATH}/${target}/latex && ${MAKE} refman.pdf && cp refman.pdf ${DOXYGEN_PDF_DEST_PATH}/${target}.pdf @@ -117,10 +75,12 @@ clean-${target}: rm -rf ${DOXYGEN_DEST_PATH}/${target} ${.OBJDIR}/${target} .endfor +CLEANDIRS+= ${.OBJDIR}/include .for file in ${MFILES} -CLEANDIRS+= ${.OBJDIR}/${file:T:S/.m$/.h/} -${.OBJDIR}/${file:T:S/.m$/.h/}: ${S}/${file} - cd ${.OBJDIR}; ${AWK} -f $S/tools/makeobjops.awk ${S}/${file} -h +CLEANFILES+= ${.OBJDIR}/include/${file:T:S/.m$/.h/} +${.OBJDIR}/include/${file:T:S/.m$/.h/}: ${S}/${file} + @mkdir -p ${.OBJDIR}/include + cd ${.OBJDIR}/include && ${AWK} -f $S/tools/makeobjops.awk ${S}/${file} -h .endfor # Modified: head/tools/kerneldoc/subsys/common-Doxyfile ============================================================================== --- head/tools/kerneldoc/subsys/common-Doxyfile Mon Aug 24 12:52:05 2009 (r196510) +++ head/tools/kerneldoc/subsys/common-Doxyfile Mon Aug 24 13:10:55 2009 (r196511) @@ -1,14 +1,14 @@ -# Doxyfile 1.4.1 +# Doxyfile 1.5.2 # $FreeBSD$ #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 PROJECT_NUMBER = CREATE_SUBDIRS = YES OUTPUT_LANGUAGE = English -USE_WINDOWS_ENCODING = NO BRIEF_MEMBER_DESC = YES REPEAT_BRIEF = YES ABBREVIATE_BRIEF = "The $name class" \ @@ -25,18 +25,20 @@ ABBREVIATE_BRIEF = "The $name clas ALWAYS_DETAILED_SEC = NO INLINE_INHERITED_MEMB = NO FULL_PATH_NAMES = YES -STRIP_FROM_PATH = +STRIP_FROM_PATH = $(DOXYGEN_SRC_PATH) $(DOXYGEN_DEST_PATH) STRIP_FROM_INC_PATH = SHORT_NAMES = NO JAVADOC_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO -DETAILS_AT_TOP = NO INHERIT_DOCS = YES -DISTRIBUTE_GROUP_DOC = NO +SEPARATE_MEMBER_PAGES = NO TAB_SIZE = 8 ALIASES = OPTIMIZE_OUTPUT_FOR_C = YES OPTIMIZE_OUTPUT_JAVA = NO +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +DISTRIBUTE_GROUP_DOC = NO SUBGROUPING = YES #--------------------------------------------------------------------------- # Build related configuration options @@ -76,9 +78,11 @@ WARN_IF_DOC_ERROR = YES WARN_NO_PARAMDOC = NO WARN_FORMAT = "$file:$line: $text" WARN_LOGFILE = + #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- +INPUT_ENCODING = UTF-8 FILE_PATTERNS = *.c \ *.cc \ *.cxx \ @@ -120,7 +124,8 @@ FILE_PATTERNS = *.c \ RECURSIVE = YES EXCLUDE = EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = */.\#* +EXCLUDE_PATTERNS = */.\#* */.svn/* +EXCLUDE_SYMBOLS = EXAMPLE_PATH = EXAMPLE_PATTERNS = * EXAMPLE_RECURSIVE = NO @@ -136,11 +141,13 @@ INLINE_SOURCES = NO STRIP_CODE_COMMENTS = YES REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES +REFERENCES_LINK_SOURCE = YES +USE_HTAGS = NO VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = NO +ALPHABETICAL_INDEX = YES COLS_IN_ALPHA_INDEX = 5 IGNORE_PREFIX = #--------------------------------------------------------------------------- @@ -220,12 +227,13 @@ ENABLE_PREPROCESSING = YES MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = YES SEARCH_INCLUDES = YES -INCLUDE_PATH = $(DOXYGEN_SRC_INCLUDE_PATH) . +INCLUDE_PATH = $(DOXYGEN_SRC_INCLUDE_PATH) \ + . INCLUDE_FILE_PATTERNS = *.h -PREDEFINED = "_KERNEL" \ - "__FreeBSD__=7" \ - "__${TARGET_ARCH}__=1" \ - "__${TARGET_ARCH}=1" +PREDEFINED = _KERNEL \ + __FreeBSD__=9 \ + __${TARGET_ARCH}__=1 \ + __${TARGET_ARCH}=1 EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- @@ -238,6 +246,7 @@ PERL_PATH = /usr/bin/perl # Configuration options related to the dot tool #--------------------------------------------------------------------------- CLASS_DIAGRAMS = NO +MSCGEN_PATH = HIDE_UNDOC_RELATIONS = YES HAVE_DOT = YES CLASS_GRAPH = YES @@ -248,14 +257,13 @@ TEMPLATE_RELATIONS = NO INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = YES CALL_GRAPH = YES +CALLER_GRAPH = YES GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES DOT_IMAGE_FORMAT = png DOT_PATH = DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1024 -MAX_DOT_GRAPH_DEPTH = 1000 +DOT_GRAPH_MAX_NODES = 50 DOT_TRANSPARENT = NO DOT_MULTI_TARGETS = YES GENERATE_LEGEND = YES From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 13:54:07 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8EF671065692; Mon, 24 Aug 2009 13:54:07 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 274828FC14; Mon, 24 Aug 2009 13:54:05 +0000 (UTC) Received: from c122-106-152-1.carlnfd1.nsw.optusnet.com.au (c122-106-152-1.carlnfd1.nsw.optusnet.com.au [122.106.152.1]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n7ODrjUw011508 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 24 Aug 2009 23:53:57 +1000 Date: Mon, 24 Aug 2009 23:53:45 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Ed Schouten In-Reply-To: <20090824124908.GF2829@hoeg.nl> Message-ID: <20090824232024.X39700@delplex.bde.org> References: <200908241053.n7OArUhX092666@svn.freebsd.org> <20090824213600.T39644@delplex.bde.org> <20090824124908.GF2829@hoeg.nl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bruce Evans Subject: Re: svn commit: r196506 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 13:54:07 -0000 On Mon, 24 Aug 2009, Ed Schouten wrote: > * Bruce Evans wrote: >> CONS_DRIVER() was a good interface, unlike CONSOLE_DRIVER(). Removing it >> completes the bitrot in the support for cn_dbctl, and completes removal >> of cn_checkc's good name at the driver level. >> >> cn_dbctl is still needed to unbreak sysctl's support for ddb (see db_main.c >> 1.4.2.1, which depends on cn_dbctl's infrastructure not having rotted) and >> can be used to unbreak polled i/o in all console drivers (not just in ddb >> mode -- it should have been named cn_ioctl) (see other mail). >> >> The higher level cngetc() and cncheckc() are still correctly named, now >> fully inconsistently with the driver level. > > Well, there are lots of things broken in the current implementation. > Just take a look at how the cn_term is entirely commented out, only > because syscons can't handle it. > > The only thing I tried to do with those changes, is remove dead code. > If someone comes up with patches to properly restore these features, I'd > be more than happy to commit them to SVN. There are some working patches in old versions (e.g., cn_dbctl last worked for syscons in RELENG_6, where I fixed it. The fix was relatively easy because none of the infrastructure or syscons support code had been removed.) I didn't even notice that cn_term was commented out. That dates from the multiple console changes in 2001, which exposed many problems. For syscons, the problem with cn_term seems to be that cn_term was only intended to be used for switching console at boot time. This is a harsh environment (can't malloc()/free()), but cn_term was implemented mainly for syscons so the switch then should have been tested. Bruce From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 16:19:47 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFA54106564A; Mon, 24 Aug 2009 16:19:47 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9C5DD8FC12; Mon, 24 Aug 2009 16:19:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OGJlvD099886; Mon, 24 Aug 2009 16:19:47 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OGJlvq099876; Mon, 24 Aug 2009 16:19:47 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908241619.n7OGJlvq099876@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 24 Aug 2009 16:19:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196512 - in head/sys: amd64/amd64 amd64/linux32 compat/ia32 i386/i386 i386/linux kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 16:19:47 -0000 Author: bz Date: Mon Aug 24 16:19:47 2009 New Revision: 196512 URL: http://svn.freebsd.org/changeset/base/196512 Log: Fix handling of .note.ABI-tag section for GNU systems [1]. Handle GNU/Linux according to LSB Core Specification 4.0, Chapter 11. Object Format, 11.8. ABI note tag. Also check the first word of desc, not only name, according to glibc abi-tags specification to distinguish between Linux and kFreeBSD. Add explicit handling for Debian GNU/kFreeBSD, which runs on our kernels as well [2]. In {amd64,i386}/trap.c, when checking osrel of the current process, also check the ABI to not change the signal behaviour for Linux binary processes, now that we save an osrel version for all three from the lists above in struct proc [2]. These changes make it possible to run FreeBSD, Debian GNU/kFreeBSD and Linux binaries on the same machine again for at least i386 and amd64, and no longer break kFreeBSD which was detected as GNU(/Linux). PR: kern/135468 Submitted by: dchagin [1] (initial patch) Suggested by: kib [2] Tested by: Petr Salinger (Petr.Salinger seznam.cz) for kFreeBSD Reviewed by: kib MFC after: 3 days Modified: head/sys/amd64/amd64/elf_machdep.c head/sys/amd64/amd64/trap.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/compat/ia32/ia32_sysvec.c head/sys/i386/i386/elf_machdep.c head/sys/i386/i386/trap.c head/sys/i386/linux/linux_sysvec.c head/sys/kern/imgact_elf.c head/sys/sys/imgact_elf.h Modified: head/sys/amd64/amd64/elf_machdep.c ============================================================================== --- head/sys/amd64/amd64/elf_machdep.c Mon Aug 24 13:10:55 2009 (r196511) +++ head/sys/amd64/amd64/elf_machdep.c Mon Aug 24 16:19:47 2009 (r196512) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -108,6 +109,22 @@ SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_AN (sysinit_cfunc_t) elf64_insert_brand_entry, &freebsd_brand_oinfo); +static Elf64_Brandinfo kfreebsd_brand_info = { + .brand = ELFOSABI_FREEBSD, + .machine = EM_X86_64, + .compat_3_brand = "FreeBSD", + .emul_path = NULL, + .interp_path = "/lib/ld-kfreebsd-x86-64.so.1", + .sysvec = &elf64_freebsd_sysvec, + .interp_newpath = NULL, + .brand_note = &elf64_kfreebsd_brandnote, + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE +}; + +SYSINIT(kelf64, SI_SUB_EXEC, SI_ORDER_ANY, + (sysinit_cfunc_t) elf64_insert_brand_entry, + &kfreebsd_brand_info); + void elf64_dump_thread(struct thread *td __unused, void *dst __unused, Modified: head/sys/amd64/amd64/trap.c ============================================================================== --- head/sys/amd64/amd64/trap.c Mon Aug 24 13:10:55 2009 (r196511) +++ head/sys/amd64/amd64/trap.c Mon Aug 24 16:19:47 2009 (r196512) @@ -409,7 +409,9 @@ trap(struct trapframe *frame) * This check also covers the images * without the ABI-tag ELF note. */ - if (p->p_osrel >= 700004) { + if (SV_CURPROC_ABI() == + SV_ABI_FREEBSD && + p->p_osrel >= 700004) { i = SIGSEGV; ucode = SEGV_ACCERR; } else { Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Mon Aug 24 13:10:55 2009 (r196511) +++ head/sys/amd64/linux32/linux32_sysvec.c Mon Aug 24 16:19:47 2009 (r196512) @@ -127,6 +127,7 @@ static void linux_sendsig(sig_t catc static void exec_linux_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings); static void linux32_fixlimit(struct rlimit *rl, int which); +static boolean_t linux32_trans_osrel(const Elf_Note *note, int32_t *osrel); static eventhandler_tag linux_exit_tag; static eventhandler_tag linux_schedtail_tag; @@ -1066,14 +1067,38 @@ struct sysentvec elf_linux_sysvec = { .sv_flags = SV_ABI_LINUX | SV_ILP32 | SV_IA32 }; -static char GNULINUX_ABI_VENDOR[] = "GNU"; +static char GNU_ABI_VENDOR[] = "GNU"; +static int GNULINUX_ABI_DESC = 0; + +static boolean_t +linux32_trans_osrel(const Elf_Note *note, int32_t *osrel) +{ + const Elf32_Word *desc; + uintptr_t p; + + p = (uintptr_t)(note + 1); + p += roundup2(note->n_namesz, sizeof(Elf32_Addr)); + + desc = (const Elf32_Word *)p; + if (desc[0] != GNULINUX_ABI_DESC) + return (FALSE); + + /* + * For linux we encode osrel as follows (see linux_mib.c): + * VVVMMMIII (version, major, minor), see linux_mib.c. + */ + *osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3]; + + return (TRUE); +} static Elf_Brandnote linux32_brandnote = { - .hdr.n_namesz = sizeof(GNULINUX_ABI_VENDOR), - .hdr.n_descsz = 16, + .hdr.n_namesz = sizeof(GNU_ABI_VENDOR), + .hdr.n_descsz = 16, /* XXX at least 16 */ .hdr.n_type = 1, - .vendor = GNULINUX_ABI_VENDOR, - .flags = 0 + .vendor = GNU_ABI_VENDOR, + .flags = BN_TRANSLATE_OSREL, + .trans_osrel = linux32_trans_osrel }; static Elf32_Brandinfo linux_brand = { Modified: head/sys/compat/ia32/ia32_sysvec.c ============================================================================== --- head/sys/compat/ia32/ia32_sysvec.c Mon Aug 24 13:10:55 2009 (r196511) +++ head/sys/compat/ia32/ia32_sysvec.c Mon Aug 24 16:19:47 2009 (r196512) @@ -172,6 +172,21 @@ SYSINIT(oia32, SI_SUB_EXEC, SI_ORDER_ANY (sysinit_cfunc_t) elf32_insert_brand_entry, &ia32_brand_oinfo); +static Elf32_Brandinfo kia32_brand_info = { + .brand = ELFOSABI_FREEBSD, + .machine = EM_386, + .compat_3_brand = "FreeBSD", + .emul_path = NULL, + .interp_path = "/lib/ld.so.1", + .sysvec = &ia32_freebsd_sysvec, + .brand_note = &elf32_kfreebsd_brandnote, + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE +}; + +SYSINIT(kia32, SI_SUB_EXEC, SI_ORDER_ANY, + (sysinit_cfunc_t) elf32_insert_brand_entry, + &kia32_brand_info); + void elf32_dump_thread(struct thread *td __unused, void *dst __unused, Modified: head/sys/i386/i386/elf_machdep.c ============================================================================== --- head/sys/i386/i386/elf_machdep.c Mon Aug 24 13:10:55 2009 (r196511) +++ head/sys/i386/i386/elf_machdep.c Mon Aug 24 16:19:47 2009 (r196512) @@ -108,6 +108,22 @@ SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_AN (sysinit_cfunc_t) elf32_insert_brand_entry, &freebsd_brand_oinfo); +static Elf32_Brandinfo kfreebsd_brand_info = { + .brand = ELFOSABI_FREEBSD, + .machine = EM_386, + .compat_3_brand = "FreeBSD", + .emul_path = NULL, + .interp_path = "/lib/ld.so.1", + .sysvec = &elf32_freebsd_sysvec, + .interp_newpath = NULL, + .brand_note = &elf32_kfreebsd_brandnote, + .flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE +}; + +SYSINIT(kelf32, SI_SUB_EXEC, SI_ORDER_ANY, + (sysinit_cfunc_t) elf32_insert_brand_entry, + &kfreebsd_brand_info); + void elf32_dump_thread(struct thread *td __unused, void *dst __unused, Modified: head/sys/i386/i386/trap.c ============================================================================== --- head/sys/i386/i386/trap.c Mon Aug 24 13:10:55 2009 (r196511) +++ head/sys/i386/i386/trap.c Mon Aug 24 16:19:47 2009 (r196512) @@ -423,7 +423,9 @@ trap(struct trapframe *frame) * This check also covers the images * without the ABI-tag ELF note. */ - if (p->p_osrel >= 700004) { + if (SV_CURPROC_ABI() == + SV_ABI_FREEBSD && + p->p_osrel >= 700004) { i = SIGSEGV; ucode = SEGV_ACCERR; } else { Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Mon Aug 24 13:10:55 2009 (r196511) +++ head/sys/i386/linux/linux_sysvec.c Mon Aug 24 16:19:47 2009 (r196512) @@ -108,6 +108,7 @@ static void linux_sendsig(sig_t catc static void exec_linux_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings); static register_t *linux_copyout_strings(struct image_params *imgp); +static boolean_t linux_trans_osrel(const Elf_Note *note, int32_t *osrel); static int linux_szplatform; const char *linux_platform; @@ -1027,14 +1028,38 @@ struct sysentvec elf_linux_sysvec = { .sv_flags = SV_ABI_LINUX | SV_IA32 | SV_ILP32 }; -static char GNULINUX_ABI_VENDOR[] = "GNU"; +static char GNU_ABI_VENDOR[] = "GNU"; +static int GNULINUX_ABI_DESC = 0; + +static boolean_t +linux_trans_osrel(const Elf_Note *note, int32_t *osrel) +{ + const Elf32_Word *desc; + uintptr_t p; + + p = (uintptr_t)(note + 1); + p += roundup2(note->n_namesz, sizeof(Elf32_Addr)); + + desc = (const Elf32_Word *)p; + if (desc[0] != GNULINUX_ABI_DESC) + return (FALSE); + + /* + * For linux we encode osrel as follows (see linux_mib.c): + * VVVMMMIII (version, major, minor), see linux_mib.c. + */ + *osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3]; + + return (TRUE); +} static Elf_Brandnote linux_brandnote = { - .hdr.n_namesz = sizeof(GNULINUX_ABI_VENDOR), - .hdr.n_descsz = 16, + .hdr.n_namesz = sizeof(GNU_ABI_VENDOR), + .hdr.n_descsz = 16, /* XXX at least 16 */ .hdr.n_type = 1, - .vendor = GNULINUX_ABI_VENDOR, - .flags = 0 + .vendor = GNU_ABI_VENDOR, + .flags = BN_TRANSLATE_OSREL, + .trans_osrel = linux_trans_osrel }; static Elf32_Brandinfo linux_brand = { Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Mon Aug 24 13:10:55 2009 (r196511) +++ head/sys/kern/imgact_elf.c Mon Aug 24 16:19:47 2009 (r196512) @@ -86,6 +86,9 @@ static int __elfN(load_section)(struct v vm_offset_t offset, caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot, size_t pagesize); static int __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp); +static boolean_t __elfN(freebsd_trans_osrel)(const Elf_Note *note, + int32_t *osrel); +static boolean_t kfreebsd_trans_osrel(const Elf_Note *note, int32_t *osrel); static boolean_t __elfN(check_note)(struct image_params *imgp, Elf_Brandnote *checknote, int32_t *osrel); @@ -116,9 +119,56 @@ Elf_Brandnote __elfN(freebsd_brandnote) .hdr.n_descsz = sizeof(int32_t), .hdr.n_type = 1, .vendor = FREEBSD_ABI_VENDOR, - .flags = BN_CAN_FETCH_OSREL + .flags = BN_TRANSLATE_OSREL, + .trans_osrel = __elfN(freebsd_trans_osrel) }; +static boolean_t +__elfN(freebsd_trans_osrel)(const Elf_Note *note, int32_t *osrel) +{ + uintptr_t p; + + p = (uintptr_t)(note + 1); + p += roundup2(note->n_namesz, sizeof(Elf32_Addr)); + *osrel = *(const int32_t *)(p); + + return (TRUE); +} + +static const char GNU_ABI_VENDOR[] = "GNU"; +static int GNU_KFREEBSD_ABI_DESC = 3; + +Elf_Brandnote __elfN(kfreebsd_brandnote) = { + .hdr.n_namesz = sizeof(GNU_ABI_VENDOR), + .hdr.n_descsz = 16, /* XXX at least 16 */ + .hdr.n_type = 1, + .vendor = GNU_ABI_VENDOR, + .flags = BN_TRANSLATE_OSREL, + .trans_osrel = kfreebsd_trans_osrel +}; + +static boolean_t +kfreebsd_trans_osrel(const Elf_Note *note, int32_t *osrel) +{ + const Elf32_Word *desc; + uintptr_t p; + + p = (uintptr_t)(note + 1); + p += roundup2(note->n_namesz, sizeof(Elf32_Addr)); + + desc = (const Elf32_Word *)p; + if (desc[0] != GNU_KFREEBSD_ABI_DESC) + return (FALSE); + + /* + * Debian GNU/kFreeBSD embed the earliest compatible kernel version + * (__FreeBSD_version: Rxx) in the LSB way. + */ + *osrel = desc[1] * 100000 + desc[2] * 1000 + desc[3]; + + return (TRUE); +} + int __elfN(insert_brand_entry)(Elf_Brandinfo *entry) { @@ -1371,11 +1421,9 @@ __elfN(check_note)(struct image_params * * Fetch the osreldate for binary * from the ELF OSABI-note if necessary. */ - if ((checknote->flags & BN_CAN_FETCH_OSREL) != 0 && - osrel != NULL) - *osrel = *(const int32_t *) (note_name + - roundup2(checknote->hdr.n_namesz, - sizeof(Elf32_Addr))); + if ((checknote->flags & BN_TRANSLATE_OSREL) != 0 && + checknote->trans_osrel != NULL) + return (checknote->trans_osrel(note, osrel)); return (TRUE); nextnote: Modified: head/sys/sys/imgact_elf.h ============================================================================== --- head/sys/sys/imgact_elf.h Mon Aug 24 13:10:55 2009 (r196511) +++ head/sys/sys/imgact_elf.h Mon Aug 24 16:19:47 2009 (r196512) @@ -58,7 +58,10 @@ typedef struct { Elf_Note hdr; const char * vendor; int flags; -#define BN_CAN_FETCH_OSREL 0x0001 + boolean_t (*trans_osrel)(const Elf_Note *, int32_t *); +#define BN_CAN_FETCH_OSREL 0x0001 /* Deprecated. */ +#define BN_TRANSLATE_OSREL 0x0002 /* Use trans_osrel fetch osrel after */ + /* checking ABI contraint if needed. */ } Elf_Brandnote; typedef struct { @@ -91,6 +94,7 @@ void __elfN(dump_thread)(struct thread * extern int __elfN(fallback_brand); extern Elf_Brandnote __elfN(freebsd_brandnote); +extern Elf_Brandnote __elfN(kfreebsd_brandnote); #endif /* _KERNEL */ #endif /* !_SYS_IMGACT_ELF_H_ */ From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 16:46:06 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33A771065692; Mon, 24 Aug 2009 16:46:06 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-fx0-f210.google.com (mail-fx0-f210.google.com [209.85.220.210]) by mx1.freebsd.org (Postfix) with ESMTP id 3CD888FC08; Mon, 24 Aug 2009 16:46:05 +0000 (UTC) Received: by fxm6 with SMTP id 6so1462889fxm.43 for ; Mon, 24 Aug 2009 09:46:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=sxnpxFiPso0XKlpE0sqKEc4x/3RSWZ89CUnzerJ5H5E=; b=xb3XIDt0hfN9NZAnlSkYXNnyIX5FrS7uSVcKTafqhzzFtC0iTNJMLn9P8Qqmpoe5v3 Y2FCxzWvAPBZvql5yEhNbpjuGw+C5C/yNNj9uK1k8sxVtrKCgos+YacYtLpvmroBaPLK iiY6j9gqcdNXYND/usihknjki6+g7f2dM6m8w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=BXLErh4o2Xo9+fspAZMRYl6Thn/qsZWfdeBF/Cxq9LG60YyNrbYpTADqNcW+dyU9k/ Ud5GmedglCNuBVWzODVEgERgXcQJVCL350lWIFyeSi46OFaTsIcRUKAOIvu/rZ4TwKrN UlnDRY94eQfsvlxPQfLOjIsY7foC2beH2OGC4= MIME-Version: 1.0 Sender: asmrookie@gmail.com Received: by 10.223.6.23 with SMTP id 23mr5037692fax.89.1251132364288; Mon, 24 Aug 2009 09:46:04 -0700 (PDT) In-Reply-To: <200908201917.n7KJHrYW096093@svn.freebsd.org> References: <200908201917.n7KJHrYW096093@svn.freebsd.org> Date: Mon, 24 Aug 2009 18:46:04 +0200 X-Google-Sender-Auth: fc926041d502d225 Message-ID: <3bbf2fe10908240946k470903ecj20f44da5976fc514@mail.gmail.com> From: Attilio Rao To: John Baldwin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196403 - in head/sys: dev/aac dev/acpica dev/adb dev/amdtemp dev/amr dev/ata dev/atkbdc dev/bktr dev/drm dev/ips dev/mfi dev/mlx dev/mmc dev/pccbb dev/pst dev/rp dev/sound/pci/hda dev/... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 16:46:06 -0000 2009/8/20 John Baldwin : > Author: jhb > Date: Thu Aug 20 19:17:53 2009 > New Revision: 196403 > URL: http://svn.freebsd.org/changeset/base/196403 > > Log: > Temporarily revert the new-bus locking for 8.0 release. It will be > reintroduced after HEAD is reopened for commits by re@. Thanks a lot for doing this in my absence. Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 17:18:17 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB0EA106568B; Mon, 24 Aug 2009 17:18:17 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA49B8FC08; Mon, 24 Aug 2009 17:18:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OHIHTr001263; Mon, 24 Aug 2009 17:18:17 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OHIHVN001259; Mon, 24 Aug 2009 17:18:17 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200908241718.n7OHIHVN001259@svn.freebsd.org> From: Brian Somers Date: Mon, 24 Aug 2009 17:18:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196513 - head/usr.sbin/ppp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 17:18:18 -0000 Author: brian Date: Mon Aug 24 17:18:17 2009 New Revision: 196513 URL: http://svn.freebsd.org/changeset/base/196513 Log: When realloc()ing device memory for transfer to another ppp process, don't continue to use the realloc()d pointer - it might have changed! Remove some stray diagnostics while I'm here. MFC after: 3 days Modified: head/usr.sbin/ppp/ether.c head/usr.sbin/ppp/netgraph.c head/usr.sbin/ppp/tty.c Modified: head/usr.sbin/ppp/ether.c ============================================================================== --- head/usr.sbin/ppp/ether.c Mon Aug 24 16:19:47 2009 (r196512) +++ head/usr.sbin/ppp/ether.c Mon Aug 24 17:18:17 2009 (r196513) @@ -193,17 +193,18 @@ static void ether_device2iov(struct device *d, struct iovec *iov, int *niov, int maxiov __unused, int *auxfd, int *nauxfd) { - struct etherdevice *dev = device2ether(d); + struct etherdevice *dev; int sz = physical_MaxDeviceSize(); - iov[*niov].iov_base = realloc(d, sz); - if (iov[*niov].iov_base == NULL) { + iov[*niov].iov_base = d = realloc(d, sz); + if (d == NULL) { log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); AbortProgram(EX_OSERR); } iov[*niov].iov_len = sz; (*niov)++; + dev = device2ether(d); if (dev->cs >= 0) { *auxfd = dev->cs; (*nauxfd)++; Modified: head/usr.sbin/ppp/netgraph.c ============================================================================== --- head/usr.sbin/ppp/netgraph.c Mon Aug 24 16:19:47 2009 (r196512) +++ head/usr.sbin/ppp/netgraph.c Mon Aug 24 17:18:17 2009 (r196513) @@ -235,7 +235,6 @@ ng_Read(struct physical *p, void *v, siz { char hook[NG_HOOKSIZ]; -log_Printf(LogDEBUG, "ng_Read\n"); switch (p->dl->state) { case DATALINK_DIAL: case DATALINK_LOGIN: @@ -282,17 +281,18 @@ static void ng_device2iov(struct device *d, struct iovec *iov, int *niov, int maxiov __unused, int *auxfd, int *nauxfd) { - struct ngdevice *dev = device2ng(d); + struct ngdevice *dev; int sz = physical_MaxDeviceSize(); - iov[*niov].iov_base = realloc(d, sz); - if (iov[*niov].iov_base == NULL) { + iov[*niov].iov_base = d = realloc(d, sz); + if (d == NULL) { log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); AbortProgram(EX_OSERR); } iov[*niov].iov_len = sz; (*niov)++; + dev = device2ng(d); *auxfd = dev->cs; (*nauxfd)++; } Modified: head/usr.sbin/ppp/tty.c ============================================================================== --- head/usr.sbin/ppp/tty.c Mon Aug 24 16:19:47 2009 (r196512) +++ head/usr.sbin/ppp/tty.c Mon Aug 24 17:18:17 2009 (r196513) @@ -384,7 +384,6 @@ UnloadLineDiscipline(struct physical *p) struct ttydevice *dev = device2tty(p->handler); if (isngtty(dev)) { -log_Printf(LogPHASE, "back to speed %d\n", dev->real.speed); if (!physical_SetSpeed(p, dev->real.speed)) log_Printf(LogWARN, "Couldn't reset tty speed to %d\n", dev->real.speed); dev->real.speed = 0; @@ -582,17 +581,19 @@ tty_device2iov(struct device *d, struct #endif ) { - struct ttydevice *dev = device2tty(d); + struct ttydevice *dev; int sz = physical_MaxDeviceSize(); - iov[*niov].iov_base = realloc(d, sz); - if (iov[*niov].iov_base == NULL) { + iov[*niov].iov_base = d = realloc(d, sz); + if (d == NULL) { log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); AbortProgram(EX_OSERR); } iov[*niov].iov_len = sz; (*niov)++; + dev = device2tty(d); + #ifndef NONETGRAPH if (dev->cs >= 0) { *auxfd = dev->cs; From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 17:19:45 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6023E106568F; Mon, 24 Aug 2009 17:19:45 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E5D48FC19; Mon, 24 Aug 2009 17:19:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OHJjit001327; Mon, 24 Aug 2009 17:19:45 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OHJjlL001322; Mon, 24 Aug 2009 17:19:45 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200908241719.n7OHJjlL001322@svn.freebsd.org> From: Brian Somers Date: Mon, 24 Aug 2009 17:19:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196514 - head/usr.sbin/ppp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 17:19:45 -0000 Author: brian Date: Mon Aug 24 17:19:45 2009 New Revision: 196514 URL: http://svn.freebsd.org/changeset/base/196514 Log: When ``ppp -direct'' is invoked by a program that uses pipe(2) to create stdin and stdout, don't blindly try to use stdin as a bi-directional channel. Instead, detect the pipe and set up a special exec handler that indirects write() calls through stdout. This fixes the problem where ``set device "!ssh -e none host ppp -direct label"'' no longer works with an openssh-5.2 server side as that version of openssh ignores the USE_PIPES config setting and *always* uses pipes (rather than socketpair) for stdin/stdout channels. MFC after: 3 days Modified: head/usr.sbin/ppp/exec.c head/usr.sbin/ppp/exec.h head/usr.sbin/ppp/main.c head/usr.sbin/ppp/physical.c Modified: head/usr.sbin/ppp/exec.c ============================================================================== --- head/usr.sbin/ppp/exec.c Mon Aug 24 17:18:17 2009 (r196513) +++ head/usr.sbin/ppp/exec.c Mon Aug 24 17:19:45 2009 (r196514) @@ -35,7 +35,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -63,24 +65,106 @@ #include "cbcp.h" #include "datalink.h" #include "id.h" +#include "main.h" #include "exec.h" -static struct device execdevice = { + +struct execdevice { + struct device dev; /* What struct physical knows about */ + int fd_out; /* output descriptor */ +}; + +#define device2exec(d) ((d)->type == EXEC_DEVICE ? (struct execdevice *)d : NULL) + +unsigned +exec_DeviceSize(void) +{ + return sizeof(struct execdevice); +} + +static void +exec_Free(struct physical *p) +{ + struct execdevice *dev = device2exec(p->handler); + + if (dev->fd_out != -1) + close(dev->fd_out); + free(dev); +} + +static void +exec_device2iov(struct device *d, struct iovec *iov, int *niov, + int maxiov __unused, int *auxfd, int *nauxfd) +{ + struct execdevice *dev; + int sz = physical_MaxDeviceSize(); + + iov[*niov].iov_base = d = realloc(d, sz); + if (d == NULL) { + log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); + AbortProgram(EX_OSERR); + } + iov[*niov].iov_len = sz; + (*niov)++; + + dev = device2exec(d); + if (dev->fd_out >= 0) { + *auxfd = dev->fd_out; + (*nauxfd)++; + } +} + +static int +exec_RemoveFromSet(struct physical *p, fd_set *r, fd_set *w, fd_set *e) +{ + struct execdevice *dev = device2exec(p->handler); + int sets; + + p->handler->removefromset = NULL; + sets = physical_RemoveFromSet(p, r, w, e); + p->handler->removefromset = exec_RemoveFromSet; + + if (dev->fd_out >= 0) { + if (w && FD_ISSET(dev->fd_out, w)) { + FD_CLR(dev->fd_out, w); + log_Printf(LogTIMER, "%s: fdunset(w) %d\n", p->link.name, dev->fd_out); + sets++; + } + if (e && FD_ISSET(dev->fd_out, e)) { + FD_CLR(dev->fd_out, e); + log_Printf(LogTIMER, "%s: fdunset(e) %d\n", p->link.name, dev->fd_out); + sets++; + } + } + + return sets; +} + +static ssize_t +exec_Write(struct physical *p, const void *v, size_t n) +{ + struct execdevice *dev = device2exec(p->handler); + int fd = dev->fd_out == -1 ? p->fd : dev->fd_out; + + return write(fd, v, n); +} + +static struct device baseexecdevice = { EXEC_DEVICE, "exec", 0, { CD_NOTREQUIRED, 0 }, NULL, + exec_RemoveFromSet, NULL, NULL, NULL, NULL, NULL, + exec_Free, NULL, - NULL, - NULL, - NULL, - NULL, + exec_Write, + exec_device2iov, NULL, NULL, NULL @@ -88,146 +172,238 @@ static struct device execdevice = { struct device * exec_iov2device(int type, struct physical *p, struct iovec *iov, - int *niov, int maxiov __unused, int *auxfd __unused, - int *nauxfd __unused) + int *niov, int maxiov __unused, int *auxfd, int *nauxfd) { if (type == EXEC_DEVICE) { - free(iov[(*niov)++].iov_base); - physical_SetupStack(p, execdevice.name, PHYSICAL_NOFORCE); - return &execdevice; + struct execdevice *dev = (struct execdevice *)iov[(*niov)++].iov_base; + + dev = realloc(dev, sizeof *dev); /* Reduce to the correct size */ + if (dev == NULL) { + log_Printf(LogALERT, "Failed to allocate memory: %d\n", + (int)(sizeof *dev)); + AbortProgram(EX_OSERR); + } + + if (*nauxfd) { + dev->fd_out = *auxfd; + (*nauxfd)--; + } else + dev->fd_out = -1; + + /* Refresh function pointers etc */ + memcpy(&dev->dev, &baseexecdevice, sizeof dev->dev); + + physical_SetupStack(p, dev->dev.name, PHYSICAL_NOFORCE); + return &dev->dev; } return NULL; } +static int +exec_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n) +{ + struct physical *p = descriptor2physical(d); + struct execdevice *dev = device2exec(p->handler); + int result = 0; + + if (w && dev->fd_out >= 0) { + FD_SET(dev->fd_out, w); + log_Printf(LogTIMER, "%s: fdset(w) %d\n", p->link.name, dev->fd_out); + result++; + w = NULL; + } + + if (e && dev->fd_out >= 0) { + FD_SET(dev->fd_out, e); + log_Printf(LogTIMER, "%s: fdset(e) %d\n", p->link.name, dev->fd_out); + result++; + } + + if (result && *n <= dev->fd_out) + *n = dev->fd_out + 1; + + return result + physical_doUpdateSet(d, r, w, e, n, 0); +} + +static int +exec_IsSet(struct fdescriptor *d, const fd_set *fdset) +{ + struct physical *p = descriptor2physical(d); + struct execdevice *dev = device2exec(p->handler); + int result = dev->fd_out >= 0 && FD_ISSET(dev->fd_out, fdset); + result += physical_IsSet(d, fdset); + + return result; +} + struct device * exec_Create(struct physical *p) { - if (p->fd < 0 && *p->name.full == '!') { - int fids[2], type; - - p->fd--; /* We own the device but maybe can't use it - change fd */ - type = physical_IsSync(p) ? SOCK_DGRAM : SOCK_STREAM; + struct execdevice *dev; - if (socketpair(AF_UNIX, type, PF_UNSPEC, fids) < 0) - log_Printf(LogPHASE, "Unable to create pipe for line exec: %s\n", - strerror(errno)); - else { - static int child_status; /* This variable is abused ! */ - int stat, argc, i, ret, wret, pidpipe[2]; - pid_t pid, realpid; - char *argv[MAXARGS]; - - stat = fcntl(fids[0], F_GETFL, 0); - if (stat > 0) { - stat |= O_NONBLOCK; - fcntl(fids[0], F_SETFL, stat); + dev = NULL; + if (p->fd < 0) { + if (*p->name.full == '!') { + int fids[2], type; + + if ((dev = malloc(sizeof *dev)) == NULL) { + log_Printf(LogWARN, "%s: Cannot allocate an exec device: %s\n", + p->link.name, strerror(errno)); + return NULL; } - realpid = getpid(); - if (pipe(pidpipe) == -1) { - log_Printf(LogPHASE, "Unable to pipe for line exec: %s\n", + dev->fd_out = -1; + + p->fd--; /* We own the device but maybe can't use it - change fd */ + type = physical_IsSync(p) ? SOCK_DGRAM : SOCK_STREAM; + + if (socketpair(AF_UNIX, type, PF_UNSPEC, fids) < 0) { + log_Printf(LogPHASE, "Unable to create pipe for line exec: %s\n", strerror(errno)); - close(fids[1]); - } else switch ((pid = fork())) { - case -1: - log_Printf(LogPHASE, "Unable to fork for line exec: %s\n", + free(dev); + dev = NULL; + } else { + static int child_status; /* This variable is abused ! */ + int stat, argc, i, ret, wret, pidpipe[2]; + pid_t pid, realpid; + char *argv[MAXARGS]; + + stat = fcntl(fids[0], F_GETFL, 0); + if (stat > 0) { + stat |= O_NONBLOCK; + fcntl(fids[0], F_SETFL, stat); + } + realpid = getpid(); + if (pipe(pidpipe) == -1) { + log_Printf(LogPHASE, "Unable to pipe for line exec: %s\n", strerror(errno)); - close(pidpipe[0]); - close(pidpipe[1]); close(fids[1]); - break; - - case 0: - close(pidpipe[0]); close(fids[0]); - timer_TermService(); -#ifndef NOSUID - setuid(ID0realuid()); -#endif - - child_status = 0; - switch ((pid = vfork())) { - case 0: - close(pidpipe[1]); - break; - - case -1: - ret = errno; - log_Printf(LogPHASE, "Unable to vfork to drop parent: %s\n", - strerror(errno)); - close(pidpipe[1]); - _exit(ret); - - default: - write(pidpipe[1], &pid, sizeof pid); - close(pidpipe[1]); - _exit(child_status); /* The error from exec() ! */ - } - - log_Printf(LogDEBUG, "Exec'ing ``%s''\n", p->name.base); - - if ((argc = MakeArgs(p->name.base, argv, VECSIZE(argv), - PARSE_REDUCE|PARSE_NOHASH)) < 0) { - log_Printf(LogWARN, "Syntax error in exec command\n"); - _exit(ESRCH); - } - - command_Expand(argv, argc, (char const *const *)argv, - p->dl->bundle, 0, realpid); - - dup2(fids[1], STDIN_FILENO); - dup2(fids[1], STDOUT_FILENO); - dup2(fids[1], STDERR_FILENO); - for (i = getdtablesize(); i > STDERR_FILENO; i--) - fcntl(i, F_SETFD, 1); - - execvp(*argv, argv); - child_status = errno; /* Only works for vfork() */ - printf("execvp failed: %s: %s\r\n", *argv, strerror(child_status)); - _exit(child_status); - break; - - default: - close(pidpipe[1]); - close(fids[1]); - if (read(pidpipe[0], &p->session_owner, sizeof p->session_owner) != - sizeof p->session_owner) - p->session_owner = (pid_t)-1; - close(pidpipe[0]); - while ((wret = waitpid(pid, &stat, 0)) == -1 && errno == EINTR) - ; - if (wret == -1) { - log_Printf(LogWARN, "Waiting for child process: %s\n", + free(dev); + dev = NULL; + } else switch ((pid = fork())) { + case -1: + log_Printf(LogPHASE, "Unable to fork for line exec: %s\n", strerror(errno)); + close(pidpipe[0]); + close(pidpipe[1]); + close(fids[1]); close(fids[0]); - p->session_owner = (pid_t)-1; - break; - } else if (WIFSIGNALED(stat)) { - log_Printf(LogWARN, "Child process received sig %d !\n", - WTERMSIG(stat)); - close(fids[0]); - p->session_owner = (pid_t)-1; break; - } else if (WIFSTOPPED(stat)) { - log_Printf(LogWARN, "Child process received stop sig %d !\n", - WSTOPSIG(stat)); - /* I guess that's ok.... */ - } else if ((ret = WEXITSTATUS(stat))) { - log_Printf(LogWARN, "Cannot exec \"%s\": %s\n", p->name.base, - strerror(ret)); + + case 0: + close(pidpipe[0]); close(fids[0]); - p->session_owner = (pid_t)-1; + timer_TermService(); + #ifndef NOSUID + setuid(ID0realuid()); + #endif + + child_status = 0; + switch ((pid = vfork())) { + case 0: + close(pidpipe[1]); + break; + + case -1: + ret = errno; + log_Printf(LogPHASE, "Unable to vfork to drop parent: %s\n", + strerror(errno)); + close(pidpipe[1]); + _exit(ret); + + default: + write(pidpipe[1], &pid, sizeof pid); + close(pidpipe[1]); + _exit(child_status); /* The error from exec() ! */ + } + + log_Printf(LogDEBUG, "Exec'ing ``%s''\n", p->name.base); + + if ((argc = MakeArgs(p->name.base, argv, VECSIZE(argv), + PARSE_REDUCE|PARSE_NOHASH)) < 0) { + log_Printf(LogWARN, "Syntax error in exec command\n"); + _exit(ESRCH); + } + + command_Expand(argv, argc, (char const *const *)argv, + p->dl->bundle, 0, realpid); + + dup2(fids[1], STDIN_FILENO); + dup2(fids[1], STDOUT_FILENO); + dup2(fids[1], STDERR_FILENO); + for (i = getdtablesize(); i > STDERR_FILENO; i--) + fcntl(i, F_SETFD, 1); + + execvp(*argv, argv); + child_status = errno; /* Only works for vfork() */ + printf("execvp failed: %s: %s\r\n", *argv, strerror(child_status)); + _exit(child_status); break; - } - p->fd = fids[0]; - log_Printf(LogDEBUG, "Using descriptor %d for child\n", p->fd); - physical_SetupStack(p, execdevice.name, PHYSICAL_NOFORCE); - if (p->cfg.cd.necessity != CD_DEFAULT) - log_Printf(LogWARN, "Carrier settings ignored\n"); - return &execdevice; + + default: + close(pidpipe[1]); + close(fids[1]); + if (read(pidpipe[0], &p->session_owner, sizeof p->session_owner) != + sizeof p->session_owner) + p->session_owner = (pid_t)-1; + close(pidpipe[0]); + while ((wret = waitpid(pid, &stat, 0)) == -1 && errno == EINTR) + ; + if (wret == -1) { + log_Printf(LogWARN, "Waiting for child process: %s\n", + strerror(errno)); + close(fids[0]); + p->session_owner = (pid_t)-1; + break; + } else if (WIFSIGNALED(stat)) { + log_Printf(LogWARN, "Child process received sig %d !\n", + WTERMSIG(stat)); + close(fids[0]); + p->session_owner = (pid_t)-1; + break; + } else if (WIFSTOPPED(stat)) { + log_Printf(LogWARN, "Child process received stop sig %d !\n", + WSTOPSIG(stat)); + /* I guess that's ok.... */ + } else if ((ret = WEXITSTATUS(stat))) { + log_Printf(LogWARN, "Cannot exec \"%s\": %s\n", p->name.base, + strerror(ret)); + close(fids[0]); + p->session_owner = (pid_t)-1; + break; + } + p->fd = fids[0]; + log_Printf(LogDEBUG, "Using descriptor %d for child\n", p->fd); + } } - close(fids[0]); } + } else { + struct stat st; + + if (fstat(p->fd, &st) != -1 && (st.st_mode & S_IFIFO)) { + if ((dev = malloc(sizeof *dev)) == NULL) + log_Printf(LogWARN, "%s: Cannot allocate an exec device: %s\n", + p->link.name, strerror(errno)); + else if (p->fd == STDIN_FILENO) { + log_Printf(LogPHASE, "%s: Using stdin/stdout to communicate with " + "parent (pipe mode)\n", p->link.name); + dev->fd_out = dup(STDOUT_FILENO); + + /* Hook things up so that we monitor dev->fd_out */ + p->desc.UpdateSet = exec_UpdateSet; + p->desc.IsSet = exec_IsSet; + } else + dev->fd_out = -1; + } + } + + if (dev) { + memcpy(&dev->dev, &baseexecdevice, sizeof dev->dev); + physical_SetupStack(p, dev->dev.name, PHYSICAL_NOFORCE); + if (p->cfg.cd.necessity != CD_DEFAULT) + log_Printf(LogWARN, "Carrier settings ignored\n"); + return &dev->dev; } return NULL; Modified: head/usr.sbin/ppp/exec.h ============================================================================== --- head/usr.sbin/ppp/exec.h Mon Aug 24 17:18:17 2009 (r196513) +++ head/usr.sbin/ppp/exec.h Mon Aug 24 17:19:45 2009 (r196514) @@ -32,4 +32,4 @@ struct device; extern struct device *exec_Create(struct physical *); extern struct device *exec_iov2device(int, struct physical *, struct iovec *, int *, int, int *, int *); -#define exec_DeviceSize physical_DeviceSize +extern unsigned exec_DeviceSize(void); Modified: head/usr.sbin/ppp/main.c ============================================================================== --- head/usr.sbin/ppp/main.c Mon Aug 24 17:18:17 2009 (r196513) +++ head/usr.sbin/ppp/main.c Mon Aug 24 17:19:45 2009 (r196514) @@ -509,9 +509,11 @@ main(int argc, char **argv) if (!sw.fg) setsid(); } else { - /* -direct - STDIN_FILENO gets used by physical_Open */ + /* + * -direct - STDIN_FILENO gets used by physical_Open. STDOUT_FILENO + * *may* get used in exec/pipe mode. + */ prompt_TtyInit(NULL); - close(STDOUT_FILENO); close(STDERR_FILENO); } } else { Modified: head/usr.sbin/ppp/physical.c ============================================================================== --- head/usr.sbin/ppp/physical.c Mon Aug 24 17:18:17 2009 (r196513) +++ head/usr.sbin/ppp/physical.c Mon Aug 24 17:19:45 2009 (r196514) @@ -1017,6 +1017,7 @@ physical_Open(struct physical *p) p->fd = STDIN_FILENO; for (h = 0; h < NDEVICES && p->handler == NULL && p->fd >= 0; h++) p->handler = (*devices[h].create)(p); + close(STDOUT_FILENO); if (p->fd >= 0) { if (p->handler == NULL) { physical_SetupStack(p, "unknown", PHYSICAL_NOFORCE); From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 18:07:17 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68BFF1065695; Mon, 24 Aug 2009 18:07:17 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id 00EA78FC27; Mon, 24 Aug 2009 18:07:16 +0000 (UTC) Received: from besplex.bde.org (c122-106-152-1.carlnfd1.nsw.optusnet.com.au [122.106.152.1]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n7OI7C5W005990 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 25 Aug 2009 04:07:14 +1000 Date: Tue, 25 Aug 2009 04:07:11 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Jilles Tjoelker In-Reply-To: <20090823213759.GA55039@stack.nl> Message-ID: <20090825031355.B729@besplex.bde.org> References: <200908231244.n7NCiFgc061095@svn.freebsd.org> <20090823213759.GA55039@stack.nl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Konstantin Belousov Subject: Re: svn commit: r196460 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 18:07:17 -0000 On Sun, 23 Aug 2009, Jilles Tjoelker wrote: > I think poll on fifos should instead be fixed by closing the > half-connection corresponding to writing from fi_readsock to > fi_writesock. I have tried this out, see attached patch. With the patch, > pipepoll only gives "expected POLLHUP; got POLLIN | POLLHUP" errors and > an error in fifo case 6b caused by our distinction between new and old > readers. This sort of worked for me, but has several problems: % Index: sys/fs/fifofs/fifo_vnops.c % =================================================================== % --- sys/fs/fifofs/fifo_vnops.c (revision 196459) % +++ sys/fs/fifofs/fifo_vnops.c (working copy) % @@ -193,6 +193,10 @@ % goto fail2; % fip->fi_writesock = wso; % error = soconnect2(wso, rso); % + if (error == 0) % + error = soshutdown(rso, SHUT_WR); % + if (error == 0) % + error = soshutdown(wso, SHUT_RD); % if (error) { % (void)soclose(wso); % fail2: The second soshutdown() is only harmful. I see the following state changes - the first soshutdown() sets SBS_CANTRCVMORE on rso like you would expect, and also sets SBS_CANTSENDMORE on wso. This gives the desired state. - the second soshutdown() then clears SBS_CANTRCVMORE on rso (without the first soshutdown() it leaves both flags clear in both directions). This clobbers the desired state. The failure shows in just one of my uncommitted regression tests (when there is a writer and there was a reader, poll() returns POLLOUT for the writer, but should return POLLHUP; the missing SBS_CANTRCVMORE on rso prevents it ever returning POLLHUP for writers). After removing the second soshutdown() and fixing a spurious POLLIN (see below), all my tests pass. Elsewhere, fifo_vnops.c hacks on SBS_CANT*MORE directly. Perhaps it should call soshutdown(), or if the direct access there is safe then it is probably safe above. % Index: sys/kern/uipc_socket.c % =================================================================== % --- sys/kern/uipc_socket.c (revision 196469) % +++ sys/kern/uipc_socket.c (working copy) % @@ -2898,11 +2898,13 @@ % if (so->so_oobmark || (so->so_rcv.sb_state & SBS_RCVATMARK)) % revents |= events & (POLLPRI | POLLRDBAND); % % - if ((events & POLLINIGNEOF) == 0) % - if (so->so_rcv.sb_state & SBS_CANTRCVMORE) % - revents |= POLLHUP; % - if (so->so_snd.sb_state & SBS_CANTSENDMORE) % - revents |= POLLHUP; % + if ((events & POLLINIGNEOF) == 0) { Old problems become larger: I don't like POLLINIGNEOF (for input) affecting POLLHUP for output. This seems to cause no problems for fifos, at least when the kernel sets POLLINIGNEOF, but it is hard to understand even why it doesn't cause problems, and kib@ wants POLLINIGNEOF to remain user-settable, so the complications might remain exported to userland for for fifos and sockets, where they are harder to document and understand. Note that fifo_poll_f() always calls here twice, first for the read socket, then for the write socket. For the first call, the kernel sets POLLINIGNEOF according to its idea of the stickyness of EOF on input. For the second call, the kernel never sets POLLINIGNEOF. Thus this code is always executed (unless the user sets POLLINIGNEOF) and since returning POLLHUP is independent of the `events' arg, it is hard to understand how setting POLLINIGNEOF for the first call has any effect... % + if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { ...well, it has an effect since the first call is on a different socket. The soshutdown()s make the states involved clearer: - SBS_CANTRCVMORE is always set for wso, so we always get here for the second call, and the resulting POLLHUP is purely for the write direction. - SBS_CANTSENDMORE is aways set for rso, so if we get here for the first call then we will set POLLHUP, and this POLLHUP is purely for the read direction. Then fifo_poll_f() will combine the POLLHUPs, so POLLHUP becomes impure, but POLLHUP remains useful. % + revents |= events & (POLLIN | POLLRDNORM); This gives spurious POLLINs when POLLHUP is also returned, and thus defeats the point of soreadable_data() being different from soreadable(). Tests 6a-6d show the spurious POLLIN. I don't understand how tests 6a and 6c-6d passed for you. % + if (so->so_snd.sb_state & SBS_CANTSENDMORE) % + revents |= POLLHUP; Tests 6a-6d pass with the above 3 lines changed to: if (so->so_snd.sb_state & SBS_CANTSENDMORE) revents |= POLLHUP; else revents |= events & (POLLIN | POLLRDNORM); Returning POLLIN will cause poll() to not block on input descriptors, but this seems to be as correct as possible since there really is a read-EOF. Applications just can't see this EOF as POLLHUP -- they will see POLLIN and have to try to read(), and then interpret read() returning 0 as meaning EOF. Device-independent applications must do precisely this anyway since the input descriptor might be a regular file and there is no POLLHUP for regular files. % + } % + } % % if (revents == 0) { % if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) { Bruce From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 18:42:05 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8252A1065693; Mon, 24 Aug 2009 18:42:05 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id 180098FC08; Mon, 24 Aug 2009 18:42:04 +0000 (UTC) Received: from besplex.bde.org (c122-106-152-1.carlnfd1.nsw.optusnet.com.au [122.106.152.1]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n7OIfx3P027988 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 25 Aug 2009 04:42:01 +1000 Date: Tue, 25 Aug 2009 04:41:59 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans In-Reply-To: <20090825031355.B729@besplex.bde.org> Message-ID: <20090825041842.I923@besplex.bde.org> References: <200908231244.n7NCiFgc061095@svn.freebsd.org> <20090823213759.GA55039@stack.nl> <20090825031355.B729@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@FreeBSD.org, Jilles Tjoelker , svn-src-all@FreeBSD.org, glebius@FreeBSD.org, Konstantin Belousov , svn-src-head@FreeBSD.org Subject: Re: svn commit: r196460 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 18:42:05 -0000 On Tue, 25 Aug 2009, Bruce Evans wrote: > On Sun, 23 Aug 2009, Jilles Tjoelker wrote: > >> I think poll on fifos should instead be fixed by closing the >> half-connection corresponding to writing from fi_readsock to >> fi_writesock. I have tried this out, see attached patch. With the patch, >> pipepoll only gives "expected POLLHUP; got POLLIN | POLLHUP" errors and >> an error in fifo case 6b caused by our distinction between new and old >> readers. > > This sort of worked for me, but has several problems: > > % Index: sys/fs/fifofs/fifo_vnops.c > % =================================================================== > % --- sys/fs/fifofs/fifo_vnops.c (revision 196459) > % +++ sys/fs/fifofs/fifo_vnops.c (working copy) > % @@ -193,6 +193,10 @@ > % goto fail2; > % fip->fi_writesock = wso; > % error = soconnect2(wso, rso); > % + if (error == 0) > % + error = soshutdown(rso, SHUT_WR); > % + if (error == 0) > % + error = soshutdown(wso, SHUT_RD); > % if (error) { > % (void)soclose(wso); > % fail2: > > The second soshutdown() is only harmful. I see the following state changes > - the first soshutdown() sets SBS_CANTRCVMORE on rso like you would expect, > and also sets SBS_CANTSENDMORE on wso. This gives the desired state. > - the second soshutdown() then clears SBS_CANTRCVMORE on rso (without > the first soshutdown() it leaves both flags clear in both directions). > This clobbers the desired state. The failure shows in just one of my > uncommitted regression tests (when there is a writer and there was > a reader, poll() returns POLLOUT for the writer, but should return > POLLHUP; the missing SBS_CANTRCVMORE on rso prevents it ever returning > POLLHUP for writers). SBS_CANTRCVMORE on rso is cleared here in ~5.2, but this seems to be fixed in -current: % void % sorflush(struct socket *so) % { % struct sockbuf *sb = &so->so_rcv; % struct protosw *pr = so->so_proto; % struct sockbuf asb; % % /* % * In order to avoid calling dom_dispose with the socket buffer mutex % * held, and in order to generally avoid holding the lock for a long % * time, we make a copy of the socket buffer and clear the original % * (except locks, state). The new socket buffer copy won't have % * initialized locks so we can only call routines that won't use or % * assert those locks. % * % * Dislodge threads currently blocked in receive and wait to acquire % * a lock against other simultaneous readers before clearing the % * socket buffer. Don't let our acquire be interrupted by a signal % * despite any existing socket disposition on interruptable waiting. % */ % CURVNET_SET(so->so_vnet); % socantrcvmore(so); % (void) sblock(sb, SBL_WAIT | SBL_NOINTR); % % /* % * Invalidate/clear most of the sockbuf structure, but leave selinfo % * and mutex data unchanged. % */ % SOCKBUF_LOCK(sb); % bzero(&asb, offsetof(struct sockbuf, sb_startzero)); % bcopy(&sb->sb_startzero, &asb.sb_startzero, % sizeof(*sb) - offsetof(struct sockbuf, sb_startzero)); % bzero(&sb->sb_startzero, % sizeof(*sb) - offsetof(struct sockbuf, sb_startzero)); ^^^^^ sb_state is at the end of the struct in 5.2, but is now just before the startzero section. sockbuf.h has usless history (no repo copy), but according to history of socketvar.h, sb_state was moved mainly to fix clobbering of SBS_CANTRCVMORE: % RCS file: /home/ncvs/src/sys/sys/socketvar.h,v % Working file: socketvar.h % head: 1.171 % ---------------------------- % revision 1.137 % date: 2005/01/30 13:11:44; author: glebius; state: Exp; lines: +1 -1 % Move sb_state to the beginning of structure, above sb_startzero member. % sb_state shouldn't be erased, when socket buffer is flushed by sorflush(). % % When sb_state was bzero'ed, a recently set SBS_CANTRCVMORE flag was cleared. % If a socket was shutdown(SHUT_RD), a subsequent read() would block on it. % % Reported by: Ed Maste, Gerrit Nagelhout % Reviewed by: rwatson % ---------------------------- What were previous symptoms of this bug? This bug lived in FreeBSD-5-2+ for about a year and for 4 more years in my version of 5.2 :-(. Older versions didn't have it since the flags were all in so_state which has never been cleared. Bruce From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 18:43:24 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 212E3106568B; Mon, 24 Aug 2009 18:43:23 +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 10D928FC25; Mon, 24 Aug 2009 18:43:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OIhMT4003082; Mon, 24 Aug 2009 18:43:22 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OIhMiZ003080; Mon, 24 Aug 2009 18:43:22 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200908241843.n7OIhMiZ003080@svn.freebsd.org> From: Ken Smith Date: Mon, 24 Aug 2009 18:43:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196515 - head/share/examples/cvsup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 18:43:25 -0000 Author: kensmith Date: Mon Aug 24 18:43:22 2009 New Revision: 196515 URL: http://svn.freebsd.org/changeset/base/196515 Log: Update example for RELENG_8. Modified: head/share/examples/cvsup/stable-supfile Modified: head/share/examples/cvsup/stable-supfile ============================================================================== --- head/share/examples/cvsup/stable-supfile Mon Aug 24 17:19:45 2009 (r196514) +++ head/share/examples/cvsup/stable-supfile Mon Aug 24 18:43:22 2009 (r196515) @@ -66,10 +66,11 @@ *default host=CHANGE_THIS.FreeBSD.org *default base=/var/db *default prefix=/usr -# The following line is for 7-stable. If you want 6-stable, 5-stable, -# 4-stable, 3-stable, or 2.2-stable, change to "RELENG_6", "RELENG_5", -# "RELENG_4", "RELENG_3", or "RELENG_2_2" respectively. -*default release=cvs tag=RELENG_7 +# The following line is for 8-stable. If you want 7-stable, 6-stable, +# 5-stable, 4-stable, 3-stable, or 2.2-stable, change to "RELENG_7", +# "RELENG_6", "RELENG_5", "RELENG_4", "RELENG_3", or "RELENG_2_2" +# respectively. +*default release=cvs tag=RELENG_8 *default delete use-rel-suffix # If you seem to be limited by CPU rather than network or disk bandwidth, try From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 18:58:14 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 247DE1065692; Mon, 24 Aug 2009 18:58:14 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F06428FC24; Mon, 24 Aug 2009 18:58:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OIwD9J003462; Mon, 24 Aug 2009 18:58:13 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OIwDb2003459; Mon, 24 Aug 2009 18:58:13 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200908241858.n7OIwDb2003459@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 24 Aug 2009 18:58:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196516 - in head/sys: dev/re pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 18:58:14 -0000 Author: yongari Date: Mon Aug 24 18:58:13 2009 New Revision: 196516 URL: http://svn.freebsd.org/changeset/base/196516 Log: Add RTL8168DP/RTL8111DP device id. While I'm here append "8111D" to the description of RTL8168D as RL_HWREV_8168D can be either RTL8168D or RTL8111D. PR: kern/137672 MFC after: 3 days Modified: head/sys/dev/re/if_re.c head/sys/pci/if_rlreg.h Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Mon Aug 24 18:43:22 2009 (r196515) +++ head/sys/dev/re/if_re.c Mon Aug 24 18:58:13 2009 (r196516) @@ -174,8 +174,8 @@ static struct rl_type re_devs[] = { { RT_VENDORID, RT_DEVICEID_8101E, 0, "RealTek 8101E/8102E/8102EL PCIe 10/100baseTX" }, { RT_VENDORID, RT_DEVICEID_8168, 0, - "RealTek 8168/8168B/8168C/8168CP/8168D/8111B/8111C/8111CP PCIe " - "Gigabit Ethernet" }, + "RealTek 8168/8168B/8168C/8168CP/8168D/8168DP/" + "8111B/8111C/8111CP/8111DP PCIe Gigabit Ethernet" }, { RT_VENDORID, RT_DEVICEID_8169, 0, "RealTek 8169/8169S/8169SB(L)/8110S/8110SB(L) Gigabit Ethernet" }, { RT_VENDORID, RT_DEVICEID_8169SC, 0, @@ -217,7 +217,8 @@ static struct rl_hwrev re_hwrevs[] = { { RL_HWREV_8168C, RL_8169, "8168C/8111C"}, { RL_HWREV_8168C_SPIN2, RL_8169, "8168C/8111C"}, { RL_HWREV_8168CP, RL_8169, "8168CP/8111CP"}, - { RL_HWREV_8168D, RL_8169, "8168D"}, + { RL_HWREV_8168D, RL_8169, "8168D/8111D"}, + { RL_HWREV_8168DP, RL_8169, "8168DP/8111DP"}, { 0, 0, NULL } }; @@ -1282,6 +1283,7 @@ re_attach(device_t dev) /* FALLTHROUGH */ case RL_HWREV_8168CP: case RL_HWREV_8168D: + case RL_HWREV_8168DP: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD; Modified: head/sys/pci/if_rlreg.h ============================================================================== --- head/sys/pci/if_rlreg.h Mon Aug 24 18:43:22 2009 (r196515) +++ head/sys/pci/if_rlreg.h Mon Aug 24 18:58:13 2009 (r196516) @@ -161,6 +161,7 @@ #define RL_HWREV_8102EL 0x24800000 #define RL_HWREV_8102EL_SPIN1 0x24c00000 #define RL_HWREV_8168D 0x28000000 +#define RL_HWREV_8168DP 0x28800000 #define RL_HWREV_8168_SPIN1 0x30000000 #define RL_HWREV_8100E 0x30800000 #define RL_HWREV_8101E 0x34000000 From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 20:37:15 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF9EC1065695; Mon, 24 Aug 2009 20:37:15 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DF2BE8FC1F; Mon, 24 Aug 2009 20:37:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OKbFpr005734; Mon, 24 Aug 2009 20:37:15 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OKbFuW005732; Mon, 24 Aug 2009 20:37:15 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200908242037.n7OKbFuW005732@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 24 Aug 2009 20:37:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196517 - head/sys/dev/alc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 20:37:16 -0000 Author: yongari Date: Mon Aug 24 20:37:15 2009 New Revision: 196517 URL: http://svn.freebsd.org/changeset/base/196517 Log: Don't try to power down PHY when alc(4) failed to map the device. This fixes system crash when mapping alc(4) device failed in device attach. Reported by: Jim < stapleton.41 <> gmail DOT com > MFC after: 3 days Modified: head/sys/dev/alc/if_alc.c Modified: head/sys/dev/alc/if_alc.c ============================================================================== --- head/sys/dev/alc/if_alc.c Mon Aug 24 18:58:13 2009 (r196516) +++ head/sys/dev/alc/if_alc.c Mon Aug 24 20:37:15 2009 (r196517) @@ -858,7 +858,8 @@ alc_detach(device_t dev) sc->alc_intrhand[i] = NULL; } } - alc_phy_down(sc); + if (sc->alc_res[0] != NULL) + alc_phy_down(sc); bus_release_resources(dev, sc->alc_irq_spec, sc->alc_irq); if ((sc->alc_flags & (ALC_FLAG_MSI | ALC_FLAG_MSIX)) != 0) pci_release_msi(dev); From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 20:41:51 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCE651065697; Mon, 24 Aug 2009 20:41:51 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CBFA68FC2D; Mon, 24 Aug 2009 20:41:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OKfpbW005910; Mon, 24 Aug 2009 20:41:51 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OKfpSd005908; Mon, 24 Aug 2009 20:41:51 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <200908242041.n7OKfpSd005908@svn.freebsd.org> From: Jack F Vogel Date: Mon, 24 Aug 2009 20:41:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196518 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 20:41:52 -0000 Author: jfv Date: Mon Aug 24 20:41:51 2009 New Revision: 196518 URL: http://svn.freebsd.org/changeset/base/196518 Log: A couple of changes: first, make header split on by default and remove from its dependency on LRO, my tests have shown that its always beneficial, even when doing bridging. Second, fix up a few problems in the statistics code, the adapter dependencies had gotten lost so some code that should only run on 82599 was always running, this resulted in bogus flow control numbers on 82598. Modified: head/sys/dev/ixgbe/ixgbe.c Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Mon Aug 24 20:37:15 2009 (r196517) +++ head/sys/dev/ixgbe/ixgbe.c Mon Aug 24 20:41:51 2009 (r196518) @@ -46,7 +46,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "1.8.8"; +char ixgbe_driver_version[] = "1.8.9"; /********************************************************************* * PCI Device ID Table @@ -246,6 +246,15 @@ static int ixgbe_enable_msix = 1; TUNABLE_INT("hw.ixgbe.enable_msix", &ixgbe_enable_msix); /* + * Header split has seemed to be beneficial in + * all circumstances tested, so its on by default + * however this variable will allow it to be disabled + * for some debug purposes. + */ +static bool ixgbe_header_split = TRUE; +TUNABLE_INT("hw.ixgbe.hdr_split", &ixgbe_header_split); + +/* * Number of Queues, should normally * be left at 0, it then autoconfigures to * the number of cpus. Each queue is a pair @@ -454,7 +463,6 @@ ixgbe_attach(device_t dev) */ if (nmbclusters > 0 ) { int s; - /* Calculate the total RX mbuf needs */ s = (ixgbe_rxd * adapter->num_queues) * ixgbe_total_ports; if (s > nmbclusters) { device_printf(dev, "RX Descriptors exceed " @@ -1459,8 +1467,7 @@ ixgbe_msix_link(void *arg) device_printf(adapter->dev, "\nCRITICAL: ECC ERROR!! " "Please Reboot!!\n"); IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_ECC); - } - if (reg_eicr & IXGBE_EICR_GPI_SDP1) { + } else if (reg_eicr & IXGBE_EICR_GPI_SDP1) { /* Clear the interrupt */ IXGBE_WRITE_REG(hw, IXGBE_EICR, IXGBE_EICR_GPI_SDP1); taskqueue_enqueue(adapter->tq, &adapter->msf_task); @@ -1883,7 +1890,11 @@ ixgbe_set_multi(struct adapter *adapter) IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCTRL, fctrl); +#if __FreeBSD_version < 800000 + IF_ADDR_LOCK(ifp); +#else if_maddr_rlock(ifp); +#endif TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1892,7 +1903,11 @@ ixgbe_set_multi(struct adapter *adapter) IXGBE_ETH_LENGTH_OF_ADDRESS); mcnt++; } +#if __FreeBSD_version < 800000 + IF_ADDR_UNLOCK(ifp); +#else if_maddr_runlock(ifp); +#endif update_ptr = mta; ixgbe_update_mc_addr_list(&adapter->hw, @@ -3534,7 +3549,10 @@ ixgbe_setup_receive_ring(struct rx_ring rxr->next_to_check = 0; rxr->last_cleaned = 0; rxr->lro_enabled = FALSE; - rxr->hdr_split = FALSE; + + /* Use header split if configured */ + if (ixgbe_header_split) + rxr->hdr_split = TRUE; bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); @@ -3553,7 +3571,6 @@ ixgbe_setup_receive_ring(struct rx_ring } INIT_DEBUGOUT("RX LRO Initialized\n"); rxr->lro_enabled = TRUE; - rxr->hdr_split = TRUE; lro->ifp = adapter->ifp; } @@ -4457,24 +4474,42 @@ ixgbe_update_stats_counters(struct adapt struct ifnet *ifp = adapter->ifp;; struct ixgbe_hw *hw = &adapter->hw; u32 missed_rx = 0, bprc, lxon, lxoff, total; + u64 total_missed_rx = 0; adapter->stats.crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS); for (int i = 0; i < 8; i++) { - int mp; - mp = IXGBE_READ_REG(hw, IXGBE_MPC(i)); - missed_rx += mp; - adapter->stats.mpc[i] += mp; - adapter->stats.rnbc[i] += IXGBE_READ_REG(hw, IXGBE_RNBC(i)); + /* missed_rx tallies misses for the gprc workaround */ + missed_rx += IXGBE_READ_REG(hw, IXGBE_MPC(i)); + adapter->stats.mpc[i] += missed_rx; + /* Running comprehensive total for stats display */ + total_missed_rx += adapter->stats.mpc[i]; + if (hw->mac.type == ixgbe_mac_82598EB) + adapter->stats.rnbc[i] += + IXGBE_READ_REG(hw, IXGBE_RNBC(i)); } /* Hardware workaround, gprc counts missed packets */ adapter->stats.gprc += IXGBE_READ_REG(hw, IXGBE_GPRC); adapter->stats.gprc -= missed_rx; - adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GORCH); - adapter->stats.gotc += IXGBE_READ_REG(hw, IXGBE_GOTCH); - adapter->stats.tor += IXGBE_READ_REG(hw, IXGBE_TORH); + if (hw->mac.type == ixgbe_mac_82599EB) { + adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GORCL); + IXGBE_READ_REG(hw, IXGBE_GORCH); /* clears register */ + adapter->stats.gotc += IXGBE_READ_REG(hw, IXGBE_GOTCL); + IXGBE_READ_REG(hw, IXGBE_GOTCH); /* clears register */ + adapter->stats.tor += IXGBE_READ_REG(hw, IXGBE_TORL); + IXGBE_READ_REG(hw, IXGBE_TORH); /* clears register */ + adapter->stats.lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXCNT); + adapter->stats.lxoffrxc += IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT); + } else { + adapter->stats.lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXC); + adapter->stats.lxoffrxc += IXGBE_READ_REG(hw, IXGBE_LXOFFRXC); + /* 82598 only has a counter in the high register */ + adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GORCH); + adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GOTCH); + adapter->stats.tor += IXGBE_READ_REG(hw, IXGBE_TORH); + } /* * Workaround: mprc hardware is incorrectly counting @@ -4494,9 +4529,6 @@ ixgbe_update_stats_counters(struct adapt adapter->stats.prc1522 += IXGBE_READ_REG(hw, IXGBE_PRC1522); adapter->stats.rlec += IXGBE_READ_REG(hw, IXGBE_RLEC); - adapter->stats.lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXCNT); - adapter->stats.lxoffrxc += IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT); - lxon = IXGBE_READ_REG(hw, IXGBE_LXONTXC); adapter->stats.lxontxc += lxon; lxoff = IXGBE_READ_REG(hw, IXGBE_LXOFFTXC); @@ -4532,7 +4564,7 @@ ixgbe_update_stats_counters(struct adapt ifp->if_collisions = 0; /* Rx Errors */ - ifp->if_ierrors = missed_rx + adapter->stats.crcerrs + + ifp->if_ierrors = total_missed_rx + adapter->stats.crcerrs + adapter->stats.rlec; } From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 21:04:52 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33CEE1065692; Mon, 24 Aug 2009 21:04:52 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 236E68FC13; Mon, 24 Aug 2009 21:04:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OL4pLb006430; Mon, 24 Aug 2009 21:04:51 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OL4pYi006428; Mon, 24 Aug 2009 21:04:51 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <200908242104.n7OL4pYi006428@svn.freebsd.org> From: Jack F Vogel Date: Mon, 24 Aug 2009 21:04:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196519 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 21:04:52 -0000 Author: jfv Date: Mon Aug 24 21:04:51 2009 New Revision: 196519 URL: http://svn.freebsd.org/changeset/base/196519 Log: When bridging LRO is causing a problem, the believe that it would work as long as all interfaces have TSO seems to be false, until the matter gets sorted out just disable LRO completely. Modified: head/sys/net/if_bridge.c Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Mon Aug 24 20:41:51 2009 (r196518) +++ head/sys/net/if_bridge.c Mon Aug 24 21:04:51 2009 (r196519) @@ -171,6 +171,11 @@ __FBSDID("$FreeBSD$"); #define BRIDGE_IFCAPS_MASK (IFCAP_TOE|IFCAP_TSO|IFCAP_TXCSUM) /* + * List of capabilities to strip + */ +#define BRIDGE_IFCAPS_STRIP IFCAP_LRO + +/* * Bridge interface list entry. */ struct bridge_iflist { @@ -802,16 +807,10 @@ bridge_mutecaps(struct bridge_softc *sc) LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { enabled = bif->bif_ifp->if_capenable; + enabled &= ~BRIDGE_IFCAPS_STRIP; /* strip off mask bits and enable them again if allowed */ enabled &= ~BRIDGE_IFCAPS_MASK; enabled |= mask; - /* - * Receive offload can only be enabled if all members also - * support send offload. - */ - if ((enabled & IFCAP_TSO) == 0) - enabled &= ~IFCAP_LRO; - bridge_set_ifcap(sc, bif, enabled); } From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 21:51:47 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CA9F106568B; Mon, 24 Aug 2009 21:51:47 +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 0B1B48FC0C; Mon, 24 Aug 2009 21:51:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OLpk6H007342; Mon, 24 Aug 2009 21:51:46 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OLpkBC007339; Mon, 24 Aug 2009 21:51:46 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200908242151.n7OLpkBC007339@svn.freebsd.org> From: John Baldwin Date: Mon, 24 Aug 2009 21:51:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196520 - in head/sys: dev/acpica isa X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 21:51:47 -0000 Author: jhb Date: Mon Aug 24 21:51:46 2009 New Revision: 196520 URL: http://svn.freebsd.org/changeset/base/196520 Log: Tweak the way that the ACPI and ISA bus drivers match hint devices to BIOS-enumerated devices: - Assume a device is a match if the memory and I/O ports match even if the IRQ or DRQ is wrong or missing. Some BIOSes don't include an IRQ for the atrtc device for example. - Add a hack to better match floppy controller devices. Many BIOSes do not include the starting port of the floppy controller listed in the hints (0x3f0) in the resources for the device. So far, however, all the BIOS variations encountered do include the 'port + 2' resource (0x3f2), so adjust the matching for "fdc" devices to look for 'port + 2'. Reviewed by: imp MFC after: 3 days Modified: head/sys/dev/acpica/acpi.c head/sys/isa/isahint.c Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Mon Aug 24 21:04:51 2009 (r196519) +++ head/sys/dev/acpica/acpi.c Mon Aug 24 21:51:46 2009 (r196520) @@ -1014,14 +1014,27 @@ acpi_hint_device_unit(device_t acdev, de continue; /* - * Check for matching resources. We must have at least one, - * and all resources specified have to match. + * Check for matching resources. We must have at least one match. + * Since I/O and memory resources cannot be shared, if we get a + * match on either of those, ignore any mismatches in IRQs or DRQs. * * XXX: We may want to revisit this to be more lenient and wire * as long as it gets one match. */ matches = 0; if (resource_long_value(name, unit, "port", &value) == 0) { + /* + * Floppy drive controllers are notorious for having a + * wide variety of resources not all of which include the + * first port that is specified by the hint (typically + * 0x3f0) (see the comment above fdc_isa_alloc_resources() + * in fdc_isa.c). However, they do all seem to include + * port + 2 (e.g. 0x3f2) so for a floppy device, look for + * 'value + 2' in the port resources instead of the hint + * value. + */ + if (strcmp(name, "fdc") == 0) + value += 2; if (acpi_match_resource_hint(child, SYS_RES_IOPORT, value)) matches++; else @@ -1033,6 +1046,8 @@ acpi_hint_device_unit(device_t acdev, de else continue; } + if (matches > 0) + goto matched; if (resource_long_value(name, unit, "irq", &value) == 0) { if (acpi_match_resource_hint(child, SYS_RES_IRQ, value)) matches++; @@ -1046,6 +1061,7 @@ acpi_hint_device_unit(device_t acdev, de continue; } + matched: if (matches > 0) { /* We have a winner! */ *unitp = unit; Modified: head/sys/isa/isahint.c ============================================================================== --- head/sys/isa/isahint.c Mon Aug 24 21:04:51 2009 (r196519) +++ head/sys/isa/isahint.c Mon Aug 24 21:51:46 2009 (r196520) @@ -118,14 +118,30 @@ isa_hint_device_unit(device_t bus, devic continue; /* - * Check for matching resources. We must have at least one, - * and all resources specified have to match. + * Check for matching resources. We must have at + * least one match. Since I/O and memory resources + * cannot be shared, if we get a match on either of + * those, ignore any mismatches in IRQs or DRQs. * - * XXX: We may want to revisit this to be more lenient and wire - * as long as it gets one match. + * XXX: We may want to revisit this to be more lenient + * and wire as long as it gets one match. */ matches = 0; if (resource_long_value(name, unit, "port", &value) == 0) { + /* + * Floppy drive controllers are notorious for + * having a wide variety of resources not all + * of which include the first port that is + * specified by the hint (typically 0x3f0) + * (see the comment above + * fdc_isa_alloc_resources() in fdc_isa.c). + * However, they do all seem to include port + + * 2 (e.g. 0x3f2) so for a floppy device, look + * for 'value + 2' in the port resources + * instead of the hint value. + */ + if (strcmp(name, "fdc") == 0) + value += 2; if (isa_match_resource_hint(child, SYS_RES_IOPORT, value)) matches++; @@ -139,6 +155,8 @@ isa_hint_device_unit(device_t bus, devic else continue; } + if (matches > 0) + goto matched; if (resource_long_value(name, unit, "irq", &value) == 0) { if (isa_match_resource_hint(child, SYS_RES_IRQ, value)) matches++; @@ -152,6 +170,7 @@ isa_hint_device_unit(device_t bus, devic continue; } + matched: if (matches > 0) { /* We have a winner! */ *unitp = unit; From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 21:55:43 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81439106568F; Mon, 24 Aug 2009 21:55:43 +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 704D18FC14; Mon, 24 Aug 2009 21:55:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OLth6j007457; Mon, 24 Aug 2009 21:55:43 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OLthjE007453; Mon, 24 Aug 2009 21:55:43 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200908242155.n7OLthjE007453@svn.freebsd.org> From: John Baldwin Date: Mon, 24 Aug 2009 21:55:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196521 - in head/release: . scripts X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 21:55:43 -0000 Author: jhb Date: Mon Aug 24 21:55:43 2009 New Revision: 196521 URL: http://svn.freebsd.org/changeset/base/196521 Log: Fix a few issues with the lib32 dist so that it includes ldd32. - Use a better find invocation to purge empty directories from all the dist trees during a release build. The previous version did not purge directories whose contents were all empty directories. - Explicitly blacklist a few files from the lib32 dist instead of using a whitelist. A better longterm solution is to fix the few offenders to not install data files during a lib32 install. MFC after: 3 days Modified: head/release/Makefile head/release/scripts/lib32-make.sh Modified: head/release/Makefile ============================================================================== --- head/release/Makefile Mon Aug 24 21:51:46 2009 (r196520) +++ head/release/Makefile Mon Aug 24 21:55:43 2009 (r196521) @@ -696,7 +696,7 @@ release.5: # Remove all the directories we don't need. -cd ${RD}/trees && \ (find ${OTHER_DISTS} -path '*/var/empty' | xargs chflags noschg; \ - find ${OTHER_DISTS} -depth -type d -empty -print | xargs rmdir) + find ${OTHER_DISTS} -depth -type d -empty -delete) touch ${.TARGET} # Modified: head/release/scripts/lib32-make.sh ============================================================================== --- head/release/scripts/lib32-make.sh Mon Aug 24 21:51:46 2009 (r196520) +++ head/release/scripts/lib32-make.sh Mon Aug 24 21:55:43 2009 (r196521) @@ -5,4 +5,4 @@ # Clean the dust. cd ${RD}/trees/lib32 && \ - find . ! -path '*/libexec/*' ! -path '*/usr/lib32/*' -delete + find . '(' -path '*/usr/share/*' -or -path '*/usr/lib/*' ')' -delete From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 21:56:42 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2569F106568B; Mon, 24 Aug 2009 21:56:42 +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 14BDD8FC08; Mon, 24 Aug 2009 21:56:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OLufJ6007509; Mon, 24 Aug 2009 21:56:41 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OLufAF007507; Mon, 24 Aug 2009 21:56:41 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200908242156.n7OLufAF007507@svn.freebsd.org> From: John Baldwin Date: Mon, 24 Aug 2009 21:56:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196522 - head/release X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 21:56:42 -0000 Author: jhb Date: Mon Aug 24 21:56:41 2009 New Revision: 196522 URL: http://svn.freebsd.org/changeset/base/196522 Log: Invoke the recently added mm-mtree.sh release script to store a pre-built mergemaster mtree database in the 'base' dist. MFC after: 3 days Modified: head/release/Makefile Modified: head/release/Makefile ============================================================================== --- head/release/Makefile Mon Aug 24 21:55:43 2009 (r196521) +++ head/release/Makefile Mon Aug 24 21:56:41 2009 (r196522) @@ -646,6 +646,7 @@ release.2: cd ${.CURDIR}/.. && ${CROSSMAKE} distrib-dirs DESTDIR=${RD}/trees/base cd ${.CURDIR}/.. && ${CROSSMAKE} ${WORLD_FLAGS} distributeworld \ DISTDIR=${RD}/trees + sh ${.CURDIR}/scripts/mm-mtree.sh -F "${CROSSENV}" -D "${RD}/trees/base" touch ${.TARGET} # Make and install the generic kernel(s). From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 22:05:08 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C17CB1065692; Mon, 24 Aug 2009 22:05:08 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B0B0D8FC1A; Mon, 24 Aug 2009 22:05:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OM584d007728; Mon, 24 Aug 2009 22:05:08 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OM58X2007726; Mon, 24 Aug 2009 22:05:08 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200908242205.n7OM58X2007726@svn.freebsd.org> From: Doug Barton Date: Mon, 24 Aug 2009 22:05:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196523 - head/etc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 22:05:08 -0000 Author: dougb Date: Mon Aug 24 22:05:08 2009 New Revision: 196523 URL: http://svn.freebsd.org/changeset/base/196523 Log: Improve the case test to detect the presence of lo0 in the list of network_interfaces. Submitted by: Christoph Mallon Modified: head/etc/network.subr Modified: head/etc/network.subr ============================================================================== --- head/etc/network.subr Mon Aug 24 21:56:41 2009 (r196522) +++ head/etc/network.subr Mon Aug 24 22:05:08 2009 (r196523) @@ -731,7 +731,7 @@ list_net_interfaces() # lo0 is effectively mandatory, so help prevent foot-shooting # case "$_tmplist" in - lo0*|*lo0|*' lo0 '*) ;; # This is fine, do nothing + lo0|'lo0 '*|*' lo0'|*' lo0 '*) ;; # This is fine, do nothing *) _tmplist="lo0 ${_tmplist}" ;; esac ;; From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 22:05:48 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9D0B1065697 for ; Mon, 24 Aug 2009 22:05:48 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 7BE1A8FC28 for ; Mon, 24 Aug 2009 22:05:48 +0000 (UTC) Received: (qmail 8384 invoked by uid 399); 24 Aug 2009 22:05:46 -0000 Received: from localhost (HELO foreign.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 24 Aug 2009 22:05:46 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4A930EB4.7080402@FreeBSD.org> Date: Mon, 24 Aug 2009 15:05:40 -0700 From: Doug Barton Organization: http://www.FreeBSD.org/ User-Agent: Thunderbird 2.0.0.23 (X11/20090822) MIME-Version: 1.0 To: Christoph Mallon References: <200908231952.n7NJqlFg070672@svn.freebsd.org> <4A9231B7.9070204@gmx.de> In-Reply-To: <4A9231B7.9070204@gmx.de> X-Enigmail-Version: 0.96.0 OpenPGP: id=D5B2F0FB Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196478 - head/etc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 22:05:49 -0000 Christoph Mallon wrote: > Doug Barton schrieb: >> Author: dougb >> Date: Sun Aug 23 19:52:47 2009 >> New Revision: 196478 >> URL: http://svn.freebsd.org/changeset/base/196478 >> >> Log: >> Prior to the dire warning about values of network_interfaces other than >> AUTO the biggest mistake users made was leaving lo0 off the list. Since >> lo0 is effectively mandatory, check for it and add it to the list if >> it's not there. >> >> Modified: >> head/etc/network.subr >> >> Modified: head/etc/network.subr >> ============================================================================== >> >> --- head/etc/network.subr Sun Aug 23 18:28:58 2009 (r196477) >> +++ head/etc/network.subr Sun Aug 23 19:52:47 2009 (r196478) >> @@ -727,6 +727,13 @@ list_net_interfaces() >> ;; >> *) >> _tmplist="${network_interfaces} ${cloned_interfaces}" >> + >> + # lo0 is effectively mandatory, so help prevent foot-shooting >> + # >> + case "$_tmplist" in >> + lo0*|*lo0|*' lo0 '*) ;; # This is fine, do nothing > > Doesn't this also match malo0? > IMO the test should be lo0|'lo0 '*|*' lo0'|*' lo0 '*. Thank you for the suggestion, I've just committed it. :) Doug -- This .signature sanitized for your protection From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 22:35:53 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88E34106564A; Mon, 24 Aug 2009 22:35:53 +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 76CF28FC19; Mon, 24 Aug 2009 22:35:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7OMZrpl008398; Mon, 24 Aug 2009 22:35:53 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7OMZrs6008394; Mon, 24 Aug 2009 22:35:53 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200908242235.n7OMZrs6008394@svn.freebsd.org> From: Xin LI Date: Mon, 24 Aug 2009 22:35:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196524 - in head/sys: dev/syscons i386/isa X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 22:35:53 -0000 Author: delphij Date: Mon Aug 24 22:35:53 2009 New Revision: 196524 URL: http://svn.freebsd.org/changeset/base/196524 Log: Fix VESA modes and allow 8bit depth modes. PR: i386/124902 Submitted by: paradox MFC after: 2 months Modified: head/sys/dev/syscons/scvgarndr.c head/sys/dev/syscons/scvidctl.c head/sys/i386/isa/vesa.c Modified: head/sys/dev/syscons/scvgarndr.c ============================================================================== --- head/sys/dev/syscons/scvgarndr.c Mon Aug 24 22:05:08 2009 (r196523) +++ head/sys/dev/syscons/scvgarndr.c Mon Aug 24 22:35:53 2009 (r196524) @@ -193,6 +193,8 @@ static u_short mouse_or_mask[16] = { case 15: \ writew(pos, vga_palette15[color]); \ break; \ + case 8: \ + writeb(pos, (uint8_t)color); \ } static uint32_t vga_palette32[16] = { @@ -215,6 +217,7 @@ static uint16_t vga_palette15[16] = { #ifndef SC_NO_CUTPASTE static uint32_t mouse_buf32[256]; static uint16_t mouse_buf16[256]; +static uint8_t mouse_buf8[256]; #endif #endif @@ -498,7 +501,9 @@ vga_rndrinit(scr_stat *scp) scp->rndr->draw_cursor = vga_pxlcursor_planar; scp->rndr->blink_cursor = vga_pxlblink_planar; scp->rndr->draw_mouse = vga_pxlmouse_planar; - } else if (scp->sc->adp->va_info.vi_mem_model == V_INFO_MM_DIRECT) { + } else + if (scp->sc->adp->va_info.vi_mem_model == V_INFO_MM_DIRECT || + scp->sc->adp->va_info.vi_mem_model == V_INFO_MM_PACKED) { scp->rndr->clear = vga_pxlclear_direct; scp->rndr->draw_border = vga_pxlborder_direct; scp->rndr->draw = vga_vgadraw_direct; @@ -1148,6 +1153,7 @@ vga_pxlmouse_direct(scr_stat *scp, int x int i, j; uint32_t *u32; uint16_t *u16; + uint8_t *u8; int bpp; if (!on) @@ -1179,6 +1185,10 @@ vga_pxlmouse_direct(scr_stat *scp, int x u16 = (uint16_t*)(p + j * pixel_size); writew(u16, mouse_buf16[i * 16 + j]); break; + case 8: + u8 = (uint8_t*)(p + j * pixel_size); + writeb(u8, mouse_buf8[i * 16 + j]); + break; } } @@ -1214,6 +1224,14 @@ vga_pxlmouse_direct(scr_stat *scp, int x else if (mouse_and_mask[i] & (1 << (15 - j))) writew(u16, 0); break; + case 8: + u8 = (uint8_t*)(p + j * pixel_size); + mouse_buf8[i * 16 + j] = *u8; + if (mouse_or_mask[i] & (1 << (15 - j))) + writeb(u8, 15); + else if (mouse_and_mask[i] & (1 << (15 - j))) + writeb(u8, 0); + break; } } Modified: head/sys/dev/syscons/scvidctl.c ============================================================================== --- head/sys/dev/syscons/scvidctl.c Mon Aug 24 22:05:08 2009 (r196523) +++ head/sys/dev/syscons/scvidctl.c Mon Aug 24 22:35:53 2009 (r196524) @@ -391,6 +391,10 @@ sc_set_pixel_mode(scr_stat *scp, struct (info.vi_depth != 15) && (info.vi_depth != 16) && (info.vi_depth != 24) && (info.vi_depth != 32)) return ENODEV; + } else if (info.vi_mem_model == V_INFO_MM_PACKED) { + if (!(info.vi_flags & V_INFO_LINEAR) && + (info.vi_depth != 8)) + return ENODEV; } else return ENODEV; Modified: head/sys/i386/isa/vesa.c ============================================================================== --- head/sys/i386/isa/vesa.c Mon Aug 24 22:05:08 2009 (r196523) +++ head/sys/i386/isa/vesa.c Mon Aug 24 22:35:53 2009 (r196524) @@ -1074,6 +1074,11 @@ vesa_set_mode(video_adapter_t *adp, int (info.vi_flags & V_INFO_COLOR) ? V_ADP_COLOR : 0; vesa_adp->va_crtc_addr = (vesa_adp->va_flags & V_ADP_COLOR) ? COLOR_CRTC : MONO_CRTC; + + vesa_adp->va_window = BIOS_PADDRTOVADDR(info.vi_window); + vesa_adp->va_window_size = info.vi_window_size; + vesa_adp->va_window_gran = info.vi_window_gran; + if (info.vi_flags & V_INFO_LINEAR) { #if VESA_DEBUG > 1 printf("VESA: setting up LFB\n"); @@ -1083,33 +1088,31 @@ vesa_set_mode(video_adapter_t *adp, int vesa_adp_info->v_memsize*64*1024); vesa_adp->va_buffer_size = info.vi_buffer_size; vesa_adp->va_window = vesa_adp->va_buffer; - vesa_adp->va_window_size = info.vi_buffer_size/info.vi_planes; - vesa_adp->va_window_gran = info.vi_buffer_size/info.vi_planes; } else { vesa_adp->va_buffer = 0; - vesa_adp->va_buffer_size = info.vi_buffer_size; - vesa_adp->va_window = BIOS_PADDRTOVADDR(info.vi_window); - vesa_adp->va_window_size = info.vi_window_size; - vesa_adp->va_window_gran = info.vi_window_gran; + vesa_adp->va_buffer_size = 0; } +#if VESA_DEBUG > 1 + printf("VESA: buffer %x, buffer_size %d, window %x, window_size %d\n", + vesa_adp->va_buffer, + vesa_adp->va_buffer_size, + vesa_adp->va_window, + vesa_adp->va_window_size); +#endif vesa_adp->va_window_orig = 0; len = vesa_bios_get_line_length(); - if (len > 0) { - vesa_adp->va_line_width = len; - } else if (info.vi_flags & V_INFO_GRAPHICS) { - switch (info.vi_depth/info.vi_planes) { - case 1: - vesa_adp->va_line_width = info.vi_width/8; - break; - case 2: - vesa_adp->va_line_width = info.vi_width/4; - break; + if (info.vi_flags & V_INFO_GRAPHICS) { + switch (info.vi_depth) { case 4: - vesa_adp->va_line_width = info.vi_width/2; + vesa_adp->va_line_width = info.vi_width; break; case 8: - default: /* shouldn't happen */ - vesa_adp->va_line_width = info.vi_width; + case 15: + case 16: + case 24: + case 32: + default: + vesa_adp->va_line_width = info.vi_width * (info.vi_depth / 8); break; case 15: case 16: @@ -1126,8 +1129,8 @@ vesa_set_mode(video_adapter_t *adp, int vesa_adp->va_disp_start.x = 0; vesa_adp->va_disp_start.y = 0; #if VESA_DEBUG > 0 - printf("vesa_set_mode(): vi_width:%d, len:%d, line_width:%d\n", - info.vi_width, len, vesa_adp->va_line_width); + printf("vesa_set_mode(): vi_width:%d, len:%d, line_width:%d vi_mem_model:%d\n", + info.vi_width, len, vesa_adp->va_line_width, info.vi_mem_model); #endif bcopy(&info, &vesa_adp->va_info, sizeof(vesa_adp->va_info)); From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 23:44:07 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E6FD106568B; Mon, 24 Aug 2009 23:44:07 +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 6D8978FC08; Mon, 24 Aug 2009 23:44:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7ONi7Q1009749; Mon, 24 Aug 2009 23:44:07 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7ONi7xY009747; Mon, 24 Aug 2009 23:44:07 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200908242344.n7ONi7xY009747@svn.freebsd.org> From: Xin LI Date: Mon, 24 Aug 2009 23:44:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196525 - head/lib/libc/db/hash X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 23:44:07 -0000 Author: delphij Date: Mon Aug 24 23:44:07 2009 New Revision: 196525 URL: http://svn.freebsd.org/changeset/base/196525 Log: Consider flag == 0 as the same of flag == R_NEXT. This change will restore a historical behavior that has been changed by revision 190491, and has seen to break exim. Modified: head/lib/libc/db/hash/hash.c Modified: head/lib/libc/db/hash/hash.c ============================================================================== --- head/lib/libc/db/hash/hash.c Mon Aug 24 22:35:53 2009 (r196524) +++ head/lib/libc/db/hash/hash.c Mon Aug 24 23:44:07 2009 (r196525) @@ -711,7 +711,7 @@ hash_seq(const DB *dbp, DBT *key, DBT *d hashp->cndx = 1; hashp->cpage = NULL; } - next_bucket: +next_bucket: for (bp = NULL; !bp || !bp[0]; ) { if (!(bufp = hashp->cpage)) { for (bucket = hashp->cbucket; @@ -732,7 +732,7 @@ hash_seq(const DB *dbp, DBT *key, DBT *d } } else { bp = (u_int16_t *)hashp->cpage->page; - if (flag == R_NEXT) { + if (flag == R_NEXT || flag == 0) { hashp->cndx += 2; if (hashp->cndx > bp[0]) { hashp->cpage = NULL; From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 01:04:15 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B96DF106568C; Tue, 25 Aug 2009 01:04:15 +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 A8E9C8FC08; Tue, 25 Aug 2009 01:04:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7P14Fvg011283; Tue, 25 Aug 2009 01:04:15 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7P14FuF011281; Tue, 25 Aug 2009 01:04:15 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200908250104.n7P14FuF011281@svn.freebsd.org> From: Xin LI Date: Tue, 25 Aug 2009 01:04:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196526 - head/share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 01:04:15 -0000 Author: delphij Date: Tue Aug 25 01:04:15 2009 New Revision: 196526 URL: http://svn.freebsd.org/changeset/base/196526 Log: Add a missing .El. Founded by: make manlint Modified: head/share/man/man5/tmpfs.5 Modified: head/share/man/man5/tmpfs.5 ============================================================================== --- head/share/man/man5/tmpfs.5 Mon Aug 24 23:44:07 2009 (r196525) +++ head/share/man/man5/tmpfs.5 Tue Aug 25 01:04:15 2009 (r196526) @@ -70,6 +70,7 @@ permissions in octal format. maximum number of inodes. .It Cm size maximum size (in bytes) for the file system. +.El .Sh EXAMPLES To mount a .Nm From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 04:09:10 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0EE60106568C; Tue, 25 Aug 2009 04:09:10 +0000 (UTC) (envelope-from charnier@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F09BB8FC18; Tue, 25 Aug 2009 04:09:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7P499W2015390; Tue, 25 Aug 2009 04:09:09 GMT (envelope-from charnier@svn.freebsd.org) Received: (from charnier@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7P499aV015388; Tue, 25 Aug 2009 04:09:09 GMT (envelope-from charnier@svn.freebsd.org) Message-Id: <200908250409.n7P499aV015388@svn.freebsd.org> From: Philippe Charnier Date: Tue, 25 Aug 2009 04:09:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196527 - head/sbin/route X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 04:09:10 -0000 Author: charnier Date: Tue Aug 25 04:09:09 2009 New Revision: 196527 URL: http://svn.freebsd.org/changeset/base/196527 Log: ANSIfy functions declarations, adjust prototypes. Rename local variable to not conflict with err(). Modified: head/sbin/route/route.c Modified: head/sbin/route/route.c ============================================================================== --- head/sbin/route/route.c Tue Aug 25 01:04:15 2009 (r196526) +++ head/sbin/route/route.c Tue Aug 25 04:09:09 2009 (r196527) @@ -37,10 +37,11 @@ static const char copyright[] = #if 0 static char sccsid[] = "@(#)route.c 8.6 (Berkeley) 4/28/95"; #endif -static const char rcsid[] = - "$FreeBSD$"; #endif /* not lint */ +#include +__FBSDID("$FreeBSD$"); + #include #include #include @@ -92,29 +93,44 @@ union sockunion { typedef union sockunion *sup; int pid, rtm_addrs; int s; -int forcehost, forcenet, doflush, nflag, af, qflag, tflag, keyword(); +int forcehost, forcenet, doflush, nflag, af, qflag, tflag; int iflag, verbose, aflen = sizeof (struct sockaddr_in); int locking, lockrest, debugonly; struct rt_metrics rt_metrics; u_long rtm_inits; uid_t uid; + int atalk_aton(const char *, struct at_addr *); char *atalk_ntoa(struct at_addr); -const char *routename(), *netname(); -void flushroutes(), newroute(), monitor(), sockaddr(), sodump(), bprintf(); -void print_getmsg(), print_rtmsg(), pmsg_common(), pmsg_addrs(), mask_addr(); +void bprintf(FILE *, int, u_char *); +void flushroutes(int argc, char *argv[]); +int getaddr(int, char *, struct hostent **); +int keyword(char *); +void inet_makenetandmask(u_long, struct sockaddr_in *, u_long); #ifdef INET6 static int inet6_makenetandmask(struct sockaddr_in6 *, char *); #endif -int getaddr(), rtmsg(), x25_makemask(); -int prefixlen(); +void interfaces(void); +void mask_addr(void); +void monitor(void); +const char *netname(struct sockaddr *); +void newroute(int, char **); +void pmsg_addrs(char *, int); +void pmsg_common(struct rt_msghdr *); +int prefixlen(char *); +void print_getmsg(struct rt_msghdr *, int); +void print_rtmsg(struct rt_msghdr *, int); +const char *routename(struct sockaddr *); +int rtmsg(int, int); +void set_metric(char *, int); +void sockaddr(char *, struct sockaddr *); +void sodump(sup, char *); extern char *iso_ntoa(); void usage(const char *) __dead2; void -usage(cp) - const char *cp; +usage(const char *cp) { if (cp) warnx("bad keyword: %s", cp); @@ -125,9 +141,7 @@ usage(cp) } int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { int ch; @@ -198,9 +212,7 @@ main(argc, argv) * associated with network interfaces. */ void -flushroutes(argc, argv) - int argc; - char *argv[]; +flushroutes(int argc, char *argv[]) { size_t needed; int mib[6], rlen, seqno, count = 0; @@ -301,8 +313,7 @@ retry: } const char * -routename(sa) - struct sockaddr *sa; +routename(struct sockaddr *sa) { char *cp; static char line[MAXHOSTNAMELEN + 1]; @@ -410,8 +421,7 @@ routename(sa) * The address is assumed to be that of a net or subnet, not a host. */ const char * -netname(sa) - struct sockaddr *sa; +netname(struct sockaddr *sa) { char *cp = 0; static char line[MAXHOSTNAMELEN + 1]; @@ -532,9 +542,7 @@ netname(sa) } void -set_metric(value, key) - char *value; - int key; +set_metric(char *value, int key) { int flag = 0; u_long noval, *valp = &noval; @@ -560,11 +568,9 @@ set_metric(value, key) } void -newroute(argc, argv) - int argc; - char **argv; +newroute(int argc, char **argv) { - char *cmd, *dest = "", *gateway = "", *err; + char *cmd, *dest = "", *gateway = "", *errmsg; int ishost = 0, proxy = 0, ret, attempts, oerrno, flags = RTF_STATIC; int key; struct hostent *hp = 0; @@ -767,35 +773,33 @@ newroute(argc, argv) } else { switch (oerrno) { case ESRCH: - err = "not in table"; + errmsg = "not in table"; break; case EBUSY: - err = "entry in use"; + errmsg = "entry in use"; break; case ENOBUFS: - err = "not enough memory"; + errmsg = "not enough memory"; break; case EADDRINUSE: /* handle recursion avoidance in rt_setgate() */ - err = "gateway uses the same route"; + errmsg = "gateway uses the same route"; break; case EEXIST: - err = "route already in table"; + errmsg = "route already in table"; break; default: - err = strerror(oerrno); + errmsg = strerror(oerrno); break; } - (void) printf(": %s\n", err); + (void) printf(": %s\n", errmsg); } } exit(ret != 0); } void -inet_makenetandmask(net, sin, bits) - u_long net, bits; - struct sockaddr_in *sin; +inet_makenetandmask(u_long net, struct sockaddr_in *sin, u_long bits) { u_long addr, mask = 0; char *cp; @@ -847,9 +851,7 @@ inet_makenetandmask(net, sin, bits) * XXX the function may need more improvement... */ static int -inet6_makenetandmask(sin6, plen) - struct sockaddr_in6 *sin6; - char *plen; +inet6_makenetandmask(struct sockaddr_in6 *sin6, char *plen) { struct in6_addr in6; @@ -879,10 +881,7 @@ inet6_makenetandmask(sin6, plen) * returning 1 if a host address, 0 if a network address. */ int -getaddr(which, s, hpp) - int which; - char *s; - struct hostent **hpp; +getaddr(int which, char *s, struct hostent **hpp) { sup su; struct hostent *hp; @@ -1077,8 +1076,7 @@ netdone: } int -prefixlen(s) - char *s; +prefixlen(char *s) { int len = atoi(s), q, r; int max; @@ -1123,7 +1121,7 @@ prefixlen(s) } void -interfaces() +interfaces(void) { size_t needed; int mib[6]; @@ -1158,7 +1156,7 @@ retry2: } void -monitor() +monitor(void) { int n; char msg[2048]; @@ -1183,8 +1181,7 @@ struct { } m_rtmsg; int -rtmsg(cmd, flags) - int cmd, flags; +rtmsg(int cmd, int flags) { static int seq; int rlen; @@ -1254,7 +1251,7 @@ rtmsg(cmd, flags) } void -mask_addr() +mask_addr(void) { int olen = so_mask.sa.sa_len; char *cp1 = olen + (char *)&so_mask, *cp2; @@ -1322,9 +1319,7 @@ char addrnames[] = "\1DST\2GATEWAY\3NETMASK\4GENMASK\5IFP\6IFA\7AUTHOR\010BRD"; void -print_rtmsg(rtm, msglen) - struct rt_msghdr *rtm; - int msglen; +print_rtmsg(struct rt_msghdr *rtm, int msglen) { struct if_msghdr *ifm; struct ifa_msghdr *ifam; @@ -1405,9 +1400,7 @@ print_rtmsg(rtm, msglen) } void -print_getmsg(rtm, msglen) - struct rt_msghdr *rtm; - int msglen; +print_getmsg(struct rt_msghdr *rtm, int msglen) { struct sockaddr *dst = NULL, *gate = NULL, *mask = NULL; struct sockaddr_dl *ifp = NULL; @@ -1415,7 +1408,8 @@ print_getmsg(rtm, msglen) char *cp; int i; - (void) printf(" route to: %s\n", routename(&so_dst)); + (void) printf(" route to: %s\n", + routename((struct sockaddr *)&so_dst)); if (rtm->rtm_version != RTM_VERSION) { warnx("routing message version %d not understood", rtm->rtm_version); @@ -1500,8 +1494,7 @@ print_getmsg(rtm, msglen) } void -pmsg_common(rtm) - struct rt_msghdr *rtm; +pmsg_common(struct rt_msghdr *rtm) { (void) printf("\nlocks: "); bprintf(stdout, rtm->rtm_rmx.rmx_locks, metricnames); @@ -1511,9 +1504,7 @@ pmsg_common(rtm) } void -pmsg_addrs(cp, addrs) - char *cp; - int addrs; +pmsg_addrs(char *cp, int addrs) { struct sockaddr *sa; int i; @@ -1536,10 +1527,7 @@ pmsg_addrs(cp, addrs) } void -bprintf(fp, b, s) - FILE *fp; - int b; - u_char *s; +bprintf(FILE *fp, int b, u_char *s) { int i; int gotsome = 0; @@ -1565,8 +1553,7 @@ bprintf(fp, b, s) } int -keyword(cp) - char *cp; +keyword(char *cp) { struct keytab *kt = keywords; @@ -1576,9 +1563,7 @@ keyword(cp) } void -sodump(su, which) - sup su; - char *which; +sodump(sup su, char *which) { switch (su->sa.sa_family) { case AF_LINK: @@ -1607,9 +1592,7 @@ sodump(su, which) #define DELIM (4*2) void -sockaddr(addr, sa) - char *addr; - struct sockaddr *sa; +sockaddr(char *addr, struct sockaddr *sa) { char *cp = (char *)sa; int size = sa->sa_len; From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 06:21:46 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 516E6106568C; Tue, 25 Aug 2009 06:21:46 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 411A28FC21; Tue, 25 Aug 2009 06:21:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7P6Lj4b018041; Tue, 25 Aug 2009 06:21:45 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7P6LjKQ018039; Tue, 25 Aug 2009 06:21:45 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200908250621.n7P6LjKQ018039@svn.freebsd.org> From: Ulf Lilleengen Date: Tue, 25 Aug 2009 06:21:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196528 - head/sbin/savecore X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 06:21:46 -0000 Author: lulf Date: Tue Aug 25 06:21:45 2009 New Revision: 196528 URL: http://svn.freebsd.org/changeset/base/196528 Log: - Add a SIGINFO handler for savecore. Modified: head/sbin/savecore/savecore.c Modified: head/sbin/savecore/savecore.c ============================================================================== --- head/sbin/savecore/savecore.c Tue Aug 25 04:09:09 2009 (r196527) +++ head/sbin/savecore/savecore.c Tue Aug 25 06:21:45 2009 (r196528) @@ -97,6 +97,9 @@ static int nfound, nsaved, nerr; /* st extern FILE *zopen(const char *, const char *); +static sig_atomic_t got_siginfo; +static void infohandler(int); + static void printheader(FILE *f, const struct kerneldumpheader *h, const char *device, int bounds, const int status) @@ -231,9 +234,10 @@ DoRegularFile(int fd, off_t dumpsize, ch const char *filename, FILE *fp) { int he, hs, nr, nw, wl; - off_t dmpcnt; + off_t dmpcnt, origsize; dmpcnt = 0; + origsize = dumpsize; he = 0; while (dumpsize > 0) { wl = BUFFERSIZE; @@ -304,6 +308,11 @@ DoRegularFile(int fd, off_t dumpsize, ch fflush(stdout); } dumpsize -= wl; + if (got_siginfo) { + printf("%s %.1lf%%\n", filename, (100.0 - (100.0 * + (double)dumpsize / (double)origsize))); + got_siginfo = 0; + } } return (0); } @@ -648,6 +657,7 @@ main(int argc, char **argv) nfound = nsaved = nerr = 0; openlog("savecore", LOG_PERROR, LOG_DAEMON); + signal(SIGINFO, infohandler); while ((ch = getopt(argc, argv, "Ccfkvz")) != -1) switch(ch) { @@ -719,3 +729,9 @@ main(int argc, char **argv) return (0); } + +static void +infohandler(int sig __unused) +{ + got_siginfo = 1; +} From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 06:25:59 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2773106568C; Tue, 25 Aug 2009 06:25:59 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B1DA58FC0A; Tue, 25 Aug 2009 06:25:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7P6Pxdu018173; Tue, 25 Aug 2009 06:25:59 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7P6Px9E018171; Tue, 25 Aug 2009 06:25:59 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200908250625.n7P6Px9E018171@svn.freebsd.org> From: Warner Losh Date: Tue, 25 Aug 2009 06:25:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196529 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 06:25:59 -0000 Author: imp Date: Tue Aug 25 06:25:59 2009 New Revision: 196529 URL: http://svn.freebsd.org/changeset/base/196529 Log: Rather than havnig enabled/disabled, implement a max queue depth. While usually not an issue, this firewalls bugs in the code that may run us out of memory. Fix a memory exhaustion in the case where devctl was disabled, but the link was bouncing. The check to queue was in the wrong place. Implement a new sysctl hw.bus.devctl_queue to control the depth. Make compatibility hacks for hw.bus.devctl_disable to ease transition. Reviewed by: emaste@ Approved by: re@ (kib) MFC after: asap Modified: head/sys/kern/subr_bus.c Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Tue Aug 25 06:21:45 2009 (r196528) +++ head/sys/kern/subr_bus.c Tue Aug 25 06:25:59 2009 (r196529) @@ -350,11 +350,18 @@ device_sysctl_fini(device_t dev) * tested since 3.4 or 2.2.8! */ +/* Deprecated way to adjust queue length */ static int sysctl_devctl_disable(SYSCTL_HANDLER_ARGS); -static int devctl_disable = 0; -TUNABLE_INT("hw.bus.devctl_disable", &devctl_disable); +/* XXX Need to support old-style tunable hw.bus.devctl_disable" */ SYSCTL_PROC(_hw_bus, OID_AUTO, devctl_disable, CTLTYPE_INT | CTLFLAG_RW, NULL, - 0, sysctl_devctl_disable, "I", "devctl disable"); + 0, sysctl_devctl_disable, "I", "devctl disable -- deprecated"); + +#define DEVCTL_DEFAULT_QUEUE_LEN 1000 +static int sysctl_devctl_queue(SYSCTL_HANDLER_ARGS); +static int devctl_queue_length = DEVCTL_DEFAULT_QUEUE_LEN; +TUNABLE_INT("hw.bus.devctl_queue", &devctl_queue_length); +SYSCTL_PROC(_hw_bus, OID_AUTO, devctl_queue, CTLTYPE_INT | CTLFLAG_RW, NULL, + 0, sysctl_devctl_queue, "I", "devctl queue length"); static d_open_t devopen; static d_close_t devclose; @@ -385,6 +392,7 @@ static struct dev_softc { int inuse; int nonblock; + int queued; struct mtx mtx; struct cv cv; struct selinfo sel; @@ -423,7 +431,7 @@ devclose(struct cdev *dev, int fflag, in mtx_lock(&devsoftc.mtx); cv_broadcast(&devsoftc.cv); mtx_unlock(&devsoftc.mtx); - + devsoftc.async_proc = NULL; return (0); } @@ -458,6 +466,7 @@ devread(struct cdev *dev, struct uio *ui } n1 = TAILQ_FIRST(&devsoftc.devq); TAILQ_REMOVE(&devsoftc.devq, n1, dei_link); + devsoftc.queued--; mtx_unlock(&devsoftc.mtx); rv = uiomove(n1->dei_data, strlen(n1->dei_data), uio); free(n1->dei_data, M_BUS); @@ -531,21 +540,33 @@ devctl_process_running(void) void devctl_queue_data(char *data) { - struct dev_event_info *n1 = NULL; + struct dev_event_info *n1 = NULL, *n2 = NULL; struct proc *p; - /* - * Do not allow empty strings to be queued, as they - * cause devd to exit prematurely. - */ if (strlen(data) == 0) return; + if (devctl_queue_length == 0) + return; n1 = malloc(sizeof(*n1), M_BUS, M_NOWAIT); if (n1 == NULL) return; n1->dei_data = data; mtx_lock(&devsoftc.mtx); + if (devctl_queue_length == 0) { + free(n1->dei_data, M_BUS); + free(n1, M_BUS); + return; + } + /* Leave at least one spot in the queue... */ + while (devsoftc.queued > devctl_queue_length - 1) { + n2 = TAILQ_FIRST(&devsoftc.devq); + TAILQ_REMOVE(&devsoftc.devq, n2, dei_link); + free(n2->dei_data, M_BUS); + free(n2, M_BUS); + devsoftc.queued--; + } TAILQ_INSERT_TAIL(&devsoftc.devq, n1, dei_link); + devsoftc.queued++; cv_broadcast(&devsoftc.cv); mtx_unlock(&devsoftc.mtx); selwakeup(&devsoftc.sel); @@ -614,7 +635,7 @@ devaddq(const char *type, const char *wh char *pnp = NULL; const char *parstr; - if (devctl_disable) + if (!devctl_queue_length)/* Rare race, but lost races safely discard */ return; data = malloc(1024, M_BUS, M_NOWAIT); if (data == NULL) @@ -731,12 +752,11 @@ sysctl_devctl_disable(SYSCTL_HANDLER_ARG struct dev_event_info *n1; int dis, error; - dis = devctl_disable; + dis = devctl_queue_length == 0; error = sysctl_handle_int(oidp, &dis, 0, req); if (error || !req->newptr) return (error); mtx_lock(&devsoftc.mtx); - devctl_disable = dis; if (dis) { while (!TAILQ_EMPTY(&devsoftc.devq)) { n1 = TAILQ_FIRST(&devsoftc.devq); @@ -744,6 +764,35 @@ sysctl_devctl_disable(SYSCTL_HANDLER_ARG free(n1->dei_data, M_BUS); free(n1, M_BUS); } + devsoftc.queued = 0; + devctl_queue_length = 0; + } else { + devctl_queue_length = DEVCTL_DEFAULT_QUEUE_LEN; + } + mtx_unlock(&devsoftc.mtx); + return (0); +} + +static int +sysctl_devctl_queue(SYSCTL_HANDLER_ARGS) +{ + struct dev_event_info *n1; + int q, error; + + q = devctl_queue_length; + error = sysctl_handle_int(oidp, &q, 0, req); + if (error || !req->newptr) + return (error); + if (q < 0) + return (EINVAL); + mtx_lock(&devsoftc.mtx); + devctl_queue_length = q; + while (devsoftc.queued > devctl_queue_length) { + n1 = TAILQ_FIRST(&devsoftc.devq); + TAILQ_REMOVE(&devsoftc.devq, n1, dei_link); + free(n1->dei_data, M_BUS); + free(n1, M_BUS); + devsoftc.queued--; } mtx_unlock(&devsoftc.mtx); return (0); @@ -886,7 +935,7 @@ devclass_find_internal(const char *class if (create && !dc) { PDEBUG(("creating %s", classname)); dc = malloc(sizeof(struct devclass) + strlen(classname) + 1, - M_BUS, M_NOWAIT|M_ZERO); + M_BUS, M_NOWAIT | M_ZERO); if (!dc) return (NULL); dc->parent = NULL; From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 06:26:07 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E4D21065691; Tue, 25 Aug 2009 06:26:07 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.freebsd.org (Postfix) with ESMTP id 371798FC0C; Tue, 25 Aug 2009 06:26:06 +0000 (UTC) Received: from phobos.local (pooker.samsco.org [168.103.85.57]) by pooker.samsco.org (8.14.2/8.14.2) with ESMTP id n7P6Px2X024537; Tue, 25 Aug 2009 00:26:00 -0600 (MDT) (envelope-from scottl@samsco.org) Message-ID: <4A9383F7.30102@samsco.org> Date: Tue, 25 Aug 2009 00:25:59 -0600 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9 MIME-Version: 1.0 To: Jeremie Le Hen References: <200908132318.n7DNIjvO015601@svn.freebsd.org> <20090823143840.GD61707@felucia.tataz.chchile.org> <76094077-6E36-45DF-B717-3C7884377A89@lassitu.de> In-Reply-To: <76094077-6E36-45DF-B717-3C7884377A89@lassitu.de> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.5 required=3.8 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on pooker.samsco.org Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Scott Long , Stefan Bethke Subject: Re: svn commit: r196200 - in head: etc/mtree include sys/dev/mfi usr.sbin usr.sbin/mfiutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 06:26:07 -0000 Stefan Bethke wrote: > > Am 23.08.2009 um 16:38 schrieb Jeremie Le Hen: > >> Wouldn't it be more reasonable to use a standard >> suffix for all dedicated admin utility such as vidcontrol, memcontrol, >> kbdcontrol: >> >> % 59# find /bin /sbin /usr/bin /usr/sbin -name \*control | wc -l >> % 25 >> % 60# find /bin /sbin /usr/bin /usr/sbin -name \*config | wc -l >> % 13 > > > $ find /bin /sbin /usr/bin /usr/sbin -name \*ctl | wc -l > 12 > $ find /bin /sbin /usr/bin /usr/sbin -name \*cfg | wc -l > 1 > $ find /bin /sbin /usr/bin /usr/sbin -name \*util | wc -l > 3 > > I'm afraid that train's left long ago. > > > Stefan > Both mptutil and mfiutil originated at Yahoo, where we have other utilities with a "util" suffix. Ultimately, I'm trying to reduce diffs between freebsd and ybsd, and it's not going to be productive for me to arbitrarily rename these programs, no matter what the aesthetic rationale might be. And, as Stefan aptly points out, there is no overwhelming aesthetic rationale anyways. Scott From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 07:52:10 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A04F106568F; Tue, 25 Aug 2009 07:52:10 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A8018FC12; Tue, 25 Aug 2009 07:52:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7P7qAqv019957; Tue, 25 Aug 2009 07:52:10 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7P7qA2r019955; Tue, 25 Aug 2009 07:52:10 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200908250752.n7P7qA2r019955@svn.freebsd.org> From: Brian Somers Date: Tue, 25 Aug 2009 07:52:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196530 - head/usr.sbin/ppp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 07:52:10 -0000 Author: brian Date: Tue Aug 25 07:52:09 2009 New Revision: 196530 URL: http://svn.freebsd.org/changeset/base/196530 Log: Document that ppp handles pipe(2) descriptors specially in -direct mode. MFC after: 3 days Modified: head/usr.sbin/ppp/ppp.8.m4 Modified: head/usr.sbin/ppp/ppp.8.m4 ============================================================================== --- head/usr.sbin/ppp/ppp.8.m4 Tue Aug 25 06:25:59 2009 (r196529) +++ head/usr.sbin/ppp/ppp.8.m4 Tue Aug 25 07:52:09 2009 (r196530) @@ -27,7 +27,7 @@ changecom(,)dnl .\" .\" $FreeBSD$ .\" -.Dd May 24, 2007 +.Dd August 25, 2009 .Dt PPP 8 .Os .Sh NAME @@ -171,6 +171,17 @@ If callback is configured, will use the .Dq set device information when dialing back. +.Pp +When run in +.Fl direct +mode, +.Nm +will behave slightly differently if descriptor 0 was created by +.Xr pipe 2 . +As pipes are not bi-directional, ppp will redirect all writes to descriptor +1 (standard output), leaving only reads acting on descriptor 0. +No special action is taken if descriptor 0 was created by +.Xr socketpair 2 . .It Fl dedicated This option is designed for machines connected with a dedicated wire. @@ -6055,6 +6066,8 @@ This socket is used to pass links betwee .Xr tcpdump 1 , .Xr telnet 1 , .Xr kldload 2 , +.Xr pipe 2 , +.Xr socketpair 2 , ifdef({LOCALNAT},{},{.Xr libalias 3 , })dnl ifdef({LOCALRAD},{},{.Xr libradius 3 , From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 08:33:55 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61953106568C; Tue, 25 Aug 2009 08:33:55 +0000 (UTC) (envelope-from mitya@m4-new.master-telecom.ru) Received: from m4-new.master-telecom.ru (m4-new.master-telecom.ru [85.193.64.114]) by mx1.freebsd.org (Postfix) with ESMTP id AD2918FC20; Tue, 25 Aug 2009 08:33:54 +0000 (UTC) Received: from m4-new.master-telecom.ru (localhost [127.0.0.1]) by m4-new.master-telecom.ru (8.13.8/8.13.8) with ESMTP id n7P7xXux078835; Tue, 25 Aug 2009 11:59:33 +0400 (MSD) (envelope-from mitya@m4-new.master-telecom.ru) Received: (from mitya@localhost) by m4-new.master-telecom.ru (8.13.8/8.13.8/Submit) id n7P7xUWX078830; Tue, 25 Aug 2009 11:59:30 +0400 (MSD) (envelope-from mitya) Date: Tue, 25 Aug 2009 11:59:30 +0400 From: Dmitry Sivachenko To: Pyun YongHyeon Message-ID: <20090825075930.GA77905@m4-new.master-telecom.ru> References: <200902271925.n1RJP699080658@svn.freebsd.org> <20090721145559.d2cf3f0b.stas@FreeBSD.org> <4A7AFFC4.5050607@tomjudge.com> <20090812234935.84e5ac74.stas@FreeBSD.org> <4A8337BD.3010700@delphij.net> <20090812225726.GI55129@michelle.cdnetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20090812225726.GI55129@michelle.cdnetworks.com> WWW-Home-Page: http://mitya.pp.ru/ X-PGP-Key: http://mitya.pp.ru/mitya.asc User-Agent: Mutt/1.5.18 (2008-05-17) Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, David Christensen , Stanislav Sedov , Tom Judge , svn-src-head@freebsd.org, Xin LI Subject: Re: svn commit: r189117 - head/sys/dev/bce X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 08:33:55 -0000 On Wed, Aug 12, 2009 at 03:57:26PM -0700, Pyun YongHyeon wrote: > On Wed, Aug 12, 2009 at 02:44:29PM -0700, Xin LI wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > Hi, Stanislav, > > > > Stanislav Sedov wrote: > > > On Thu, 06 Aug 2009 11:07:32 -0500 > > > Tom Judge mentioned: > > > > > >> I can confirm that we are also seeing this problem on a number of Dell > > >> PE2950 systems running the bce driver from 7.2, the bug is more > > >> visible/producible on systems that are using Jumbo Frames (in our case 8Kb). > > >> > > >> The symptoms of this are an increase in the requests for jumbo clusters > > >> denied counter at 9k, and then random network stalls which sometimes > > >> recover on there own and others require a reboot. > > >> > > >> We have backed this change and so far it seems to have fixed the issue. > > >> > > > > > > David, > > > > > > are you OK with reverting this patch? I submitted the patch to re@ for > > > review, and I can commit it if you don't mind doing so. :-) > > > > I think there was some motivation supporting the SPLIT_HEADER disable in > > the past (IIRC it was for reliability or data corruption), but I think I > > have lost the mail archive (at least I couldn't find it at this moment > > :-/ I'm not very sure if that was fixed by my busdma_sync fix, though, > > can anyone confirm that? > > > > Since I don't have bce(4) hardwares I can't confirm it. I think the > busdma_sync fix would be prerequisite condition to fix data > corruption problem but I think it would not necessarily fix > previous data corruption issue. I wish you reach some consensus there because bce(4) is indeed broken and stas's patch seems to make it better. From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 09:30:03 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8875B10656A5; Tue, 25 Aug 2009 09:30:03 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 773ED8FC28; Tue, 25 Aug 2009 09:30:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7P9U38E022031; Tue, 25 Aug 2009 09:30:03 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7P9U3A3022025; Tue, 25 Aug 2009 09:30:03 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200908250930.n7P9U3A3022025@svn.freebsd.org> From: Rafal Jaworowski Date: Tue, 25 Aug 2009 09:30:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196531 - in head/sys/arm/mv: . discovery kirkwood orion X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 09:30:03 -0000 Author: raj Date: Tue Aug 25 09:30:03 2009 New Revision: 196531 URL: http://svn.freebsd.org/changeset/base/196531 Log: Eliminate platform_pmap_init() to simplify Marvell bootstrap code. Modified: head/sys/arm/mv/discovery/db78xxx.c head/sys/arm/mv/kirkwood/db88f6xxx.c head/sys/arm/mv/mv_machdep.c head/sys/arm/mv/mvvar.h head/sys/arm/mv/orion/db88f5xxx.c Modified: head/sys/arm/mv/discovery/db78xxx.c ============================================================================== --- head/sys/arm/mv/discovery/db78xxx.c Tue Aug 25 07:52:09 2009 (r196530) +++ head/sys/arm/mv/discovery/db78xxx.c Tue Aug 25 09:30:03 2009 (r196531) @@ -68,11 +68,8 @@ __FBSDID("$FreeBSD$"); * 0xffff_2000 - 0xffff_ffff : unused (~55KB) */ -const struct pmap_devmap *pmap_devmap_bootstrap_table; -vm_offset_t pmap_bootstrap_lastaddr; - /* Static device mappings. */ -static const struct pmap_devmap pmap_devmap[] = { +const struct pmap_devmap pmap_devmap[] = { /* * Map the on-board devices VA == PA so that we can access them * with the MMU on or off. @@ -105,16 +102,6 @@ const struct gpio_config mv_gpio_config[ { -1, -1, -1 } }; -int -platform_pmap_init(void) -{ - - pmap_bootstrap_lastaddr = MV_BASE - ARM_NOCACHE_KVA_SIZE; - pmap_devmap_bootstrap_table = &pmap_devmap[0]; - - return (0); -} - void platform_mpp_init(void) { Modified: head/sys/arm/mv/kirkwood/db88f6xxx.c ============================================================================== --- head/sys/arm/mv/kirkwood/db88f6xxx.c Tue Aug 25 07:52:09 2009 (r196530) +++ head/sys/arm/mv/kirkwood/db88f6xxx.c Tue Aug 25 09:30:03 2009 (r196531) @@ -68,11 +68,8 @@ __FBSDID("$FreeBSD$"); * 0xffff_2000 - 0xffff_ffff : unused (~55KB) */ -const struct pmap_devmap *pmap_devmap_bootstrap_table; -vm_offset_t pmap_bootstrap_lastaddr; - /* Static device mappings. */ -static const struct pmap_devmap pmap_devmap[] = { +const struct pmap_devmap pmap_devmap[] = { /* * Map the on-board devices VA == PA so that we can access them * with the MMU on or off. @@ -105,16 +102,6 @@ const struct gpio_config mv_gpio_config[ { -1, -1, -1 } }; -int -platform_pmap_init(void) -{ - - pmap_bootstrap_lastaddr = MV_BASE - ARM_NOCACHE_KVA_SIZE; - pmap_devmap_bootstrap_table = &pmap_devmap[0]; - - return (0); -} - void platform_mpp_init(void) { Modified: head/sys/arm/mv/mv_machdep.c ============================================================================== --- head/sys/arm/mv/mv_machdep.c Tue Aug 25 07:52:09 2009 (r196530) +++ head/sys/arm/mv/mv_machdep.c Tue Aug 25 09:30:03 2009 (r196531) @@ -86,6 +86,7 @@ __FBSDID("$FreeBSD$"); #include #include /* XXX eventually this should be eliminated */ +#include #ifdef DEBUG #define debugf(fmt, args...) printf(fmt, ##args) @@ -133,7 +134,9 @@ struct pcpu *pcpup = &__pcpu; vm_paddr_t phys_avail[10]; vm_paddr_t dump_avail[4]; vm_offset_t physical_pages; +vm_offset_t pmap_bootstrap_lastaddr; +const struct pmap_devmap *pmap_devmap_bootstrap_table; struct pv_addr systempage; struct pv_addr msgbufpv; struct pv_addr irqstack; @@ -423,8 +426,8 @@ initarm(void *mdp, void *unused __unused while (1); /* Platform-specific initialisation */ - if (platform_pmap_init() != 0) - return (NULL); + pmap_bootstrap_lastaddr = MV_BASE - ARM_NOCACHE_KVA_SIZE; + pmap_devmap_bootstrap_table = &pmap_devmap[0]; pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); Modified: head/sys/arm/mv/mvvar.h ============================================================================== --- head/sys/arm/mv/mvvar.h Tue Aug 25 07:52:09 2009 (r196530) +++ head/sys/arm/mv/mvvar.h Tue Aug 25 09:30:03 2009 (r196531) @@ -41,6 +41,10 @@ #define _MVVAR_H_ #include +#include +#include +#include +#include #define MV_TYPE_PCI 0 #define MV_TYPE_PCIE 1 @@ -104,6 +108,7 @@ struct decode_win { int remap; }; +extern const struct pmap_devmap pmap_devmap[]; extern const struct obio_pci mv_pci_info[]; extern const struct gpio_config mv_gpio_config[]; extern bus_space_tag_t obio_tag; @@ -124,7 +129,6 @@ int mv_gpio_configure(uint32_t pin, uint void mv_gpio_out(uint32_t pin, uint8_t val, uint8_t enable); uint8_t mv_gpio_in(uint32_t pin); -int platform_pmap_init(void); void platform_mpp_init(void); int soc_decode_win(void); void soc_id(uint32_t *dev, uint32_t *rev); Modified: head/sys/arm/mv/orion/db88f5xxx.c ============================================================================== --- head/sys/arm/mv/orion/db88f5xxx.c Tue Aug 25 07:52:09 2009 (r196530) +++ head/sys/arm/mv/orion/db88f5xxx.c Tue Aug 25 09:30:03 2009 (r196531) @@ -70,12 +70,10 @@ __FBSDID("$FreeBSD$"); * 0xffff_2000 - 0xffff_ffff : unused (~55KB) */ -const struct pmap_devmap *pmap_devmap_bootstrap_table; -vm_offset_t pmap_bootstrap_lastaddr; int platform_pci_get_irq(u_int bus, u_int slot, u_int func, u_int pin); /* Static device mappings. */ -static const struct pmap_devmap pmap_devmap[] = { +const struct pmap_devmap pmap_devmap[] = { /* * Map the on-board devices VA == PA so that we can access them * with the MMU on or off. @@ -184,16 +182,6 @@ const struct gpio_config mv_gpio_config[ }; #endif -int -platform_pmap_init(void) -{ - - pmap_bootstrap_lastaddr = MV_BASE - ARM_NOCACHE_KVA_SIZE; - pmap_devmap_bootstrap_table = &pmap_devmap[0]; - - return (0); -} - void platform_mpp_init(void) { From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 09:35:51 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2751106568B; Tue, 25 Aug 2009 09:35:50 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D177D8FC0C; Tue, 25 Aug 2009 09:35:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7P9ZovL022183; Tue, 25 Aug 2009 09:35:50 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7P9Zonj022179; Tue, 25 Aug 2009 09:35:50 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200908250935.n7P9Zonj022179@svn.freebsd.org> From: Rafal Jaworowski Date: Tue, 25 Aug 2009 09:35:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196532 - head/sys/arm/mv X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 09:35:51 -0000 Author: raj Date: Tue Aug 25 09:35:50 2009 New Revision: 196532 URL: http://svn.freebsd.org/changeset/base/196532 Log: Properly handle initial state of power mgmt. Modules on Marvell SOC can be selectively PM-disabled, and we must not access disabled devices' registers (attempt to initialize them) unconditionally, as this leads to the system hang. This patch introduces graceful handling of the PM state during devices init. Submitted by: Michal Hajduk Obtained from: Semihalf Modified: head/sys/arm/mv/common.c head/sys/arm/mv/mvreg.h head/sys/arm/mv/mvvar.h Modified: head/sys/arm/mv/common.c ============================================================================== --- head/sys/arm/mv/common.c Tue Aug 25 09:30:03 2009 (r196531) +++ head/sys/arm/mv/common.c Tue Aug 25 09:35:50 2009 (r196532) @@ -32,8 +32,10 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include +#include #include @@ -62,6 +64,76 @@ static void decode_win_usb_dump(void); static uint32_t used_cpu_wins; +static __inline int +pm_is_disabled(uint32_t mask) +{ + + return (soc_power_ctrl_get(mask) == mask ? 0 : 1); +} + +static __inline uint32_t +obio_get_pm_mask(uint32_t base) +{ + struct obio_device *od; + + for (od = obio_devices; od->od_name != NULL; od++) + if (od->od_base == base) + return (od->od_pwr_mask); + + return (CPU_PM_CTRL_NONE); +} + +/* + * Disable device using power management register. + * 1 - Device Power On + * 0 - Device Power Off + * Mask can be set in loader. + * EXAMPLE: + * loader> set hw.pm-disable-mask=0x2 + * + * Common mask: + * |-------------------------------| + * | Device | Kirkwood | Discovery | + * |-------------------------------| + * | USB0 | 0x00008 | 0x020000 | + * |-------------------------------| + * | USB1 | - | 0x040000 | + * |-------------------------------| + * | USB2 | - | 0x080000 | + * |-------------------------------| + * | GE0 | 0x00001 | 0x000002 | + * |-------------------------------| + * | GE1 | - | 0x000004 | + * |-------------------------------| + * | IDMA | - | 0x100000 | + * |-------------------------------| + * | XOR | 0x10000 | 0x200000 | + * |-------------------------------| + * | CESA | 0x20000 | 0x400000 | + * |-------------------------------| + * | SATA | 0x04000 | 0x004000 | + * --------------------------------| + * This feature can be used only on Kirkwood and Discovery + * machines. + */ +static __inline void +pm_disable_device(int mask) +{ +#ifdef DIAGNOSTIC + uint32_t reg; + + reg = soc_power_ctrl_get(CPU_PM_CTRL_ALL); + printf("Power Management Register: 0%x\n", reg); + + reg &= ~mask; + soc_power_ctrl_set(reg); + printf("Device %x is disabled\n", mask); + + reg = soc_power_ctrl_get(CPU_PM_CTRL_ALL); + printf("Power Management Register: 0%x\n", reg); +#endif +} + uint32_t read_cpu_ctrl(uint32_t reg) { @@ -103,14 +175,36 @@ cpu_extra_feat(void) return (ef); } +/* + * Get the power status of device. This feature is only supported on + * Kirkwood and Discovery SoCs. + */ uint32_t soc_power_ctrl_get(uint32_t mask) { +#ifndef SOC_MV_ORION if (mask != CPU_PM_CTRL_NONE) mask &= read_cpu_ctrl(CPU_PM_CTRL); return (mask); +#else + return (mask); +#endif +} + +/* + * Set the power status of device. This feature is only supported on + * Kirkwood and Discovery SoCs. + */ +void +soc_power_ctrl_set(uint32_t mask) +{ + +#ifndef SOC_MV_ORION + if (mask != CPU_PM_CTRL_NONE) + write_cpu_ctrl(CPU_PM_CTRL, mask); +#endif } void @@ -191,6 +285,13 @@ int soc_decode_win(void) { uint32_t dev, rev; + int mask; + + mask = 0; + TUNABLE_INT_FETCH("hw.pm-disable-mask", &mask); + + if (mask != 0) + pm_disable_device(mask); /* Retrieve our ID: some windows facilities vary between SoC models */ soc_id(&dev, &rev); @@ -623,8 +724,12 @@ decode_win_usb_setup(void) /* Disable and clear all USB windows for all ports */ m = usb_max_ports(); + for (p = 0; p < m; p++) { + if (pm_is_disabled(CPU_PM_CTRL_USB(p))) + continue; + for (i = 0; i < MV_WIN_USB_MAX; i++) { win_usb_cr_write(i, p, 0); win_usb_br_write(i, p, 0); @@ -710,6 +815,9 @@ decode_win_eth_setup(uint32_t base) uint32_t br, sz; int i, j; + if (pm_is_disabled(obio_get_pm_mask(base))) + return; + /* Disable, clear and revoke protection for all ETH windows */ for (i = 0; i < MV_WIN_ETH_MAX; i++) { @@ -880,6 +988,8 @@ decode_win_idma_setup(void) uint32_t br, sz; int i, j; + if (pm_is_disabled(CPU_PM_CTRL_IDMA)) + return; /* * Disable and clear all IDMA windows, revoke protection for all channels */ @@ -1172,6 +1282,9 @@ decode_win_xor_setup(void) uint32_t br, sz; int i, j, z, e = 1, m, window; + if (pm_is_disabled(CPU_PM_CTRL_XOR)) + return; + /* * Disable and clear all XOR windows, revoke protection for all * channels @@ -1364,6 +1477,9 @@ decode_win_cesa_setup(void) uint32_t br, cr; int i, j; + if (pm_is_disabled(CPU_PM_CTRL_CRYPTO)) + return; + /* Disable and clear all CESA windows */ for (i = 0; i < MV_WIN_CESA_MAX; i++) { win_cesa_cr_write(i, 0); @@ -1432,6 +1548,9 @@ decode_win_sata_setup(void) uint32_t cr, br; int i, j; + if (pm_is_disabled(CPU_PM_CTRL_SATA)) + return; + for (i = 0; i < MV_WIN_SATA_MAX; i++) { win_sata_cr_write(i, 0); win_sata_br_write(i, 0); Modified: head/sys/arm/mv/mvreg.h ============================================================================== --- head/sys/arm/mv/mvreg.h Tue Aug 25 09:30:03 2009 (r196531) +++ head/sys/arm/mv/mvreg.h Tue Aug 25 09:35:50 2009 (r196532) @@ -218,6 +218,7 @@ */ #define CPU_PM_CTRL 0x1C #define CPU_PM_CTRL_NONE 0 +#define CPU_PM_CTRL_ALL ~0x0 #if defined(SOC_MV_KIRKWOOD) #define CPU_PM_CTRL_GE0 (1 << 0) @@ -234,8 +235,11 @@ #define CPU_PM_CTRL_SATA1 (1 << 15) #define CPU_PM_CTRL_XOR1 (1 << 16) #define CPU_PM_CTRL_CRYPTO (1 << 17) -#define CPU_PM_CTRL_GE1 (1 << 18) -#define CPU_PM_CTRL_TDM (1 << 19) +#define CPU_PM_CTRL_GE1 (1 << 19) +#define CPU_PM_CTRL_TDM (1 << 20) +#define CPU_PM_CTRL_XOR (CPU_PM_CTRL_XOR0 | CPU_PM_CTRL_XOR1) +#define CPU_PM_CTRL_USB(u) (CPU_PM_CTRL_USB0) +#define CPU_PM_CTRL_SATA (CPU_PM_CTRL_SATA0 | CPU_PM_CTRL_SATA1) #elif defined(SOC_MV_DISCOVERY) #define CPU_PM_CTRL_GE0 (1 << 1) #define CPU_PM_CTRL_GE1 (1 << 2) @@ -258,6 +262,14 @@ #define CPU_PM_CTRL_XOR (1 << 21) #define CPU_PM_CTRL_CRYPTO (1 << 22) #define CPU_PM_CTRL_DEVICE (1 << 23) +#define CPU_PM_CTRL_USB(u) (1 << (17 + (u))) +#define CPU_PM_CTRL_SATA (CPU_PM_CTRL_SATA0 | CPU_PM_CTRL_SATA1) +#else +#define CPU_PM_CTRL_CRYPTO (CPU_PM_CTRL_NONE) +#define CPU_PM_CTRL_IDMA (CPU_PM_CTRL_NONE) +#define CPU_PM_CTRL_XOR (CPU_PM_CTRL_NONE) +#define CPU_PM_CTRL_SATA (CPU_PM_CTRL_NONE) +#define CPU_PM_CTRL_USB(u) (CPU_PM_CTRL_NONE) #endif /* Modified: head/sys/arm/mv/mvvar.h ============================================================================== --- head/sys/arm/mv/mvvar.h Tue Aug 25 09:30:03 2009 (r196531) +++ head/sys/arm/mv/mvvar.h Tue Aug 25 09:35:50 2009 (r196532) @@ -135,6 +135,7 @@ void soc_id(uint32_t *dev, uint32_t *rev void soc_identify(void); void soc_dump_decode_win(void); uint32_t soc_power_ctrl_get(uint32_t mask); +void soc_power_ctrl_set(uint32_t mask); int decode_win_cpu_set(int target, int attr, vm_paddr_t base, uint32_t size, int remap); From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 09:39:11 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA6A0106568C; Tue, 25 Aug 2009 09:39:11 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F8C98FC0C; Tue, 25 Aug 2009 09:39:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7P9dBbX022270; Tue, 25 Aug 2009 09:39:11 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7P9dBTA022265; Tue, 25 Aug 2009 09:39:11 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200908250939.n7P9dBTA022265@svn.freebsd.org> From: Rafal Jaworowski Date: Tue, 25 Aug 2009 09:39:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196533 - head/sys/arm/mv/kirkwood X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 09:39:11 -0000 Author: raj Date: Tue Aug 25 09:39:11 2009 New Revision: 196533 URL: http://svn.freebsd.org/changeset/base/196533 Log: Exclude common Kirkwood settings so they can be shared among various platforms based on this SOC. This is a preliminary step for SheevaPlug support. Submitted by: Michal Hajduk Obtained from: Semihalf Added: head/sys/arm/mv/kirkwood/files.kirkwood (contents, props changed) head/sys/arm/mv/kirkwood/std.kirkwood (contents, props changed) Modified: head/sys/arm/mv/kirkwood/files.db88f6xxx head/sys/arm/mv/kirkwood/std.db88f6xxx Modified: head/sys/arm/mv/kirkwood/files.db88f6xxx ============================================================================== --- head/sys/arm/mv/kirkwood/files.db88f6xxx Tue Aug 25 09:35:50 2009 (r196532) +++ head/sys/arm/mv/kirkwood/files.db88f6xxx Tue Aug 25 09:39:11 2009 (r196533) @@ -1,5 +1,4 @@ # $FreeBSD$ -arm/mv/rtc.c standard -arm/mv/kirkwood/kirkwood.c standard +include "arm/mv/kirkwood/files.kirkwood" arm/mv/kirkwood/db88f6xxx.c standard Added: head/sys/arm/mv/kirkwood/files.kirkwood ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/kirkwood/files.kirkwood Tue Aug 25 09:39:11 2009 (r196533) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +arm/mv/rtc.c standard +arm/mv/kirkwood/kirkwood.c standard Modified: head/sys/arm/mv/kirkwood/std.db88f6xxx ============================================================================== --- head/sys/arm/mv/kirkwood/std.db88f6xxx Tue Aug 25 09:35:50 2009 (r196532) +++ head/sys/arm/mv/kirkwood/std.db88f6xxx Tue Aug 25 09:39:11 2009 (r196533) @@ -1,13 +1,8 @@ # $FreeBSD$ include "../mv/std.mv" +include "../mv/kirkwood/std.kirkwood" files "../mv/kirkwood/files.db88f6xxx" -makeoptions KERNPHYSADDR=0x00900000 -makeoptions KERNVIRTADDR=0xc0900000 -options KERNPHYSADDR=0x00900000 -options KERNVIRTADDR=0xc0900000 -options PHYSADDR=0x00000000 options PHYSMEM_SIZE=0x20000000 -options STARTUP_PAGETABLE_ADDR=0x00100000 Added: head/sys/arm/mv/kirkwood/std.kirkwood ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/kirkwood/std.kirkwood Tue Aug 25 09:39:11 2009 (r196533) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +# kernel gets loaded at 0x00900000 by the loader, but runs at virtual address +# 0xc0900000. RAM starts at 0. We put the pagetable at a reasonable place +# in memory, but may need to bounce it higher if there's a problem with this. +# We could paper over this by loading the kernel at 0xc0000000 virtual, but +# that leads to other complications, so we'll just reclaim the lower region of +# ram after we're loaded. Put the page tables for startup at 1MB. +makeoptions KERNPHYSADDR=0x00900000 +makeoptions KERNVIRTADDR=0xc0900000 + +options KERNPHYSADDR=0x00900000 +options KERNVIRTADDR=0xc0900000 +options PHYSADDR=0x00000000 +options STARTUP_PAGETABLE_ADDR=0x00100000 From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 09:47:13 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57B6E106568B; Tue, 25 Aug 2009 09:47:13 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 46DA38FC15; Tue, 25 Aug 2009 09:47:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7P9lD8t022466; Tue, 25 Aug 2009 09:47:13 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7P9lDpM022463; Tue, 25 Aug 2009 09:47:13 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200908250947.n7P9lDpM022463@svn.freebsd.org> From: Rafal Jaworowski Date: Tue, 25 Aug 2009 09:47:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196534 - in head/sys: conf dev/mge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 09:47:13 -0000 Author: raj Date: Tue Aug 25 09:47:12 2009 New Revision: 196534 URL: http://svn.freebsd.org/changeset/base/196534 Log: Introduce MII_ADDR_BASE option on ARM, which allows to override the default per platform requirements. Notes: - Only used by mge(4) at the moment. - This is very simplified approach and should be replaced by some long-term solution for managing the board/platform configuration (among others the MAC-PHY binding info). Submitted by: Michal Hajduk Obtained from: Semihalf Modified: head/sys/conf/options.arm head/sys/dev/mge/if_mge.c Modified: head/sys/conf/options.arm ============================================================================== --- head/sys/conf/options.arm Tue Aug 25 09:39:11 2009 (r196533) +++ head/sys/conf/options.arm Tue Aug 25 09:47:12 2009 (r196534) @@ -24,6 +24,7 @@ KERNVIRTADDR opt_global.h LOADERRAMADDR opt_global.h PHYSADDR opt_global.h PHYSMEM_SIZE opt_global.h +MII_ADDR_BASE opt_global.h SKYEYE_WORKAROUNDS opt_global.h SOC_MV_DISCOVERY opt_global.h SOC_MV_KIRKWOOD opt_global.h Modified: head/sys/dev/mge/if_mge.c ============================================================================== --- head/sys/dev/mge/if_mge.c Tue Aug 25 09:39:11 2009 (r196533) +++ head/sys/dev/mge/if_mge.c Tue Aug 25 09:47:12 2009 (r196534) @@ -69,7 +69,9 @@ __FBSDID("$FreeBSD$"); #include #include -#define MV_PHY_ADDR_BASE 8 +#ifndef MII_ADDR_BASE +#define MII_ADDR_BASE 8 +#endif #include #include @@ -1264,14 +1266,15 @@ mge_miibus_readreg(device_t dev, int phy /* * We assume static PHY address <=> device unit mapping: - * PHY Address = MV_PHY_ADDR_BASE + devce unit. + * PHY Address = MII_ADDR_BASE + devce unit. * This is true for most Marvell boards. * * Code below grants proper PHY detection on each device * unit. */ - if ((MV_PHY_ADDR_BASE + device_get_unit(dev)) != phy) + + if ((MII_ADDR_BASE + device_get_unit(dev)) != phy) return (0); MGE_WRITE(sc_mge0, MGE_REG_SMI, 0x1fffffff & @@ -1292,7 +1295,7 @@ mge_miibus_writereg(device_t dev, int ph { uint32_t retries; - if ((MV_PHY_ADDR_BASE + device_get_unit(dev)) != phy) + if ((MII_ADDR_BASE + device_get_unit(dev)) != phy) return (0); MGE_WRITE(sc_mge0, MGE_REG_SMI, 0x1fffffff & From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 09:52:39 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 404B9106568C; Tue, 25 Aug 2009 09:52:39 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2ED608FC14; Tue, 25 Aug 2009 09:52:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7P9qd2b022605; Tue, 25 Aug 2009 09:52:39 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7P9qdhD022600; Tue, 25 Aug 2009 09:52:39 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200908250952.n7P9qdhD022600@svn.freebsd.org> From: Robert Watson Date: Tue, 25 Aug 2009 09:52:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196535 - in head/sys: net netinet netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 09:52:39 -0000 Author: rwatson Date: Tue Aug 25 09:52:38 2009 New Revision: 196535 URL: http://svn.freebsd.org/changeset/base/196535 Log: Use locks specific to the lltable code, rather than borrow the ifnet list/index locks, to protect link layer address tables. This avoids lock order issues during interface teardown, but maintains the bug that sysctl copy routines may be called while a non-sleepable lock is held. Reviewed by: bz, kmacy MFC after: 3 days Modified: head/sys/net/if_llatbl.c head/sys/net/if_llatbl.h head/sys/netinet/in.c head/sys/netinet6/in6.c Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Tue Aug 25 09:47:12 2009 (r196534) +++ head/sys/net/if_llatbl.c Tue Aug 25 09:52:38 2009 (r196535) @@ -62,6 +62,9 @@ static SLIST_HEAD(, lltable) lltables = extern void arprequest(struct ifnet *, struct in_addr *, struct in_addr *, u_char *); +struct rwlock lltable_rwlock; +RW_SYSINIT(lltable_rwlock, &lltable_rwlock, "lltable_rwlock"); + /* * Dump arp state for a specific address family. */ @@ -71,7 +74,7 @@ lltable_sysctl_dumparp(int af, struct sy struct lltable *llt; int error = 0; - IFNET_RLOCK(); + LLTABLE_RLOCK(); SLIST_FOREACH(llt, &lltables, llt_link) { if (llt->llt_af == af) { error = llt->llt_dump(llt, wr); @@ -80,7 +83,7 @@ lltable_sysctl_dumparp(int af, struct sy } } done: - IFNET_RUNLOCK(); + LLTABLE_RUNLOCK(); return (error); } @@ -144,8 +147,6 @@ llentry_update(struct llentry **llep, st /* * Free all entries from given table and free itself. - * Since lltables collects from all of the intefaces, - * the caller of this function must acquire IFNET_WLOCK(). */ void lltable_free(struct lltable *llt) @@ -155,9 +156,9 @@ lltable_free(struct lltable *llt) KASSERT(llt != NULL, ("%s: llt is NULL", __func__)); - IFNET_WLOCK(); + LLTABLE_WLOCK(); SLIST_REMOVE(&lltables, llt, lltable, llt_link); - IFNET_WUNLOCK(); + LLTABLE_WUNLOCK(); for (i=0; i < LLTBL_HASHTBL_SIZE; i++) { LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) { @@ -178,7 +179,7 @@ lltable_drain(int af) struct llentry *lle; register int i; - IFNET_RLOCK(); + LLTABLE_RLOCK(); SLIST_FOREACH(llt, &lltables, llt_link) { if (llt->llt_af != af) continue; @@ -192,7 +193,7 @@ lltable_drain(int af) } } } - IFNET_RUNLOCK(); + LLTABLE_RUNLOCK(); } void @@ -200,14 +201,14 @@ lltable_prefix_free(int af, struct socka { struct lltable *llt; - IFNET_RLOCK_NOSLEEP(); + LLTABLE_RLOCK(); SLIST_FOREACH(llt, &lltables, llt_link) { if (llt->llt_af != af) continue; llt->llt_prefix_free(llt, prefix, mask); } - IFNET_RUNLOCK_NOSLEEP(); + LLTABLE_RUNLOCK(); } @@ -230,9 +231,9 @@ lltable_init(struct ifnet *ifp, int af) for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) LIST_INIT(&llt->lle_head[i]); - IFNET_WLOCK(); + LLTABLE_WLOCK(); SLIST_INSERT_HEAD(&lltables, llt, llt_link); - IFNET_WUNLOCK(); + LLTABLE_WUNLOCK(); return (llt); } @@ -300,13 +301,13 @@ lla_rt_output(struct rt_msghdr *rtm, str } /* XXX linked list may be too expensive */ - IFNET_RLOCK_NOSLEEP(); + LLTABLE_RLOCK(); SLIST_FOREACH(llt, &lltables, llt_link) { if (llt->llt_af == dst->sa_family && llt->llt_ifp == ifp) break; } - IFNET_RUNLOCK_NOSLEEP(); + LLTABLE_RUNLOCK(); KASSERT(llt != NULL, ("Yep, ugly hacks are bad\n")); if (flags && LLE_CREATE) Modified: head/sys/net/if_llatbl.h ============================================================================== --- head/sys/net/if_llatbl.h Tue Aug 25 09:47:12 2009 (r196534) +++ head/sys/net/if_llatbl.h Tue Aug 25 09:52:38 2009 (r196535) @@ -41,6 +41,13 @@ struct rt_addrinfo; struct llentry; LIST_HEAD(llentries, llentry); +extern struct rwlock lltable_rwlock; +#define LLTABLE_RLOCK() rw_rlock(&lltable_rwlock) +#define LLTABLE_RUNLOCK() rw_runlock(&lltable_rwlock) +#define LLTABLE_WLOCK() rw_wlock(&lltable_rwlock) +#define LLTABLE_WUNLOCK() rw_wunlock(&lltable_rwlock) +#define LLTABLE_LOCK_ASSERT() rw_assert(&lltable_rwlock, RA_LOCKED) + /* * Code referencing llentry must at least hold * a shared lock Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Tue Aug 25 09:47:12 2009 (r196534) +++ head/sys/netinet/in.c Tue Aug 25 09:52:38 2009 (r196535) @@ -1407,7 +1407,7 @@ in_lltable_dump(struct lltable *llt, str } arpc; int error, i; - IFNET_RLOCK_ASSERT(); + LLTABLE_LOCK_ASSERT(); error = 0; for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Tue Aug 25 09:47:12 2009 (r196534) +++ head/sys/netinet6/in6.c Tue Aug 25 09:52:38 2009 (r196535) @@ -2495,7 +2495,7 @@ in6_lltable_dump(struct lltable *llt, st } ndpc; int i, error; - IFNET_RLOCK_ASSERT(); + LLTABLE_LOCK_ASSERT(); error = 0; for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 10:09:26 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29C24106568C; Tue, 25 Aug 2009 10:09:26 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 17DC08FC15; Tue, 25 Aug 2009 10:09:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PA9PjZ023029; Tue, 25 Aug 2009 10:09:25 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PA9PpS023024; Tue, 25 Aug 2009 10:09:25 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200908251009.n7PA9PpS023024@svn.freebsd.org> From: Rafal Jaworowski Date: Tue, 25 Aug 2009 10:09:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196536 - in head/sys/arm: conf mv/kirkwood X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 10:09:26 -0000 Author: raj Date: Tue Aug 25 10:09:25 2009 New Revision: 196536 URL: http://svn.freebsd.org/changeset/base/196536 Log: Introduce SheevaPlug support. - The device is based on Marvell 88F6281 system on chip. - More info about the platform at http://www.plugcomputer.org - To build the FreeBSD kernel: make buildkernel TARGET_ARCH=arm KERNCONF=SHEEVAPLUG - Installation notes at: http://wiki.freebsd.org/FreeBSDMarvell Submitted by: Michal Hajduk Obtained from: Semihalf Added: head/sys/arm/conf/SHEEVAPLUG (contents, props changed) head/sys/arm/mv/kirkwood/files.sheevaplug (contents, props changed) head/sys/arm/mv/kirkwood/sheevaplug.c (contents, props changed) head/sys/arm/mv/kirkwood/std.sheevaplug (contents, props changed) Added: head/sys/arm/conf/SHEEVAPLUG ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/conf/SHEEVAPLUG Tue Aug 25 10:09:25 2009 (r196536) @@ -0,0 +1,70 @@ +# +# Custom kernel for Marvell SheevaPlug devices. +# +# $FreeBSD$ +# + +ident SHEEVAPLUG +include "../mv/kirkwood/std.sheevaplug" + +options SOC_MV_KIRKWOOD +makeoptions MODULES_OVERRIDE="" + +#makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols +makeoptions WERROR="-Werror" + +options SCHED_4BSD #4BSD scheduler +options INET #InterNETworking +options INET6 #IPv6 communications protocols +options FFS #Berkeley Fast Filesystem +options NFSCLIENT #Network Filesystem Client +options NFSLOCKD #Network Lock Manager +options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options BOOTP +options BOOTP_NFSROOT +options BOOTP_NFSV3 +options BOOTP_WIRED_TO=mge0 + +# Root fs on USB device +#options ROOTDEVNAME=\"ufs:/dev/da0a\" + +options SYSVSHM #SYSV-style shared memory +options SYSVMSG #SYSV-style message queues +options SYSVSEM #SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions +options MUTEX_NOINLINE +options RWLOCK_NOINLINE +options NO_FFS_SNAPSHOT +options NO_SWAPPING + +# Debugging +options ALT_BREAK_TO_DEBUGGER +options DDB +options KDB + +# Pseudo devices +device random +device pty +device loop + +# Serial ports +device uart + +# Networking +device ether +device mge # Marvell Gigabit Ethernet controller +device mii +device e1000phy +device bpf +options HZ=1000 +options DEVICE_POLLING +device vlan + +# USB +device usb +device ehci +device umass +device scbus +device pass +device da + Added: head/sys/arm/mv/kirkwood/files.sheevaplug ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/kirkwood/files.sheevaplug Tue Aug 25 10:09:25 2009 (r196536) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +include "arm/mv/kirkwood/files.kirkwood" +arm/mv/kirkwood/sheevaplug.c standard Added: head/sys/arm/mv/kirkwood/sheevaplug.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/kirkwood/sheevaplug.c Tue Aug 25 10:09:25 2009 (r196536) @@ -0,0 +1,152 @@ +/*- + * Copyright (C) 2008 MARVELL INTERNATIONAL LTD. + * Copyright (C) 2009 Semihalf + * All rights reserved. + * + * 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. + * 3. Neither the name of MARVELL nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY 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 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +/* + * Virtual address space layout: + * ----------------------------- + * 0x0000_0000 - 0x7FFF_FFFF : User Process (2 GB) + * 0x8000_0000 - 0xBBFF_FFFF : Unused (960 MB) + * 0xBC00_0000 - 0xBDFF_FFFF : Device Bus: CS1 (32 MB) + * 0xBE00_0000 - 0xBECF_FFFF : Unused (13 MB) + * 0xBED0_0000 - 0xBEDF_FFFF : Device Bus: CS2 (1 MB) + * 0xBEE0_0000 - 0xBEEF_FFFF : Device Bus: CS0 (1 MB) + * 0xBEF0_0000 - 0xBEFF_FFFF : Device Bus: BOOT (1 MB) + * 0xBF00_0000 - 0xBFFF_FFFF : Unused (16 MB) + * 0xC000_0000 - virtual_avail : Kernel Reserved (text, data, page tables, + * : stack etc.) + * virtual-avail - 0xEFFF_FFFF : KVA (virtual_avail is typically < 0xc0a0_0000) + * 0xF000_0000 - 0xF0FF_FFFF : No-Cache allocation area (16 MB) + * 0xF100_0000 - 0xF10F_FFFF : SoC Integrated devices registers range (1 MB) + * 0xF110_0000 - 0xF11F_FFFF : CESA SRAM (1 MB) + * 0xF120_0000 - 0xFFFE_FFFF : Unused (237 MB + 960 kB) + * 0xFFFF_0000 - 0xFFFF_0FFF : 'High' vectors page (4 kB) + * 0xFFFF_1000 - 0xFFFF_1FFF : ARM_TP_ADDRESS/RAS page (4 kB) + * 0xFFFF_2000 - 0xFFFF_FFFF : Unused (56 kB) + */ + +/* Static device mappings. */ +const struct pmap_devmap pmap_devmap[] = { + /* + * Map the on-board devices VA == PA so that we can access them + * with the MMU on or off. + */ + { /* SoC integrated peripherals registers range */ + MV_BASE, + MV_PHYS_BASE, + MV_SIZE, + VM_PROT_READ | VM_PROT_WRITE, + PTE_NOCACHE, + }, + { /* CESA SRAM */ + MV_CESA_SRAM_BASE, + MV_CESA_SRAM_PHYS_BASE, + MV_CESA_SRAM_SIZE, + VM_PROT_READ | VM_PROT_WRITE, + PTE_NOCACHE, + }, + { 0, 0, 0, 0, 0, } +}; + +const struct gpio_config mv_gpio_config[] = { + { -1, -1, -1 } +}; + +void +platform_mpp_init(void) +{ + + /* + * MPP configuration for Sheeva Plug + * + * MPP[0]: NF_IO[2] + * MPP[1]: NF_IO[3] + * MPP[2]: NF_IO[4] + * MPP[3]: NF_IO[5] + * MPP[4]: NF_IO[6] + * MPP[5]: NF_IO[7] + * MPP[6]: SYSRST_OUTn + * MPP[8]: UA0_RTS + * MPP[9]: UA0_CTS + * MPP[10]: UA0_TXD + * MPP[11]: UA0_RXD + * MPP[12]: SD_CLK + * MPP[13]: SD_CMD + * MPP[14]: SD_D[0] + * MPP[15]: SD_D[1] + * MPP[16]: SD_D[2] + * MPP[17]: SD_D[3] + * MPP[18]: NF_IO[0] + * MPP[19]: NF_IO[1] + * MPP[29]: TSMP[9] + * + * Others: GPIO + */ + + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL0, 0x01111111); + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL1, 0x11113322); + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL2, 0x00001111); + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL3, 0x00100000); + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL4, 0x00000000); + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL5, 0x00000000); + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL6, 0x00000000); +} + +static void +platform_identify(void *dummy) +{ + + soc_identify(); + + /* + * XXX Board identification e.g. read out from FPGA or similar should + * go here + */ +} +SYSINIT(platform_identify, SI_SUB_CPU, SI_ORDER_SECOND, platform_identify, NULL); Added: head/sys/arm/mv/kirkwood/std.sheevaplug ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/kirkwood/std.sheevaplug Tue Aug 25 10:09:25 2009 (r196536) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +include "../mv/std.mv" +include "../mv/kirkwood/std.kirkwood" +files "../mv/kirkwood/files.sheevaplug" + +options PHYSMEM_SIZE=0x20000000 +options MII_ADDR_BASE=0 From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 11:44:17 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97AA61065757; Tue, 25 Aug 2009 11:44:17 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 854AD8FC15; Tue, 25 Aug 2009 11:44:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PBiHEE026686; Tue, 25 Aug 2009 11:44:17 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PBiH8m026684; Tue, 25 Aug 2009 11:44:17 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908251144.n7PBiH8m026684@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 11:44:17 +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: r196537 - in stable/7/sys: . contrib/pf netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 11:44:17 -0000 Author: bz Date: Tue Aug 25 11:44:17 2009 New Revision: 196537 URL: http://svn.freebsd.org/changeset/base/196537 Log: MFC r182841: Add a second KASSERT checking for len >= 0 in the tcp output path. This is different to the first one (as len gets updated between those two) and would have caught various edge cases (read bugs) at a well defined place I had been debugging the last months instead of triggering (random) panics further down the call graph. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/netinet/tcp_output.c Modified: stable/7/sys/netinet/tcp_output.c ============================================================================== --- stable/7/sys/netinet/tcp_output.c Tue Aug 25 10:09:25 2009 (r196536) +++ stable/7/sys/netinet/tcp_output.c Tue Aug 25 11:44:17 2009 (r196537) @@ -391,7 +391,7 @@ after_sack_rexmit: } /* len will be >= 0 after this point. */ - KASSERT(len >= 0, ("%s: len < 0", __func__)); + KASSERT(len >= 0, ("[%s:%d]: len < 0", __func__, __LINE__)); /* * Automatic sizing of send socket buffer. Often the send buffer @@ -741,6 +741,12 @@ send: /*#endif*/ /* + * This KASSERT is here to catch edge cases at a well defined place. + * Before, those had triggered (random) panic conditions further down. + */ + KASSERT(len >= 0, ("[%s:%d]: len < 0", __func__, __LINE__)); + + /* * Grab a header mbuf, attaching a copy of data to * be transmitted, and initialize the header from * the template for sends on this connection. From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 12:32:16 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81029106568C; Tue, 25 Aug 2009 12:32:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E6E98FC1A; Tue, 25 Aug 2009 12:32:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PCWGON027750; Tue, 25 Aug 2009 12:32:16 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PCWGt1027748; Tue, 25 Aug 2009 12:32:16 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908251232.n7PCWGt1027748@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 12:32:16 +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: r196538 - in stable/7/sys: . contrib/pf kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 12:32:16 -0000 Author: bz Date: Tue Aug 25 12:32:16 2009 New Revision: 196538 URL: http://svn.freebsd.org/changeset/base/196538 Log: MFC r182842: Catch a possible NULL pointer deref in case the offsets got mangled somehow. As a consequence we may now get an unexpected result(*). Catch that error cases with a well defined panic giving appropriate pointers to ease debugging. (*) While the concensus was that the case should never happen unless there was a bug, noone was definitively sure. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/kern/uipc_sockbuf.c Modified: stable/7/sys/kern/uipc_sockbuf.c ============================================================================== --- stable/7/sys/kern/uipc_sockbuf.c Tue Aug 25 11:44:17 2009 (r196537) +++ stable/7/sys/kern/uipc_sockbuf.c Tue Aug 25 12:32:16 2009 (r196538) @@ -930,11 +930,13 @@ sbsndptr(struct sockbuf *sb, u_int off, /* Advance by len to be as close as possible for the next transmit. */ for (off = off - sb->sb_sndptroff + len - 1; - off > 0 && off >= m->m_len; + off > 0 && m != NULL && off >= m->m_len; m = m->m_next) { sb->sb_sndptroff += m->m_len; off -= m->m_len; } + if (off > 0 && m == NULL) + panic("%s: sockbuf %p and mbuf %p clashing", __func__, sb, ret); sb->sb_sndptr = m; return (ret); From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 13:01:51 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD673106568E; Tue, 25 Aug 2009 13:01:51 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BB0058FC15; Tue, 25 Aug 2009 13:01:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PD1pXb028684; Tue, 25 Aug 2009 13:01:51 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PD1paj028682; Tue, 25 Aug 2009 13:01:51 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908251301.n7PD1paj028682@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 13:01:51 +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: r196539 - in stable/7/sys: . contrib/pf netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 13:01:51 -0000 Author: bz Date: Tue Aug 25 13:01:51 2009 New Revision: 196539 URL: http://svn.freebsd.org/changeset/base/196539 Log: MFC r191433: Compare protosw pointer with NULL. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/netinet6/ip6_input.c Modified: stable/7/sys/netinet6/ip6_input.c ============================================================================== --- stable/7/sys/netinet6/ip6_input.c Tue Aug 25 12:32:16 2009 (r196538) +++ stable/7/sys/netinet6/ip6_input.c Tue Aug 25 13:01:51 2009 (r196539) @@ -152,7 +152,7 @@ ip6_init(void) panic("sizeof(protosw) != sizeof(ip6protosw)"); #endif pr = (struct ip6protosw *)pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW); - if (pr == 0) + if (pr == NULL) panic("ip6_init"); /* Initialize the entire ip6_protox[] array to IPPROTO_RAW. */ From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 13:04:14 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F7A3106568C; Tue, 25 Aug 2009 13:04:14 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F168B8FC12; Tue, 25 Aug 2009 13:04:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PD4DvJ028774; Tue, 25 Aug 2009 13:04:13 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PD4DES028772; Tue, 25 Aug 2009 13:04:13 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908251304.n7PD4DES028772@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 13:04:13 +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: r196540 - in stable/7/sys: . contrib/pf sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 13:04:14 -0000 Author: bz Date: Tue Aug 25 13:04:13 2009 New Revision: 196540 URL: http://svn.freebsd.org/changeset/base/196540 Log: MFC r191529: Whitespace (use tabs like for all other lines). Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/sys/mbuf.h Modified: stable/7/sys/sys/mbuf.h ============================================================================== --- stable/7/sys/sys/mbuf.h Tue Aug 25 13:01:51 2009 (r196539) +++ stable/7/sys/sys/mbuf.h Tue Aug 25 13:04:13 2009 (r196540) @@ -853,7 +853,7 @@ struct mbuf *m_unshare(struct mbuf *, in #define PACKET_TAG_PF 21 /* PF + ALTQ information */ #define PACKET_TAG_RTSOCKFAM 25 /* rtsock sa family */ #define PACKET_TAG_IPOPTIONS 27 /* Saved IP options */ -#define PACKET_TAG_CARP 28 /* CARP info */ +#define PACKET_TAG_CARP 28 /* CARP info */ /* Specific cookies and tags. */ From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 13:39:15 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDDC1106568B; Tue, 25 Aug 2009 13:39:14 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C255E8FC24; Tue, 25 Aug 2009 13:39:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PDdEe8029564; Tue, 25 Aug 2009 13:39:14 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PDdEcD029562; Tue, 25 Aug 2009 13:39:14 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200908251339.n7PDdEcD029562@svn.freebsd.org> From: Bruce M Simpson Date: Tue, 25 Aug 2009 13:39:14 +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: r196541 - stable/7/etc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 13:39:15 -0000 Author: bms Date: Tue Aug 25 13:39:14 2009 New Revision: 196541 URL: http://svn.freebsd.org/changeset/base/196541 Log: MFC r179014: Add support for /conf/T/M/remount_optional. The rc.initdiskless functionality is used by NanoBSD to allow configuration files to live on a separate configuration slice, which acts as NVRAM, whilst the system image is mounted read-only. Normally, if the remount command fails during boot, this is regarded as a fatal error. If /conf/T/M/remount_optional is present, this error is non-fatal. If the file is not present, the default behaviour is unchanged. This is very useful for people building live CD images using FreeBSD, where the NVRAM lives somewhere completely differently from the system image, and may be present on removable media which is not present during the initial boot. Modified: stable/7/etc/ (props changed) stable/7/etc/rc.initdiskless stable/7/etc/termcap.small (props changed) Modified: stable/7/etc/rc.initdiskless ============================================================================== --- stable/7/etc/rc.initdiskless Tue Aug 25 13:04:13 2009 (r196540) +++ stable/7/etc/rc.initdiskless Tue Aug 25 13:39:14 2009 (r196541) @@ -69,6 +69,10 @@ # /conf/1.2.3.4/foo/remount contains "mount -o ro /dev/ad0s3", # then /dev/ad0s3 will be be mounted on /conf/1.2.3.4/foo/ # +# /conf/T/M/remount_optional +# If this file exists, then failure to execute the mount +# command contained in /conf/T/M/remount is non-fatal. +# # /conf/T/M/diskless_remount # The contents of the file points to an NFS filesystem, # possibly followed by mount_nfs options. If the server name @@ -147,8 +151,12 @@ log() { # # checks error code and drops into shell on failure. # if shell exits, terminates script as well as /etc/rc. +# if remount_optional exists under the mountpoint, skip this check. # chkerr() { + lastitem () ( n=$(($# - 1)) ; shift $n ; echo $1 ) + mountpoint="$(lastitem $2)" + [ -r $mountpoint/remount_optional ] && ( echo "$2 failed: ignoring due to remount_optional" ; return ) case $1 in 0) ;; From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 13:40:46 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97B3E1065690; Tue, 25 Aug 2009 13:40:46 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C6738FC12; Tue, 25 Aug 2009 13:40:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PDek4O029647; Tue, 25 Aug 2009 13:40:46 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PDekQn029645; Tue, 25 Aug 2009 13:40:46 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200908251340.n7PDekQn029645@svn.freebsd.org> From: Bruce M Simpson Date: Tue, 25 Aug 2009 13:40:46 +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: r196542 - stable/7/etc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 13:40:46 -0000 Author: bms Date: Tue Aug 25 13:40:46 2009 New Revision: 196542 URL: http://svn.freebsd.org/changeset/base/196542 Log: MFC r182895: Add support to rc.initdiskless for /conf/T/M/remount_subdir. This allows the location of the configuration data to be relocated within the filesystem containing it. A nullfs mount is used in order to achieve this. Obtained from: XORP, Inc. Modified: stable/7/etc/ (props changed) stable/7/etc/rc.initdiskless stable/7/etc/termcap.small (props changed) Modified: stable/7/etc/rc.initdiskless ============================================================================== --- stable/7/etc/rc.initdiskless Tue Aug 25 13:39:14 2009 (r196541) +++ stable/7/etc/rc.initdiskless Tue Aug 25 13:40:46 2009 (r196542) @@ -73,6 +73,16 @@ # If this file exists, then failure to execute the mount # command contained in /conf/T/M/remount is non-fatal. # +# /conf/T/M/remount_subdir +# If this file exists, then the behaviour of /conf/T/M/remount +# changes as follows: +# 1. /conf/T/M/remount is invoked to mount the root of the +# filesystem where the configuration data exists on a +# temporary mountpoint. +# 2. /conf/T/M/remount_subdir is then invoked to mount a +# *subdirectory* of the filesystem mounted by +# /conf/T/M/remount on /conf/T/M/. +# # /conf/T/M/diskless_remount # The contents of the file points to an NFS filesystem, # possibly followed by mount_nfs options. If the server name @@ -296,10 +306,33 @@ for i in ${templates} ; do # remount. Beware, the command is in the file itself! if [ -f $j/remount ]; then - nfspt=`/bin/cat $j/remount` - $nfspt $j - chkerr $? "$nfspt $j" - to_umount="$j ${to_umount}" # XXX hope it is really a mount! + if [ -f $j/remount_subdir ]; then + k="/conf.tmp/$i/$subdir" + [ -d $k ] || continue + + # Mount the filesystem root where the config data is + # on the temporary mount point. + nfspt=`/bin/cat $j/remount` + $nfspt $k + chkerr $? "$nfspt $k" + + # Now use a nullfs mount to get the data where we + # really want to see it. + remount_subdir=`/bin/cat $j/remount_subdir` + remount_subdir_cmd="mount -t nullfs $k/$remount_subdir" + + $remount_subdir_cmd $j + chkerr $? "$remount_subdir_cmd $j" + + # XXX check order -- we must force $k to be unmounted + # after j, as j depends on k. + to_umount="$j $k ${to_umount}" + else + nfspt=`/bin/cat $j/remount` + $nfspt $j + chkerr $? "$nfspt $j" + to_umount="$j ${to_umount}" # XXX hope it is really a mount! + fi fi # NFS remount From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 14:08:33 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3B35106568E; Tue, 25 Aug 2009 14:08:33 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A24478FC23; Tue, 25 Aug 2009 14:08:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PE8XQN030218; Tue, 25 Aug 2009 14:08:33 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PE8Xk1030216; Tue, 25 Aug 2009 14:08:33 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <200908251408.n7PE8Xk1030216@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 25 Aug 2009 14:08:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196543 - head/sys/i386/isa X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 14:08:33 -0000 Author: glebius Date: Tue Aug 25 14:08:33 2009 New Revision: 196543 URL: http://svn.freebsd.org/changeset/base/196543 Log: Fix build broken in r196524. Modified: head/sys/i386/isa/vesa.c Modified: head/sys/i386/isa/vesa.c ============================================================================== --- head/sys/i386/isa/vesa.c Tue Aug 25 13:40:46 2009 (r196542) +++ head/sys/i386/isa/vesa.c Tue Aug 25 14:08:33 2009 (r196543) @@ -1114,14 +1114,6 @@ vesa_set_mode(video_adapter_t *adp, int default: vesa_adp->va_line_width = info.vi_width * (info.vi_depth / 8); break; - case 15: - case 16: - vesa_adp->va_line_width = info.vi_width*2; - break; - case 24: - case 32: - vesa_adp->va_line_width = info.vi_width*4; - break; } } else { vesa_adp->va_line_width = info.vi_width; From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 15:54:54 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F37C610656C3; Tue, 25 Aug 2009 15:54:53 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E12B78FC20; Tue, 25 Aug 2009 15:54:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PFsrZJ032505; Tue, 25 Aug 2009 15:54:53 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PFsrRQ032504; Tue, 25 Aug 2009 15:54:53 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908251554.n7PFsrRQ032504@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 15:54:53 +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: r196544 - in stable/7: sys sys/contrib/pf sys/kern usr.bin/cpuset usr.sbin/jail X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 15:54:54 -0000 Author: bz Date: Tue Aug 25 15:54:52 2009 New Revision: 196544 URL: http://svn.freebsd.org/changeset/base/196544 Log: Backout r191596: Document an issue of jail(8) in conjunction with cpuset(1). MFC r191639: Prevent a superuser inside a jail from modifying the dedicated root cpuset of that jail. Processes inside the jail will still be able to change child sets. A superuser outside of a jail will still be able to change the jail cpuset and thus limit the number of cpus available to the jail. Problem reported by: 000.fbsd@quip.cz (Miroslav Lachman) PR: kern/134050 Reviewed by: jeff Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/kern/kern_cpuset.c stable/7/usr.bin/cpuset/cpuset.1 stable/7/usr.sbin/jail/jail.8 Modified: stable/7/sys/kern/kern_cpuset.c ============================================================================== --- stable/7/sys/kern/kern_cpuset.c Tue Aug 25 14:08:33 2009 (r196543) +++ stable/7/sys/kern/kern_cpuset.c Tue Aug 25 15:54:52 2009 (r196544) @@ -357,6 +357,15 @@ cpuset_modify(struct cpuset *set, cpuset if (error) return (error); /* + * In case we are called from within the jail + * we do not allow modifying the dedicated root + * cpuset of the jail but may still allow to + * change child sets. + */ + if (jailed(curthread->td_ucred) && + set->cs_flags & CPU_SET_ROOT) + return (EPERM); + /* * Verify that we have access to this set of * cpus. */ Modified: stable/7/usr.bin/cpuset/cpuset.1 ============================================================================== --- stable/7/usr.bin/cpuset/cpuset.1 Tue Aug 25 14:08:33 2009 (r196543) +++ stable/7/usr.bin/cpuset/cpuset.1 Tue Aug 25 15:54:52 2009 (r196544) @@ -177,9 +177,3 @@ command first appeared in .Fx 7.1 . .Sh AUTHORS .An Jeffrey Roberson Aq jeff@FreeBSD.org -.Sh BUGS -At the moment it is possible for a superuser inside a -.Xr jail 8 -to modify the root -.Xr cpuset 2 -of that jail. Modified: stable/7/usr.sbin/jail/jail.8 ============================================================================== --- stable/7/usr.sbin/jail/jail.8 Tue Aug 25 14:08:33 2009 (r196543) +++ stable/7/usr.sbin/jail/jail.8 Tue Aug 25 15:54:52 2009 (r196544) @@ -699,9 +699,3 @@ Currently, the simplest answer is to min offered on the host, possibly limiting it to services offered from .Xr inetd 8 which is easily configurable. -.Pp -At the moment it is possible for a superuser inside a -.Nm -to modify the root -.Xr cpuset 2 -of that jail. From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 15:58:07 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D793B106564A; Tue, 25 Aug 2009 15:58:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C5D7F8FC15; Tue, 25 Aug 2009 15:58:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PFw7uH032634; Tue, 25 Aug 2009 15:58:07 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PFw7qn032632; Tue, 25 Aug 2009 15:58:07 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908251558.n7PFw7qn032632@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 15:58:07 +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: r196545 - in stable/7/sys: . contrib/pf kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 15:58:07 -0000 Author: bz Date: Tue Aug 25 15:58:07 2009 New Revision: 196545 URL: http://svn.freebsd.org/changeset/base/196545 Log: MFC r191403: Correct a comment: the function name given had never existed in any (relevant) version of this file orany of my patches. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/kern/kern_cpuset.c Modified: stable/7/sys/kern/kern_cpuset.c ============================================================================== --- stable/7/sys/kern/kern_cpuset.c Tue Aug 25 15:54:52 2009 (r196544) +++ stable/7/sys/kern/kern_cpuset.c Tue Aug 25 15:58:07 2009 (r196545) @@ -731,7 +731,8 @@ cpuset_thread0(void) * Create a cpuset, which would be cpuset_create() but * mark the new 'set' as root. * - * We are not going to reparent the td to it. Use cpuset_reparentproc() for that. + * We are not going to reparent the td to it. Use cpuset_setproc_update_set() + * for that. * * In case of no error, returns the set in *setp locked with a reference. */ From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 16:56:34 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BF2B1065690; Tue, 25 Aug 2009 16:56:34 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 00DAA8FC27; Tue, 25 Aug 2009 16:56:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PGuXnl033984; Tue, 25 Aug 2009 16:56:33 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PGuXOs033981; Tue, 25 Aug 2009 16:56:33 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908251656.n7PGuXOs033981@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 16:56:33 +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: r196546 - in stable/7/sys: . contrib/pf netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 16:56:34 -0000 Author: bz Date: Tue Aug 25 16:56:33 2009 New Revision: 196546 URL: http://svn.freebsd.org/changeset/base/196546 Log: MFC r187939: Remove 4 entirely unsued ip6 variables. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/netinet6/ip6_input.c stable/7/sys/netinet6/ip6_var.h Modified: stable/7/sys/netinet6/ip6_input.c ============================================================================== --- stable/7/sys/netinet6/ip6_input.c Tue Aug 25 15:58:07 2009 (r196545) +++ stable/7/sys/netinet6/ip6_input.c Tue Aug 25 16:56:33 2009 (r196546) @@ -120,12 +120,6 @@ struct in6_ifaddr *in6_ifaddr; extern struct callout in6_tmpaddrtimer_ch; -int ip6_forward_srcrt; /* XXX */ -int ip6_sourcecheck; /* XXX */ -int ip6_sourcecheck_interval; /* XXX */ - -int ip6_ours_check_algorithm; - struct pfil_head inet6_pfil_hook; struct ip6stat ip6stat; Modified: stable/7/sys/netinet6/ip6_var.h ============================================================================== --- stable/7/sys/netinet6/ip6_var.h Tue Aug 25 15:58:07 2009 (r196545) +++ stable/7/sys/netinet6/ip6_var.h Tue Aug 25 16:56:33 2009 (r196546) @@ -282,7 +282,6 @@ extern struct ip6stat ip6stat; /* statis extern int ip6_defhlim; /* default hop limit */ extern int ip6_defmcasthlim; /* default multicast hop limit */ extern int ip6_forwarding; /* act as router? */ -extern int ip6_forward_srcrt; /* forward src-routed? */ extern int ip6_gif_hlim; /* Hop limit for gif encap packet */ extern int ip6_use_deprecated; /* allow deprecated addr as source */ extern int ip6_rr_prune; /* router renumbering prefix @@ -294,8 +293,6 @@ extern struct socket *ip6_mrouter; /* mu extern int ip6_sendredirects; /* send IP redirects when forwarding? */ extern int ip6_maxfragpackets; /* Maximum packets in reassembly queue */ extern int ip6_maxfrags; /* Maximum fragments in reassembly queue */ -extern int ip6_sourcecheck; /* Verify source interface */ -extern int ip6_sourcecheck_interval; /* Interval between log messages */ extern int ip6_accept_rtadv; /* Acts as a host not a router */ extern int ip6_keepfaith; /* Firewall Aided Internet Translator */ extern int ip6_log_interval; From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 16:59:55 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9DB81065690; Tue, 25 Aug 2009 16:59:55 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 98ECD8FC39; Tue, 25 Aug 2009 16:59:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PGxtuu034086; Tue, 25 Aug 2009 16:59:55 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PGxtsq034084; Tue, 25 Aug 2009 16:59:55 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200908251659.n7PGxtsq034084@svn.freebsd.org> From: Andrew Thompson Date: Tue, 25 Aug 2009 16:59:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196547 - head/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 16:59:55 -0000 Author: thompsa Date: Tue Aug 25 16:59:55 2009 New Revision: 196547 URL: http://svn.freebsd.org/changeset/base/196547 Log: It is possible for all the kthreads to exit (hci modules unloaded) which in turn ends our usb process. This means the proc pointer becomes invalid and will panic if a new kthread is added. Count the number of threads and clear the proc pointer on the last one. Suggested by: julian MFC after: 3 days Modified: head/sys/dev/usb/usb_process.c Modified: head/sys/dev/usb/usb_process.c ============================================================================== --- head/sys/dev/usb/usb_process.c Tue Aug 25 16:56:33 2009 (r196546) +++ head/sys/dev/usb/usb_process.c Tue Aug 25 16:59:55 2009 (r196547) @@ -64,6 +64,7 @@ #if (__FreeBSD_version >= 800000) static struct proc *usbproc; +static int usb_pcount; #define USB_THREAD_CREATE(f, s, p, ...) \ kproc_kthread_add((f), (s), &usbproc, (p), RFHIGHPID, \ 0, "usb", __VA_ARGS__) @@ -183,6 +184,11 @@ usb_process(void *arg) up->up_ptr = NULL; cv_signal(&up->up_cv); mtx_unlock(up->up_mtx); +#if (__FreeBSD_version >= 800000) + /* Clear the proc pointer if this is the last thread. */ + if (--usb_pcount == 0) + usbproc = NULL; +#endif USB_THREAD_EXIT(0); } @@ -218,6 +224,9 @@ usb_proc_create(struct usb_process *up, up->up_ptr = NULL; goto error; } +#if (__FreeBSD_version >= 800000) + usb_pcount++; +#endif return (0); error: From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 17:00:25 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 271661065698; Tue, 25 Aug 2009 17:00:25 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 154A68FC74; Tue, 25 Aug 2009 17:00:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PH0OmQ034161; Tue, 25 Aug 2009 17:00:24 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PH0ON0034159; Tue, 25 Aug 2009 17:00:24 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908251700.n7PH0ON0034159@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 17:00:24 +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: r196548 - in stable/7/sys: . contrib/pf netipsec X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 17:00:25 -0000 Author: bz Date: Tue Aug 25 17:00:24 2009 New Revision: 196548 URL: http://svn.freebsd.org/changeset/base/196548 Log: MFC r187936: Use NULL rather than 0 when comparing pointers. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/netipsec/ipsec_output.c Modified: stable/7/sys/netipsec/ipsec_output.c ============================================================================== --- stable/7/sys/netipsec/ipsec_output.c Tue Aug 25 16:59:55 2009 (r196547) +++ stable/7/sys/netipsec/ipsec_output.c Tue Aug 25 17:00:24 2009 (r196548) @@ -782,14 +782,14 @@ ipsec6_output_tunnel(struct ipsec_output RTFREE(state->ro->ro_rt); state->ro->ro_rt = NULL; } - if (state->ro->ro_rt == 0) { + if (state->ro->ro_rt == NULL) { bzero(dst6, sizeof(*dst6)); dst6->sin6_family = AF_INET6; dst6->sin6_len = sizeof(*dst6); dst6->sin6_addr = ip6->ip6_dst; rtalloc(state->ro); } - if (state->ro->ro_rt == 0) { + if (state->ro->ro_rt == NULL) { ip6stat.ip6s_noroute++; ipsec6stat.ips_out_noroute++; error = EHOSTUNREACH; From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 18:49:08 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F88F106568E; Tue, 25 Aug 2009 18:49:08 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.delphij.net (delphij-pt.tunnel.tserv2.fmt.ipv6.he.net [IPv6:2001:470:1f03:2c9::2]) by mx1.freebsd.org (Postfix) with ESMTP id 275238FC1C; Tue, 25 Aug 2009 18:49:08 +0000 (UTC) Received: from tarsier.geekcn.org (tarsier.geekcn.org [211.166.10.233]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tarsier.delphij.net (Postfix) with ESMTPS id 3A9F35C06F; Wed, 26 Aug 2009 02:49:07 +0800 (CST) Received: from localhost (tarsier.geekcn.org [211.166.10.233]) by tarsier.geekcn.org (Postfix) with ESMTP id F224855CDD00; Wed, 26 Aug 2009 02:49:01 +0800 (CST) X-Virus-Scanned: amavisd-new at geekcn.org Received: from tarsier.geekcn.org ([211.166.10.233]) by localhost (mail.geekcn.org [211.166.10.233]) (amavisd-new, port 10024) with ESMTP id lfqDkAcZTz4h; Wed, 26 Aug 2009 02:48:08 +0800 (CST) Received: from charlie.delphij.net (adsl-76-237-33-62.dsl.pltn13.sbcglobal.net [76.237.33.62]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tarsier.geekcn.org (Postfix) with ESMTPSA id 4993855CDD07; Wed, 26 Aug 2009 02:48:02 +0800 (CST) DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns; h=message-id:date:from:reply-to:organization:user-agent: mime-version:to:cc:subject:references:in-reply-to: x-enigmail-version:openpgp:content-type:content-transfer-encoding; b=MQzgv+m3VJooz7RdtsycC4QjdpY7urRD4OwWkTwABKNEIsnUz5jkKt6bm48r/NHD7 WBJrKfL/LHfHMiLhXqWlA== Message-ID: <4A9431D1.9060104@delphij.net> Date: Tue, 25 Aug 2009 11:47:45 -0700 From: Xin LI Organization: The FreeBSD Project User-Agent: Thunderbird 2.0.0.22 (X11/20090803) MIME-Version: 1.0 To: Gleb Smirnoff References: <200908251408.n7PE8Xk1030216@svn.freebsd.org> In-Reply-To: <200908251408.n7PE8Xk1030216@svn.freebsd.org> X-Enigmail-Version: 0.96.0 OpenPGP: id=18EDEBA0; url=http://www.delphij.net/delphij.asc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r196543 - head/sys/i386/isa X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: d@delphij.net List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 18:49:08 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Gleb Smirnoff wrote: > Author: glebius > Date: Tue Aug 25 14:08:33 2009 > New Revision: 196543 > URL: http://svn.freebsd.org/changeset/base/196543 > > Log: > Fix build broken in r196524. Thanks and sorry for the breakage. I should never trusted non-clean code checkout :-/ Cheers, - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.12 (FreeBSD) iEYEARECAAYFAkqUMdEACgkQi+vbBBjt66Ca2gCggvZisOLrhp6rrsoCsyNNSJcC xz0AmgP3tz6HbGSO64nDx0x0eYvJO4xQ =f7m5 -----END PGP SIGNATURE----- From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 19:04:22 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C75281065692; Tue, 25 Aug 2009 19:04:22 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9BFF98FC1C; Tue, 25 Aug 2009 19:04:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PJ4MgP036764; Tue, 25 Aug 2009 19:04:22 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PJ4MHP036760; Tue, 25 Aug 2009 19:04:22 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908251904.n7PJ4MHP036760@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 19:04:22 +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: r196549 - in stable/7/sys: . contrib/pf netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 19:04:22 -0000 Author: bz Date: Tue Aug 25 19:04:22 2009 New Revision: 196549 URL: http://svn.freebsd.org/changeset/base/196549 Log: MFC r187946: Like with r185713 make sure to not leak a lock as rtalloc1(9) returns a locked route. Thus we have to use RTFREE_LOCKED(9) to get it unlocked and rtfree(9)d rather than just rtfree(9)d. PR: kern/129793 Submitted by: Dheeraj Reddy Originally committed from: Bugathon #6 Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/netinet6/in6_gif.c stable/7/sys/netinet6/in6_ifattach.c stable/7/sys/netinet6/nd6_nbr.c Modified: stable/7/sys/netinet6/in6_gif.c ============================================================================== --- stable/7/sys/netinet6/in6_gif.c Tue Aug 25 17:00:24 2009 (r196548) +++ stable/7/sys/netinet6/in6_gif.c Tue Aug 25 19:04:22 2009 (r196549) @@ -389,10 +389,10 @@ gif_validate6(const struct ip6_hdr *ip6, ip6_sprintf(ip6buf, &sin6.sin6_addr)); #endif if (rt) - rtfree(rt); + RTFREE_LOCKED(rt); return 0; } - rtfree(rt); + RTFREE_LOCKED(rt); } return 128 * 2; Modified: stable/7/sys/netinet6/in6_ifattach.c ============================================================================== --- stable/7/sys/netinet6/in6_ifattach.c Tue Aug 25 17:00:24 2009 (r196548) +++ stable/7/sys/netinet6/in6_ifattach.c Tue Aug 25 19:04:22 2009 (r196549) @@ -767,7 +767,7 @@ in6_ifdetach(struct ifnet *ifp) if ((ia->ia_flags & IFA_ROUTE) && (rt = rtalloc1((struct sockaddr *)&ia->ia_addr, 0, 0UL))) { rtflags = rt->rt_flags; - rtfree(rt); + RTFREE_LOCKED(rt); rtrequest(RTM_DELETE, (struct sockaddr *)&ia->ia_addr, (struct sockaddr *)&ia->ia_addr, (struct sockaddr *)&ia->ia_prefixmask, Modified: stable/7/sys/netinet6/nd6_nbr.c ============================================================================== --- stable/7/sys/netinet6/nd6_nbr.c Tue Aug 25 17:00:24 2009 (r196548) +++ stable/7/sys/netinet6/nd6_nbr.c Tue Aug 25 19:04:22 2009 (r196549) @@ -236,7 +236,7 @@ nd6_ns_input(struct mbuf *m, int off, in need_proxy = (rt && (rt->rt_flags & RTF_ANNOUNCE) != 0 && rt->rt_gateway->sa_family == AF_LINK); if (rt) - rtfree(rt); + RTFREE_LOCKED(rt); if (need_proxy) { /* * proxy NDP for single entry From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 19:07:26 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB5A5106568B; Tue, 25 Aug 2009 19:07:26 +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 B96ED8FC18; Tue, 25 Aug 2009 19:07:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PJ7Q1t036873; Tue, 25 Aug 2009 19:07:26 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PJ7QiO036868; Tue, 25 Aug 2009 19:07:26 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200908251907.n7PJ7QiO036868@svn.freebsd.org> From: Xin LI Date: Tue, 25 Aug 2009 19:07:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196550 - in head: etc/defaults etc/rc.d share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 19:07:26 -0000 Author: delphij Date: Tue Aug 25 19:07:26 2009 New Revision: 196550 URL: http://svn.freebsd.org/changeset/base/196550 Log: Add a new rc.d script, static_arp, which enables the administrator to statically bind IPv4 <-> MAC address at boot time. In order to use this, the administrator needs to configure the following rc.conf(5) variable: - static_arp_pairs: A list of names for static bind pairs, and, - a series of static_arp_(name): the arguments that is being passed to ``arp -S'' operation. Example: static_arp_pairs="gw" static_arp_gw="192.168.1.1 00:01:02:03:04:05" See the rc.conf(5) manual page for more details. Reviewed by: -rc@ MFC after: 2 weeks Added: head/etc/rc.d/static_arp (contents, props changed) Modified: head/etc/defaults/rc.conf head/etc/rc.d/Makefile head/share/man/man5/rc.conf.5 Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Tue Aug 25 19:04:22 2009 (r196549) +++ head/etc/defaults/rc.conf Tue Aug 25 19:07:26 2009 (r196550) @@ -357,6 +357,7 @@ bsnmpd_flags="" # Flags for bsnmpd. ### Network routing options: ### defaultrouter="NO" # Set to default gateway (or NO). +static_arp_pairs="" # Set to static ARP list (or leave empty). static_routes="" # Set to static route list (or leave empty). natm_static_routes="" # Set to static route list for NATM (or leave empty). gateway_enable="NO" # Set to YES if this host will be a gateway. Modified: head/etc/rc.d/Makefile ============================================================================== --- head/etc/rc.d/Makefile Tue Aug 25 19:04:22 2009 (r196549) +++ head/etc/rc.d/Makefile Tue Aug 25 19:07:26 2009 (r196550) @@ -32,7 +32,7 @@ FILES= DAEMON FILESYSTEMS LOGIN NETWORKI random rarpd resolv rfcomm_pppd_server root \ route6d routed routing rpcbind rtadvd rwho \ savecore sdpd securelevel sendmail \ - serial sppp statd swap1 \ + serial sppp statd static_arp swap1 \ syscons sysctl syslogd \ timed tmp \ ugidfw \ Added: head/etc/rc.d/static_arp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/etc/rc.d/static_arp Tue Aug 25 19:07:26 2009 (r196550) @@ -0,0 +1,71 @@ +#!/bin/sh +# +# Copyright (c) 2009 Xin LI +# All rights reserved. +# +# 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. +# +# Configure static ARP table +# +# $FreeBSD$ +# + +# PROVIDE: static_arp +# REQUIRE: netif +# KEYWORD: nojail + +. /etc/rc.subr + +name="static_arp" +start_cmd="static_arp_start" +stop_cmd="static_arp_stop" + +static_arp_start() +{ + if [ -n "${static_arp_pairs}" ]; then + echo -n 'Binding static ARP pair(s):' + for e in ${static_arp_pairs}; do + local arp_args + echo -n " ${e}" + eval arp_args=\$static_arp_${e} + arp -S ${arp_args} >/dev/null 2>&1 + done + echo '.' + fi +} + +static_arp_stop() +{ + if [ -n "${static_arp_pairs}" ]; then + echo -n 'Unbinding static ARP pair(s):' + for e in ${static_arp_pairs}; do + local arp_args + echo -n " ${e}" + eval arp_args=\$static_arp_${e} + arp -d ${arp_args%%[ ]*} > /dev/null 2>&1 + done + echo '.' + fi +} + +load_rc_config $name +run_rc_command "$1" Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Tue Aug 25 19:04:22 2009 (r196549) +++ head/share/man/man5/rc.conf.5 Tue Aug 25 19:07:26 2009 (r196550) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 10, 2009 +.Dd August 25, 2009 .Dt RC.CONF 5 .Os .Sh NAME @@ -2227,6 +2227,22 @@ name server!). .Pq Vt str The IPv6 equivalent of .Va defaultrouter . +.It Va static_arp_pairs +.Pq Vt str +Set to the list of static ARP pairs that are to be added at system +boot time. +For each whitespace separated +.Ar element +in the value, a +.Va static_arp_ Ns Aq Ar element +variable is assumed to exist whose contents will later be passed to a +.Dq Nm arp Cm -S +operation. +For example +.Bd -literal +static_arp_pairs="gw" +static_arp_gw="192.168.1.1 00:01:02:03:04:05" +.Ed .It Va static_routes .Pq Vt str Set to the list of static routes that are to be added at system From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 19:26:31 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72EB71065695 for ; Tue, 25 Aug 2009 19:26:31 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 2589B8FC24 for ; Tue, 25 Aug 2009 19:26:31 +0000 (UTC) Received: (qmail 18255 invoked by uid 399); 25 Aug 2009 19:26:28 -0000 Received: from localhost (HELO foreign.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 25 Aug 2009 19:26:28 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4A943ADE.2080500@FreeBSD.org> Date: Tue, 25 Aug 2009 12:26:22 -0700 From: Doug Barton Organization: http://www.FreeBSD.org/ User-Agent: Thunderbird 2.0.0.23 (X11/20090822) MIME-Version: 1.0 To: Xin LI References: <200908251907.n7PJ7QiO036868@svn.freebsd.org> In-Reply-To: <200908251907.n7PJ7QiO036868@svn.freebsd.org> X-Enigmail-Version: 0.96.0 OpenPGP: id=D5B2F0FB Content-Type: multipart/mixed; boundary="------------050907050001070408080904" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196550 - in head: etc/defaults etc/rc.d share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 19:26:31 -0000 This is a multi-part message in MIME format. --------------050907050001070408080904 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit My sincere apologies for missing this the first N times I reviewed it, but both variables in functions should be declared local. Attached is a suggested patch. Doug -- This .signature sanitized for your protection --------------050907050001070408080904 Content-Type: text/plain; name="static_arp-local.diff" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="static_arp-local.diff" SW5kZXg6IHN0YXRpY19hcnAKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gc3RhdGljX2FycAkocmV2aXNp b24gMTk2NTUwKQorKysgc3RhdGljX2FycAkod29ya2luZyBjb3B5KQpAQCAtNDEsMTAgKzQx LDExIEBACiAKIHN0YXRpY19hcnBfc3RhcnQoKQogeworCWxvY2FsIGUgYXJwX2FyZ3MKKwog CWlmIFsgLW4gIiR7c3RhdGljX2FycF9wYWlyc30iIF07IHRoZW4KIAkJZWNobyAtbiAnQmlu ZGluZyBzdGF0aWMgQVJQIHBhaXIocyk6JwogCQlmb3IgZSBpbiAke3N0YXRpY19hcnBfcGFp cnN9OyBkbwotCQkJbG9jYWwgYXJwX2FyZ3MKIAkJCWVjaG8gLW4gIiAke2V9IgogCQkJZXZh bCBhcnBfYXJncz1cJHN0YXRpY19hcnBfJHtlfQogCQkJYXJwIC1TICR7YXJwX2FyZ3N9ID4v ZGV2L251bGwgMj4mMQpAQCAtNTUsMTAgKzU2LDExIEBACiAKIHN0YXRpY19hcnBfc3RvcCgp CiB7CisJbG9jYWwgZSBhcnBfYXJncworCiAJaWYgWyAtbiAiJHtzdGF0aWNfYXJwX3BhaXJz fSIgXTsgdGhlbgogCQllY2hvIC1uICdVbmJpbmRpbmcgc3RhdGljIEFSUCBwYWlyKHMpOicK IAkJZm9yIGUgaW4gJHtzdGF0aWNfYXJwX3BhaXJzfTsgZG8KLQkJCWxvY2FsIGFycF9hcmdz CiAJCQllY2hvIC1uICIgJHtlfSIKIAkJCWV2YWwgYXJwX2FyZ3M9XCRzdGF0aWNfYXJwXyR7 ZX0KIAkJCWFycCAtZCAke2FycF9hcmdzJSVbIAldKn0gPiAvZGV2L251bGwgMj4mMQo= --------------050907050001070408080904-- From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 19:30:32 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93EED1065691; Tue, 25 Aug 2009 19:30:32 +0000 (UTC) (envelope-from mlaier@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 82F6E8FC28; Tue, 25 Aug 2009 19:30:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PJUWr6037400; Tue, 25 Aug 2009 19:30:32 GMT (envelope-from mlaier@svn.freebsd.org) Received: (from mlaier@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PJUWn3037398; Tue, 25 Aug 2009 19:30:32 GMT (envelope-from mlaier@svn.freebsd.org) Message-Id: <200908251930.n7PJUWn3037398@svn.freebsd.org> From: Max Laier Date: Tue, 25 Aug 2009 19:30:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196551 - head/sys/contrib/pf/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 19:30:32 -0000 Author: mlaier Date: Tue Aug 25 19:30:32 2009 New Revision: 196551 URL: http://svn.freebsd.org/changeset/base/196551 Log: Fix argument ordering to memcpy as well as the size of the copy in the (theoretical) case that pfi_buffer_cnt should be greater than ~_max. Submitted by: pjd Reviewed by: {krw,sthen,markus}@openbsd.org MFC after: 3 days Modified: head/sys/contrib/pf/net/pf_if.c Modified: head/sys/contrib/pf/net/pf_if.c ============================================================================== --- head/sys/contrib/pf/net/pf_if.c Tue Aug 25 19:07:26 2009 (r196550) +++ head/sys/contrib/pf/net/pf_if.c Tue Aug 25 19:30:32 2009 (r196551) @@ -663,7 +663,7 @@ pfi_address_add(struct sockaddr *sa, int "(%d/%d)\n", pfi_buffer_cnt, PFI_BUFFER_MAX); return; } - memcpy(pfi_buffer, p, pfi_buffer_cnt * sizeof(*pfi_buffer)); + memcpy(p, pfi_buffer, pfi_buffer_max * sizeof(*pfi_buffer)); /* no need to zero buffer */ free(pfi_buffer, PFI_MTYPE); pfi_buffer = p; From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 20:05:51 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B70AE1065690; Tue, 25 Aug 2009 20:05:51 +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 A61678FC18; Tue, 25 Aug 2009 20:05:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PK5pYC038211; Tue, 25 Aug 2009 20:05:51 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PK5psT038209; Tue, 25 Aug 2009 20:05:51 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200908252005.n7PK5psT038209@svn.freebsd.org> From: Xin LI Date: Tue, 25 Aug 2009 20:05:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196552 - head/etc/rc.d X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 20:05:51 -0000 Author: delphij Date: Tue Aug 25 20:05:51 2009 New Revision: 196552 URL: http://svn.freebsd.org/changeset/base/196552 Log: Localize 'e'. Submitted by: dougb Modified: head/etc/rc.d/static_arp Modified: head/etc/rc.d/static_arp ============================================================================== --- head/etc/rc.d/static_arp Tue Aug 25 19:30:32 2009 (r196551) +++ head/etc/rc.d/static_arp Tue Aug 25 20:05:51 2009 (r196552) @@ -41,10 +41,11 @@ stop_cmd="static_arp_stop" static_arp_start() { + local e arp_args + if [ -n "${static_arp_pairs}" ]; then echo -n 'Binding static ARP pair(s):' for e in ${static_arp_pairs}; do - local arp_args echo -n " ${e}" eval arp_args=\$static_arp_${e} arp -S ${arp_args} >/dev/null 2>&1 @@ -55,10 +56,11 @@ static_arp_start() static_arp_stop() { + local e arp_args + if [ -n "${static_arp_pairs}" ]; then echo -n 'Unbinding static ARP pair(s):' for e in ${static_arp_pairs}; do - local arp_args echo -n " ${e}" eval arp_args=\$static_arp_${e} arp -d ${arp_args%%[ ]*} > /dev/null 2>&1 From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 20:15:42 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34207106568B; Tue, 25 Aug 2009 20:15:42 +0000 (UTC) (envelope-from gleb.kurtsou@gmail.com) Received: from mail-fx0-f210.google.com (mail-fx0-f210.google.com [209.85.220.210]) by mx1.freebsd.org (Postfix) with ESMTP id 273BB8FC22; Tue, 25 Aug 2009 20:15:40 +0000 (UTC) Received: by fxm6 with SMTP id 6so2303274fxm.43 for ; Tue, 25 Aug 2009 13:15:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=BDOGocis9bV+HC9nTR00zJFUu7U7Dk2StKRjSUeYRvw=; b=AkYxf/eiiEpYSvVkvGLcVNlcgkPQ/QIGCNR1CvtoF3Q60NhYWwDlGI1SspPlyUAIYl 9VTE0tbySIXw4BEjJAkKMT4UOZ+1nV/gKyvI/SUszqn0szpOAZDNRYClFHB0U1yLtkXE 7OIH4IM985gRQ+l15s+XkRfxRT57NrcC9H/6Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=ec30ceF+Z++aXjPlBgRcL8Vh0DdioGGm4JkjPbEnMY8fmmWWxLteOX0FCf8b2/GF3z 9vNtdh97TzHwTbqRBAUoVemO+UDt60ZSNRieeFnylrb4g6vGPqC+geI9rJV+3D4YYmEP zaK+UhUDmg7ur1yeQXGYSTLmCfakMXpdLkEtc= Received: by 10.103.86.13 with SMTP id o13mr2255068mul.6.1251229400732; Tue, 25 Aug 2009 12:43:20 -0700 (PDT) Received: from localhost (lan-78-157-90-54.vln.skynet.lt [78.157.90.54]) by mx.google.com with ESMTPS id y2sm3346805mug.12.2009.08.25.12.43.19 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 25 Aug 2009 12:43:19 -0700 (PDT) Date: Tue, 25 Aug 2009 22:42:58 +0300 From: Gleb Kurtsou To: Xin LI Message-ID: <20090825194258.GB1471@tops> References: <200908251907.n7PJ7QiO036868@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <200908251907.n7PJ7QiO036868@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196550 - in head: etc/defaults etc/rc.d share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 20:15:42 -0000 On (25/08/2009 19:07), Xin LI wrote: > Author: delphij > Date: Tue Aug 25 19:07:26 2009 > New Revision: 196550 > URL: http://svn.freebsd.org/changeset/base/196550 > > Log: > Add a new rc.d script, static_arp, which enables the administrator to > statically bind IPv4 <-> MAC address at boot time. > > In order to use this, the administrator needs to configure the following > rc.conf(5) variable: > > - static_arp_pairs: A list of names for static bind pairs, and, > - a series of static_arp_(name): the arguments that is being passed to > ``arp -S'' operation. > > Example: > static_arp_pairs="gw" > static_arp_gw="192.168.1.1 00:01:02:03:04:05" > > See the rc.conf(5) manual page for more details. Thanks for it! Would you please add support for reading pairs from file, that should be trivial. I've been using my own rc script for reading static arp entries from file but can't find it right now. Thanks, Gleb. From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 20:21:17 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47FB4106568C; Tue, 25 Aug 2009 20:21:17 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 36B518FC19; Tue, 25 Aug 2009 20:21:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PKLHRu038607; Tue, 25 Aug 2009 20:21:17 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PKLH8s038605; Tue, 25 Aug 2009 20:21:17 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200908252021.n7PKLH8s038605@svn.freebsd.org> From: Robert Watson Date: Tue, 25 Aug 2009 20:21:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196553 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 20:21:17 -0000 Author: rwatson Date: Tue Aug 25 20:21:16 2009 New Revision: 196553 URL: http://svn.freebsd.org/changeset/base/196553 Log: Break out allocation of new ifindex values from if_alloc() and if_vmove(), and centralize in a single function ifindex_alloc(). Assert the IFNET_WLOCK, and add missing IFNET_WLOCK in if_alloc(). This does not close all known races in this code. Reviewed by: bz MFC after: 3 days Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Tue Aug 25 20:05:51 2009 (r196552) +++ head/sys/net/if.c Tue Aug 25 20:21:16 2009 (r196553) @@ -223,6 +223,37 @@ ifnet_byindex_ref(u_short idx) return (ifp); } +/* + * Allocate an ifindex array entry; return 0 on success or an error on + * failure. + */ +static int +ifindex_alloc(u_short *idxp) +{ + u_short idx; + + IFNET_WLOCK_ASSERT(); + + /* + * Try to find an empty slot below if_index. If we fail, take the + * next slot. + */ + for (idx = 1; idx <= V_if_index; idx++) { + if (ifnet_byindex_locked(idx) == NULL) + break; + } + + /* Catch if_index overflow. */ + if (idx < 1) + return (ENOSPC); + if (idx > V_if_index) + V_if_index = idx; + if (V_if_index >= V_if_indexlim) + if_grow(); + *idxp = idx; + return (0); +} + static void ifnet_setbyindex_locked(u_short idx, struct ifnet *ifp) { @@ -335,32 +366,19 @@ struct ifnet * if_alloc(u_char type) { struct ifnet *ifp; + u_short idx; ifp = malloc(sizeof(struct ifnet), M_IFNET, M_WAITOK|M_ZERO); - - /* - * Try to find an empty slot below if_index. If we fail, take - * the next slot. - * - * XXX: should be locked! - */ - for (ifp->if_index = 1; ifp->if_index <= V_if_index; ifp->if_index++) { - if (ifnet_byindex(ifp->if_index) == NULL) - break; - } - /* Catch if_index overflow. */ - if (ifp->if_index < 1) { + IFNET_WLOCK(); + if (ifindex_alloc(&idx) != 0) { + IFNET_WUNLOCK(); free(ifp, M_IFNET); return (NULL); } - if (ifp->if_index > V_if_index) - V_if_index = ifp->if_index; - if (V_if_index >= V_if_indexlim) - if_grow(); - + IFNET_WUNLOCK(); + ifp->if_index = idx; ifp->if_type = type; ifp->if_alloctype = type; - if (if_com_alloc[type] != NULL) { ifp->if_l2com = if_com_alloc[type](type, ifp); if (ifp->if_l2com == NULL) { @@ -882,6 +900,7 @@ if_detach_internal(struct ifnet *ifp, in void if_vmove(struct ifnet *ifp, struct vnet *new_vnet) { + u_short idx; /* * Detach from current vnet, but preserve LLADDR info, do not @@ -907,23 +926,12 @@ if_vmove(struct ifnet *ifp, struct vnet */ CURVNET_SET_QUIET(new_vnet); - /* - * Try to find an empty slot below if_index. If we fail, take - * the next slot. - */ IFNET_WLOCK(); - for (ifp->if_index = 1; ifp->if_index <= V_if_index; ifp->if_index++) { - if (ifnet_byindex_locked(ifp->if_index) == NULL) - break; - } - /* Catch if_index overflow. */ - if (ifp->if_index < 1) + if (ifindex_alloc(&idx) != 0) { + IFNET_WUNLOCK(); panic("if_index overflow"); - - if (ifp->if_index > V_if_index) - V_if_index = ifp->if_index; - if (V_if_index >= V_if_indexlim) - if_grow(); + } + ifp->if_index = idx; ifnet_setbyindex_locked(ifp->if_index, ifp); IFNET_WUNLOCK(); From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 20:33:38 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A2011065696; Tue, 25 Aug 2009 20:33:38 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 27A808FC25; Tue, 25 Aug 2009 20:33:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PKXcom038937; Tue, 25 Aug 2009 20:33:38 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PKXcvE038934; Tue, 25 Aug 2009 20:33:38 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200908252033.n7PKXcvE038934@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 25 Aug 2009 20:33:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196554 - head/tools/regression/poll X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 20:33:38 -0000 Author: jilles Date: Tue Aug 25 20:33:37 2009 New Revision: 196554 URL: http://svn.freebsd.org/changeset/base/196554 Log: Add some tests for poll(2)/shutdown(2) interaction. Added: head/tools/regression/poll/sockpoll.c (contents, props changed) Modified: head/tools/regression/poll/Makefile Modified: head/tools/regression/poll/Makefile ============================================================================== --- head/tools/regression/poll/Makefile Tue Aug 25 20:21:16 2009 (r196553) +++ head/tools/regression/poll/Makefile Tue Aug 25 20:33:37 2009 (r196554) @@ -3,14 +3,15 @@ # Nothing yet works with gmake for the path to the sources. .PATH: .. -PROG= pipepoll pipeselect +PROG= pipepoll pipeselect sockpoll CFLAGS+= -Werror -Wall all: ${PROG} pipepoll: pipepoll.c pipeselect: pipeselect.c +sockpoll: sockpoll.c -pipepoll pipeselect: +pipepoll pipeselect sockpoll: ${CC} ${CFLAGS} ${LDFLAGS} -o $@ $@.c test: all Added: head/tools/regression/poll/sockpoll.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/poll/sockpoll.c Tue Aug 25 20:33:37 2009 (r196554) @@ -0,0 +1,202 @@ +/* $FreeBSD$ */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +static const char * +decode_events(int events) +{ + char *ncresult; + const char *result; + + switch (events) { + case POLLIN: + result = "POLLIN"; + break; + case POLLOUT: + result = "POLLOUT"; + break; + case POLLIN | POLLOUT: + result = "POLLIN | POLLOUT"; + break; + case POLLHUP: + result = "POLLHUP"; + break; + case POLLIN | POLLHUP: + result = "POLLIN | POLLHUP"; + break; + case POLLOUT | POLLHUP: + result = "POLLOUT | POLLHUP"; + break; + case POLLIN | POLLOUT | POLLHUP: + result = "POLLIN | POLLOUT | POLLHUP"; + break; + default: + asprintf(&ncresult, "%#x", events); + result = ncresult; + break; + } + return (result); +} + +static void +report(int num, const char *state, int expected, int got) +{ + if (expected == got) + printf("ok %-2d ", num); + else + printf("not ok %-2d", num); + printf(" state %s: expected %s; got %s\n", + state, decode_events(expected), decode_events(got)); + fflush(stdout); +} + +static int +set_nonblocking(int sck) +{ + int flags; + + flags = fcntl(sck, F_GETFL, 0); + flags |= O_NONBLOCK; + + if (fcntl(sck, F_SETFL, flags)) + return -1; + + return 0; +} + +static char largeblock[1048576]; /* should be more than AF_UNIX sockbuf size */ +static int fd[2]; +static struct pollfd pfd0; +static struct pollfd pfd1; + +void +setup(void) +{ + if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != 0) + err(1, "socketpair"); + if (set_nonblocking(fd[0]) == -1) + err(1, "fcntl"); + if (set_nonblocking(fd[1]) == -1) + err(1, "fcntl"); + pfd0.fd = fd[0]; + pfd0.events = POLLIN | POLLOUT; + pfd1.fd = fd[1]; + pfd1.events = POLLIN | POLLOUT; +} + +int +main(void) +{ + int num; + + num = 1; + printf("1..18\n"); + fflush(stdout); + + /* Large write with close */ + setup(); + if (poll(&pfd0, 1, 0) == -1) + err(1, "poll"); + report(num++, "initial 0", POLLOUT, pfd0.revents); + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "initial 1", POLLOUT, pfd1.revents); + if (write(fd[0], largeblock, sizeof(largeblock)) == -1) + err(1, "write"); + if (poll(&pfd0, 1, 0) == -1) + err(1, "poll"); + report(num++, "after large write", 0, pfd0.revents); + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "other side after large write", POLLIN | POLLOUT, pfd1.revents); + close(fd[0]); + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "other side after close", POLLIN | POLLHUP, pfd1.revents); + if (read(fd[1], largeblock, sizeof(largeblock)) == -1) + err(1, "read"); + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "other side after reading input", POLLHUP, pfd1.revents); + close(fd[1]); + + /* With shutdown(SHUT_WR) */ + setup(); + if (shutdown(fd[0], SHUT_WR) == -1) + err(1, "shutdown"); + if (poll(&pfd0, 1, 0) == -1) + err(1, "poll"); + report(num++, "after shutdown(SHUT_WR)", POLLOUT, pfd0.revents); + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "other side after shutdown(SHUT_WR)", POLLIN | POLLOUT, pfd1.revents); + switch (read(fd[1], largeblock, sizeof(largeblock))) { + case 0: + break; + case -1: + err(1, "read after other side shutdown"); + break; + default: + errx(1, "kernel made up data that was never written"); + } + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "other side after reading EOF", POLLIN | POLLOUT, pfd1.revents); + if (write(fd[1], largeblock, sizeof(largeblock)) == -1) + err(1, "write"); + if (poll(&pfd0, 1, 0) == -1) + err(1, "poll"); + report(num++, "after data from other side", POLLIN | POLLOUT, pfd0.revents); + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "after writing", POLLIN, pfd1.revents); + if (shutdown(fd[1], SHUT_WR) == -1) + err(1, "shutdown second"); + if (poll(&pfd0, 1, 0) == -1) + err(1, "poll"); + report(num++, "after second shutdown", POLLIN | POLLHUP, pfd0.revents); + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "after second shutdown", POLLHUP, pfd1.revents); + close(fd[0]); + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "after close", POLLHUP, pfd1.revents); + close(fd[1]); + + /* + * With shutdown(SHUT_RD) + * Note that shutdown(SHUT_WR) is passed to the peer, but + * shutdown(SHUT_RD) is not. + */ + setup(); + if (shutdown(fd[0], SHUT_RD) == -1) + err(1, "shutdown"); + if (poll(&pfd0, 1, 0) == -1) + err(1, "poll"); + report(num++, "after shutdown(SHUT_RD)", POLLIN | POLLOUT, pfd0.revents); + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "other side after shutdown(SHUT_RD)", POLLOUT, pfd1.revents); + if (shutdown(fd[0], SHUT_WR) == -1) + err(1, "shutdown"); + if (poll(&pfd0, 1, 0) == -1) + err(1, "poll"); + report(num++, "after shutdown(SHUT_WR)", POLLHUP, pfd0.revents); + if (poll(&pfd1, 1, 0) == -1) + err(1, "poll"); + report(num++, "other side after shutdown(SHUT_WR)", POLLIN | POLLOUT, pfd1.revents); + close(fd[0]); + close(fd[1]); + + return (0); +} From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 20:35:57 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6995106568C; Tue, 25 Aug 2009 20:35:57 +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 D436C8FC21; Tue, 25 Aug 2009 20:35:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PKZv5f039023; Tue, 25 Aug 2009 20:35:57 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PKZvlh039020; Tue, 25 Aug 2009 20:35:57 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200908252035.n7PKZvlh039020@svn.freebsd.org> From: John Baldwin Date: Tue, 25 Aug 2009 20:35:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196555 - head/usr.sbin/acpi/acpidump X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 20:35:58 -0000 Author: jhb Date: Tue Aug 25 20:35:57 2009 New Revision: 196555 URL: http://svn.freebsd.org/changeset/base/196555 Log: - Use the headers from ACPI-CA to define various constants and structures for table layouts, etc. rather than homerolling our own structures and constants in acpidump.h. - Verify the extended checksum on the RSDP. - Handle new ACPI 3.0 fields in MADT including X2APIC entries and UIDs for local SAPICs. - Add handling for new ACPI 3.0 flags in the FADT. Reviewed by: jkim MFC after: 1 month Modified: head/usr.sbin/acpi/acpidump/acpi.c head/usr.sbin/acpi/acpidump/acpi_user.c head/usr.sbin/acpi/acpidump/acpidump.c head/usr.sbin/acpi/acpidump/acpidump.h Modified: head/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- head/usr.sbin/acpi/acpidump/acpi.c Tue Aug 25 20:33:37 2009 (r196554) +++ head/usr.sbin/acpi/acpidump/acpi.c Tue Aug 25 20:35:57 2009 (r196555) @@ -47,31 +47,36 @@ #define END_COMMENT " */\n" static void acpi_print_string(char *s, size_t length); -static void acpi_print_gas(struct ACPIgas *gas); -static int acpi_get_fadt_revision(struct FADTbody *fadt); -static void acpi_handle_fadt(struct ACPIsdt *fadt); +static void acpi_print_gas(ACPI_GENERIC_ADDRESS *gas); +static int acpi_get_fadt_revision(ACPI_TABLE_FADT *fadt); +static void acpi_handle_fadt(ACPI_TABLE_HEADER *fadt); static void acpi_print_cpu(u_char cpu_id); -static void acpi_print_local_apic(u_char cpu_id, u_char apic_id, - u_int32_t flags); -static void acpi_print_io_apic(u_char apic_id, u_int32_t int_base, - u_int64_t apic_addr); -static void acpi_print_mps_flags(u_int16_t flags); -static void acpi_print_intr(u_int32_t intr, u_int16_t mps_flags); -static void acpi_print_apic(struct MADT_APIC *mp); -static void acpi_handle_apic(struct ACPIsdt *sdp); -static void acpi_handle_hpet(struct ACPIsdt *sdp); +static void acpi_print_cpu_uid(uint32_t uid, char *uid_string); +static void acpi_print_local_apic(uint32_t apic_id, uint32_t flags); +static void acpi_print_io_apic(uint32_t apic_id, uint32_t int_base, + uint64_t apic_addr); +static void acpi_print_mps_flags(uint16_t flags); +static void acpi_print_intr(uint32_t intr, uint16_t mps_flags); +static void acpi_print_local_nmi(u_int lint, uint16_t mps_flags); +static void acpi_print_madt(ACPI_SUBTABLE_HEADER *mp); +static void acpi_handle_madt(ACPI_TABLE_HEADER *sdp); +static void acpi_handle_ecdt(ACPI_TABLE_HEADER *sdp); +static void acpi_handle_hpet(ACPI_TABLE_HEADER *sdp); +static void acpi_handle_mcfg(ACPI_TABLE_HEADER *sdp); static void acpi_print_srat_cpu(uint32_t apic_id, uint32_t proximity_domain, uint32_t flags); -static void acpi_print_srat_memory(struct SRAT_memory *mp); -static void acpi_print_srat(struct SRATentry *srat); -static void acpi_handle_srat(struct ACPIsdt *sdp); -static void acpi_print_sdt(struct ACPIsdt *sdp); -static void acpi_print_fadt(struct ACPIsdt *sdp); -static void acpi_print_facs(struct FACSbody *facs); -static void acpi_print_dsdt(struct ACPIsdt *dsdp); -static struct ACPIsdt *acpi_map_sdt(vm_offset_t pa); -static void acpi_print_rsd_ptr(struct ACPIrsdp *rp); -static void acpi_handle_rsdt(struct ACPIsdt *rsdp); +static void acpi_print_srat_memory(ACPI_SRAT_MEM_AFFINITY *mp); +static void acpi_print_srat(ACPI_SUBTABLE_HEADER *srat); +static void acpi_handle_srat(ACPI_TABLE_HEADER *sdp); +static void acpi_print_sdt(ACPI_TABLE_HEADER *sdp); +static void acpi_print_fadt(ACPI_TABLE_HEADER *sdp); +static void acpi_print_facs(ACPI_TABLE_FACS *facs); +static void acpi_print_dsdt(ACPI_TABLE_HEADER *dsdp); +static ACPI_TABLE_HEADER *acpi_map_sdt(vm_offset_t pa); +static void acpi_print_rsd_ptr(ACPI_TABLE_RSDP *rp); +static void acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp); +static void acpi_walk_subtables(ACPI_TABLE_HEADER *table, void *first, + void (*action)(ACPI_SUBTABLE_HEADER *)); /* Size of an address. 32-bit for ACPI 1.0, 64-bit for ACPI 2.0 and up. */ static int addr_size; @@ -92,41 +97,44 @@ acpi_print_string(char *s, size_t length } static void -acpi_print_gas(struct ACPIgas *gas) +acpi_print_gas(ACPI_GENERIC_ADDRESS *gas) { - switch(gas->address_space_id) { + switch(gas->SpaceId) { case ACPI_GAS_MEMORY: - printf("0x%08lx:%u[%u] (Memory)", (u_long)gas->address, - gas->bit_offset, gas->bit_width); + printf("0x%08lx:%u[%u] (Memory)", (u_long)gas->Address, + gas->BitOffset, gas->BitWidth); break; case ACPI_GAS_IO: - printf("0x%02lx:%u[%u] (IO)", (u_long)gas->address, - gas->bit_offset, gas->bit_width); + printf("0x%02lx:%u[%u] (IO)", (u_long)gas->Address, + gas->BitOffset, gas->BitWidth); break; case ACPI_GAS_PCI: - printf("%x:%x+0x%x (PCI)", (uint16_t)(gas->address >> 32), - (uint16_t)((gas->address >> 16) & 0xffff), - (uint16_t)gas->address); + printf("%x:%x+0x%x (PCI)", (uint16_t)(gas->Address >> 32), + (uint16_t)((gas->Address >> 16) & 0xffff), + (uint16_t)gas->Address); break; /* XXX How to handle these below? */ case ACPI_GAS_EMBEDDED: - printf("0x%x:%u[%u] (EC)", (uint16_t)gas->address, - gas->bit_offset, gas->bit_width); + printf("0x%x:%u[%u] (EC)", (uint16_t)gas->Address, + gas->BitOffset, gas->BitWidth); break; case ACPI_GAS_SMBUS: - printf("0x%x:%u[%u] (SMBus)", (uint16_t)gas->address, - gas->bit_offset, gas->bit_width); + printf("0x%x:%u[%u] (SMBus)", (uint16_t)gas->Address, + gas->BitOffset, gas->BitWidth); break; + case ACPI_GAS_CMOS: + case ACPI_GAS_PCIBAR: + case ACPI_GAS_DATATABLE: case ACPI_GAS_FIXED: default: - printf("0x%08lx (?)", (u_long)gas->address); + printf("0x%08lx (?)", (u_long)gas->Address); break; } } /* The FADT revision indicates whether we use the DSDT or X_DSDT addresses. */ static int -acpi_get_fadt_revision(struct FADTbody *fadt) +acpi_get_fadt_revision(ACPI_TABLE_FADT *fadt) { int fadt_revision; @@ -141,8 +149,8 @@ acpi_get_fadt_revision(struct FADTbody * * 32 and 64 bit versions don't match, prefer the 32 bit * version for all subsequent tables. */ - if (fadt->facs_ptr != 0 && - (fadt->x_facs_ptr & 0xffffffff) != fadt->facs_ptr) + if (fadt->Facs != 0 && + (fadt->XFacs & 0xffffffff) != fadt->Facs) fadt_revision = 1; } else fadt_revision = 1; @@ -150,35 +158,52 @@ acpi_get_fadt_revision(struct FADTbody * } static void -acpi_handle_fadt(struct ACPIsdt *sdp) +acpi_handle_fadt(ACPI_TABLE_HEADER *sdp) { - struct ACPIsdt *dsdp; - struct FACSbody *facs; - struct FADTbody *fadt; + ACPI_TABLE_HEADER *dsdp; + ACPI_TABLE_FACS *facs; + ACPI_TABLE_FADT *fadt; int fadt_revision; - fadt = (struct FADTbody *)sdp->body; + fadt = (ACPI_TABLE_FADT *)sdp; acpi_print_fadt(sdp); fadt_revision = acpi_get_fadt_revision(fadt); if (fadt_revision == 1) - facs = (struct FACSbody *)acpi_map_sdt(fadt->facs_ptr); + facs = (ACPI_TABLE_FACS *)acpi_map_sdt(fadt->Facs); else - facs = (struct FACSbody *)acpi_map_sdt(fadt->x_facs_ptr); - if (memcmp(facs->signature, "FACS", 4) != 0 || facs->len < 64) + facs = (ACPI_TABLE_FACS *)acpi_map_sdt(fadt->XFacs); + if (memcmp(facs->Signature, ACPI_SIG_FACS, 4) != 0 || facs->Length < 64) errx(1, "FACS is corrupt"); acpi_print_facs(facs); if (fadt_revision == 1) - dsdp = (struct ACPIsdt *)acpi_map_sdt(fadt->dsdt_ptr); + dsdp = (ACPI_TABLE_HEADER *)acpi_map_sdt(fadt->Dsdt); else - dsdp = (struct ACPIsdt *)acpi_map_sdt(fadt->x_dsdt_ptr); - if (acpi_checksum(dsdp, dsdp->len)) + dsdp = (ACPI_TABLE_HEADER *)acpi_map_sdt(fadt->XDsdt); + if (acpi_checksum(dsdp, dsdp->Length)) errx(1, "DSDT is corrupt"); acpi_print_dsdt(dsdp); } static void +acpi_walk_subtables(ACPI_TABLE_HEADER *table, void *first, + void (*action)(ACPI_SUBTABLE_HEADER *)) +{ + ACPI_SUBTABLE_HEADER *subtable; + char *end; + + subtable = first; + end = (char *)table + table->Length; + while ((char *)subtable < end) { + printf("\n"); + action(subtable); + subtable = (ACPI_SUBTABLE_HEADER *)((char *)subtable + + subtable->Length); + } +} + +static void acpi_print_cpu(u_char cpu_id) { @@ -190,219 +215,264 @@ acpi_print_cpu(u_char cpu_id) } static void -acpi_print_local_apic(u_char cpu_id, u_char apic_id, u_int32_t flags) +acpi_print_cpu_uid(uint32_t uid, char *uid_string) { - acpi_print_cpu(cpu_id); + + printf("\tUID=%d", uid); + if (uid_string != NULL) + printf(" (%s)", uid_string); + printf("\n"); +} + +static void +acpi_print_local_apic(uint32_t apic_id, uint32_t flags) +{ + printf("\tFlags={"); - if (flags & ACPI_MADT_APIC_LOCAL_FLAG_ENABLED) + if (flags & ACPI_MADT_ENABLED) printf("ENABLED"); else printf("DISABLED"); printf("}\n"); - printf("\tAPIC ID=%d\n", (u_int)apic_id); + printf("\tAPIC ID=%d\n", apic_id); } static void -acpi_print_io_apic(u_char apic_id, u_int32_t int_base, u_int64_t apic_addr) +acpi_print_io_apic(uint32_t apic_id, uint32_t int_base, uint64_t apic_addr) { - printf("\tAPIC ID=%d\n", (u_int)apic_id); + + printf("\tAPIC ID=%d\n", apic_id); printf("\tINT BASE=%d\n", int_base); - printf("\tADDR=0x%016jx\n", apic_addr); + printf("\tADDR=0x%016jx\n", (uintmax_t)apic_addr); } static void -acpi_print_mps_flags(u_int16_t flags) +acpi_print_mps_flags(uint16_t flags) { printf("\tFlags={Polarity="); - switch (flags & MPS_INT_FLAG_POLARITY_MASK) { - case MPS_INT_FLAG_POLARITY_CONFORM: + switch (flags & ACPI_MADT_POLARITY_MASK) { + case ACPI_MADT_POLARITY_CONFORMS: printf("conforming"); break; - case MPS_INT_FLAG_POLARITY_HIGH: + case ACPI_MADT_POLARITY_ACTIVE_HIGH: printf("active-hi"); break; - case MPS_INT_FLAG_POLARITY_LOW: + case ACPI_MADT_POLARITY_ACTIVE_LOW: printf("active-lo"); break; default: - printf("0x%x", flags & MPS_INT_FLAG_POLARITY_MASK); + printf("0x%x", flags & ACPI_MADT_POLARITY_MASK); break; } printf(", Trigger="); - switch (flags & MPS_INT_FLAG_TRIGGER_MASK) { - case MPS_INT_FLAG_TRIGGER_CONFORM: + switch (flags & ACPI_MADT_TRIGGER_MASK) { + case ACPI_MADT_TRIGGER_CONFORMS: printf("conforming"); break; - case MPS_INT_FLAG_TRIGGER_EDGE: + case ACPI_MADT_TRIGGER_EDGE: printf("edge"); break; - case MPS_INT_FLAG_TRIGGER_LEVEL: + case ACPI_MADT_TRIGGER_LEVEL: printf("level"); break; default: - printf("0x%x", (flags & MPS_INT_FLAG_TRIGGER_MASK) >> 2); + printf("0x%x", (flags & ACPI_MADT_TRIGGER_MASK) >> 2); } printf("}\n"); } static void -acpi_print_intr(u_int32_t intr, u_int16_t mps_flags) +acpi_print_intr(uint32_t intr, uint16_t mps_flags) { - printf("\tINTR=%d\n", (u_int)intr); + printf("\tINTR=%d\n", intr); + acpi_print_mps_flags(mps_flags); +} + +static void +acpi_print_local_nmi(u_int lint, uint16_t mps_flags) +{ + + printf("\tLINT Pin=%d\n", lint); acpi_print_mps_flags(mps_flags); } const char *apic_types[] = { "Local APIC", "IO APIC", "INT Override", "NMI", - "Local NMI", "Local APIC Override", "IO SAPIC", - "Local SAPIC", "Platform Interrupt" }; -const char *platform_int_types[] = { "PMI", "INIT", + "Local APIC NMI", "Local APIC Override", + "IO SAPIC", "Local SAPIC", "Platform Interrupt", + "Local X2APIC", "Local X2APIC NMI" }; +const char *platform_int_types[] = { "0 (unknown)", "PMI", "INIT", "Corrected Platform Error" }; static void -acpi_print_apic(struct MADT_APIC *mp) +acpi_print_madt(ACPI_SUBTABLE_HEADER *mp) { + ACPI_MADT_LOCAL_APIC *lapic; + ACPI_MADT_IO_APIC *ioapic; + ACPI_MADT_INTERRUPT_OVERRIDE *over; + ACPI_MADT_NMI_SOURCE *nmi; + ACPI_MADT_LOCAL_APIC_NMI *lapic_nmi; + ACPI_MADT_LOCAL_APIC_OVERRIDE *lapic_over; + ACPI_MADT_IO_SAPIC *iosapic; + ACPI_MADT_LOCAL_SAPIC *lsapic; + ACPI_MADT_INTERRUPT_SOURCE *isrc; + ACPI_MADT_LOCAL_X2APIC *x2apic; + ACPI_MADT_LOCAL_X2APIC_NMI *x2apic_nmi; - if (mp->type < sizeof(apic_types) / sizeof(apic_types[0])) - printf("\tType=%s\n", apic_types[mp->type]); + if (mp->Type < sizeof(apic_types) / sizeof(apic_types[0])) + printf("\tType=%s\n", apic_types[mp->Type]); else - printf("\tType=%d (unknown)\n", mp->type); - switch (mp->type) { - case ACPI_MADT_APIC_TYPE_LOCAL_APIC: - acpi_print_local_apic(mp->body.local_apic.cpu_id, - mp->body.local_apic.apic_id, mp->body.local_apic.flags); - break; - case ACPI_MADT_APIC_TYPE_IO_APIC: - acpi_print_io_apic(mp->body.io_apic.apic_id, - mp->body.io_apic.int_base, - mp->body.io_apic.apic_addr); - break; - case ACPI_MADT_APIC_TYPE_INT_OVERRIDE: - printf("\tBUS=%d\n", (u_int)mp->body.int_override.bus); - printf("\tIRQ=%d\n", (u_int)mp->body.int_override.source); - acpi_print_intr(mp->body.int_override.intr, - mp->body.int_override.mps_flags); - break; - case ACPI_MADT_APIC_TYPE_NMI: - acpi_print_intr(mp->body.nmi.intr, mp->body.nmi.mps_flags); - break; - case ACPI_MADT_APIC_TYPE_LOCAL_NMI: - acpi_print_cpu(mp->body.local_nmi.cpu_id); - printf("\tLINT Pin=%d\n", mp->body.local_nmi.lintpin); - acpi_print_mps_flags(mp->body.local_nmi.mps_flags); + printf("\tType=%d (unknown)\n", mp->Type); + switch (mp->Type) { + case ACPI_MADT_TYPE_LOCAL_APIC: + lapic = (ACPI_MADT_LOCAL_APIC *)mp; + acpi_print_cpu(lapic->ProcessorId); + acpi_print_local_apic(lapic->Id, lapic->LapicFlags); + break; + case ACPI_MADT_TYPE_IO_APIC: + ioapic = (ACPI_MADT_IO_APIC *)mp; + acpi_print_io_apic(ioapic->Id, ioapic->GlobalIrqBase, + ioapic->Address); + break; + case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE: + over = (ACPI_MADT_INTERRUPT_OVERRIDE *)mp; + printf("\tBUS=%d\n", (u_int)over->Bus); + printf("\tIRQ=%d\n", (u_int)over->SourceIrq); + acpi_print_intr(over->GlobalIrq, over->IntiFlags); + break; + case ACPI_MADT_TYPE_NMI_SOURCE: + nmi = (ACPI_MADT_NMI_SOURCE *)mp; + acpi_print_intr(nmi->GlobalIrq, nmi->IntiFlags); + break; + case ACPI_MADT_TYPE_LOCAL_APIC_NMI: + lapic_nmi = (ACPI_MADT_LOCAL_APIC_NMI *)mp; + acpi_print_cpu(lapic_nmi->ProcessorId); + acpi_print_local_nmi(lapic_nmi->Lint, lapic_nmi->IntiFlags); break; - case ACPI_MADT_APIC_TYPE_LOCAL_OVERRIDE: + case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE: + lapic_over = (ACPI_MADT_LOCAL_APIC_OVERRIDE *)mp; printf("\tLocal APIC ADDR=0x%016jx\n", - mp->body.local_apic_override.apic_addr); - break; - case ACPI_MADT_APIC_TYPE_IO_SAPIC: - acpi_print_io_apic(mp->body.io_sapic.apic_id, - mp->body.io_sapic.int_base, - mp->body.io_sapic.apic_addr); - break; - case ACPI_MADT_APIC_TYPE_LOCAL_SAPIC: - acpi_print_local_apic(mp->body.local_sapic.cpu_id, - mp->body.local_sapic.apic_id, mp->body.local_sapic.flags); - printf("\tAPIC EID=%d\n", (u_int)mp->body.local_sapic.apic_eid); + (uintmax_t)lapic_over->Address); break; - case ACPI_MADT_APIC_TYPE_INT_SRC: - printf("\tType=%s\n", - platform_int_types[mp->body.int_src.type]); - printf("\tCPU ID=%d\n", (u_int)mp->body.int_src.cpu_id); - printf("\tCPU EID=%d\n", (u_int)mp->body.int_src.cpu_id); - printf("\tSAPIC Vector=%d\n", - (u_int)mp->body.int_src.sapic_vector); - acpi_print_intr(mp->body.int_src.intr, - mp->body.int_src.mps_flags); + case ACPI_MADT_TYPE_IO_SAPIC: + iosapic = (ACPI_MADT_IO_SAPIC *)mp; + acpi_print_io_apic(iosapic->Id, iosapic->GlobalIrqBase, + iosapic->Address); + break; + case ACPI_MADT_TYPE_LOCAL_SAPIC: + lsapic = (ACPI_MADT_LOCAL_SAPIC *)mp; + acpi_print_cpu(lsapic->ProcessorId); + acpi_print_local_apic(lsapic->Id, lsapic->LapicFlags); + printf("\tAPIC EID=%d\n", (u_int)lsapic->Eid); + if (mp->Length > __offsetof(ACPI_MADT_LOCAL_SAPIC, Uid)) + acpi_print_cpu_uid(lsapic->Uid, lsapic->UidString); + break; + case ACPI_MADT_TYPE_INTERRUPT_SOURCE: + isrc = (ACPI_MADT_INTERRUPT_SOURCE *)mp; + if (isrc->Type < sizeof(platform_int_types) / + sizeof(platform_int_types[0])) + printf("\tType=%s\n", platform_int_types[isrc->Type]); + else + printf("\tType=%d (unknown)\n", isrc->Type); + printf("\tAPIC ID=%d\n", (u_int)isrc->Id); + printf("\tAPIC EID=%d\n", (u_int)isrc->Eid); + printf("\tSAPIC Vector=%d\n", (u_int)isrc->IoSapicVector); + acpi_print_intr(isrc->GlobalIrq, isrc->IntiFlags); + break; + case ACPI_MADT_TYPE_LOCAL_X2APIC: + x2apic = (ACPI_MADT_LOCAL_X2APIC *)mp; + acpi_print_cpu_uid(x2apic->Uid, NULL); + acpi_print_local_apic(x2apic->LocalApicId, x2apic->LapicFlags); + break; + case ACPI_MADT_TYPE_LOCAL_X2APIC_NMI: + x2apic_nmi = (ACPI_MADT_LOCAL_X2APIC_NMI *)mp; + acpi_print_cpu_uid(x2apic_nmi->Uid, NULL); + acpi_print_local_nmi(x2apic_nmi->Lint, x2apic_nmi->IntiFlags); break; } } static void -acpi_handle_apic(struct ACPIsdt *sdp) +acpi_handle_madt(ACPI_TABLE_HEADER *sdp) { - struct MADTbody *madtp; - struct MADT_APIC *madt_apicp; + ACPI_TABLE_MADT *madt; printf(BEGIN_COMMENT); acpi_print_sdt(sdp); - madtp = (struct MADTbody *) sdp->body; - printf("\tLocal APIC ADDR=0x%08x\n", madtp->lapic_addr); + madt = (ACPI_TABLE_MADT *)sdp; + printf("\tLocal APIC ADDR=0x%08x\n", madt->Address); printf("\tFlags={"); - if (madtp->flags & ACPI_APIC_FLAG_PCAT_COMPAT) + if (madt->Flags & ACPI_MADT_PCAT_COMPAT) printf("PC-AT"); printf("}\n"); - madt_apicp = (struct MADT_APIC *)madtp->body; - while (((uintptr_t)madt_apicp) - ((uintptr_t)sdp) < sdp->len) { - printf("\n"); - acpi_print_apic(madt_apicp); - madt_apicp = (struct MADT_APIC *) ((char *)madt_apicp + - madt_apicp->len); - } + acpi_walk_subtables(sdp, (madt + 1), acpi_print_madt); printf(END_COMMENT); } static void -acpi_handle_hpet(struct ACPIsdt *sdp) +acpi_handle_hpet(ACPI_TABLE_HEADER *sdp) { - struct HPETbody *hpetp; + ACPI_TABLE_HPET *hpet; printf(BEGIN_COMMENT); acpi_print_sdt(sdp); - hpetp = (struct HPETbody *) sdp->body; - printf("\tHPET Number=%d\n", hpetp->hpet_number); + hpet = (ACPI_TABLE_HPET *)sdp; + printf("\tHPET Number=%d\n", hpet->Sequence); printf("\tADDR="); - acpi_print_gas(&hpetp->genaddr); - printf("\tHW Rev=0x%x\n", hpetp->block_hwrev); - printf("\tComparitors=%d\n", hpetp->block_comparitors); - printf("\tCounter Size=%d\n", hpetp->block_counter_size); + acpi_print_gas(&hpet->Address); + printf("\tHW Rev=0x%x\n", hpet->Id & ACPI_HPET_ID_HARDWARE_REV_ID); + printf("\tComparators=%d\n", (hpet->Id & ACPI_HPET_ID_COMPARATORS) >> + 8); + printf("\tCounter Size=%d\n", hpet->Id & ACPI_HPET_ID_COUNT_SIZE_CAP ? + 1 : 0); printf("\tLegacy IRQ routing capable={"); - if (hpetp->block_legacy_capable) + if (hpet->Id & ACPI_HPET_ID_LEGACY_CAPABLE) printf("TRUE}\n"); else printf("FALSE}\n"); - printf("\tPCI Vendor ID=0x%04x\n", hpetp->block_pcivendor); - printf("\tMinimal Tick=%d\n", hpetp->clock_tick); + printf("\tPCI Vendor ID=0x%04x\n", hpet->Id >> 16); + printf("\tMinimal Tick=%d\n", hpet->MinimumTick); printf(END_COMMENT); } static void -acpi_handle_ecdt(struct ACPIsdt *sdp) +acpi_handle_ecdt(ACPI_TABLE_HEADER *sdp) { - struct ECDTbody *ecdt; + ACPI_TABLE_ECDT *ecdt; printf(BEGIN_COMMENT); acpi_print_sdt(sdp); - ecdt = (struct ECDTbody *) sdp->body; + ecdt = (ACPI_TABLE_ECDT *)sdp; printf("\tEC_CONTROL="); - acpi_print_gas(&ecdt->ec_control); + acpi_print_gas(&ecdt->Control); printf("\n\tEC_DATA="); - acpi_print_gas(&ecdt->ec_data); - printf("\n\tUID=%#x, ", ecdt->uid); - printf("GPE_BIT=%#x\n", ecdt->gpe_bit); - printf("\tEC_ID=%s\n", ecdt->ec_id); + acpi_print_gas(&ecdt->Data); + printf("\n\tUID=%#x, ", ecdt->Uid); + printf("GPE_BIT=%#x\n", ecdt->Gpe); + printf("\tEC_ID=%s\n", ecdt->Id); printf(END_COMMENT); } static void -acpi_handle_mcfg(struct ACPIsdt *sdp) +acpi_handle_mcfg(ACPI_TABLE_HEADER *sdp) { - struct MCFGbody *mcfg; - u_int i, e; + ACPI_TABLE_MCFG *mcfg; + ACPI_MCFG_ALLOCATION *alloc; + u_int i, entries; printf(BEGIN_COMMENT); acpi_print_sdt(sdp); - mcfg = (struct MCFGbody *) sdp->body; - - e = (sdp->len - ((caddr_t)&mcfg->s[0] - (caddr_t)sdp)) / - sizeof(*mcfg->s); - for (i = 0; i < e; i++, mcfg++) { + mcfg = (ACPI_TABLE_MCFG *)sdp; + entries = (sdp->Length - sizeof(ACPI_TABLE_MCFG)) / + sizeof(ACPI_MCFG_ALLOCATION); + alloc = (ACPI_MCFG_ALLOCATION *)(mcfg + 1); + for (i = 0; i < entries; i++, alloc++) { printf("\n"); - printf("\tBase Address=0x%016jx\n", mcfg->s[i].baseaddr); - printf("\tSegment Group=0x%04x\n", mcfg->s[i].seg_grp); - printf("\tStart Bus=%d\n", mcfg->s[i].start); - printf("\tEnd Bus=%d\n", mcfg->s[i].end); + printf("\tBase Address=0x%016jx\n", alloc->Address); + printf("\tSegment Group=0x%04x\n", alloc->PciSegment); + printf("\tStart Bus=%d\n", alloc->StartBusNumber); + printf("\tEnd Bus=%d\n", alloc->EndBusNumber); } printf(END_COMMENT); } @@ -423,108 +493,109 @@ acpi_print_srat_cpu(uint32_t apic_id, ui } static void -acpi_print_srat_memory(struct SRAT_memory *mp) +acpi_print_srat_memory(ACPI_SRAT_MEM_AFFINITY *mp) { printf("\tFlags={"); - if (mp->flags & ACPI_SRAT_MEM_ENABLED) + if (mp->Flags & ACPI_SRAT_MEM_ENABLED) printf("ENABLED"); else printf("DISABLED"); - if (mp->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) + if (mp->Flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) printf(",HOT_PLUGGABLE"); - if (mp->flags & ACPI_SRAT_MEM_NON_VOLATILE) + if (mp->Flags & ACPI_SRAT_MEM_NON_VOLATILE) printf(",NON_VOLATILE"); printf("}\n"); - printf("\tBase Address=0x%016jx\n", (uintmax_t)mp->base_address); - printf("\tLength=0x%016jx\n", (uintmax_t)mp->length); - printf("\tProximity Domain=%d\n", mp->proximity_domain); + printf("\tBase Address=0x%016jx\n", (uintmax_t)mp->BaseAddress); + printf("\tLength=0x%016jx\n", (uintmax_t)mp->Length); + printf("\tProximity Domain=%d\n", mp->ProximityDomain); } const char *srat_types[] = { "CPU", "Memory", "X2APIC" }; static void -acpi_print_srat(struct SRATentry *srat) +acpi_print_srat(ACPI_SUBTABLE_HEADER *srat) { + ACPI_SRAT_CPU_AFFINITY *cpu; + ACPI_SRAT_X2APIC_CPU_AFFINITY *x2apic; - if (srat->type < sizeof(srat_types) / sizeof(srat_types[0])) - printf("\tType=%s\n", srat_types[srat->type]); + if (srat->Type < sizeof(srat_types) / sizeof(srat_types[0])) + printf("\tType=%s\n", srat_types[srat->Type]); else - printf("\tType=%d (unknown)\n", srat->type); - switch (srat->type) { + printf("\tType=%d (unknown)\n", srat->Type); + switch (srat->Type) { case ACPI_SRAT_TYPE_CPU_AFFINITY: - acpi_print_srat_cpu(srat->body.cpu.apic_id, - srat->body.cpu.proximity_domain_hi[2] << 24 | - srat->body.cpu.proximity_domain_hi[1] << 16 | - srat->body.cpu.proximity_domain_hi[0] << 0 | - srat->body.cpu.proximity_domain_lo, srat->body.cpu.flags); + cpu = (ACPI_SRAT_CPU_AFFINITY *)srat; + acpi_print_srat_cpu(cpu->ApicId, + cpu->ProximityDomainHi[2] << 24 | + cpu->ProximityDomainHi[1] << 16 | + cpu->ProximityDomainHi[0] << 0 | + cpu->ProximityDomainLo, cpu->Flags); break; case ACPI_SRAT_TYPE_MEMORY_AFFINITY: - acpi_print_srat_memory(&srat->body.mem); + acpi_print_srat_memory((ACPI_SRAT_MEM_AFFINITY *)srat); break; case ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY: - acpi_print_srat_cpu(srat->body.x2apic.apic_id, - srat->body.x2apic.proximity_domain, - srat->body.x2apic.flags); + x2apic = (ACPI_SRAT_X2APIC_CPU_AFFINITY *)srat; + acpi_print_srat_cpu(x2apic->ApicId, x2apic->ProximityDomain, + x2apic->Flags); break; } } static void -acpi_handle_srat(struct ACPIsdt *sdp) +acpi_handle_srat(ACPI_TABLE_HEADER *sdp) { - struct SRATbody *sratp; - struct SRATentry *entry; + ACPI_TABLE_SRAT *srat; printf(BEGIN_COMMENT); acpi_print_sdt(sdp); - sratp = (struct SRATbody *)sdp->body; - printf("\tTable Revision=%d\n", sratp->table_revision); - entry = sratp->body; - while (((uintptr_t)entry) - ((uintptr_t)sdp) < sdp->len) { - printf("\n"); - acpi_print_srat(entry); - entry = (struct SRATentry *)((char *)entry + entry->len); - } + srat = (ACPI_TABLE_SRAT *)sdp; + printf("\tTable Revision=%d\n", srat->TableRevision); + acpi_walk_subtables(sdp, (srat + 1), acpi_print_srat); printf(END_COMMENT); } static void -acpi_print_sdt(struct ACPIsdt *sdp) +acpi_print_sdt(ACPI_TABLE_HEADER *sdp) { printf(" "); - acpi_print_string(sdp->signature, 4); + acpi_print_string(sdp->Signature, ACPI_NAME_SIZE); printf(": Length=%d, Revision=%d, Checksum=%d,\n", - sdp->len, sdp->rev, sdp->check); + sdp->Length, sdp->Revision, sdp->Checksum); printf("\tOEMID="); - acpi_print_string(sdp->oemid, 6); + acpi_print_string(sdp->OemId, ACPI_OEM_ID_SIZE); printf(", OEM Table ID="); - acpi_print_string(sdp->oemtblid, 8); - printf(", OEM Revision=0x%x,\n", sdp->oemrev); + acpi_print_string(sdp->OemTableId, ACPI_OEM_TABLE_ID_SIZE); + printf(", OEM Revision=0x%x,\n", sdp->OemRevision); printf("\tCreator ID="); - acpi_print_string(sdp->creator, 4); - printf(", Creator Revision=0x%x\n", sdp->crerev); + acpi_print_string(sdp->AslCompilerId, ACPI_NAME_SIZE); + printf(", Creator Revision=0x%x\n", sdp->AslCompilerRevision); } static void -acpi_print_rsdt(struct ACPIsdt *rsdp) +acpi_print_rsdt(ACPI_TABLE_HEADER *rsdp) { + ACPI_TABLE_RSDT *rsdt; + ACPI_TABLE_XSDT *xsdt; int i, entries; u_long addr; + rsdt = (ACPI_TABLE_RSDT *)rsdp; + xsdt = (ACPI_TABLE_XSDT *)rsdp; printf(BEGIN_COMMENT); acpi_print_sdt(rsdp); - entries = (rsdp->len - SIZEOF_SDT_HDR) / addr_size; + entries = (rsdp->Length - sizeof(ACPI_TABLE_HEADER)) / addr_size; printf("\tEntries={ "); for (i = 0; i < entries; i++) { if (i > 0) printf(", "); switch (addr_size) { case 4: - addr = le32dec((char*)rsdp->body + i * addr_size); + addr = le32toh(rsdt->TableOffsetEntry[i]); break; case 8: - addr = le64dec((char*)rsdp->body + i * addr_size); + addr = le64toh(xsdt->TableOffsetEntry[i]); break; default: addr = 0; @@ -542,138 +613,147 @@ static const char *acpi_pm_profiles[] = }; static void -acpi_print_fadt(struct ACPIsdt *sdp) +acpi_print_fadt(ACPI_TABLE_HEADER *sdp) { - struct FADTbody *fadt; + ACPI_TABLE_FADT *fadt; const char *pm; char sep; - fadt = (struct FADTbody *)sdp->body; + fadt = (ACPI_TABLE_FADT *)sdp; printf(BEGIN_COMMENT); acpi_print_sdt(sdp); - printf(" \tFACS=0x%x, DSDT=0x%x\n", fadt->facs_ptr, - fadt->dsdt_ptr); - printf("\tINT_MODEL=%s\n", fadt->int_model ? "APIC" : "PIC"); - if (fadt->pm_profile >= sizeof(acpi_pm_profiles) / sizeof(char *)) + printf(" \tFACS=0x%x, DSDT=0x%x\n", fadt->Facs, + fadt->Dsdt); + printf("\tINT_MODEL=%s\n", fadt->Model ? "APIC" : "PIC"); + if (fadt->PreferredProfile >= sizeof(acpi_pm_profiles) / sizeof(char *)) pm = "Reserved"; else - pm = acpi_pm_profiles[fadt->pm_profile]; - printf("\tPreferred_PM_Profile=%s (%d)\n", pm, fadt->pm_profile); - printf("\tSCI_INT=%d\n", fadt->sci_int); - printf("\tSMI_CMD=0x%x, ", fadt->smi_cmd); - printf("ACPI_ENABLE=0x%x, ", fadt->acpi_enable); - printf("ACPI_DISABLE=0x%x, ", fadt->acpi_disable); - printf("S4BIOS_REQ=0x%x\n", fadt->s4biosreq); - printf("\tPSTATE_CNT=0x%x\n", fadt->pstate_cnt); + pm = acpi_pm_profiles[fadt->PreferredProfile]; + printf("\tPreferred_PM_Profile=%s (%d)\n", pm, fadt->PreferredProfile); + printf("\tSCI_INT=%d\n", fadt->SciInterrupt); + printf("\tSMI_CMD=0x%x, ", fadt->SmiCommand); + printf("ACPI_ENABLE=0x%x, ", fadt->AcpiEnable); + printf("ACPI_DISABLE=0x%x, ", fadt->AcpiDisable); + printf("S4BIOS_REQ=0x%x\n", fadt->S4BiosRequest); + printf("\tPSTATE_CNT=0x%x\n", fadt->PstateControl); printf("\tPM1a_EVT_BLK=0x%x-0x%x\n", - fadt->pm1a_evt_blk, - fadt->pm1a_evt_blk + fadt->pm1_evt_len - 1); - if (fadt->pm1b_evt_blk != 0) + fadt->Pm1aEventBlock, + fadt->Pm1aEventBlock + fadt->Pm1EventLength - 1); + if (fadt->Pm1bEventBlock != 0) printf("\tPM1b_EVT_BLK=0x%x-0x%x\n", - fadt->pm1b_evt_blk, - fadt->pm1b_evt_blk + fadt->pm1_evt_len - 1); + fadt->Pm1bEventBlock, + fadt->Pm1bEventBlock + fadt->Pm1EventLength - 1); printf("\tPM1a_CNT_BLK=0x%x-0x%x\n", - fadt->pm1a_cnt_blk, - fadt->pm1a_cnt_blk + fadt->pm1_cnt_len - 1); - if (fadt->pm1b_cnt_blk != 0) + fadt->Pm1aControlBlock, + fadt->Pm1aControlBlock + fadt->Pm1ControlLength - 1); + if (fadt->Pm1bControlBlock != 0) printf("\tPM1b_CNT_BLK=0x%x-0x%x\n", - fadt->pm1b_cnt_blk, - fadt->pm1b_cnt_blk + fadt->pm1_cnt_len - 1); - if (fadt->pm2_cnt_blk != 0) + fadt->Pm1bControlBlock, + fadt->Pm1bControlBlock + fadt->Pm1ControlLength - 1); + if (fadt->Pm2ControlBlock != 0) printf("\tPM2_CNT_BLK=0x%x-0x%x\n", - fadt->pm2_cnt_blk, - fadt->pm2_cnt_blk + fadt->pm2_cnt_len - 1); + fadt->Pm2ControlBlock, + fadt->Pm2ControlBlock + fadt->Pm2ControlLength - 1); printf("\tPM_TMR_BLK=0x%x-0x%x\n", - fadt->pm_tmr_blk, - fadt->pm_tmr_blk + fadt->pm_tmr_len - 1); - if (fadt->gpe0_blk != 0) + fadt->PmTimerBlock, + fadt->PmTimerBlock + fadt->PmTimerLength - 1); + if (fadt->Gpe0Block != 0) printf("\tGPE0_BLK=0x%x-0x%x\n", - fadt->gpe0_blk, - fadt->gpe0_blk + fadt->gpe0_len - 1); - if (fadt->gpe1_blk != 0) + fadt->Gpe0Block, + fadt->Gpe0Block + fadt->Gpe0BlockLength - 1); + if (fadt->Gpe1Block != 0) printf("\tGPE1_BLK=0x%x-0x%x, GPE1_BASE=%d\n", - fadt->gpe1_blk, - fadt->gpe1_blk + fadt->gpe1_len - 1, - fadt->gpe1_base); - if (fadt->cst_cnt != 0) - printf("\tCST_CNT=0x%x\n", fadt->cst_cnt); + fadt->Gpe1Block, + fadt->Gpe1Block + fadt->Gpe1BlockLength - 1, + fadt->Gpe1Base); + if (fadt->CstControl != 0) + printf("\tCST_CNT=0x%x\n", fadt->CstControl); printf("\tP_LVL2_LAT=%d us, P_LVL3_LAT=%d us\n", - fadt->p_lvl2_lat, fadt->p_lvl3_lat); + fadt->C2Latency, fadt->C3Latency); printf("\tFLUSH_SIZE=%d, FLUSH_STRIDE=%d\n", - fadt->flush_size, fadt->flush_stride); + fadt->FlushSize, fadt->FlushStride); printf("\tDUTY_OFFSET=%d, DUTY_WIDTH=%d\n", - fadt->duty_off, fadt->duty_width); + fadt->DutyOffset, fadt->DutyWidth); printf("\tDAY_ALRM=%d, MON_ALRM=%d, CENTURY=%d\n", - fadt->day_alrm, fadt->mon_alrm, fadt->century); + fadt->DayAlarm, fadt->MonthAlarm, fadt->Century); #define PRINTFLAG(var, flag) do { \ - if ((var) & FADT_FLAG_## flag) { \ + if ((var) & ACPI_FADT_## flag) { \ printf("%c%s", sep, #flag); sep = ','; \ } \ } while (0) printf("\tIAPC_BOOT_ARCH="); sep = '{'; - PRINTFLAG(fadt->iapc_boot_arch, LEGACY_DEV); - PRINTFLAG(fadt->iapc_boot_arch, 8042); - if (fadt->iapc_boot_arch != 0) + PRINTFLAG(fadt->BootFlags, LEGACY_DEVICES); + PRINTFLAG(fadt->BootFlags, 8042); + PRINTFLAG(fadt->BootFlags, NO_VGA); + PRINTFLAG(fadt->BootFlags, NO_MSI); + PRINTFLAG(fadt->BootFlags, NO_ASPM); + if (fadt->BootFlags != 0) printf("}"); printf("\n"); printf("\tFlags="); sep = '{'; - PRINTFLAG(fadt->flags, WBINVD); - PRINTFLAG(fadt->flags, WBINVD_FLUSH); - PRINTFLAG(fadt->flags, PROC_C1); - PRINTFLAG(fadt->flags, P_LVL2_UP); - PRINTFLAG(fadt->flags, PWR_BUTTON); - PRINTFLAG(fadt->flags, SLP_BUTTON); - PRINTFLAG(fadt->flags, FIX_RTC); - PRINTFLAG(fadt->flags, RTC_S4); - PRINTFLAG(fadt->flags, TMR_VAL_EXT); - PRINTFLAG(fadt->flags, DCK_CAP); - PRINTFLAG(fadt->flags, RESET_REG); - PRINTFLAG(fadt->flags, SEALED_CASE); - PRINTFLAG(fadt->flags, HEADLESS); - PRINTFLAG(fadt->flags, CPU_SW_SLP); - if (fadt->flags != 0) + PRINTFLAG(fadt->Flags, WBINVD); + PRINTFLAG(fadt->Flags, WBINVD_FLUSH); + PRINTFLAG(fadt->Flags, C1_SUPPORTED); + PRINTFLAG(fadt->Flags, C2_MP_SUPPORTED); + PRINTFLAG(fadt->Flags, POWER_BUTTON); + PRINTFLAG(fadt->Flags, SLEEP_BUTTON); + PRINTFLAG(fadt->Flags, FIXED_RTC); + PRINTFLAG(fadt->Flags, S4_RTC_WAKE); + PRINTFLAG(fadt->Flags, 32BIT_TIMER); + PRINTFLAG(fadt->Flags, DOCKING_SUPPORTED); + PRINTFLAG(fadt->Flags, RESET_REGISTER); + PRINTFLAG(fadt->Flags, SEALED_CASE); + PRINTFLAG(fadt->Flags, HEADLESS); + PRINTFLAG(fadt->Flags, SLEEP_TYPE); + PRINTFLAG(fadt->Flags, PCI_EXPRESS_WAKE); + PRINTFLAG(fadt->Flags, PLATFORM_CLOCK); + PRINTFLAG(fadt->Flags, S4_RTC_VALID); + PRINTFLAG(fadt->Flags, REMOTE_POWER_ON); + PRINTFLAG(fadt->Flags, APIC_CLUSTER); + PRINTFLAG(fadt->Flags, APIC_PHYSICAL); + if (fadt->Flags != 0) printf("}\n"); #undef PRINTFLAG - if (fadt->flags & FADT_FLAG_RESET_REG) { + if (fadt->Flags & ACPI_FADT_RESET_REGISTER) { printf("\tRESET_REG="); - acpi_print_gas(&fadt->reset_reg); - printf(", RESET_VALUE=%#x\n", fadt->reset_value); + acpi_print_gas(&fadt->ResetRegister); + printf(", RESET_VALUE=%#x\n", fadt->ResetValue); } if (acpi_get_fadt_revision(fadt) > 1) { - printf("\tX_FACS=0x%08lx, ", (u_long)fadt->x_facs_ptr); - printf("X_DSDT=0x%08lx\n", (u_long)fadt->x_dsdt_ptr); + printf("\tX_FACS=0x%08lx, ", (u_long)fadt->XFacs); + printf("X_DSDT=0x%08lx\n", (u_long)fadt->XDsdt); printf("\tX_PM1a_EVT_BLK="); - acpi_print_gas(&fadt->x_pm1a_evt_blk); - if (fadt->x_pm1b_evt_blk.address != 0) { + acpi_print_gas(&fadt->XPm1aEventBlock); + if (fadt->XPm1bEventBlock.Address != 0) { printf("\n\tX_PM1b_EVT_BLK="); - acpi_print_gas(&fadt->x_pm1b_evt_blk); + acpi_print_gas(&fadt->XPm1bEventBlock); } printf("\n\tX_PM1a_CNT_BLK="); - acpi_print_gas(&fadt->x_pm1a_cnt_blk); - if (fadt->x_pm1b_cnt_blk.address != 0) { + acpi_print_gas(&fadt->XPm1aControlBlock); + if (fadt->XPm1bControlBlock.Address != 0) { printf("\n\tX_PM1b_CNT_BLK="); - acpi_print_gas(&fadt->x_pm1b_cnt_blk); + acpi_print_gas(&fadt->XPm1bControlBlock); } - if (fadt->x_pm1b_cnt_blk.address != 0) { + if (fadt->XPm2ControlBlock.Address != 0) { printf("\n\tX_PM2_CNT_BLK="); - acpi_print_gas(&fadt->x_pm2_cnt_blk); + acpi_print_gas(&fadt->XPm2ControlBlock); } printf("\n\tX_PM_TMR_BLK="); - acpi_print_gas(&fadt->x_pm_tmr_blk); - if (fadt->x_gpe0_blk.address != 0) { + acpi_print_gas(&fadt->XPmTimerBlock); + if (fadt->XGpe0Block.Address != 0) { printf("\n\tX_GPE0_BLK="); - acpi_print_gas(&fadt->x_gpe0_blk); + acpi_print_gas(&fadt->XGpe0Block); } - if (fadt->x_gpe1_blk.address != 0) { + if (fadt->XGpe1Block.Address != 0) { printf("\n\tX_GPE1_BLK="); - acpi_print_gas(&fadt->x_gpe1_blk); + acpi_print_gas(&fadt->XGpe1Block); } printf("\n"); } @@ -682,38 +762,38 @@ acpi_print_fadt(struct ACPIsdt *sdp) } static void -acpi_print_facs(struct FACSbody *facs) +acpi_print_facs(ACPI_TABLE_FACS *facs) { printf(BEGIN_COMMENT); - printf(" FACS:\tLength=%u, ", facs->len); - printf("HwSig=0x%08x, ", facs->hw_sig); - printf("Firm_Wake_Vec=0x%08x\n", facs->firm_wake_vec); + printf(" FACS:\tLength=%u, ", facs->Length); + printf("HwSig=0x%08x, ", facs->HardwareSignature); + printf("Firm_Wake_Vec=0x%08x\n", facs->FirmwareWakingVector); printf("\tGlobal_Lock="); - if (facs->global_lock != 0) { - if (facs->global_lock & FACS_FLAG_LOCK_PENDING) + if (facs->GlobalLock != 0) { + if (facs->GlobalLock & ACPI_GLOCK_PENDING) printf("PENDING,"); - if (facs->global_lock & FACS_FLAG_LOCK_OWNED) + if (facs->GlobalLock & ACPI_GLOCK_OWNED) printf("OWNED"); } printf("\n"); printf("\tFlags="); - if (facs->flags & FACS_FLAG_S4BIOS_F) + if (facs->Flags & ACPI_FACS_S4_BIOS_PRESENT) printf("S4BIOS"); printf("\n"); - if (facs->x_firm_wake_vec != 0) { + if (facs->XFirmwareWakingVector != 0) { printf("\tX_Firm_Wake_Vec=%08lx\n", - (u_long)facs->x_firm_wake_vec); + (u_long)facs->XFirmwareWakingVector); } - printf("\tVersion=%u\n", facs->version); + printf("\tVersion=%u\n", facs->Version); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 21:08:17 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1062110656B9; Tue, 25 Aug 2009 21:08:17 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id C9C138FC1D; Tue, 25 Aug 2009 21:08:16 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 8532B375839; Tue, 25 Aug 2009 23:08:15 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 6FBD8228CD; Tue, 25 Aug 2009 23:08:15 +0200 (CEST) Date: Tue, 25 Aug 2009 23:08:15 +0200 From: Jilles Tjoelker To: Bruce Evans Message-ID: <20090825210815.GA8792@stack.nl> References: <200908231244.n7NCiFgc061095@svn.freebsd.org> <20090823213759.GA55039@stack.nl> <20090825031355.B729@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090825031355.B729@besplex.bde.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Konstantin Belousov Subject: Re: svn commit: r196460 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 21:08:17 -0000 On Tue, Aug 25, 2009 at 04:07:11AM +1000, Bruce Evans wrote: > On Sun, 23 Aug 2009, Jilles Tjoelker wrote: > > I think poll on fifos should instead be fixed by closing the > > half-connection corresponding to writing from fi_readsock to > > fi_writesock. I have tried this out, see attached patch. With the patch, > > pipepoll only gives "expected POLLHUP; got POLLIN | POLLHUP" errors and > > an error in fifo case 6b caused by our distinction between new and old > > readers. > This sort of worked for me, but has several problems: > % Index: sys/fs/fifofs/fifo_vnops.c > % =================================================================== > % --- sys/fs/fifofs/fifo_vnops.c (revision 196459) > % +++ sys/fs/fifofs/fifo_vnops.c (working copy) > % @@ -193,6 +193,10 @@ > % goto fail2; > % fip->fi_writesock = wso; > % error = soconnect2(wso, rso); > % + if (error == 0) > % + error = soshutdown(rso, SHUT_WR); > % + if (error == 0) > % + error = soshutdown(wso, SHUT_RD); > % if (error) { > % (void)soclose(wso); > % fail2: > The second soshutdown() is only harmful. I see the following state changes > - the first soshutdown() sets SBS_CANTRCVMORE on rso like you would expect, > and also sets SBS_CANTSENDMORE on wso. This gives the desired state. > - the second soshutdown() then clears SBS_CANTRCVMORE on rso (without > the first soshutdown() it leaves both flags clear in both directions). > This clobbers the desired state. The failure shows in just one of my > uncommitted regression tests (when there is a writer and there was > a reader, poll() returns POLLOUT for the writer, but should return > POLLHUP; the missing SBS_CANTRCVMORE on rso prevents it ever returning > POLLHUP for writers). > After removing the second soshutdown() and fixing a spurious POLLIN (see > below), all my tests pass. I have removed the second shutdown, it is not necessary. > Elsewhere, fifo_vnops.c hacks on SBS_CANT*MORE directly. Perhaps it should > call soshutdown(), or if the direct access there is safe then it is probably > safe above. That's for a later commit to fix. > % Index: sys/kern/uipc_socket.c > % =================================================================== > % --- sys/kern/uipc_socket.c (revision 196469) > % +++ sys/kern/uipc_socket.c (working copy) > % @@ -2898,11 +2898,13 @@ > % if (so->so_oobmark || (so->so_rcv.sb_state & SBS_RCVATMARK)) > % revents |= events & (POLLPRI | POLLRDBAND); > % > % - if ((events & POLLINIGNEOF) == 0) > % - if (so->so_rcv.sb_state & SBS_CANTRCVMORE) > % - revents |= POLLHUP; > % - if (so->so_snd.sb_state & SBS_CANTSENDMORE) > % - revents |= POLLHUP; > % + if ((events & POLLINIGNEOF) == 0) { > Old problems become larger: > I don't like POLLINIGNEOF (for input) affecting POLLHUP for output. This > seems to cause no problems for fifos, at least when the kernel sets > POLLINIGNEOF, but it is hard to understand even why it doesn't cause > problems, and kib@ wants POLLINIGNEOF to remain user-settable, so the > complications might remain exported to userland for for fifos and > sockets, where they are harder to document and understand. I do not like userland POLLINIGNEOF either. I think programs can do fine with the standard functionality (closing and reopening a fifo to reset the POLLHUP state). > % + revents |= events & (POLLIN | POLLRDNORM); > This gives spurious POLLINs when POLLHUP is also returned, and thus defeats > the point of soreadable_data() being different from soreadable(). Tests > 6a-6d show the spurious POLLIN. I don't understand how tests 6a and 6c-6d > passed for you. Same problem here. I think kib@ wants to keep this in 8.x for the sake of buggy programs that do not check for POLLHUP. I suppose we can do it properly in 9.x. > % + if (so->so_snd.sb_state & SBS_CANTSENDMORE) > % + revents |= POLLHUP; > Tests 6a-6d pass with the above 3 lines changed to: > if (so->so_snd.sb_state & SBS_CANTSENDMORE) > revents |= POLLHUP; > else > revents |= events & (POLLIN | POLLRDNORM); > Returning POLLIN will cause poll() to not block on input descriptors, but > this seems to be as correct as possible since there really is a read-EOF. > Applications just can't see this EOF as POLLHUP -- they will see POLLIN > and have to try to read(), and then interpret read() returning 0 as meaning > EOF. Device-independent applications must do precisely this anyway since > the input descriptor might be a regular file and there is no POLLHUP for > regular files. Yes. Even more, any program must handle it because it is also possible that an EOF happens between poll() and read(). -- Jilles Tjoelker From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 21:44:14 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2395106568D; Tue, 25 Aug 2009 21:44:14 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C73BF8FC18; Tue, 25 Aug 2009 21:44:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PLiEJP040559; Tue, 25 Aug 2009 21:44:14 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PLiETE040556; Tue, 25 Aug 2009 21:44:14 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200908252144.n7PLiETE040556@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 25 Aug 2009 21:44:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196556 - in head/sys: fs/fifofs kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 21:44:15 -0000 Author: jilles Date: Tue Aug 25 21:44:14 2009 New Revision: 196556 URL: http://svn.freebsd.org/changeset/base/196556 Log: Fix poll() on half-closed sockets, while retaining POLLHUP for fifos. This reverts part of r196460, so that sockets only return POLLHUP if both directions are closed/error. Fifos get POLLHUP by closing the unused direction immediately after creating the sockets. The tools/regression/poll/*poll.c tests now pass except for two other things: - if POLLHUP is returned, POLLIN is always returned as well instead of only when there is data left in the buffer to be read - fifo old/new reader distinction does not work the way POSIX specs it Reviewed by: kib, bde Modified: head/sys/fs/fifofs/fifo_vnops.c head/sys/kern/uipc_socket.c Modified: head/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- head/sys/fs/fifofs/fifo_vnops.c Tue Aug 25 20:35:57 2009 (r196555) +++ head/sys/fs/fifofs/fifo_vnops.c Tue Aug 25 21:44:14 2009 (r196556) @@ -193,6 +193,9 @@ fifo_open(ap) goto fail2; fip->fi_writesock = wso; error = soconnect2(wso, rso); + /* Close the direction we do not use, so we can get POLLHUP. */ + if (error == 0) + error = soshutdown(rso, SHUT_WR); if (error) { (void)soclose(wso); fail2: Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Tue Aug 25 20:35:57 2009 (r196555) +++ head/sys/kern/uipc_socket.c Tue Aug 25 21:44:14 2009 (r196556) @@ -2898,11 +2898,13 @@ sopoll_generic(struct socket *so, int ev if (so->so_oobmark || (so->so_rcv.sb_state & SBS_RCVATMARK)) revents |= events & (POLLPRI | POLLRDBAND); - if ((events & POLLINIGNEOF) == 0) - if (so->so_rcv.sb_state & SBS_CANTRCVMORE) - revents |= POLLHUP; - if (so->so_snd.sb_state & SBS_CANTSENDMORE) - revents |= POLLHUP; + if ((events & POLLINIGNEOF) == 0) { + if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { + revents |= events & (POLLIN | POLLRDNORM); + if (so->so_snd.sb_state & SBS_CANTSENDMORE) + revents |= POLLHUP; + } + } if (revents == 0) { if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) { From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 21:51:48 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 457FA106568C; Tue, 25 Aug 2009 21:51:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3298C8FC19; Tue, 25 Aug 2009 21:51:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PLpl8g040746; Tue, 25 Aug 2009 21:51:47 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PLpl3n040737; Tue, 25 Aug 2009 21:51:47 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908252151.n7PLpl3n040737@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 21:51:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196557 - in stable/6/sys: . contrib/pf dev/cxgb net netinet netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 21:51:48 -0000 Author: bz Date: Tue Aug 25 21:51:47 2009 New Revision: 196557 URL: http://svn.freebsd.org/changeset/base/196557 Log: MFC r185713 (from csjp): in_rtalloc1(9) returns a locked route, so make sure that we use RTFREE_LOCKED() here. This macro makes sure the reference count on the route is being managed properly. MFC r187946: Like with r185713 make sure to not leak a lock as rtalloc1(9) returns a locked route. Thus we have to use RTFREE_LOCKED(9) to get it either rtfree(9)d or the reference count decremented and unlocked depending on the reference count. [Note: the original commit message was bogus here]. RELENG_6 had a few more places that either had changed or were already fixed in HEAD/7 at the time above revisions were done so just fixed them along with the MFCs. Modified: stable/6/sys/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) stable/6/sys/net/if_stf.c stable/6/sys/netinet/if_ether.c stable/6/sys/netinet/in_gif.c stable/6/sys/netinet6/in6.c stable/6/sys/netinet6/in6_gif.c stable/6/sys/netinet6/in6_ifattach.c stable/6/sys/netinet6/nd6.c stable/6/sys/netinet6/nd6_nbr.c Modified: stable/6/sys/net/if_stf.c ============================================================================== --- stable/6/sys/net/if_stf.c Tue Aug 25 21:44:14 2009 (r196556) +++ stable/6/sys/net/if_stf.c Tue Aug 25 21:51:47 2009 (r196557) @@ -646,10 +646,10 @@ stf_checkaddr4(sc, in, inifp) (u_int32_t)ntohl(sin.sin_addr.s_addr)); #endif if (rt) - rtfree(rt); + RTFREE_LOCKED(rt); return -1; } - rtfree(rt); + RTFREE_LOCKED(rt); } return 0; Modified: stable/6/sys/netinet/if_ether.c ============================================================================== --- stable/6/sys/netinet/if_ether.c Tue Aug 25 21:44:14 2009 (r196556) +++ stable/6/sys/netinet/if_ether.c Tue Aug 25 21:51:47 2009 (r196557) @@ -854,12 +854,12 @@ reply: * over who claims what Ether address. */ if (rt->rt_ifp == ifp) { - rtfree(rt); + RTFREE_LOCKED(rt); goto drop; } (void)memcpy(ar_tha(ah), ar_sha(ah), ah->ar_hln); (void)memcpy(ar_sha(ah), enaddr, ah->ar_hln); - rtfree(rt); + RTFREE_LOCKED(rt); /* * Also check that the node which sent the ARP packet @@ -877,10 +877,10 @@ reply: " from %s via %s, expecting %s\n", inet_ntoa(isaddr), ifp->if_xname, rt->rt_ifp->if_xname); - rtfree(rt); + RTFREE_LOCKED(rt); goto drop; } - rtfree(rt); + RTFREE_LOCKED(rt); #ifdef DEBUG_PROXY printf("arp: proxying for %s\n", Modified: stable/6/sys/netinet/in_gif.c ============================================================================== --- stable/6/sys/netinet/in_gif.c Tue Aug 25 21:44:14 2009 (r196556) +++ stable/6/sys/netinet/in_gif.c Tue Aug 25 21:51:47 2009 (r196557) @@ -398,10 +398,10 @@ gif_validate4(ip, sc, ifp) (u_int32_t)ntohl(sin.sin_addr.s_addr)); #endif if (rt) - rtfree(rt); + RTFREE_LOCKED(rt); return 0; } - rtfree(rt); + RTFREE_LOCKED(rt); } return 32 * 2; Modified: stable/6/sys/netinet6/in6.c ============================================================================== --- stable/6/sys/netinet6/in6.c Tue Aug 25 21:44:14 2009 (r196556) +++ stable/6/sys/netinet6/in6.c Tue Aug 25 21:51:47 2009 (r196557) @@ -190,7 +190,7 @@ in6_ifloop_request(int cmd, struct ifadd rt_newaddrmsg(cmd, ifa, e, nrt); if (cmd == RTM_DELETE) { - rtfree(nrt); + RTFREE_LOCKED(nrt); } else { /* the cmd must be RTM_ADD here */ RT_REMREF(nrt); @@ -217,7 +217,7 @@ in6_ifaddloop(struct ifaddr *ifa) need_loop = (rt == NULL || (rt->rt_flags & RTF_HOST) == 0 || (rt->rt_ifp->if_flags & IFF_LOOPBACK) == 0); if (rt) - rtfree(rt); + RTFREE_LOCKED(rt); if (need_loop) in6_ifloop_request(RTM_ADD, ifa); } @@ -269,7 +269,7 @@ in6_ifremloop(struct ifaddr *ifa) if (rt != NULL) { if ((rt->rt_flags & RTF_HOST) != 0 && (rt->rt_ifp->if_flags & IFF_LOOPBACK) != 0) { - rtfree(rt); + RTFREE_LOCKED(rt); in6_ifloop_request(RTM_DELETE, ifa); } else RT_UNLOCK(rt); Modified: stable/6/sys/netinet6/in6_gif.c ============================================================================== --- stable/6/sys/netinet6/in6_gif.c Tue Aug 25 21:44:14 2009 (r196556) +++ stable/6/sys/netinet6/in6_gif.c Tue Aug 25 21:51:47 2009 (r196557) @@ -392,10 +392,10 @@ gif_validate6(ip6, sc, ifp) ip6_sprintf(&sin6.sin6_addr)); #endif if (rt) - rtfree(rt); + RTFREE_LOCKED(rt); return 0; } - rtfree(rt); + RTFREE_LOCKED(rt); } return 128 * 2; Modified: stable/6/sys/netinet6/in6_ifattach.c ============================================================================== --- stable/6/sys/netinet6/in6_ifattach.c Tue Aug 25 21:44:14 2009 (r196556) +++ stable/6/sys/netinet6/in6_ifattach.c Tue Aug 25 21:51:47 2009 (r196557) @@ -772,7 +772,7 @@ in6_ifdetach(ifp) if ((ia->ia_flags & IFA_ROUTE) && (rt = rtalloc1((struct sockaddr *)&ia->ia_addr, 0, 0UL))) { rtflags = rt->rt_flags; - rtfree(rt); + RTFREE_LOCKED(rt); rtrequest(RTM_DELETE, (struct sockaddr *)&ia->ia_addr, (struct sockaddr *)&ia->ia_addr, (struct sockaddr *)&ia->ia_prefixmask, Modified: stable/6/sys/netinet6/nd6.c ============================================================================== --- stable/6/sys/netinet6/nd6.c Tue Aug 25 21:44:14 2009 (r196556) +++ stable/6/sys/netinet6/nd6.c Tue Aug 25 21:51:47 2009 (r196557) @@ -2009,7 +2009,7 @@ again: rt = rt->rt_gwroute; RT_LOCK(rt); /* NB: gwroute */ if ((rt->rt_flags & RTF_UP) == 0) { - rtfree(rt); /* unlock gwroute */ + RTFREE_LOCKED(rt); /* unlock gwroute */ rt = rt0; rt0->rt_gwroute = NULL; lookup: Modified: stable/6/sys/netinet6/nd6_nbr.c ============================================================================== --- stable/6/sys/netinet6/nd6_nbr.c Tue Aug 25 21:44:14 2009 (r196556) +++ stable/6/sys/netinet6/nd6_nbr.c Tue Aug 25 21:51:47 2009 (r196557) @@ -239,7 +239,7 @@ nd6_ns_input(m, off, icmp6len) need_proxy = (rt && (rt->rt_flags & RTF_ANNOUNCE) != 0 && rt->rt_gateway->sa_family == AF_LINK); if (rt) - rtfree(rt); + RTFREE_LOCKED(rt); if (need_proxy) { /* * proxy NDP for single entry From owner-svn-src-all@FreeBSD.ORG Tue Aug 25 22:34:55 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27CCD1065694 for ; Tue, 25 Aug 2009 22:34:55 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 6F7EC8FC25 for ; Tue, 25 Aug 2009 22:34:54 +0000 (UTC) Received: (qmail 21993 invoked by uid 399); 25 Aug 2009 22:34:50 -0000 Received: from localhost (HELO foreign.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 25 Aug 2009 22:34:50 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4A946704.4080308@FreeBSD.org> Date: Tue, 25 Aug 2009 15:34:44 -0700 From: Doug Barton Organization: http://www.FreeBSD.org/ User-Agent: Thunderbird 2.0.0.23 (X11/20090822) MIME-Version: 1.0 To: Gleb Kurtsou References: <200908251907.n7PJ7QiO036868@svn.freebsd.org> <20090825194258.GB1471@tops> In-Reply-To: <20090825194258.GB1471@tops> X-Enigmail-Version: 0.96.0 OpenPGP: id=D5B2F0FB Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Xin LI Subject: Re: svn commit: r196550 - in head: etc/defaults etc/rc.d share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 22:34:55 -0000 Gleb Kurtsou wrote: > Would you please add support for reading pairs from file It does read them from a file, the file is named "rc.conf." :) Doug -- This .signature sanitized for your protection From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 03:30:06 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA987106568C; Wed, 26 Aug 2009 03:30:06 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA71F8FC18; Wed, 26 Aug 2009 03:30:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7Q3U61d047847; Wed, 26 Aug 2009 03:30:06 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7Q3U61l047845; Wed, 26 Aug 2009 03:30:06 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <200908260330.n7Q3U61l047845@svn.freebsd.org> From: Colin Percival Date: Wed, 26 Aug 2009 03:30:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196558 - head/usr.bin/look X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 03:30:06 -0000 Author: cperciva Date: Wed Aug 26 03:30:06 2009 New Revision: 196558 URL: http://svn.freebsd.org/changeset/base/196558 Log: Don't try to mmap the contents of empty files. This behaviour was harmless prior to r195693, since historical behaviour of mmap(2) was to silently ignore length-zero mmap requests; but mmap now returns EINVAL, which caused look(1) to emit an error message and fail. Among other things, this makes `freebsd-update fetch` on a newly installed 8.0-BETA3 system print bogus warning messages. MFC after: 3 days Modified: head/usr.bin/look/look.c Modified: head/usr.bin/look/look.c ============================================================================== --- head/usr.bin/look/look.c Tue Aug 25 21:51:47 2009 (r196557) +++ head/usr.bin/look/look.c Wed Aug 26 03:30:06 2009 (r196558) @@ -140,6 +140,10 @@ main(int argc, char *argv[]) err(2, "%s", file); if (sb.st_size > SIZE_T_MAX) errx(2, "%s: %s", file, strerror(EFBIG)); + if (sb.st_size == 0) { + close(fd); + continue; + } if ((front = mmap(NULL, (size_t)sb.st_size, PROT_READ, MAP_SHARED, fd, (off_t)0)) == MAP_FAILED) err(2, "%s", file); back = front + sb.st_size; From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 07:09:04 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AEC76106568C; Wed, 26 Aug 2009 07:09:04 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id 455508FC23; Wed, 26 Aug 2009 07:09:03 +0000 (UTC) Received: from c122-106-152-1.carlnfd1.nsw.optusnet.com.au (c122-106-152-1.carlnfd1.nsw.optusnet.com.au [122.106.152.1]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n7Q78v7R026854 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 26 Aug 2009 17:08:59 +1000 Date: Wed, 26 Aug 2009 17:08:57 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Jilles Tjoelker In-Reply-To: <20090825210815.GA8792@stack.nl> Message-ID: <20090826163931.C41472@delplex.bde.org> References: <200908231244.n7NCiFgc061095@svn.freebsd.org> <20090823213759.GA55039@stack.nl> <20090825031355.B729@besplex.bde.org> <20090825210815.GA8792@stack.nl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Konstantin Belousov , Bruce Evans Subject: Re: svn commit: r196460 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 07:09:04 -0000 On Tue, 25 Aug 2009, Jilles Tjoelker wrote: > On Tue, Aug 25, 2009 at 04:07:11AM +1000, Bruce Evans wrote: >> On Sun, 23 Aug 2009, Jilles Tjoelker wrote: > >>> I think poll on fifos should instead be fixed by closing the >>> half-connection corresponding to writing from fi_readsock to >>> fi_writesock. I have tried this out, see attached patch. With the patch, >>> pipepoll only gives "expected POLLHUP; got POLLIN | POLLHUP" errors and >>> an error in fifo case 6b caused by our distinction between new and old >>> readers. > >> This sort of worked for me, but has several problems: > >> % Index: sys/fs/fifofs/fifo_vnops.c >> % =================================================================== >> % --- sys/fs/fifofs/fifo_vnops.c (revision 196459) >> % +++ sys/fs/fifofs/fifo_vnops.c (working copy) >> % @@ -193,6 +193,10 @@ >> % goto fail2; >> % fip->fi_writesock = wso; >> % error = soconnect2(wso, rso); >> % + if (error == 0) >> % + error = soshutdown(rso, SHUT_WR); >> % + if (error == 0) >> % + error = soshutdown(wso, SHUT_RD); >> % if (error) { >> % (void)soclose(wso); >> % fail2: > >> The second soshutdown() is only harmful. I see the following state changes >> - the first soshutdown() sets SBS_CANTRCVMORE on rso like you would expect, >> and also sets SBS_CANTSENDMORE on wso. This gives the desired state. >> - the second soshutdown() then clears SBS_CANTRCVMORE on rso (without >> the first soshutdown() it leaves both flags clear in both directions). >> This clobbers the desired state. The failure shows in just one of my >> uncommitted regression tests (when there is a writer and there was >> a reader, poll() returns POLLOUT for the writer, but should return >> POLLHUP; the missing SBS_CANTRCVMORE on rso prevents it ever returning >> POLLHUP for writers). > >> After removing the second soshutdown() and fixing a spurious POLLIN (see >> below), all my tests pass. > > I have removed the second shutdown, it is not necessary. The second shutdown became harmless for me when I fixed the clobbering of sb_state. Does it have any effect? >> % Index: sys/kern/uipc_socket.c >> % =================================================================== >> % --- sys/kern/uipc_socket.c (revision 196469) >> % +++ sys/kern/uipc_socket.c (working copy) >> % @@ -2898,11 +2898,13 @@ >> % if (so->so_oobmark || (so->so_rcv.sb_state & SBS_RCVATMARK)) >> % revents |= events & (POLLPRI | POLLRDBAND); >> % >> % - if ((events & POLLINIGNEOF) == 0) >> % - if (so->so_rcv.sb_state & SBS_CANTRCVMORE) >> % - revents |= POLLHUP; >> % - if (so->so_snd.sb_state & SBS_CANTSENDMORE) >> % - revents |= POLLHUP; >> % + if ((events & POLLINIGNEOF) == 0) { > >> Old problems become larger: > >> I don't like POLLINIGNEOF (for input) affecting POLLHUP for output. This >> seems to cause no problems for fifos, at least when the kernel sets >> POLLINIGNEOF, but it is hard to understand even why it doesn't cause >> problems, and kib@ wants POLLINIGNEOF to remain user-settable, so the >> complications might remain exported to userland for for fifos and >> sockets, where they are harder to document and understand. > > I do not like userland POLLINIGNEOF either. I think programs can do fine > with the standard functionality (closing and reopening a fifo to reset > the POLLHUP state). > >> % + revents |= events & (POLLIN | POLLRDNORM); > >> This gives spurious POLLINs when POLLHUP is also returned, and thus defeats >> the point of soreadable_data() being different from soreadable(). Tests >> 6a-6d show the spurious POLLIN. I don't understand how tests 6a and 6c-6d >> passed for you. > > Same problem here. I think kib@ wants to keep this in 8.x for the sake > of buggy programs that do not check for POLLHUP. I suppose we can do it > properly in 9.x. But it may break non-buggy programs, and doesn't help for buggy programs like gdb. (gdb exits immediately when it sees POLLHUP, despite POLLIN also being set and input being queued. gdb used to work before it was converted to use poll(). Then it saw a ready input fd and had to read() it to detect EOF.) I now have better tests for POLLOUT, and have tested the buggy case for select some more (test 9, and 6b (?) in current): if POLLINIGNEOF is not applied for select(), then test 9 passes as expected. Test 9 only covers a fifo in initial state with a reader and no writers. This is EOF for read() and input-ready for select(), but neither POLLIN nor POLLHUP for poll(). Test 6b is for essentially the initial state for read() and select(), but for poll() the state is too-sticky hangup (POSIX) or back to the initial state (Linux-2.6.10/FreeBSD-current). Bruce From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 10:19:58 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 19544106568C; Wed, 26 Aug 2009 10:19:58 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (chello087206049004.chello.pl [87.206.49.4]) by mx1.freebsd.org (Postfix) with ESMTP id 4CE8C8FC19; Wed, 26 Aug 2009 10:19:56 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id ECB4845B36; Wed, 26 Aug 2009 12:19:54 +0200 (CEST) Received: from localhost (pdawidek.wheel.pl [10.0.1.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 21C0C45684; Wed, 26 Aug 2009 12:19:50 +0200 (CEST) Date: Wed, 26 Aug 2009 12:19:53 +0200 From: Pawel Jakub Dawidek To: Gleb Kurtsou Message-ID: <20090826101953.GC3055@garage.freebsd.pl> References: <200908251907.n7PJ7QiO036868@svn.freebsd.org> <20090825194258.GB1471@tops> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0/kgSOzhNoDC5T3a" Content-Disposition: inline In-Reply-To: <20090825194258.GB1471@tops> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 8.0-CURRENT i386 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-5.9 required=4.5 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Xin LI Subject: Re: svn commit: r196550 - in head: etc/defaults etc/rc.d share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 10:19:58 -0000 --0/kgSOzhNoDC5T3a Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 25, 2009 at 10:42:58PM +0300, Gleb Kurtsou wrote: > On (25/08/2009 19:07), Xin LI wrote: > > Author: delphij > > Date: Tue Aug 25 19:07:26 2009 > > New Revision: 196550 > > URL: http://svn.freebsd.org/changeset/base/196550 > >=20 > > Log: > > Add a new rc.d script, static_arp, which enables the administrator to > > statically bind IPv4 <-> MAC address at boot time. > > =20 > > In order to use this, the administrator needs to configure the follow= ing > > rc.conf(5) variable: > > =20 > > - static_arp_pairs: A list of names for static bind pairs, and, > > - a series of static_arp_(name): the arguments that is being passed = to > > ``arp -S'' operation. > > =20 > > Example: > > static_arp_pairs=3D"gw" > > static_arp_gw=3D"192.168.1.1 00:01:02:03:04:05" > > =20 > > See the rc.conf(5) manual page for more details. > Thanks for it! >=20 > Would you please add support for reading pairs from file, that should be > trivial. I've been using my own rc script for reading static arp entries > from file but can't find it right now. I put '/usr/sbin/arp -f /etc/arp.conf' into /etc/rc.local on almost all of my servers, which is very handy, indeed. And with your patch proposed in another e-mail to be able to remove entries defined in a file seems to be a complete solution. I'd also like to see support for it. --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --0/kgSOzhNoDC5T3a Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFKlQxJForvXbEpPzQRAlocAJ9f43hx7eH5+Eyd3t4f+UM9CVFXtACg8K6r pw0f5zn8fIRxM1FgOichzCQ= =x5xm -----END PGP SIGNATURE----- --0/kgSOzhNoDC5T3a-- From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 11:13:10 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A41F2106568B; Wed, 26 Aug 2009 11:13:10 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 921468FC19; Wed, 26 Aug 2009 11:13:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QBDASR059798; Wed, 26 Aug 2009 11:13:10 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QBDA9S059796; Wed, 26 Aug 2009 11:13:10 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200908261113.n7QBDA9S059796@svn.freebsd.org> From: Robert Watson Date: Wed, 26 Aug 2009 11:13:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196559 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 11:13:10 -0000 Author: rwatson Date: Wed Aug 26 11:13:10 2009 New Revision: 196559 URL: http://svn.freebsd.org/changeset/base/196559 Log: Add IFNET_HOLD reserved pointer value for the ifindex ifnet array, which allows an index to be reserved for an ifnet without making the ifnet available for management operations. Use this in if_alloc() while the ifnet lock is released between initial index allocation and completion of ifnet initialization. Add ifindex_free() to centralize the implementation of releasing an ifindex value. Use in if_free() and if_vmove(), as well as when releasing a held index in if_alloc(). Reviewed by: bz MFC after: 3 days Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Wed Aug 26 03:30:06 2009 (r196558) +++ head/sys/net/if.c Wed Aug 26 11:13:10 2009 (r196559) @@ -175,6 +175,13 @@ int ifqmaxlen = IFQ_MAXLEN; struct rwlock ifnet_rwlock; struct sx ifnet_sxlock; +/* + * The allocation of network interfaces is a rather non-atomic affair; we + * need to select an index before we are ready to expose the interface for + * use, so will use this pointer value to indicate reservation. + */ +#define IFNET_HOLD (void *)(uintptr_t)(-1) + static if_com_alloc_t *if_com_alloc[256]; static if_com_free_t *if_com_free[256]; @@ -193,6 +200,8 @@ ifnet_byindex_locked(u_short idx) if (idx > V_if_index) return (NULL); + if (V_ifindex_table[idx].ife_ifnet == IFNET_HOLD) + return (NULL); return (V_ifindex_table[idx].ife_ifnet); } @@ -228,18 +237,18 @@ ifnet_byindex_ref(u_short idx) * failure. */ static int -ifindex_alloc(u_short *idxp) +ifindex_alloc_locked(u_short *idxp) { u_short idx; IFNET_WLOCK_ASSERT(); /* - * Try to find an empty slot below if_index. If we fail, take the + * Try to find an empty slot below V_if_index. If we fail, take the * next slot. */ for (idx = 1; idx <= V_if_index; idx++) { - if (ifnet_byindex_locked(idx) == NULL) + if (V_ifindex_table[idx].ife_ifnet == NULL) break; } @@ -255,6 +264,27 @@ ifindex_alloc(u_short *idxp) } static void +ifindex_free_locked(u_short idx) +{ + + IFNET_WLOCK_ASSERT(); + + V_ifindex_table[idx].ife_ifnet = NULL; + while (V_if_index > 0 && + V_ifindex_table[V_if_index].ife_ifnet == NULL) + V_if_index--; +} + +static void +ifindex_free(u_short idx) +{ + + IFNET_WLOCK(); + ifindex_free_locked(idx); + IFNET_WUNLOCK(); +} + +static void ifnet_setbyindex_locked(u_short idx, struct ifnet *ifp) { @@ -370,11 +400,12 @@ if_alloc(u_char type) ifp = malloc(sizeof(struct ifnet), M_IFNET, M_WAITOK|M_ZERO); IFNET_WLOCK(); - if (ifindex_alloc(&idx) != 0) { + if (ifindex_alloc_locked(&idx) != 0) { IFNET_WUNLOCK(); free(ifp, M_IFNET); return (NULL); } + ifnet_setbyindex_locked(idx, IFNET_HOLD); IFNET_WUNLOCK(); ifp->if_index = idx; ifp->if_type = type; @@ -383,6 +414,7 @@ if_alloc(u_char type) ifp->if_l2com = if_com_alloc[type](type, ifp); if (ifp->if_l2com == NULL) { free(ifp, M_IFNET); + ifindex_free(idx); return (NULL); } } @@ -421,9 +453,7 @@ if_free_internal(struct ifnet *ifp) KASSERT(ifp == ifnet_byindex_locked(ifp->if_index), ("%s: freeing unallocated ifnet", ifp->if_xname)); - ifnet_setbyindex_locked(ifp->if_index, NULL); - while (V_if_index > 0 && ifnet_byindex_locked(V_if_index) == NULL) - V_if_index--; + ifindex_free_locked(ifp->if_index); IFNET_WUNLOCK(); if (if_com_free[ifp->if_alloctype] != NULL) @@ -916,18 +946,14 @@ if_vmove(struct ifnet *ifp, struct vnet * or we'd lock on one vnet and unlock on another. */ IFNET_WLOCK(); - ifnet_setbyindex_locked(ifp->if_index, NULL); - while (V_if_index > 0 && ifnet_byindex_locked(V_if_index) == NULL) - V_if_index--; - IFNET_WUNLOCK(); + ifindex_free_locked(ifp->if_index); /* * Switch to the context of the target vnet. */ CURVNET_SET_QUIET(new_vnet); - IFNET_WLOCK(); - if (ifindex_alloc(&idx) != 0) { + if (ifindex_alloc_locked(&idx) != 0) { IFNET_WUNLOCK(); panic("if_index overflow"); } From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 12:34:06 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7413A106568C; Wed, 26 Aug 2009 12:34:06 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id 368DC8FC1C; Wed, 26 Aug 2009 12:34:05 +0000 (UTC) Received: from compute2.internal (compute2.internal [10.202.2.42]) by gateway1.messagingengine.com (Postfix) with ESMTP id CA2AA582FB; Wed, 26 Aug 2009 08:34:04 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute2.internal (MEProxy); Wed, 26 Aug 2009 08:34:04 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=message-id:date:from:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; s=smtpout; bh=ZbotpB93t+xv9A2CffQmIOMxdIM=; b=Krc4nlbA7waGw8uK2xdQ7MeV89ZUYw81V7ykKGzxZES+RFwPf6T1kffl+uV4S7Y8zTYuF2naBsr3k40SlMlUdQdZu31OuwOEo69QE90U4T+hJYHDg0+/TDH2kMHhtOHndP9Y1MaI9WCPDM29qlhYyGqHsE4HMQT8X7vwJJ9ECqc= X-Sasl-enc: kRPyC3YYh6R/qnzyAAiVX6xWa6ffKK4A9u81ZFUQsJ7m 1251290044 Received: from [192.168.123.18] (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTPSA id 18CE116304; Wed, 26 Aug 2009 08:34:03 -0400 (EDT) Message-ID: <4A952BBA.1050700@incunabulum.net> Date: Wed, 26 Aug 2009 13:34:02 +0100 From: Bruce Simpson User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Xin LI References: <200908251907.n7PJ7QiO036868@svn.freebsd.org> In-Reply-To: <200908251907.n7PJ7QiO036868@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196550 - in head: etc/defaults etc/rc.d share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 12:34:06 -0000 Xin LI wrote: > Log: > Add a new rc.d script, static_arp, which enables the administrator to > statically bind IPv4 <-> MAC address at boot time. > Thanks for doing this -- users will love this! From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 13:32:09 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 763781065690; Wed, 26 Aug 2009 13:32:09 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 483B28FC26; Wed, 26 Aug 2009 13:32:09 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id D730D46B09; Wed, 26 Aug 2009 09:32:08 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 36B508A02A; Wed, 26 Aug 2009 09:32:08 -0400 (EDT) From: John Baldwin To: Colin Percival Date: Wed, 26 Aug 2009 07:34:12 -0400 User-Agent: KMail/1.9.7 References: <200908260330.n7Q3U61l047845@svn.freebsd.org> In-Reply-To: <200908260330.n7Q3U61l047845@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200908260734.12893.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Wed, 26 Aug 2009 09:32:08 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196558 - head/usr.bin/look X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 13:32:09 -0000 On Tuesday 25 August 2009 11:30:06 pm Colin Percival wrote: > Author: cperciva > Date: Wed Aug 26 03:30:06 2009 > New Revision: 196558 > URL: http://svn.freebsd.org/changeset/base/196558 > > Log: > Don't try to mmap the contents of empty files. This behaviour was harmless > prior to r195693, since historical behaviour of mmap(2) was to silently > ignore length-zero mmap requests; but mmap now returns EINVAL, which caused > look(1) to emit an error message and fail. FWIW, it did not silently ignore the request. Instead it rounded the size up to a page and mapped a page of data. However, if you then passed that pointer with a length of 0 to munmap() munmap() would fail. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 14:32:37 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 995FF106568B; Wed, 26 Aug 2009 14:32:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 893BF8FC26; Wed, 26 Aug 2009 14:32:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QEWbdC064459; Wed, 26 Aug 2009 14:32:37 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QEWbLb064458; Wed, 26 Aug 2009 14:32:37 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200908261432.n7QEWbLb064458@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 26 Aug 2009 14:32:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196560 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 14:32:37 -0000 Author: kib Date: Wed Aug 26 14:32:37 2009 New Revision: 196560 URL: http://svn.freebsd.org/changeset/base/196560 Log: Honor the vfs.timestamp_precision sysctl settings for utimes(path, NULL) and similar calls. Obtained from: Petr Salinger, Debian GNU/kFreeBSD, Debian bug #489894 MFC after: 3 days Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Wed Aug 26 11:13:10 2009 (r196559) +++ head/sys/kern/vfs_syscalls.c Wed Aug 26 14:32:37 2009 (r196560) @@ -3134,8 +3134,7 @@ getutimes(usrtvp, tvpseg, tsp) int error; if (usrtvp == NULL) { - microtime(&tv[0]); - TIMEVAL_TO_TIMESPEC(&tv[0], &tsp[0]); + vfs_timestamp(&tsp[0]); tsp[1] = tsp[0]; } else { if (tvpseg == UIO_SYSSPACE) { From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 18:54:40 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF04F106568C; Wed, 26 Aug 2009 18:54:40 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id A91498FC2C; Wed, 26 Aug 2009 18:54:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 333EB9CB0D3; Wed, 26 Aug 2009 20:51:55 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 318CrAUP28tY; Wed, 26 Aug 2009 20:51:53 +0200 (CEST) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 104679CB0EC; Wed, 26 Aug 2009 20:51:53 +0200 (CEST) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.3/8.14.3/Submit) id n7QIpr5h043137; Wed, 26 Aug 2009 20:51:53 +0200 (CEST) (envelope-from rdivacky) Date: Wed, 26 Aug 2009 20:51:53 +0200 From: Roman Divacky Message-ID: <20090826185153.GA39075@freebsd.org> References: <200908191517.n7JFHDFr057881@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200908191517.n7JFHDFr057881@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196382 - head/contrib/top X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 18:54:41 -0000 On Wed, Aug 19, 2009 at 03:17:13PM +0000, John Baldwin wrote: > Author: jhb > Date: Wed Aug 19 15:17:13 2009 > New Revision: 196382 > URL: http://svn.freebsd.org/changeset/base/196382 > > Log: > Explicitly line up the CPU state labels with the calculated starting column > that takes into account the width of the largest CPU ID. On systems with > > 10 CPUs the labels for the first 10 CPUs were not lined up properly > otherwise. what happened to the import of newer top? From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 19:04:08 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0182E106568E; Wed, 26 Aug 2009 19:04:08 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id AB0CA8FC20; Wed, 26 Aug 2009 19:04:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 081889CB08A; Wed, 26 Aug 2009 21:01:22 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id B9JBkDMWpU30; Wed, 26 Aug 2009 21:01:19 +0200 (CEST) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id D0FB19CB0EC; Wed, 26 Aug 2009 21:01:19 +0200 (CEST) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.3/8.14.3/Submit) id n7QJ1JW8044576; Wed, 26 Aug 2009 21:01:19 +0200 (CEST) (envelope-from rdivacky) Date: Wed, 26 Aug 2009 21:01:19 +0200 From: Roman Divacky To: Rui Paulo Message-ID: <20090826190119.GB39075@freebsd.org> References: <200908230955.n7N9t6Go053499@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200908230955.n7N9t6Go053499@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r196454 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 19:04:08 -0000 On Sun, Aug 23, 2009 at 09:55:06AM +0000, Rui Paulo wrote: > Author: rpaulo > Date: Sun Aug 23 09:55:06 2009 > New Revision: 196454 > URL: http://svn.freebsd.org/changeset/base/196454 > > Log: > Constify prime numbers. > > Modified: > head/sys/kern/kern_subr.c > > Modified: head/sys/kern/kern_subr.c > ============================================================================== > --- head/sys/kern/kern_subr.c Sun Aug 23 08:49:32 2009 (r196453) > +++ head/sys/kern/kern_subr.c Sun Aug 23 09:55:06 2009 (r196454) > @@ -419,9 +419,9 @@ hashdestroy(void *vhashtbl, struct mallo > free(hashtbl, type); > } > > -static int primes[] = { 1, 13, 31, 61, 127, 251, 509, 761, 1021, 1531, 2039, > - 2557, 3067, 3583, 4093, 4603, 5119, 5623, 6143, 6653, > - 7159, 7673, 8191, 12281, 16381, 24571, 32749 }; > +static const int primes[] = { 1, 13, 31, 61, 127, 251, 509, 761, 1021, 1531, > + 2039, 2557, 3067, 3583, 4093, 4603, 5119, 5623, 6143, > + 6653, 7159, 7673, 8191, 12281, 16381, 24571, 32749 }; > #define NPRIMES (sizeof(primes) / sizeof(primes[0])) > > /* btw... this is currently unused as we dont use the "prime hash". maybe we can remove this completely? From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 19:42:34 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 193201065691 for ; Wed, 26 Aug 2009 19:42:34 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 9CEEE8FC30 for ; Wed, 26 Aug 2009 19:42:33 +0000 (UTC) Received: (qmail 23439 invoked by uid 399); 26 Aug 2009 19:42:30 -0000 Received: from localhost (HELO foreign.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 26 Aug 2009 19:42:30 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4A959020.4040606@FreeBSD.org> Date: Wed, 26 Aug 2009 12:42:24 -0700 From: Doug Barton Organization: http://www.FreeBSD.org/ User-Agent: Thunderbird 2.0.0.23 (X11/20090822) MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <200908251907.n7PJ7QiO036868@svn.freebsd.org> <20090825194258.GB1471@tops> <20090826101953.GC3055@garage.freebsd.pl> In-Reply-To: <20090826101953.GC3055@garage.freebsd.pl> X-Enigmail-Version: 0.96.0 OpenPGP: id=D5B2F0FB Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, Gleb Kurtsou , src-committers@freebsd.org, Xin LI , svn-src-all@freebsd.org Subject: Re: svn commit: r196550 - in head: etc/defaults etc/rc.d share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 19:42:34 -0000 Pawel Jakub Dawidek wrote: > I put '/usr/sbin/arp -f /etc/arp.conf' into /etc/rc.local on almost all > of my servers, which is very handy, indeed. And with your patch proposed > in another e-mail to be able to remove entries defined in a file seems > to be a complete solution. I'd also like to see support for it. What would the relative value be of adding support for files vs. using the method that Xin already created? I understand that you will have a one-time cost of migrating your conf file to Xin's format .... Doug -- This .signature sanitized for your protection From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 19:45:20 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1346B106568B; Wed, 26 Aug 2009 19:45:20 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 019A78FC2C; Wed, 26 Aug 2009 19:45:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QJjJj3071946; Wed, 26 Aug 2009 19:45:19 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QJjJnR071944; Wed, 26 Aug 2009 19:45:19 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <200908261945.n7QJjJnR071944@svn.freebsd.org> From: Peter Wemm Date: Wed, 26 Aug 2009 19:45:17 +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: r196561 - stable/7/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 19:45:20 -0000 Author: peter Date: Wed Aug 26 19:45:17 2009 New Revision: 196561 URL: http://svn.freebsd.org/changeset/base/196561 Log: MFC r194304: Fix ticks overflow in the handling of t_badtrxtwin. Modified: stable/7/sys/netinet/tcp_input.c Modified: stable/7/sys/netinet/tcp_input.c ============================================================================== --- stable/7/sys/netinet/tcp_input.c Wed Aug 26 14:32:37 2009 (r196560) +++ stable/7/sys/netinet/tcp_input.c Wed Aug 26 19:45:17 2009 (r196561) @@ -1030,7 +1030,7 @@ tcp_do_segment(struct mbuf *m, struct tc * "bad retransmit" recovery. */ if (tp->t_rxtshift == 1 && - ticks < tp->t_badrxtwin) { + (int)(ticks - tp->t_badrxtwin) < 0) { ++tcpstat.tcps_sndrexmitbad; tp->snd_cwnd = tp->snd_cwnd_prev; tp->snd_ssthresh = @@ -1961,7 +1961,7 @@ process_ACK: * original cwnd and ssthresh, and proceed to transmit where * we left off. */ - if (tp->t_rxtshift == 1 && ticks < tp->t_badrxtwin) { + if (tp->t_rxtshift == 1 && (int)(ticks - tp->t_badrxtwin) < 0) { ++tcpstat.tcps_sndrexmitbad; tp->snd_cwnd = tp->snd_cwnd_prev; tp->snd_ssthresh = tp->snd_ssthresh_prev; From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 19:50:28 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C811106568C; Wed, 26 Aug 2009 19:50:28 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4A2718FC24; Wed, 26 Aug 2009 19:50:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QJoRV4072095; Wed, 26 Aug 2009 19:50:27 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QJoRta072093; Wed, 26 Aug 2009 19:50:27 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <200908261950.n7QJoRta072093@svn.freebsd.org> From: Peter Wemm Date: Wed, 26 Aug 2009 19:50:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196562 - stable/6/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 19:50:28 -0000 Author: peter Date: Wed Aug 26 19:50:27 2009 New Revision: 196562 URL: http://svn.freebsd.org/changeset/base/196562 Log: MFC: r196410: fix timewait expiration code when ticks goes negative after 24 days of uptime. Modified: stable/6/sys/netinet/tcp_timer.c Modified: stable/6/sys/netinet/tcp_timer.c ============================================================================== --- stable/6/sys/netinet/tcp_timer.c Wed Aug 26 19:45:17 2009 (r196561) +++ stable/6/sys/netinet/tcp_timer.c Wed Aug 26 19:50:27 2009 (r196562) @@ -247,7 +247,7 @@ tcp_timer_2msl_tw(int reuse) INP_INFO_WLOCK_ASSERT(&tcbinfo); for (;;) { tw = TAILQ_FIRST(&twq_2msl); - if (tw == NULL || (!reuse && tw->tw_time > ticks)) + if (tw == NULL || (!reuse && (int)(tw->tw_time - ticks) > 0)) break; INP_LOCK(tw->tw_inpcb); tcp_twclose(tw, reuse); From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 19:51:55 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B4E01065672; Wed, 26 Aug 2009 19:51:55 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 09C3D8FC21; Wed, 26 Aug 2009 19:51:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QJpsAe072188; Wed, 26 Aug 2009 19:51:54 GMT (envelope-from peter@svn.freebsd.org) Received: (from peter@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QJpsQo072186; Wed, 26 Aug 2009 19:51:54 GMT (envelope-from peter@svn.freebsd.org) Message-Id: <200908261951.n7QJpsQo072186@svn.freebsd.org> From: Peter Wemm Date: Wed, 26 Aug 2009 19:51:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196563 - stable/6/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 19:51:55 -0000 Author: peter Date: Wed Aug 26 19:51:54 2009 New Revision: 196563 URL: http://svn.freebsd.org/changeset/base/196563 Log: MFC r194304: Fix ticks overflow in the handling of t_badtrxtwin. Modified: stable/6/sys/netinet/tcp_input.c Modified: stable/6/sys/netinet/tcp_input.c ============================================================================== --- stable/6/sys/netinet/tcp_input.c Wed Aug 26 19:50:27 2009 (r196562) +++ stable/6/sys/netinet/tcp_input.c Wed Aug 26 19:51:54 2009 (r196563) @@ -1182,7 +1182,7 @@ after_listen: * "bad retransmit" recovery */ if (tp->t_rxtshift == 1 && - ticks < tp->t_badrxtwin) { + (int)(ticks - tp->t_badrxtwin) < 0) { ++tcpstat.tcps_sndrexmitbad; tp->snd_cwnd = tp->snd_cwnd_prev; tp->snd_ssthresh = @@ -2070,7 +2070,7 @@ process_ACK: * original cwnd and ssthresh, and proceed to transmit where * we left off. */ - if (tp->t_rxtshift == 1 && ticks < tp->t_badrxtwin) { + if (tp->t_rxtshift == 1 && (int)(ticks - tp->t_badrxtwin) < 0) { ++tcpstat.tcps_sndrexmitbad; tp->snd_cwnd = tp->snd_cwnd_prev; tp->snd_ssthresh = tp->snd_ssthresh_prev; From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 19:56:45 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 073181065672; Wed, 26 Aug 2009 19:56:45 +0000 (UTC) (envelope-from gleb.kurtsou@gmail.com) Received: from mail-fx0-f210.google.com (mail-fx0-f210.google.com [209.85.220.210]) by mx1.freebsd.org (Postfix) with ESMTP id DC9CE8FC22; Wed, 26 Aug 2009 19:56:43 +0000 (UTC) Received: by fxm6 with SMTP id 6so388768fxm.43 for ; Wed, 26 Aug 2009 12:56:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=hGU3gYkTYkIUdjh+fkRGQCWMry2KJgYzMJm3rC05mCA=; b=mqAVsSPi3t7tb67qEnK/XJ3Z7cXr1i6nNcvlc/H0b1nr1rBSz+fzBSRKx4yngyxDDK 8KEGoVa+kXipYSlw3rP7N4Tofm34KMJINhvsghMZCAI6UrxnN1NqqIaWmBhEnunueqms pAK16uAZ9TDGI+zqx9N3XSyXWo4yUVVXenIOc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=ata+r/huYmEw2O7GNrB9W4KqXsCpxHQ/qf9XnmMnWI/au1n/UK8tZ5NZ61aZ75ocm8 OmB1WrInD4BixJCf2xCp5T2zAEymFf4nTMwwiCwjdCrPXQ96I+X47gLJVwj2EG68lE87 a6oXGsMe0Y6u5Fr9EoXZRKYLgfTevLtsODRiw= Received: by 10.103.78.30 with SMTP id f30mr3845260mul.87.1251316602361; Wed, 26 Aug 2009 12:56:42 -0700 (PDT) Received: from localhost (lan-78-157-90-54.vln.skynet.lt [78.157.90.54]) by mx.google.com with ESMTPS id j9sm3743337mue.52.2009.08.26.12.56.41 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 26 Aug 2009 12:56:41 -0700 (PDT) Date: Wed, 26 Aug 2009 22:56:20 +0300 From: Gleb Kurtsou To: Doug Barton Message-ID: <20090826195620.GA3357@tops> References: <200908251907.n7PJ7QiO036868@svn.freebsd.org> <20090825194258.GB1471@tops> <20090826101953.GC3055@garage.freebsd.pl> <4A959020.4040606@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4A959020.4040606@FreeBSD.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, Xin LI , svn-src-all@freebsd.org, src-committers@freebsd.org, Pawel Jakub Dawidek Subject: Re: svn commit: r196550 - in head: etc/defaults etc/rc.d share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 19:56:45 -0000 On (26/08/2009 12:42), Doug Barton wrote: > Pawel Jakub Dawidek wrote: > > > I put '/usr/sbin/arp -f /etc/arp.conf' into /etc/rc.local on almost all > > of my servers, which is very handy, indeed. And with your patch proposed > > in another e-mail to be able to remove entries defined in a file seems > > to be a complete solution. I'd also like to see support for it. > > What would the relative value be of adding support for files vs. using > the method that Xin already created? I understand that you will have a > one-time cost of migrating your conf file to Xin's format .... Unless there are too many arp entries to convert and these "files" are also used by other utilities. Adding support for reading it from file is negligible comparing to the effort one should take to convert plain 'arp -f' entires into rc.conf style and keep them in sync. Thanks, Gleb > > > Doug > > -- > > This .signature sanitized for your protection > From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 20:57:21 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDC491065691; Wed, 26 Aug 2009 20:57:21 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB3018FC2C; Wed, 26 Aug 2009 20:57:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QKvLun073740; Wed, 26 Aug 2009 20:57:21 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QKvLKP073739; Wed, 26 Aug 2009 20:57:21 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200908262057.n7QKvLKP073739@svn.freebsd.org> From: Doug Barton Date: Wed, 26 Aug 2009 20:57:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196564 - in stable/8/release: . doc scripts X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 20:57:22 -0000 Author: dougb Date: Wed Aug 26 20:57:21 2009 New Revision: 196564 URL: http://svn.freebsd.org/changeset/base/196564 Log: MFC 196434: Add a script to create the /var/db/mergemaster.mtree file for new releases so that when users subsequently update their source trees they can make use of mergemaster's -U option. Approved by: re (kib) Added: stable/8/release/scripts/mm-mtree.sh - copied unchanged from r196434, head/release/scripts/mm-mtree.sh Modified: stable/8/release/ (props changed) stable/8/release/doc/ (props changed) Copied: stable/8/release/scripts/mm-mtree.sh (from r196434, head/release/scripts/mm-mtree.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/release/scripts/mm-mtree.sh Wed Aug 26 20:57:21 2009 (r196564, copy of r196434, head/release/scripts/mm-mtree.sh) @@ -0,0 +1,155 @@ +#!/bin/sh + +# mergemaster mtree database generator + +# This script is intended to be used as part of the release building +# process to generate the /var/db/mergemaster.mtree file relevant to +# the source tree used to create the release so that users can make +# use of mergemaster's -U option to update their files after csup'ing +# to -stable. + +# Copyright 2009 Douglas Barton +# dougb@FreeBSD.org + +# $FreeBSD$ + +PATH=/bin:/usr/bin:/usr/sbin + +display_usage () { + VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4` + echo "${0##*/} version ${VERSION_NUMBER}" + echo "Usage: ${0##*/} [-m /path] [-t /path] [-A arch] [-F ] [-D /path]" + echo "Options:" + echo " -m /path/directory Specify location of source to do the make in" + echo " -t /path/directory Specify temp root directory" + echo " -A architecture Alternative architecture name to pass to make" + echo " -F Specify what to put on the make command line" + echo ' -D /path/directory Specify the destination directory to install files to' + echo '' +} + +# Set the default path for the temporary root environment +# +TEMPROOT='/var/tmp/temproot' + +# Assign the location of the mtree database +# +MTREEDB=${MTREEDB:-/var/db} +MTREEFILE="${MTREEDB}/mergemaster.mtree" + +# Check the command line options +# +while getopts "m:t:A:F:D:h" COMMAND_LINE_ARGUMENT ; do + case "${COMMAND_LINE_ARGUMENT}" in + m) + SOURCEDIR=${OPTARG} + ;; + t) + TEMPROOT=${OPTARG} + ;; + A) + ARCHSTRING='TARGET_ARCH='${OPTARG} + ;; + F) + MM_MAKE_ARGS="${OPTARG}" + ;; + D) + DESTDIR=${OPTARG} + ;; + h) + display_usage + exit 0 + ;; + *) + echo '' + display_usage + exit 1 + ;; + esac +done + +# Assign the source directory +# +SOURCEDIR=${SOURCEDIR:-/usr/src} +if [ ! -f ${SOURCEDIR}/Makefile.inc1 -a \ + -f ${SOURCEDIR}/../Makefile.inc1 ]; then + echo " *** The source directory you specified (${SOURCEDIR})" + echo " will be reset to ${SOURCEDIR}/.." + echo '' + sleep 3 + SOURCEDIR=${SOURCEDIR}/.. +fi + +# Setup make to use system files from SOURCEDIR +MM_MAKE="make ${ARCHSTRING} ${MM_MAKE_ARGS} -m ${SOURCEDIR}/share/mk" + +delete_temproot () { + rm -rf "${TEMPROOT}" 2>/dev/null + chflags -R 0 "${TEMPROOT}" 2>/dev/null + rm -rf "${TEMPROOT}" || exit 1 +} + +[ -d "${TEMPROOT}" ] && delete_temproot + +echo "*** Creating the temporary root environment in ${TEMPROOT}" + +if mkdir -p "${TEMPROOT}"; then + echo " *** ${TEMPROOT} ready for use" +fi + +if [ ! -d "${TEMPROOT}" ]; then + echo '' + echo " *** FATAL ERROR: Cannot create ${TEMPROOT}" + echo '' + exit 1 +fi + +echo " *** Creating and populating directory structure in ${TEMPROOT}" +echo '' + +{ cd ${SOURCEDIR} || { echo "*** Cannot cd to ${SOURCEDIR}" ; exit 1;} + case "${DESTDIR}" in + '') ;; + *) + ${MM_MAKE} DESTDIR=${DESTDIR} distrib-dirs + ;; + esac + od=${TEMPROOT}/usr/obj + ${MM_MAKE} DESTDIR=${TEMPROOT} distrib-dirs && + MAKEOBJDIRPREFIX=$od ${MM_MAKE} _obj SUBDIR_OVERRIDE=etc && + MAKEOBJDIRPREFIX=$od ${MM_MAKE} everything SUBDIR_OVERRIDE=etc && + MAKEOBJDIRPREFIX=$od ${MM_MAKE} DESTDIR=${TEMPROOT} distribution;} || + { echo ''; + echo " *** FATAL ERROR: Cannot 'cd' to ${SOURCEDIR} and install files to"; + echo " the temproot environment"; + echo ''; + exit 1;} + +# We really don't want to have to deal with files like login.conf.db, pwd.db, +# or spwd.db. Instead, we want to compare the text versions, and run *_mkdb. +# Prompt the user to do so below, as needed. +# +rm -f ${TEMPROOT}/etc/*.db ${TEMPROOT}/etc/passwd + +# We only need to compare things like freebsd.cf once +find ${TEMPROOT}/usr/obj -type f -delete 2>/dev/null + +# Delete stuff we do not need to keep the mtree database small, +# and to make the actual comparison faster. +find ${TEMPROOT}/usr -type l -delete 2>/dev/null +find ${TEMPROOT} -type f -size 0 -delete 2>/dev/null +find -d ${TEMPROOT} -type d -empty -delete 2>/dev/null + +# Build the mtree database in a temporary location. +MTREENEW=`mktemp -t mergemaster.mtree` +mtree -ci -p ${TEMPROOT} -k size,md5digest > ${MTREENEW} 2>/dev/null + +if [ -s "${MTREENEW}" ]; then + echo "*** Saving mtree database for future upgrades" + test -e "${DESTDIR}${MTREEFILE}" && unlink ${DESTDIR}${MTREEFILE} + mv ${MTREENEW} ${DESTDIR}${MTREEFILE} +fi + +delete_temproot + +exit 0 From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 21:05:17 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B7CB106568E; Wed, 26 Aug 2009 21:05:17 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4903D8FC20; Wed, 26 Aug 2009 21:05:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QL5HVA074092; Wed, 26 Aug 2009 21:05:17 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QL5Ho7074091; Wed, 26 Aug 2009 21:05:17 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200908262105.n7QL5Ho7074091@svn.freebsd.org> From: Doug Barton Date: Wed, 26 Aug 2009 21:05:17 +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: r196565 - in stable/7/release: . scripts X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 21:05:17 -0000 Author: dougb Date: Wed Aug 26 21:05:17 2009 New Revision: 196565 URL: http://svn.freebsd.org/changeset/base/196565 Log: MFC 196434: Add a script to create the /var/db/mergemaster.mtree file for new releases so that when users subsequently update their source trees they can make use of mergemaster's -U option. Added: stable/7/release/scripts/mm-mtree.sh - copied unchanged from r196434, head/release/scripts/mm-mtree.sh Modified: stable/7/release/ (props changed) stable/7/release/scripts/src-install.sh (props changed) Copied: stable/7/release/scripts/mm-mtree.sh (from r196434, head/release/scripts/mm-mtree.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/7/release/scripts/mm-mtree.sh Wed Aug 26 21:05:17 2009 (r196565, copy of r196434, head/release/scripts/mm-mtree.sh) @@ -0,0 +1,155 @@ +#!/bin/sh + +# mergemaster mtree database generator + +# This script is intended to be used as part of the release building +# process to generate the /var/db/mergemaster.mtree file relevant to +# the source tree used to create the release so that users can make +# use of mergemaster's -U option to update their files after csup'ing +# to -stable. + +# Copyright 2009 Douglas Barton +# dougb@FreeBSD.org + +# $FreeBSD$ + +PATH=/bin:/usr/bin:/usr/sbin + +display_usage () { + VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4` + echo "${0##*/} version ${VERSION_NUMBER}" + echo "Usage: ${0##*/} [-m /path] [-t /path] [-A arch] [-F ] [-D /path]" + echo "Options:" + echo " -m /path/directory Specify location of source to do the make in" + echo " -t /path/directory Specify temp root directory" + echo " -A architecture Alternative architecture name to pass to make" + echo " -F Specify what to put on the make command line" + echo ' -D /path/directory Specify the destination directory to install files to' + echo '' +} + +# Set the default path for the temporary root environment +# +TEMPROOT='/var/tmp/temproot' + +# Assign the location of the mtree database +# +MTREEDB=${MTREEDB:-/var/db} +MTREEFILE="${MTREEDB}/mergemaster.mtree" + +# Check the command line options +# +while getopts "m:t:A:F:D:h" COMMAND_LINE_ARGUMENT ; do + case "${COMMAND_LINE_ARGUMENT}" in + m) + SOURCEDIR=${OPTARG} + ;; + t) + TEMPROOT=${OPTARG} + ;; + A) + ARCHSTRING='TARGET_ARCH='${OPTARG} + ;; + F) + MM_MAKE_ARGS="${OPTARG}" + ;; + D) + DESTDIR=${OPTARG} + ;; + h) + display_usage + exit 0 + ;; + *) + echo '' + display_usage + exit 1 + ;; + esac +done + +# Assign the source directory +# +SOURCEDIR=${SOURCEDIR:-/usr/src} +if [ ! -f ${SOURCEDIR}/Makefile.inc1 -a \ + -f ${SOURCEDIR}/../Makefile.inc1 ]; then + echo " *** The source directory you specified (${SOURCEDIR})" + echo " will be reset to ${SOURCEDIR}/.." + echo '' + sleep 3 + SOURCEDIR=${SOURCEDIR}/.. +fi + +# Setup make to use system files from SOURCEDIR +MM_MAKE="make ${ARCHSTRING} ${MM_MAKE_ARGS} -m ${SOURCEDIR}/share/mk" + +delete_temproot () { + rm -rf "${TEMPROOT}" 2>/dev/null + chflags -R 0 "${TEMPROOT}" 2>/dev/null + rm -rf "${TEMPROOT}" || exit 1 +} + +[ -d "${TEMPROOT}" ] && delete_temproot + +echo "*** Creating the temporary root environment in ${TEMPROOT}" + +if mkdir -p "${TEMPROOT}"; then + echo " *** ${TEMPROOT} ready for use" +fi + +if [ ! -d "${TEMPROOT}" ]; then + echo '' + echo " *** FATAL ERROR: Cannot create ${TEMPROOT}" + echo '' + exit 1 +fi + +echo " *** Creating and populating directory structure in ${TEMPROOT}" +echo '' + +{ cd ${SOURCEDIR} || { echo "*** Cannot cd to ${SOURCEDIR}" ; exit 1;} + case "${DESTDIR}" in + '') ;; + *) + ${MM_MAKE} DESTDIR=${DESTDIR} distrib-dirs + ;; + esac + od=${TEMPROOT}/usr/obj + ${MM_MAKE} DESTDIR=${TEMPROOT} distrib-dirs && + MAKEOBJDIRPREFIX=$od ${MM_MAKE} _obj SUBDIR_OVERRIDE=etc && + MAKEOBJDIRPREFIX=$od ${MM_MAKE} everything SUBDIR_OVERRIDE=etc && + MAKEOBJDIRPREFIX=$od ${MM_MAKE} DESTDIR=${TEMPROOT} distribution;} || + { echo ''; + echo " *** FATAL ERROR: Cannot 'cd' to ${SOURCEDIR} and install files to"; + echo " the temproot environment"; + echo ''; + exit 1;} + +# We really don't want to have to deal with files like login.conf.db, pwd.db, +# or spwd.db. Instead, we want to compare the text versions, and run *_mkdb. +# Prompt the user to do so below, as needed. +# +rm -f ${TEMPROOT}/etc/*.db ${TEMPROOT}/etc/passwd + +# We only need to compare things like freebsd.cf once +find ${TEMPROOT}/usr/obj -type f -delete 2>/dev/null + +# Delete stuff we do not need to keep the mtree database small, +# and to make the actual comparison faster. +find ${TEMPROOT}/usr -type l -delete 2>/dev/null +find ${TEMPROOT} -type f -size 0 -delete 2>/dev/null +find -d ${TEMPROOT} -type d -empty -delete 2>/dev/null + +# Build the mtree database in a temporary location. +MTREENEW=`mktemp -t mergemaster.mtree` +mtree -ci -p ${TEMPROOT} -k size,md5digest > ${MTREENEW} 2>/dev/null + +if [ -s "${MTREENEW}" ]; then + echo "*** Saving mtree database for future upgrades" + test -e "${DESTDIR}${MTREEFILE}" && unlink ${DESTDIR}${MTREEFILE} + mv ${MTREENEW} ${DESTDIR}${MTREEFILE} +fi + +delete_temproot + +exit 0 From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 21:08:41 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA861106568B; Wed, 26 Aug 2009 21:08:41 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9EC918FC19; Wed, 26 Aug 2009 21:08:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QL8fZ3074317; Wed, 26 Aug 2009 21:08:41 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QL8fF7074314; Wed, 26 Aug 2009 21:08:41 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200908262108.n7QL8fF7074314@svn.freebsd.org> From: Doug Barton Date: Wed, 26 Aug 2009 21:08:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196566 - in stable/8/etc: . rc.d X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 21:08:41 -0000 Author: dougb Date: Wed Aug 26 21:08:41 2009 New Revision: 196566 URL: http://svn.freebsd.org/changeset/base/196566 Log: MFC 196436; Move is_wired_interface() from rc.d/wpa_supplicant into network.subr, simplify it a bit, and make use of that method to determine if an interface is a candidate for IPv6 rtsol rather than listing all of the possible wireless interfaces that should _not_ get rtsol'ed. This change is only relevant for 8.0+ unless the "wlan mandatory" code gets ported back to RELENG_7. Approved by: re (kib) Modified: stable/8/etc/ (props changed) stable/8/etc/network.subr stable/8/etc/rc.d/wpa_supplicant Modified: stable/8/etc/network.subr ============================================================================== --- stable/8/etc/network.subr Wed Aug 26 21:05:17 2009 (r196565) +++ stable/8/etc/network.subr Wed Aug 26 21:08:41 2009 (r196566) @@ -816,6 +816,17 @@ hexprint() echo ${str} } +is_wired_interface() +{ + local media + + case `ifconfig $1 2>/dev/null` in + *media:?Ethernet*) media=Ethernet ;; + esac + + test "$media" = "Ethernet" +} + # Setup the interfaces for IPv6 network6_interface_setup() { @@ -858,14 +869,19 @@ network6_interface_setup() ifconfig $i inet6 ${ipv6_ifconfig} alias fi + # Wireless NIC cards are virtualized through the wlan interface + if ! is_wired_interface ${i}; then + case "${i}" in + wlan*) rtsol_available=yes ;; + *) rtsol_available=no ;; + esac + fi + if [ ${rtsol_available} = yes -a ${rtsol_interface} = yes ] then case ${i} in lo0|gif[0-9]*|stf[0-9]*|faith[0-9]*|lp[0-9]*|sl[0-9]*|tun[0-9]*|pflog[0-9]*|pfsync[0-9]*) ;; - # Wireless NIC cards are virtualized through the wlan interface - an[0-9]*|ath[0-9]*|ipw[0-9]*|iwi[0-9]*|iwn[0-9]*|ral[0-9]*|wi[0-9]*|wl[0-9]*|wpi[0-9]*) - ;; *) rtsol_interfaces="${rtsol_interfaces} ${i}" ;; Modified: stable/8/etc/rc.d/wpa_supplicant ============================================================================== --- stable/8/etc/rc.d/wpa_supplicant Wed Aug 26 21:05:17 2009 (r196565) +++ stable/8/etc/rc.d/wpa_supplicant Wed Aug 26 21:08:41 2009 (r196566) @@ -18,18 +18,6 @@ if [ -z "$ifn" ]; then return 1 fi -is_wired_interface() -{ - media=`ifconfig $1 2>/dev/null | while read line; do - case "$line" in - *media:?Ethernet*) - echo Ethernet - ;; - esac - done` - test "$media" = "Ethernet" -} - is_ndis_interface() { case `sysctl -n net.wlan.${1#wlan}.%parent 2>/dev/null` in From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 21:10:48 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 100E710657D9; Wed, 26 Aug 2009 21:10:48 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F22548FC19; Wed, 26 Aug 2009 21:10:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QLAlGJ074476; Wed, 26 Aug 2009 21:10:47 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QLAlgm074474; Wed, 26 Aug 2009 21:10:47 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200908262110.n7QLAlgm074474@svn.freebsd.org> From: Marius Strobl Date: Wed, 26 Aug 2009 21:10:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196567 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 21:10:48 -0000 Author: marius Date: Wed Aug 26 21:10:47 2009 New Revision: 196567 URL: http://svn.freebsd.org/changeset/base/196567 Log: Add a temporary workaround which just lets init die instead of causing a panic if it is killed due to a unsolved stack overflow seen very late during shutdown on sparc64 when the gmirror worker process exists, which is a regression introduced in 8.0. Reviewed by: kib MFC after: 3 days Modified: head/sys/kern/kern_exit.c Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Wed Aug 26 21:08:41 2009 (r196566) +++ head/sys/kern/kern_exit.c Wed Aug 26 21:10:47 2009 (r196567) @@ -131,7 +131,12 @@ exit1(struct thread *td, int rv) mtx_assert(&Giant, MA_NOTOWNED); p = td->td_proc; - if (p == initproc) { + /* + * XXX in case we're rebooting we just let init die in order to + * work around an unsolved stack overflow seen very late during + * shutdown on sparc64 when the gmirror worker process exists. + */ + if (p == initproc && rebooting == 0) { printf("init died (signal %d, exit %d)\n", WTERMSIG(rv), WEXITSTATUS(rv)); panic("Going nowhere without my init!"); From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 21:14:28 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C96E5106568D; Wed, 26 Aug 2009 21:14:28 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B7FBF8FC22; Wed, 26 Aug 2009 21:14:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QLESST074727; Wed, 26 Aug 2009 21:14:28 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QLESLq074725; Wed, 26 Aug 2009 21:14:28 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200908262114.n7QLESLq074725@svn.freebsd.org> From: Stanislav Sedov Date: Wed, 26 Aug 2009 21:14:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196568 - head/sys/cam/scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 21:14:28 -0000 Author: stas Date: Wed Aug 26 21:14:28 2009 New Revision: 196568 URL: http://svn.freebsd.org/changeset/base/196568 Log: - Add quirk for Sony DSC digital cameras. This umass devices fail to attach without these quirks applied. PR: usb/137035 URL: http://lists.freebsd.org/pipermail/freebsd-current/2009-August/010852.html Reported by: Henri Hennebert , Andrey V. Elsukov MFC after: 1 week Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Wed Aug 26 21:10:47 2009 (r196567) +++ head/sys/cam/scsi/scsi_da.c Wed Aug 26 21:14:28 2009 (r196568) @@ -554,6 +554,14 @@ static struct da_quirk_entry da_quirk_ta { {T_DIRECT, SIP_MEDIA_REMOVABLE, "Netac", "OnlyDisk*", "2000"}, /*quirks*/ DA_Q_NO_SYNC_CACHE + }, + { + /* + * Sony Cyber-Shot DSC cameras + * PR: usb/137035 + */ + {T_DIRECT, SIP_MEDIA_REMOVABLE, "Sony", "Sony DSC", "*"}, + /*quirks*/ DA_Q_NO_SYNC_CACHE | DA_Q_NO_PREVENT } }; From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 21:32:51 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50D59106568B; Wed, 26 Aug 2009 21:32:51 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 25D448FC34; Wed, 26 Aug 2009 21:32:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QLWp13075308; Wed, 26 Aug 2009 21:32:51 GMT (envelope-from qingli@svn.freebsd.org) Received: (from qingli@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QLWpMt075306; Wed, 26 Aug 2009 21:32:51 GMT (envelope-from qingli@svn.freebsd.org) Message-Id: <200908262132.n7QLWpMt075306@svn.freebsd.org> From: Qing Li Date: Wed, 26 Aug 2009 21:32:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196569 - head/sys/netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 21:32:51 -0000 Author: qingli Date: Wed Aug 26 21:32:50 2009 New Revision: 196569 URL: http://svn.freebsd.org/changeset/base/196569 Log: When multiple interfaces exist in the system, with each interface having an IPv6 address assigned to it, and if an incoming packet received on one interface has a packet destination address that belongs to another interface, the routing table is consulted to determine how to reach this packet destination. Since the packet destination is an interface address, the route table will return a host route with the loopback interface as rt_ifp. The input code must recognize this fact, instead of using the loopback interface, the input code performs a search to find the right interface that owns the given IPv6 address. Reviewed by: bz, gnn, kmacy MFC after: immediately Modified: head/sys/netinet6/ip6_input.c Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Wed Aug 26 21:14:28 2009 (r196568) +++ head/sys/netinet6/ip6_input.c Wed Aug 26 21:32:50 2009 (r196569) @@ -628,8 +628,27 @@ passin: &rt6_key(rin6.ro_rt)->sin6_addr) #endif rin6.ro_rt->rt_ifp->if_type == IFT_LOOP) { - struct in6_ifaddr *ia6 = - (struct in6_ifaddr *)rin6.ro_rt->rt_ifa; + int free_ia6 = 0; + struct in6_ifaddr *ia6; + + /* + * found the loopback route to the interface address + */ + if (rin6.ro_rt->rt_gateway->sa_family == AF_LINK) { + struct sockaddr_in6 dest6; + + bzero(&dest6, sizeof(dest6)); + dest6.sin6_family = AF_INET6; + dest6.sin6_len = sizeof(dest6); + dest6.sin6_addr = ip6->ip6_dst; + ia6 = (struct in6_ifaddr *) + ifa_ifwithaddr((struct sockaddr *)&dest6); + if (ia6 == NULL) + goto bad; + free_ia6 = 1; + } + else + ia6 = (struct in6_ifaddr *)rin6.ro_rt->rt_ifa; /* * record address information into m_tag. @@ -647,6 +666,8 @@ passin: /* Count the packet in the ip address stats */ ia6->ia_ifa.if_ipackets++; ia6->ia_ifa.if_ibytes += m->m_pkthdr.len; + if (ia6 != NULL && free_ia6 != 0) + ifa_free(&ia6->ia_ifa); goto hbhcheck; } else { char ip6bufs[INET6_ADDRSTRLEN]; @@ -657,6 +678,8 @@ passin: ip6_sprintf(ip6bufs, &ip6->ip6_src), ip6_sprintf(ip6bufd, &ip6->ip6_dst))); + if (ia6 != NULL && free_ia6 != 0) + ifa_free(&ia6->ia_ifa); goto bad; } } From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 21:33:45 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 277F4106568C; Wed, 26 Aug 2009 21:33:45 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id ECB0D8FC34; Wed, 26 Aug 2009 21:33:44 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 9E73F46B09; Wed, 26 Aug 2009 17:33:44 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 01B348A02A; Wed, 26 Aug 2009 17:33:44 -0400 (EDT) From: John Baldwin To: Marius Strobl Date: Wed, 26 Aug 2009 17:33:37 -0400 User-Agent: KMail/1.9.7 References: <200908262110.n7QLAlgm074474@svn.freebsd.org> In-Reply-To: <200908262110.n7QLAlgm074474@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200908261733.38270.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Wed, 26 Aug 2009 17:33:44 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196567 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 21:33:45 -0000 On Wednesday 26 August 2009 5:10:47 pm Marius Strobl wrote: > Author: marius > Date: Wed Aug 26 21:10:47 2009 > New Revision: 196567 > URL: http://svn.freebsd.org/changeset/base/196567 > > Log: > Add a temporary workaround which just lets init die instead of > causing a panic if it is killed due to a unsolved stack overflow > seen very late during shutdown on sparc64 when the gmirror worker > process exists, which is a regression introduced in 8.0. Maybe still whine about it and just not panic() so that there is a reminder to fix this and remove the workaround? -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 22:32:15 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09916106568C; Wed, 26 Aug 2009 22:32:15 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D05AC8FC22; Wed, 26 Aug 2009 22:32:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QMWEei076782; Wed, 26 Aug 2009 22:32:14 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QMWEEI076780; Wed, 26 Aug 2009 22:32:14 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200908262232.n7QMWEEI076780@svn.freebsd.org> From: Doug Barton Date: Wed, 26 Aug 2009 22:32:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196571 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris conf contrib/dev/acpica contrib/pf dev/xen/xenpci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 22:32:15 -0000 Author: dougb Date: Wed Aug 26 22:32:14 2009 New Revision: 196571 URL: http://svn.freebsd.org/changeset/base/196571 Log: MFC r196435: The svnversion string is only relevant when newvers.sh is called during the kernel build process, the other places that call the script do not make use of that information. So restrict execution of the svnversion-related code to the kernel build context. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/newvers.sh stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/conf/newvers.sh ============================================================================== --- stable/8/sys/conf/newvers.sh Wed Aug 26 21:42:16 2009 (r196570) +++ stable/8/sys/conf/newvers.sh Wed Aug 26 22:32:14 2009 (r196571) @@ -87,29 +87,25 @@ touch version v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date` i=`${MAKE:-make} -V KERN_IDENT` -for dir in /bin /usr/bin /usr/local/bin; do - if [ -x "${dir}/svnversion" ]; then - svnversion=${dir}/svnversion - SRCDIR=${d##*obj} - if [ -n "$MACHINE" ]; then - SRCDIR=${SRCDIR##/$MACHINE} +case "$d" in +*/sys/*) + for dir in /bin /usr/bin /usr/local/bin; do + if [ -x "${dir}/svnversion" ]; then + svnversion=${dir}/svnversion + SRCDIR=${d##*obj} + if [ -n "$MACHINE" ]; then + SRCDIR=${SRCDIR##/$MACHINE} + fi + SRCDIR=${SRCDIR%%/sys/*} + break fi - SRCDIR=${SRCDIR%%/sys/*} - break - fi -done + done -if [ -n "$svnversion" -a -d "${SRCDIR}/.svn" ] ; then - # If we are called from the kernel build, limit - # the scope of svnversion to sys/ . - if [ -e "${SRCDIR}/sys/conf/newvers.sh" ] ; then - svn=" r`cd $SRCDIR/sys && $svnversion`" - else - svn=" r`cd $SRCDIR && $svnversion`" + if [ -n "$svnversion" -a -d "${SRCDIR}/sys/.svn" ] ; then + svn=" r`cd ${SRCDIR}/sys && $svnversion`" fi -else - svn="" -fi + ;; +esac cat << EOF > vers.c $COPYRIGHT From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 22:34:19 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4903106568C; Wed, 26 Aug 2009 22:34:19 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 4C8DD8FC1C; Wed, 26 Aug 2009 22:34:19 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.3/8.14.3/ALCHEMY.FRANKEN.DE) with ESMTP id n7QLufS9021836; Wed, 26 Aug 2009 23:56:41 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.3/8.14.3/Submit) id n7QLufpZ021835; Wed, 26 Aug 2009 23:56:41 +0200 (CEST) (envelope-from marius) Date: Wed, 26 Aug 2009 23:56:41 +0200 From: Marius Strobl To: John Baldwin Message-ID: <20090826215641.GH94142@alchemy.franken.de> References: <200908262110.n7QLAlgm074474@svn.freebsd.org> <200908261733.38270.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200908261733.38270.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r196567 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 22:34:19 -0000 On Wed, Aug 26, 2009 at 05:33:37PM -0400, John Baldwin wrote: > On Wednesday 26 August 2009 5:10:47 pm Marius Strobl wrote: > > Author: marius > > Date: Wed Aug 26 21:10:47 2009 > > New Revision: 196567 > > URL: http://svn.freebsd.org/changeset/base/196567 > > > > Log: > > Add a temporary workaround which just lets init die instead of > > causing a panic if it is killed due to a unsolved stack overflow > > seen very late during shutdown on sparc64 when the gmirror worker > > process exists, which is a regression introduced in 8.0. > > Maybe still whine about it and just not panic() so that there is a reminder to > fix this and remove the workaround? > Well, with a default configuration one still gets the usual "pid 1 (init), uid 0: exited on signal 4" on the console, which I thought would be sufficient whining. Marius From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 22:38:05 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7EB7810656E5; Wed, 26 Aug 2009 22:38:04 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id 42A458FC14; Wed, 26 Aug 2009 22:38:04 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 5C60A359960; Thu, 27 Aug 2009 00:38:03 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 3B7EB228CD; Thu, 27 Aug 2009 00:38:03 +0200 (CEST) Date: Thu, 27 Aug 2009 00:38:03 +0200 From: Jilles Tjoelker To: Bruce Evans Message-ID: <20090826223803.GA33468@stack.nl> References: <200908231244.n7NCiFgc061095@svn.freebsd.org> <20090823213759.GA55039@stack.nl> <20090825031355.B729@besplex.bde.org> <20090825210815.GA8792@stack.nl> <20090826163931.C41472@delplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090826163931.C41472@delplex.bde.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Konstantin Belousov Subject: Re: svn commit: r196460 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 22:38:05 -0000 On Wed, Aug 26, 2009 at 05:08:57PM +1000, Bruce Evans wrote: > On Tue, 25 Aug 2009, Jilles Tjoelker wrote: > > On Tue, Aug 25, 2009 at 04:07:11AM +1000, Bruce Evans wrote: > >> On Sun, 23 Aug 2009, Jilles Tjoelker wrote: > >> % Index: sys/fs/fifofs/fifo_vnops.c > >> % =================================================================== > >> % --- sys/fs/fifofs/fifo_vnops.c (revision 196459) > >> % +++ sys/fs/fifofs/fifo_vnops.c (working copy) > >> % @@ -193,6 +193,10 @@ > >> % goto fail2; > >> % fip->fi_writesock = wso; > >> % error = soconnect2(wso, rso); > >> % + if (error == 0) > >> % + error = soshutdown(rso, SHUT_WR); > >> % + if (error == 0) > >> % + error = soshutdown(wso, SHUT_RD); > >> % if (error) { > >> % (void)soclose(wso); > >> % fail2: > The second shutdown became harmless for me when I fixed the clobbering of > sb_state. Does it have any effect? It seems not. shutdown(SHUT_RD) basically calls the pru_flush protocol function (which uipc_usrreq.c does not provide), calls socantrecvmore (which uipc_usrreq.c had already done synchronously with the first shutdown) and clears the receive socket buffer (which is already empty). Regarding the direct access to SBS_CANTRCVMORE and SBS_CANTSENDMORE, this seems related to the special property of fifos that they can disconnect and reconnect a stream using the same object. The socket layer normally does not allow clearing SBS_CANTRCVMORE and SBS_CANTSENDMORE. The only case where fifo_vnops.c touches these flags directly where a so* function call could be used is the setting of SBS_CANTRCVMORE on the read side at initial creation (possibly because a wakeup is not necessary there). I suppose the new fifo implementation will avoid abusing sockets this way. -- Jilles Tjoelker From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 22:50:14 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91689106568D; Wed, 26 Aug 2009 22:50:14 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F6708FC3A; Wed, 26 Aug 2009 22:50:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QMoEaM077331; Wed, 26 Aug 2009 22:50:14 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QMoERq077329; Wed, 26 Aug 2009 22:50:14 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200908262250.n7QMoERq077329@svn.freebsd.org> From: Doug Barton Date: Wed, 26 Aug 2009 22:50:14 +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: r196572 - in stable/7/sys: . conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 22:50:14 -0000 Author: dougb Date: Wed Aug 26 22:50:14 2009 New Revision: 196572 URL: http://svn.freebsd.org/changeset/base/196572 Log: MFC r196435: The svnversion string is only relevant when newvers.sh is called during the kernel build process, the other places that call the script do not make use of that information. So restrict execution of the svnversion-related code to the kernel build context. Modified: stable/7/sys/ (props changed) stable/7/sys/conf/ (props changed) stable/7/sys/conf/newvers.sh Modified: stable/7/sys/conf/newvers.sh ============================================================================== --- stable/7/sys/conf/newvers.sh Wed Aug 26 22:32:14 2009 (r196571) +++ stable/7/sys/conf/newvers.sh Wed Aug 26 22:50:14 2009 (r196572) @@ -87,29 +87,25 @@ touch version v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date` i=`${MAKE:-make} -V KERN_IDENT` -for dir in /bin /usr/bin /usr/local/bin; do - if [ -x "${dir}/svnversion" ]; then - svnversion=${dir}/svnversion - SRCDIR=${d##*obj} - if [ -n "$MACHINE" ]; then - SRCDIR=${SRCDIR##/$MACHINE} +case "$d" in +*/sys/*) + for dir in /bin /usr/bin /usr/local/bin; do + if [ -x "${dir}/svnversion" ]; then + svnversion=${dir}/svnversion + SRCDIR=${d##*obj} + if [ -n "$MACHINE" ]; then + SRCDIR=${SRCDIR##/$MACHINE} + fi + SRCDIR=${SRCDIR%%/sys/*} + break fi - SRCDIR=${SRCDIR%%/sys/*} - break - fi -done + done -if [ -n "$svnversion" -a -d "${SRCDIR}/.svn" ] ; then - # If we are called from the kernel build, limit - # the scope of svnversion to sys/ . - if [ -e "${SRCDIR}/sys/conf/newvers.sh" ] ; then - svn=" r`cd $SRCDIR/sys && $svnversion`" - else - svn=" r`cd $SRCDIR && $svnversion`" + if [ -n "$svnversion" -a -d "${SRCDIR}/sys/.svn" ] ; then + svn=" r`cd ${SRCDIR}/sys && $svnversion`" fi -else - svn="" -fi + ;; +esac cat << EOF > vers.c $COPYRIGHT From owner-svn-src-all@FreeBSD.ORG Wed Aug 26 22:51:14 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C804F1065698; Wed, 26 Aug 2009 22:51:14 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B5F9D8FC49; Wed, 26 Aug 2009 22:51:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7QMpE2r077390; Wed, 26 Aug 2009 22:51:14 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7QMpEGK077388; Wed, 26 Aug 2009 22:51:14 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200908262251.n7QMpEGK077388@svn.freebsd.org> From: Doug Barton Date: Wed, 26 Aug 2009 22:51:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196573 - in stable/6/sys: . conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2009 22:51:14 -0000 Author: dougb Date: Wed Aug 26 22:51:14 2009 New Revision: 196573 URL: http://svn.freebsd.org/changeset/base/196573 Log: MFC r196435: The svnversion string is only relevant when newvers.sh is called during the kernel build process, the other places that call the script do not make use of that information. So restrict execution of the svnversion-related code to the kernel build context. Modified: stable/6/sys/ (props changed) stable/6/sys/conf/ (props changed) stable/6/sys/conf/newvers.sh Modified: stable/6/sys/conf/newvers.sh ============================================================================== --- stable/6/sys/conf/newvers.sh Wed Aug 26 22:50:14 2009 (r196572) +++ stable/6/sys/conf/newvers.sh Wed Aug 26 22:51:14 2009 (r196573) @@ -87,20 +87,22 @@ touch version v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date` i=`${MAKE:-make} -V KERN_IDENT` -for dir in /bin /usr/bin /usr/local/bin; do - if [ -x "${dir}/svnversion" ]; then - svnversion=${dir}/svnversion - SRCDIR=${d##*obj} - SRCDIR=${SRCDIR%%/sys/*} - break - fi -done +case "$d" in +*/sys/*) + for dir in /bin /usr/bin /usr/local/bin; do + if [ -x "${dir}/svnversion" ]; then + svnversion=${dir}/svnversion + SRCDIR=${d##*obj} + SRCDIR=${SRCDIR%%/sys/*} + break + fi + done -if [ -n "$svnversion" -a -d "${SRCDIR}/.svn" ] ; then - svn=" r`cd $SRCDIR && $svnversion`" -else - svn="" -fi + if [ -n "$svnversion" -a -d "${SRCDIR}/sys/.svn" ] ; then + svn=" r`cd ${SRCDIR}/sys && $svnversion`" + fi + ;; +esac cat << EOF > vers.c $COPYRIGHT From owner-svn-src-all@FreeBSD.ORG Thu Aug 27 00:45:01 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3D1F106568C; Thu, 27 Aug 2009 00:45:01 +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 9BE0A8FC20; Thu, 27 Aug 2009 00:45:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7R0j1UV079839; Thu, 27 Aug 2009 00:45:01 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7R0j1xs079837; Thu, 27 Aug 2009 00:45:01 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200908270045.n7R0j1xs079837@svn.freebsd.org> From: Attilio Rao Date: Thu, 27 Aug 2009 00:45:01 +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: r196574 - stable/7/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2009 00:45:01 -0000 Author: attilio Date: Thu Aug 27 00:45:00 2009 New Revision: 196574 URL: http://svn.freebsd.org/changeset/base/196574 Log: Fix a problem introduced when MFCing the rw_try_wlock() operation from HEAD: __rw_wunlock() relies on the cookie state to not be cleanly 'tid' when some conditions needing of special care happens, and lock recursion is among those. Dirty the cookie by adding the RW_LOCK_RECURSE flag in the case of a successfull try lock operation. This is not a problem on -CURRENT and STABLE_8 where the unlocking algorithm works differently. Submitted by: Andrew Brampton Modified: stable/7/sys/kern/kern_rwlock.c Modified: stable/7/sys/kern/kern_rwlock.c ============================================================================== --- stable/7/sys/kern/kern_rwlock.c Wed Aug 26 22:51:14 2009 (r196573) +++ stable/7/sys/kern/kern_rwlock.c Thu Aug 27 00:45:00 2009 (r196574) @@ -204,6 +204,7 @@ _rw_try_wlock(struct rwlock *rw, const c if (rw_wlocked(rw) && (rw->lock_object.lo_flags & RW_RECURSE) != 0) { rw->rw_recurse++; + atomic_set_ptr(&rw->rw_lock, RW_LOCK_RECURSED); rval = 1; } else rval = atomic_cmpset_acq_ptr(&rw->rw_lock, RW_UNLOCKED, From owner-svn-src-all@FreeBSD.ORG Thu Aug 27 07:05:46 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B6945106568C; Thu, 27 Aug 2009 07:05:46 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A488F8FC21; Thu, 27 Aug 2009 07:05:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7R75kwm087543; Thu, 27 Aug 2009 07:05:46 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7R75kd9087542; Thu, 27 Aug 2009 07:05:46 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200908270705.n7R75kd9087542@svn.freebsd.org> From: Brian Somers Date: Thu, 27 Aug 2009 07:05:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196575 - stable/8/usr.sbin/ppp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2009 07:05:46 -0000 Author: brian Date: Thu Aug 27 07:05:46 2009 New Revision: 196575 URL: http://svn.freebsd.org/changeset/base/196575 Log: MFC: When realloc()ing device memory for transfer to another ppp process, don't continue to use the realloc()d pointer - it might have changed! Remove some stray diagnostics while I'm here. Approved by: re (kib) Modified: stable/8/usr.sbin/ppp/ (props changed) stable/8/usr.sbin/ppp/ether.c stable/8/usr.sbin/ppp/netgraph.c stable/8/usr.sbin/ppp/tty.c Modified: stable/8/usr.sbin/ppp/ether.c ============================================================================== --- stable/8/usr.sbin/ppp/ether.c Thu Aug 27 00:45:00 2009 (r196574) +++ stable/8/usr.sbin/ppp/ether.c Thu Aug 27 07:05:46 2009 (r196575) @@ -193,17 +193,18 @@ static void ether_device2iov(struct device *d, struct iovec *iov, int *niov, int maxiov __unused, int *auxfd, int *nauxfd) { - struct etherdevice *dev = device2ether(d); + struct etherdevice *dev; int sz = physical_MaxDeviceSize(); - iov[*niov].iov_base = realloc(d, sz); - if (iov[*niov].iov_base == NULL) { + iov[*niov].iov_base = d = realloc(d, sz); + if (d == NULL) { log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); AbortProgram(EX_OSERR); } iov[*niov].iov_len = sz; (*niov)++; + dev = device2ether(d); if (dev->cs >= 0) { *auxfd = dev->cs; (*nauxfd)++; Modified: stable/8/usr.sbin/ppp/netgraph.c ============================================================================== --- stable/8/usr.sbin/ppp/netgraph.c Thu Aug 27 00:45:00 2009 (r196574) +++ stable/8/usr.sbin/ppp/netgraph.c Thu Aug 27 07:05:46 2009 (r196575) @@ -235,7 +235,6 @@ ng_Read(struct physical *p, void *v, siz { char hook[NG_HOOKSIZ]; -log_Printf(LogDEBUG, "ng_Read\n"); switch (p->dl->state) { case DATALINK_DIAL: case DATALINK_LOGIN: @@ -282,17 +281,18 @@ static void ng_device2iov(struct device *d, struct iovec *iov, int *niov, int maxiov __unused, int *auxfd, int *nauxfd) { - struct ngdevice *dev = device2ng(d); + struct ngdevice *dev; int sz = physical_MaxDeviceSize(); - iov[*niov].iov_base = realloc(d, sz); - if (iov[*niov].iov_base == NULL) { + iov[*niov].iov_base = d = realloc(d, sz); + if (d == NULL) { log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); AbortProgram(EX_OSERR); } iov[*niov].iov_len = sz; (*niov)++; + dev = device2ng(d); *auxfd = dev->cs; (*nauxfd)++; } Modified: stable/8/usr.sbin/ppp/tty.c ============================================================================== --- stable/8/usr.sbin/ppp/tty.c Thu Aug 27 00:45:00 2009 (r196574) +++ stable/8/usr.sbin/ppp/tty.c Thu Aug 27 07:05:46 2009 (r196575) @@ -384,7 +384,6 @@ UnloadLineDiscipline(struct physical *p) struct ttydevice *dev = device2tty(p->handler); if (isngtty(dev)) { -log_Printf(LogPHASE, "back to speed %d\n", dev->real.speed); if (!physical_SetSpeed(p, dev->real.speed)) log_Printf(LogWARN, "Couldn't reset tty speed to %d\n", dev->real.speed); dev->real.speed = 0; @@ -582,17 +581,19 @@ tty_device2iov(struct device *d, struct #endif ) { - struct ttydevice *dev = device2tty(d); + struct ttydevice *dev; int sz = physical_MaxDeviceSize(); - iov[*niov].iov_base = realloc(d, sz); - if (iov[*niov].iov_base == NULL) { + iov[*niov].iov_base = d = realloc(d, sz); + if (d == NULL) { log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); AbortProgram(EX_OSERR); } iov[*niov].iov_len = sz; (*niov)++; + dev = device2tty(d); + #ifndef NONETGRAPH if (dev->cs >= 0) { *auxfd = dev->cs; From owner-svn-src-all@FreeBSD.ORG Thu Aug 27 07:07:39 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35E73106568E; Thu, 27 Aug 2009 07:07:39 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 22FA28FC2D; Thu, 27 Aug 2009 07:07:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7R77dL6087627; Thu, 27 Aug 2009 07:07:39 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7R77drZ087622; Thu, 27 Aug 2009 07:07:39 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200908270707.n7R77drZ087622@svn.freebsd.org> From: Brian Somers Date: Thu, 27 Aug 2009 07:07:39 +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: r196576 - stable/8/usr.sbin/ppp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2009 07:07:39 -0000 Author: brian Date: Thu Aug 27 07:07:38 2009 New Revision: 196576 URL: http://svn.freebsd.org/changeset/base/196576 Log: MFC: When ``ppp -direct'' is invoked by a program that uses pipe(2) to create stdin and stdout, don't blindly try to use stdin as a bi-directional channel. Instead, detect the pipe and set up a special exec handler that indirects write() calls through stdout. This fixes the problem where ``set device "!ssh -e none host ppp -direct label"'' no longer works with an openssh-5.2 server side as that version of openssh ignores the USE_PIPES config setting and *always* uses pipes (rather than socketpair) for stdin/stdout channels. Approved by: re (kib) Modified: stable/8/usr.sbin/ppp/ (props changed) stable/8/usr.sbin/ppp/exec.c stable/8/usr.sbin/ppp/exec.h stable/8/usr.sbin/ppp/main.c stable/8/usr.sbin/ppp/physical.c Modified: stable/8/usr.sbin/ppp/exec.c ============================================================================== --- stable/8/usr.sbin/ppp/exec.c Thu Aug 27 07:05:46 2009 (r196575) +++ stable/8/usr.sbin/ppp/exec.c Thu Aug 27 07:07:38 2009 (r196576) @@ -35,7 +35,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -63,24 +65,106 @@ #include "cbcp.h" #include "datalink.h" #include "id.h" +#include "main.h" #include "exec.h" -static struct device execdevice = { + +struct execdevice { + struct device dev; /* What struct physical knows about */ + int fd_out; /* output descriptor */ +}; + +#define device2exec(d) ((d)->type == EXEC_DEVICE ? (struct execdevice *)d : NULL) + +unsigned +exec_DeviceSize(void) +{ + return sizeof(struct execdevice); +} + +static void +exec_Free(struct physical *p) +{ + struct execdevice *dev = device2exec(p->handler); + + if (dev->fd_out != -1) + close(dev->fd_out); + free(dev); +} + +static void +exec_device2iov(struct device *d, struct iovec *iov, int *niov, + int maxiov __unused, int *auxfd, int *nauxfd) +{ + struct execdevice *dev; + int sz = physical_MaxDeviceSize(); + + iov[*niov].iov_base = d = realloc(d, sz); + if (d == NULL) { + log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); + AbortProgram(EX_OSERR); + } + iov[*niov].iov_len = sz; + (*niov)++; + + dev = device2exec(d); + if (dev->fd_out >= 0) { + *auxfd = dev->fd_out; + (*nauxfd)++; + } +} + +static int +exec_RemoveFromSet(struct physical *p, fd_set *r, fd_set *w, fd_set *e) +{ + struct execdevice *dev = device2exec(p->handler); + int sets; + + p->handler->removefromset = NULL; + sets = physical_RemoveFromSet(p, r, w, e); + p->handler->removefromset = exec_RemoveFromSet; + + if (dev->fd_out >= 0) { + if (w && FD_ISSET(dev->fd_out, w)) { + FD_CLR(dev->fd_out, w); + log_Printf(LogTIMER, "%s: fdunset(w) %d\n", p->link.name, dev->fd_out); + sets++; + } + if (e && FD_ISSET(dev->fd_out, e)) { + FD_CLR(dev->fd_out, e); + log_Printf(LogTIMER, "%s: fdunset(e) %d\n", p->link.name, dev->fd_out); + sets++; + } + } + + return sets; +} + +static ssize_t +exec_Write(struct physical *p, const void *v, size_t n) +{ + struct execdevice *dev = device2exec(p->handler); + int fd = dev->fd_out == -1 ? p->fd : dev->fd_out; + + return write(fd, v, n); +} + +static struct device baseexecdevice = { EXEC_DEVICE, "exec", 0, { CD_NOTREQUIRED, 0 }, NULL, + exec_RemoveFromSet, NULL, NULL, NULL, NULL, NULL, + exec_Free, NULL, - NULL, - NULL, - NULL, - NULL, + exec_Write, + exec_device2iov, NULL, NULL, NULL @@ -88,146 +172,238 @@ static struct device execdevice = { struct device * exec_iov2device(int type, struct physical *p, struct iovec *iov, - int *niov, int maxiov __unused, int *auxfd __unused, - int *nauxfd __unused) + int *niov, int maxiov __unused, int *auxfd, int *nauxfd) { if (type == EXEC_DEVICE) { - free(iov[(*niov)++].iov_base); - physical_SetupStack(p, execdevice.name, PHYSICAL_NOFORCE); - return &execdevice; + struct execdevice *dev = (struct execdevice *)iov[(*niov)++].iov_base; + + dev = realloc(dev, sizeof *dev); /* Reduce to the correct size */ + if (dev == NULL) { + log_Printf(LogALERT, "Failed to allocate memory: %d\n", + (int)(sizeof *dev)); + AbortProgram(EX_OSERR); + } + + if (*nauxfd) { + dev->fd_out = *auxfd; + (*nauxfd)--; + } else + dev->fd_out = -1; + + /* Refresh function pointers etc */ + memcpy(&dev->dev, &baseexecdevice, sizeof dev->dev); + + physical_SetupStack(p, dev->dev.name, PHYSICAL_NOFORCE); + return &dev->dev; } return NULL; } +static int +exec_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n) +{ + struct physical *p = descriptor2physical(d); + struct execdevice *dev = device2exec(p->handler); + int result = 0; + + if (w && dev->fd_out >= 0) { + FD_SET(dev->fd_out, w); + log_Printf(LogTIMER, "%s: fdset(w) %d\n", p->link.name, dev->fd_out); + result++; + w = NULL; + } + + if (e && dev->fd_out >= 0) { + FD_SET(dev->fd_out, e); + log_Printf(LogTIMER, "%s: fdset(e) %d\n", p->link.name, dev->fd_out); + result++; + } + + if (result && *n <= dev->fd_out) + *n = dev->fd_out + 1; + + return result + physical_doUpdateSet(d, r, w, e, n, 0); +} + +static int +exec_IsSet(struct fdescriptor *d, const fd_set *fdset) +{ + struct physical *p = descriptor2physical(d); + struct execdevice *dev = device2exec(p->handler); + int result = dev->fd_out >= 0 && FD_ISSET(dev->fd_out, fdset); + result += physical_IsSet(d, fdset); + + return result; +} + struct device * exec_Create(struct physical *p) { - if (p->fd < 0 && *p->name.full == '!') { - int fids[2], type; - - p->fd--; /* We own the device but maybe can't use it - change fd */ - type = physical_IsSync(p) ? SOCK_DGRAM : SOCK_STREAM; + struct execdevice *dev; - if (socketpair(AF_UNIX, type, PF_UNSPEC, fids) < 0) - log_Printf(LogPHASE, "Unable to create pipe for line exec: %s\n", - strerror(errno)); - else { - static int child_status; /* This variable is abused ! */ - int stat, argc, i, ret, wret, pidpipe[2]; - pid_t pid, realpid; - char *argv[MAXARGS]; - - stat = fcntl(fids[0], F_GETFL, 0); - if (stat > 0) { - stat |= O_NONBLOCK; - fcntl(fids[0], F_SETFL, stat); + dev = NULL; + if (p->fd < 0) { + if (*p->name.full == '!') { + int fids[2], type; + + if ((dev = malloc(sizeof *dev)) == NULL) { + log_Printf(LogWARN, "%s: Cannot allocate an exec device: %s\n", + p->link.name, strerror(errno)); + return NULL; } - realpid = getpid(); - if (pipe(pidpipe) == -1) { - log_Printf(LogPHASE, "Unable to pipe for line exec: %s\n", + dev->fd_out = -1; + + p->fd--; /* We own the device but maybe can't use it - change fd */ + type = physical_IsSync(p) ? SOCK_DGRAM : SOCK_STREAM; + + if (socketpair(AF_UNIX, type, PF_UNSPEC, fids) < 0) { + log_Printf(LogPHASE, "Unable to create pipe for line exec: %s\n", strerror(errno)); - close(fids[1]); - } else switch ((pid = fork())) { - case -1: - log_Printf(LogPHASE, "Unable to fork for line exec: %s\n", + free(dev); + dev = NULL; + } else { + static int child_status; /* This variable is abused ! */ + int stat, argc, i, ret, wret, pidpipe[2]; + pid_t pid, realpid; + char *argv[MAXARGS]; + + stat = fcntl(fids[0], F_GETFL, 0); + if (stat > 0) { + stat |= O_NONBLOCK; + fcntl(fids[0], F_SETFL, stat); + } + realpid = getpid(); + if (pipe(pidpipe) == -1) { + log_Printf(LogPHASE, "Unable to pipe for line exec: %s\n", strerror(errno)); - close(pidpipe[0]); - close(pidpipe[1]); close(fids[1]); - break; - - case 0: - close(pidpipe[0]); close(fids[0]); - timer_TermService(); -#ifndef NOSUID - setuid(ID0realuid()); -#endif - - child_status = 0; - switch ((pid = vfork())) { - case 0: - close(pidpipe[1]); - break; - - case -1: - ret = errno; - log_Printf(LogPHASE, "Unable to vfork to drop parent: %s\n", - strerror(errno)); - close(pidpipe[1]); - _exit(ret); - - default: - write(pidpipe[1], &pid, sizeof pid); - close(pidpipe[1]); - _exit(child_status); /* The error from exec() ! */ - } - - log_Printf(LogDEBUG, "Exec'ing ``%s''\n", p->name.base); - - if ((argc = MakeArgs(p->name.base, argv, VECSIZE(argv), - PARSE_REDUCE|PARSE_NOHASH)) < 0) { - log_Printf(LogWARN, "Syntax error in exec command\n"); - _exit(ESRCH); - } - - command_Expand(argv, argc, (char const *const *)argv, - p->dl->bundle, 0, realpid); - - dup2(fids[1], STDIN_FILENO); - dup2(fids[1], STDOUT_FILENO); - dup2(fids[1], STDERR_FILENO); - for (i = getdtablesize(); i > STDERR_FILENO; i--) - fcntl(i, F_SETFD, 1); - - execvp(*argv, argv); - child_status = errno; /* Only works for vfork() */ - printf("execvp failed: %s: %s\r\n", *argv, strerror(child_status)); - _exit(child_status); - break; - - default: - close(pidpipe[1]); - close(fids[1]); - if (read(pidpipe[0], &p->session_owner, sizeof p->session_owner) != - sizeof p->session_owner) - p->session_owner = (pid_t)-1; - close(pidpipe[0]); - while ((wret = waitpid(pid, &stat, 0)) == -1 && errno == EINTR) - ; - if (wret == -1) { - log_Printf(LogWARN, "Waiting for child process: %s\n", + free(dev); + dev = NULL; + } else switch ((pid = fork())) { + case -1: + log_Printf(LogPHASE, "Unable to fork for line exec: %s\n", strerror(errno)); + close(pidpipe[0]); + close(pidpipe[1]); + close(fids[1]); close(fids[0]); - p->session_owner = (pid_t)-1; - break; - } else if (WIFSIGNALED(stat)) { - log_Printf(LogWARN, "Child process received sig %d !\n", - WTERMSIG(stat)); - close(fids[0]); - p->session_owner = (pid_t)-1; break; - } else if (WIFSTOPPED(stat)) { - log_Printf(LogWARN, "Child process received stop sig %d !\n", - WSTOPSIG(stat)); - /* I guess that's ok.... */ - } else if ((ret = WEXITSTATUS(stat))) { - log_Printf(LogWARN, "Cannot exec \"%s\": %s\n", p->name.base, - strerror(ret)); + + case 0: + close(pidpipe[0]); close(fids[0]); - p->session_owner = (pid_t)-1; + timer_TermService(); + #ifndef NOSUID + setuid(ID0realuid()); + #endif + + child_status = 0; + switch ((pid = vfork())) { + case 0: + close(pidpipe[1]); + break; + + case -1: + ret = errno; + log_Printf(LogPHASE, "Unable to vfork to drop parent: %s\n", + strerror(errno)); + close(pidpipe[1]); + _exit(ret); + + default: + write(pidpipe[1], &pid, sizeof pid); + close(pidpipe[1]); + _exit(child_status); /* The error from exec() ! */ + } + + log_Printf(LogDEBUG, "Exec'ing ``%s''\n", p->name.base); + + if ((argc = MakeArgs(p->name.base, argv, VECSIZE(argv), + PARSE_REDUCE|PARSE_NOHASH)) < 0) { + log_Printf(LogWARN, "Syntax error in exec command\n"); + _exit(ESRCH); + } + + command_Expand(argv, argc, (char const *const *)argv, + p->dl->bundle, 0, realpid); + + dup2(fids[1], STDIN_FILENO); + dup2(fids[1], STDOUT_FILENO); + dup2(fids[1], STDERR_FILENO); + for (i = getdtablesize(); i > STDERR_FILENO; i--) + fcntl(i, F_SETFD, 1); + + execvp(*argv, argv); + child_status = errno; /* Only works for vfork() */ + printf("execvp failed: %s: %s\r\n", *argv, strerror(child_status)); + _exit(child_status); break; - } - p->fd = fids[0]; - log_Printf(LogDEBUG, "Using descriptor %d for child\n", p->fd); - physical_SetupStack(p, execdevice.name, PHYSICAL_NOFORCE); - if (p->cfg.cd.necessity != CD_DEFAULT) - log_Printf(LogWARN, "Carrier settings ignored\n"); - return &execdevice; + + default: + close(pidpipe[1]); + close(fids[1]); + if (read(pidpipe[0], &p->session_owner, sizeof p->session_owner) != + sizeof p->session_owner) + p->session_owner = (pid_t)-1; + close(pidpipe[0]); + while ((wret = waitpid(pid, &stat, 0)) == -1 && errno == EINTR) + ; + if (wret == -1) { + log_Printf(LogWARN, "Waiting for child process: %s\n", + strerror(errno)); + close(fids[0]); + p->session_owner = (pid_t)-1; + break; + } else if (WIFSIGNALED(stat)) { + log_Printf(LogWARN, "Child process received sig %d !\n", + WTERMSIG(stat)); + close(fids[0]); + p->session_owner = (pid_t)-1; + break; + } else if (WIFSTOPPED(stat)) { + log_Printf(LogWARN, "Child process received stop sig %d !\n", + WSTOPSIG(stat)); + /* I guess that's ok.... */ + } else if ((ret = WEXITSTATUS(stat))) { + log_Printf(LogWARN, "Cannot exec \"%s\": %s\n", p->name.base, + strerror(ret)); + close(fids[0]); + p->session_owner = (pid_t)-1; + break; + } + p->fd = fids[0]; + log_Printf(LogDEBUG, "Using descriptor %d for child\n", p->fd); + } } - close(fids[0]); } + } else { + struct stat st; + + if (fstat(p->fd, &st) != -1 && (st.st_mode & S_IFIFO)) { + if ((dev = malloc(sizeof *dev)) == NULL) + log_Printf(LogWARN, "%s: Cannot allocate an exec device: %s\n", + p->link.name, strerror(errno)); + else if (p->fd == STDIN_FILENO) { + log_Printf(LogPHASE, "%s: Using stdin/stdout to communicate with " + "parent (pipe mode)\n", p->link.name); + dev->fd_out = dup(STDOUT_FILENO); + + /* Hook things up so that we monitor dev->fd_out */ + p->desc.UpdateSet = exec_UpdateSet; + p->desc.IsSet = exec_IsSet; + } else + dev->fd_out = -1; + } + } + + if (dev) { + memcpy(&dev->dev, &baseexecdevice, sizeof dev->dev); + physical_SetupStack(p, dev->dev.name, PHYSICAL_NOFORCE); + if (p->cfg.cd.necessity != CD_DEFAULT) + log_Printf(LogWARN, "Carrier settings ignored\n"); + return &dev->dev; } return NULL; Modified: stable/8/usr.sbin/ppp/exec.h ============================================================================== --- stable/8/usr.sbin/ppp/exec.h Thu Aug 27 07:05:46 2009 (r196575) +++ stable/8/usr.sbin/ppp/exec.h Thu Aug 27 07:07:38 2009 (r196576) @@ -32,4 +32,4 @@ struct device; extern struct device *exec_Create(struct physical *); extern struct device *exec_iov2device(int, struct physical *, struct iovec *, int *, int, int *, int *); -#define exec_DeviceSize physical_DeviceSize +extern unsigned exec_DeviceSize(void); Modified: stable/8/usr.sbin/ppp/main.c ============================================================================== --- stable/8/usr.sbin/ppp/main.c Thu Aug 27 07:05:46 2009 (r196575) +++ stable/8/usr.sbin/ppp/main.c Thu Aug 27 07:07:38 2009 (r196576) @@ -509,9 +509,11 @@ main(int argc, char **argv) if (!sw.fg) setsid(); } else { - /* -direct - STDIN_FILENO gets used by physical_Open */ + /* + * -direct - STDIN_FILENO gets used by physical_Open. STDOUT_FILENO + * *may* get used in exec/pipe mode. + */ prompt_TtyInit(NULL); - close(STDOUT_FILENO); close(STDERR_FILENO); } } else { Modified: stable/8/usr.sbin/ppp/physical.c ============================================================================== --- stable/8/usr.sbin/ppp/physical.c Thu Aug 27 07:05:46 2009 (r196575) +++ stable/8/usr.sbin/ppp/physical.c Thu Aug 27 07:07:38 2009 (r196576) @@ -1017,6 +1017,7 @@ physical_Open(struct physical *p) p->fd = STDIN_FILENO; for (h = 0; h < NDEVICES && p->handler == NULL && p->fd >= 0; h++) p->handler = (*devices[h].create)(p); + close(STDOUT_FILENO); if (p->fd >= 0) { if (p->handler == NULL) { physical_SetupStack(p, "unknown", PHYSICAL_NOFORCE); From owner-svn-src-all@FreeBSD.ORG Thu Aug 27 07:10:58 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDB171065690; Thu, 27 Aug 2009 07:10:57 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CBD4D8FC2E; Thu, 27 Aug 2009 07:10:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7R7AvUH087751; Thu, 27 Aug 2009 07:10:57 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7R7Av56087747; Thu, 27 Aug 2009 07:10:57 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200908270710.n7R7Av56087747@svn.freebsd.org> From: Brian Somers Date: Thu, 27 Aug 2009 07:10:57 +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: r196577 - stable/7/usr.sbin/ppp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2009 07:10:58 -0000 Author: brian Date: Thu Aug 27 07:10:57 2009 New Revision: 196577 URL: http://svn.freebsd.org/changeset/base/196577 Log: MFC: When realloc()ing device memory for transfer to another ppp process, don't continue to use the realloc()d pointer - it might have changed! Remove some stray diagnostics while I'm here. Modified: stable/7/usr.sbin/ppp/ (props changed) stable/7/usr.sbin/ppp/ether.c stable/7/usr.sbin/ppp/netgraph.c stable/7/usr.sbin/ppp/tty.c Modified: stable/7/usr.sbin/ppp/ether.c ============================================================================== --- stable/7/usr.sbin/ppp/ether.c Thu Aug 27 07:07:38 2009 (r196576) +++ stable/7/usr.sbin/ppp/ether.c Thu Aug 27 07:10:57 2009 (r196577) @@ -193,17 +193,18 @@ static void ether_device2iov(struct device *d, struct iovec *iov, int *niov, int maxiov __unused, int *auxfd, int *nauxfd) { - struct etherdevice *dev = device2ether(d); + struct etherdevice *dev; int sz = physical_MaxDeviceSize(); - iov[*niov].iov_base = realloc(d, sz); - if (iov[*niov].iov_base == NULL) { + iov[*niov].iov_base = d = realloc(d, sz); + if (d == NULL) { log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); AbortProgram(EX_OSERR); } iov[*niov].iov_len = sz; (*niov)++; + dev = device2ether(d); if (dev->cs >= 0) { *auxfd = dev->cs; (*nauxfd)++; Modified: stable/7/usr.sbin/ppp/netgraph.c ============================================================================== --- stable/7/usr.sbin/ppp/netgraph.c Thu Aug 27 07:07:38 2009 (r196576) +++ stable/7/usr.sbin/ppp/netgraph.c Thu Aug 27 07:10:57 2009 (r196577) @@ -235,7 +235,6 @@ ng_Read(struct physical *p, void *v, siz { char hook[NG_HOOKSIZ]; -log_Printf(LogDEBUG, "ng_Read\n"); switch (p->dl->state) { case DATALINK_DIAL: case DATALINK_LOGIN: @@ -282,17 +281,18 @@ static void ng_device2iov(struct device *d, struct iovec *iov, int *niov, int maxiov __unused, int *auxfd, int *nauxfd) { - struct ngdevice *dev = device2ng(d); + struct ngdevice *dev; int sz = physical_MaxDeviceSize(); - iov[*niov].iov_base = realloc(d, sz); - if (iov[*niov].iov_base == NULL) { + iov[*niov].iov_base = d = realloc(d, sz); + if (d == NULL) { log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); AbortProgram(EX_OSERR); } iov[*niov].iov_len = sz; (*niov)++; + dev = device2ng(d); *auxfd = dev->cs; (*nauxfd)++; } Modified: stable/7/usr.sbin/ppp/tty.c ============================================================================== --- stable/7/usr.sbin/ppp/tty.c Thu Aug 27 07:07:38 2009 (r196576) +++ stable/7/usr.sbin/ppp/tty.c Thu Aug 27 07:10:57 2009 (r196577) @@ -384,7 +384,6 @@ UnloadLineDiscipline(struct physical *p) struct ttydevice *dev = device2tty(p->handler); if (isngtty(dev)) { -log_Printf(LogPHASE, "back to speed %d\n", dev->real.speed); if (!physical_SetSpeed(p, dev->real.speed)) log_Printf(LogWARN, "Couldn't reset tty speed to %d\n", dev->real.speed); dev->real.speed = 0; @@ -582,17 +581,19 @@ tty_device2iov(struct device *d, struct #endif ) { - struct ttydevice *dev = device2tty(d); + struct ttydevice *dev; int sz = physical_MaxDeviceSize(); - iov[*niov].iov_base = realloc(d, sz); - if (iov[*niov].iov_base == NULL) { + iov[*niov].iov_base = d = realloc(d, sz); + if (d == NULL) { log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); AbortProgram(EX_OSERR); } iov[*niov].iov_len = sz; (*niov)++; + dev = device2tty(d); + #ifndef NONETGRAPH if (dev->cs >= 0) { *auxfd = dev->cs; From owner-svn-src-all@FreeBSD.ORG Thu Aug 27 07:11:47 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7883D106568E; Thu, 27 Aug 2009 07:11:47 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 65A4F8FC3F; Thu, 27 Aug 2009 07:11:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7R7BlX1087830; Thu, 27 Aug 2009 07:11:47 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7R7BlR6087825; Thu, 27 Aug 2009 07:11:47 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200908270711.n7R7BlR6087825@svn.freebsd.org> From: Brian Somers Date: Thu, 27 Aug 2009 07:11:47 +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: r196578 - stable/7/usr.sbin/ppp X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2009 07:11:47 -0000 Author: brian Date: Thu Aug 27 07:11:47 2009 New Revision: 196578 URL: http://svn.freebsd.org/changeset/base/196578 Log: MFC: When ``ppp -direct'' is invoked by a program that uses pipe(2) to create stdin and stdout, don't blindly try to use stdin as a bi-directional channel. Instead, detect the pipe and set up a special exec handler that indirects write() calls through stdout. This fixes the problem where ``set device "!ssh -e none host ppp -direct label"'' no longer works with an openssh-5.2 server side as that version of openssh ignores the USE_PIPES config setting and *always* uses pipes (rather than socketpair) for stdin/stdout channels. Modified: stable/7/usr.sbin/ppp/ (props changed) stable/7/usr.sbin/ppp/exec.c stable/7/usr.sbin/ppp/exec.h stable/7/usr.sbin/ppp/main.c stable/7/usr.sbin/ppp/physical.c Modified: stable/7/usr.sbin/ppp/exec.c ============================================================================== --- stable/7/usr.sbin/ppp/exec.c Thu Aug 27 07:10:57 2009 (r196577) +++ stable/7/usr.sbin/ppp/exec.c Thu Aug 27 07:11:47 2009 (r196578) @@ -35,7 +35,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -63,24 +65,106 @@ #include "cbcp.h" #include "datalink.h" #include "id.h" +#include "main.h" #include "exec.h" -static struct device execdevice = { + +struct execdevice { + struct device dev; /* What struct physical knows about */ + int fd_out; /* output descriptor */ +}; + +#define device2exec(d) ((d)->type == EXEC_DEVICE ? (struct execdevice *)d : NULL) + +unsigned +exec_DeviceSize(void) +{ + return sizeof(struct execdevice); +} + +static void +exec_Free(struct physical *p) +{ + struct execdevice *dev = device2exec(p->handler); + + if (dev->fd_out != -1) + close(dev->fd_out); + free(dev); +} + +static void +exec_device2iov(struct device *d, struct iovec *iov, int *niov, + int maxiov __unused, int *auxfd, int *nauxfd) +{ + struct execdevice *dev; + int sz = physical_MaxDeviceSize(); + + iov[*niov].iov_base = d = realloc(d, sz); + if (d == NULL) { + log_Printf(LogALERT, "Failed to allocate memory: %d\n", sz); + AbortProgram(EX_OSERR); + } + iov[*niov].iov_len = sz; + (*niov)++; + + dev = device2exec(d); + if (dev->fd_out >= 0) { + *auxfd = dev->fd_out; + (*nauxfd)++; + } +} + +static int +exec_RemoveFromSet(struct physical *p, fd_set *r, fd_set *w, fd_set *e) +{ + struct execdevice *dev = device2exec(p->handler); + int sets; + + p->handler->removefromset = NULL; + sets = physical_RemoveFromSet(p, r, w, e); + p->handler->removefromset = exec_RemoveFromSet; + + if (dev->fd_out >= 0) { + if (w && FD_ISSET(dev->fd_out, w)) { + FD_CLR(dev->fd_out, w); + log_Printf(LogTIMER, "%s: fdunset(w) %d\n", p->link.name, dev->fd_out); + sets++; + } + if (e && FD_ISSET(dev->fd_out, e)) { + FD_CLR(dev->fd_out, e); + log_Printf(LogTIMER, "%s: fdunset(e) %d\n", p->link.name, dev->fd_out); + sets++; + } + } + + return sets; +} + +static ssize_t +exec_Write(struct physical *p, const void *v, size_t n) +{ + struct execdevice *dev = device2exec(p->handler); + int fd = dev->fd_out == -1 ? p->fd : dev->fd_out; + + return write(fd, v, n); +} + +static struct device baseexecdevice = { EXEC_DEVICE, "exec", 0, { CD_NOTREQUIRED, 0 }, NULL, + exec_RemoveFromSet, NULL, NULL, NULL, NULL, NULL, + exec_Free, NULL, - NULL, - NULL, - NULL, - NULL, + exec_Write, + exec_device2iov, NULL, NULL, NULL @@ -88,146 +172,238 @@ static struct device execdevice = { struct device * exec_iov2device(int type, struct physical *p, struct iovec *iov, - int *niov, int maxiov __unused, int *auxfd __unused, - int *nauxfd __unused) + int *niov, int maxiov __unused, int *auxfd, int *nauxfd) { if (type == EXEC_DEVICE) { - free(iov[(*niov)++].iov_base); - physical_SetupStack(p, execdevice.name, PHYSICAL_NOFORCE); - return &execdevice; + struct execdevice *dev = (struct execdevice *)iov[(*niov)++].iov_base; + + dev = realloc(dev, sizeof *dev); /* Reduce to the correct size */ + if (dev == NULL) { + log_Printf(LogALERT, "Failed to allocate memory: %d\n", + (int)(sizeof *dev)); + AbortProgram(EX_OSERR); + } + + if (*nauxfd) { + dev->fd_out = *auxfd; + (*nauxfd)--; + } else + dev->fd_out = -1; + + /* Refresh function pointers etc */ + memcpy(&dev->dev, &baseexecdevice, sizeof dev->dev); + + physical_SetupStack(p, dev->dev.name, PHYSICAL_NOFORCE); + return &dev->dev; } return NULL; } +static int +exec_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n) +{ + struct physical *p = descriptor2physical(d); + struct execdevice *dev = device2exec(p->handler); + int result = 0; + + if (w && dev->fd_out >= 0) { + FD_SET(dev->fd_out, w); + log_Printf(LogTIMER, "%s: fdset(w) %d\n", p->link.name, dev->fd_out); + result++; + w = NULL; + } + + if (e && dev->fd_out >= 0) { + FD_SET(dev->fd_out, e); + log_Printf(LogTIMER, "%s: fdset(e) %d\n", p->link.name, dev->fd_out); + result++; + } + + if (result && *n <= dev->fd_out) + *n = dev->fd_out + 1; + + return result + physical_doUpdateSet(d, r, w, e, n, 0); +} + +static int +exec_IsSet(struct fdescriptor *d, const fd_set *fdset) +{ + struct physical *p = descriptor2physical(d); + struct execdevice *dev = device2exec(p->handler); + int result = dev->fd_out >= 0 && FD_ISSET(dev->fd_out, fdset); + result += physical_IsSet(d, fdset); + + return result; +} + struct device * exec_Create(struct physical *p) { - if (p->fd < 0 && *p->name.full == '!') { - int fids[2], type; - - p->fd--; /* We own the device but maybe can't use it - change fd */ - type = physical_IsSync(p) ? SOCK_DGRAM : SOCK_STREAM; + struct execdevice *dev; - if (socketpair(AF_UNIX, type, PF_UNSPEC, fids) < 0) - log_Printf(LogPHASE, "Unable to create pipe for line exec: %s\n", - strerror(errno)); - else { - static int child_status; /* This variable is abused ! */ - int stat, argc, i, ret, wret, pidpipe[2]; - pid_t pid, realpid; - char *argv[MAXARGS]; - - stat = fcntl(fids[0], F_GETFL, 0); - if (stat > 0) { - stat |= O_NONBLOCK; - fcntl(fids[0], F_SETFL, stat); + dev = NULL; + if (p->fd < 0) { + if (*p->name.full == '!') { + int fids[2], type; + + if ((dev = malloc(sizeof *dev)) == NULL) { + log_Printf(LogWARN, "%s: Cannot allocate an exec device: %s\n", + p->link.name, strerror(errno)); + return NULL; } - realpid = getpid(); - if (pipe(pidpipe) == -1) { - log_Printf(LogPHASE, "Unable to pipe for line exec: %s\n", + dev->fd_out = -1; + + p->fd--; /* We own the device but maybe can't use it - change fd */ + type = physical_IsSync(p) ? SOCK_DGRAM : SOCK_STREAM; + + if (socketpair(AF_UNIX, type, PF_UNSPEC, fids) < 0) { + log_Printf(LogPHASE, "Unable to create pipe for line exec: %s\n", strerror(errno)); - close(fids[1]); - } else switch ((pid = fork())) { - case -1: - log_Printf(LogPHASE, "Unable to fork for line exec: %s\n", + free(dev); + dev = NULL; + } else { + static int child_status; /* This variable is abused ! */ + int stat, argc, i, ret, wret, pidpipe[2]; + pid_t pid, realpid; + char *argv[MAXARGS]; + + stat = fcntl(fids[0], F_GETFL, 0); + if (stat > 0) { + stat |= O_NONBLOCK; + fcntl(fids[0], F_SETFL, stat); + } + realpid = getpid(); + if (pipe(pidpipe) == -1) { + log_Printf(LogPHASE, "Unable to pipe for line exec: %s\n", strerror(errno)); - close(pidpipe[0]); - close(pidpipe[1]); close(fids[1]); - break; - - case 0: - close(pidpipe[0]); close(fids[0]); - timer_TermService(); -#ifndef NOSUID - setuid(ID0realuid()); -#endif - - child_status = 0; - switch ((pid = vfork())) { - case 0: - close(pidpipe[1]); - break; - - case -1: - ret = errno; - log_Printf(LogPHASE, "Unable to vfork to drop parent: %s\n", - strerror(errno)); - close(pidpipe[1]); - _exit(ret); - - default: - write(pidpipe[1], &pid, sizeof pid); - close(pidpipe[1]); - _exit(child_status); /* The error from exec() ! */ - } - - log_Printf(LogDEBUG, "Exec'ing ``%s''\n", p->name.base); - - if ((argc = MakeArgs(p->name.base, argv, VECSIZE(argv), - PARSE_REDUCE|PARSE_NOHASH)) < 0) { - log_Printf(LogWARN, "Syntax error in exec command\n"); - _exit(ESRCH); - } - - command_Expand(argv, argc, (char const *const *)argv, - p->dl->bundle, 0, realpid); - - dup2(fids[1], STDIN_FILENO); - dup2(fids[1], STDOUT_FILENO); - dup2(fids[1], STDERR_FILENO); - for (i = getdtablesize(); i > STDERR_FILENO; i--) - fcntl(i, F_SETFD, 1); - - execvp(*argv, argv); - child_status = errno; /* Only works for vfork() */ - printf("execvp failed: %s: %s\r\n", *argv, strerror(child_status)); - _exit(child_status); - break; - - default: - close(pidpipe[1]); - close(fids[1]); - if (read(pidpipe[0], &p->session_owner, sizeof p->session_owner) != - sizeof p->session_owner) - p->session_owner = (pid_t)-1; - close(pidpipe[0]); - while ((wret = waitpid(pid, &stat, 0)) == -1 && errno == EINTR) - ; - if (wret == -1) { - log_Printf(LogWARN, "Waiting for child process: %s\n", + free(dev); + dev = NULL; + } else switch ((pid = fork())) { + case -1: + log_Printf(LogPHASE, "Unable to fork for line exec: %s\n", strerror(errno)); + close(pidpipe[0]); + close(pidpipe[1]); + close(fids[1]); close(fids[0]); - p->session_owner = (pid_t)-1; - break; - } else if (WIFSIGNALED(stat)) { - log_Printf(LogWARN, "Child process received sig %d !\n", - WTERMSIG(stat)); - close(fids[0]); - p->session_owner = (pid_t)-1; break; - } else if (WIFSTOPPED(stat)) { - log_Printf(LogWARN, "Child process received stop sig %d !\n", - WSTOPSIG(stat)); - /* I guess that's ok.... */ - } else if ((ret = WEXITSTATUS(stat))) { - log_Printf(LogWARN, "Cannot exec \"%s\": %s\n", p->name.base, - strerror(ret)); + + case 0: + close(pidpipe[0]); close(fids[0]); - p->session_owner = (pid_t)-1; + timer_TermService(); + #ifndef NOSUID + setuid(ID0realuid()); + #endif + + child_status = 0; + switch ((pid = vfork())) { + case 0: + close(pidpipe[1]); + break; + + case -1: + ret = errno; + log_Printf(LogPHASE, "Unable to vfork to drop parent: %s\n", + strerror(errno)); + close(pidpipe[1]); + _exit(ret); + + default: + write(pidpipe[1], &pid, sizeof pid); + close(pidpipe[1]); + _exit(child_status); /* The error from exec() ! */ + } + + log_Printf(LogDEBUG, "Exec'ing ``%s''\n", p->name.base); + + if ((argc = MakeArgs(p->name.base, argv, VECSIZE(argv), + PARSE_REDUCE|PARSE_NOHASH)) < 0) { + log_Printf(LogWARN, "Syntax error in exec command\n"); + _exit(ESRCH); + } + + command_Expand(argv, argc, (char const *const *)argv, + p->dl->bundle, 0, realpid); + + dup2(fids[1], STDIN_FILENO); + dup2(fids[1], STDOUT_FILENO); + dup2(fids[1], STDERR_FILENO); + for (i = getdtablesize(); i > STDERR_FILENO; i--) + fcntl(i, F_SETFD, 1); + + execvp(*argv, argv); + child_status = errno; /* Only works for vfork() */ + printf("execvp failed: %s: %s\r\n", *argv, strerror(child_status)); + _exit(child_status); break; - } - p->fd = fids[0]; - log_Printf(LogDEBUG, "Using descriptor %d for child\n", p->fd); - physical_SetupStack(p, execdevice.name, PHYSICAL_NOFORCE); - if (p->cfg.cd.necessity != CD_DEFAULT) - log_Printf(LogWARN, "Carrier settings ignored\n"); - return &execdevice; + + default: + close(pidpipe[1]); + close(fids[1]); + if (read(pidpipe[0], &p->session_owner, sizeof p->session_owner) != + sizeof p->session_owner) + p->session_owner = (pid_t)-1; + close(pidpipe[0]); + while ((wret = waitpid(pid, &stat, 0)) == -1 && errno == EINTR) + ; + if (wret == -1) { + log_Printf(LogWARN, "Waiting for child process: %s\n", + strerror(errno)); + close(fids[0]); + p->session_owner = (pid_t)-1; + break; + } else if (WIFSIGNALED(stat)) { + log_Printf(LogWARN, "Child process received sig %d !\n", + WTERMSIG(stat)); + close(fids[0]); + p->session_owner = (pid_t)-1; + break; + } else if (WIFSTOPPED(stat)) { + log_Printf(LogWARN, "Child process received stop sig %d !\n", + WSTOPSIG(stat)); + /* I guess that's ok.... */ + } else if ((ret = WEXITSTATUS(stat))) { + log_Printf(LogWARN, "Cannot exec \"%s\": %s\n", p->name.base, + strerror(ret)); + close(fids[0]); + p->session_owner = (pid_t)-1; + break; + } + p->fd = fids[0]; + log_Printf(LogDEBUG, "Using descriptor %d for child\n", p->fd); + } } - close(fids[0]); } + } else { + struct stat st; + + if (fstat(p->fd, &st) != -1 && (st.st_mode & S_IFIFO)) { + if ((dev = malloc(sizeof *dev)) == NULL) + log_Printf(LogWARN, "%s: Cannot allocate an exec device: %s\n", + p->link.name, strerror(errno)); + else if (p->fd == STDIN_FILENO) { + log_Printf(LogPHASE, "%s: Using stdin/stdout to communicate with " + "parent (pipe mode)\n", p->link.name); + dev->fd_out = dup(STDOUT_FILENO); + + /* Hook things up so that we monitor dev->fd_out */ + p->desc.UpdateSet = exec_UpdateSet; + p->desc.IsSet = exec_IsSet; + } else + dev->fd_out = -1; + } + } + + if (dev) { + memcpy(&dev->dev, &baseexecdevice, sizeof dev->dev); + physical_SetupStack(p, dev->dev.name, PHYSICAL_NOFORCE); + if (p->cfg.cd.necessity != CD_DEFAULT) + log_Printf(LogWARN, "Carrier settings ignored\n"); + return &dev->dev; } return NULL; Modified: stable/7/usr.sbin/ppp/exec.h ============================================================================== --- stable/7/usr.sbin/ppp/exec.h Thu Aug 27 07:10:57 2009 (r196577) +++ stable/7/usr.sbin/ppp/exec.h Thu Aug 27 07:11:47 2009 (r196578) @@ -32,4 +32,4 @@ struct device; extern struct device *exec_Create(struct physical *); extern struct device *exec_iov2device(int, struct physical *, struct iovec *, int *, int, int *, int *); -#define exec_DeviceSize physical_DeviceSize +extern unsigned exec_DeviceSize(void); Modified: stable/7/usr.sbin/ppp/main.c ============================================================================== --- stable/7/usr.sbin/ppp/main.c Thu Aug 27 07:10:57 2009 (r196577) +++ stable/7/usr.sbin/ppp/main.c Thu Aug 27 07:11:47 2009 (r196578) @@ -508,9 +508,11 @@ main(int argc, char **argv) if (!sw.fg) setsid(); } else { - /* -direct - STDIN_FILENO gets used by physical_Open */ + /* + * -direct - STDIN_FILENO gets used by physical_Open. STDOUT_FILENO + * *may* get used in exec/pipe mode. + */ prompt_TtyInit(NULL); - close(STDOUT_FILENO); close(STDERR_FILENO); } } else { Modified: stable/7/usr.sbin/ppp/physical.c ============================================================================== --- stable/7/usr.sbin/ppp/physical.c Thu Aug 27 07:10:57 2009 (r196577) +++ stable/7/usr.sbin/ppp/physical.c Thu Aug 27 07:11:47 2009 (r196578) @@ -1027,6 +1027,7 @@ physical_Open(struct physical *p) p->fd = STDIN_FILENO; for (h = 0; h < NDEVICES && p->handler == NULL && p->fd >= 0; h++) p->handler = (*devices[h].create)(p); + close(STDOUT_FILENO); if (p->fd >= 0) { if (p->handler == NULL) { physical_SetupStack(p, "unknown", PHYSICAL_NOFORCE); From owner-svn-src-all@FreeBSD.ORG Thu Aug 27 08:28:34 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99FDE106568D; Thu, 27 Aug 2009 08:28:34 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 88F918FC49; Thu, 27 Aug 2009 08:28:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7R8SYYs089291; Thu, 27 Aug 2009 08:28:34 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7R8SYFb089289; Thu, 27 Aug 2009 08:28:34 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908270828.n7R8SYFb089289@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 27 Aug 2009 08:28:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196579 - head/sys/geom/multipath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2009 08:28:34 -0000 Author: pjd Date: Thu Aug 27 08:28:34 2009 New Revision: 196579 URL: http://svn.freebsd.org/changeset/base/196579 Log: Fix an obvious topology lock leak. MFC after: 3 days Modified: head/sys/geom/multipath/g_multipath.c Modified: head/sys/geom/multipath/g_multipath.c ============================================================================== --- head/sys/geom/multipath/g_multipath.c Thu Aug 27 07:11:47 2009 (r196578) +++ head/sys/geom/multipath/g_multipath.c Thu Aug 27 08:28:34 2009 (r196579) @@ -198,6 +198,7 @@ g_multipath_done_error(struct bio *bp) if (sc->cp_active == NULL) { printf("GEOM_MULTIPATH: out of providers for %s\n", sc->sc_name); + g_topology_unlock(); return; } else { printf("GEOM_MULTIPATH: %s now active path in %s\n", From owner-svn-src-all@FreeBSD.ORG Thu Aug 27 08:40:51 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5D73106568E; Thu, 27 Aug 2009 08:40:51 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 94B998FC1C; Thu, 27 Aug 2009 08:40:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7R8epL5089599; Thu, 27 Aug 2009 08:40:51 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7R8ep2R089597; Thu, 27 Aug 2009 08:40:51 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200908270840.n7R8ep2R089597@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 27 Aug 2009 08:40:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196580 - head/sys/geom/multipath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2009 08:40:51 -0000 Author: pjd Date: Thu Aug 27 08:40:51 2009 New Revision: 196580 URL: http://svn.freebsd.org/changeset/base/196580 Log: There's no need for checking result of M_WAITOK allocation. Modified: head/sys/geom/multipath/g_multipath.c Modified: head/sys/geom/multipath/g_multipath.c ============================================================================== --- head/sys/geom/multipath/g_multipath.c Thu Aug 27 08:28:34 2009 (r196579) +++ head/sys/geom/multipath/g_multipath.c Thu Aug 27 08:40:51 2009 (r196580) @@ -295,10 +295,6 @@ g_multipath_create(struct g_class *mp, s } sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); - if (sc == NULL) { - goto fail; - } - gp->softc = sc; gp->start = g_multipath_start; gp->orphan = g_multipath_orphan; From owner-svn-src-all@FreeBSD.ORG Thu Aug 27 12:22:51 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 045E4106568E; Thu, 27 Aug 2009 12:22:51 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DC83E8FC1C; Thu, 27 Aug 2009 12:22:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RCMoeB095654; Thu, 27 Aug 2009 12:22:50 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RCMoPO095649; Thu, 27 Aug 2009 12:22:50 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200908271222.n7RCMoPO095649@svn.freebsd.org> From: Edwin Groothuis Date: Thu, 27 Aug 2009 12:22:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196581 - head/share/zoneinfo X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2009 12:22:51 -0000 Author: edwin Date: Thu Aug 27 12:22:50 2009 New Revision: 196581 URL: http://svn.freebsd.org/changeset/base/196581 Log: MFV of r195792: Import of tzdata2009k to head. - Changes in Mauritius and Bangladesh - No leapsecond at the end of December 2009 Modified: head/share/zoneinfo/ (props changed) head/share/zoneinfo/africa head/share/zoneinfo/asia head/share/zoneinfo/europe head/share/zoneinfo/leapseconds Modified: head/share/zoneinfo/africa ============================================================================== --- head/share/zoneinfo/africa Thu Aug 27 08:40:51 2009 (r196580) +++ head/share/zoneinfo/africa Thu Aug 27 12:22:50 2009 (r196581) @@ -1,5 +1,5 @@ #
-# @(#)africa	8.21
+# @(#)africa	8.22
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -502,11 +502,33 @@ Zone Africa/Nouakchott	-1:03:48 -	LMT	19
 # http://www.gov.mu/portal/goc/assemblysite/file/bill2708.pdf
 # 
 
+# From Steffen Thorsen (2009-06-05):
+# According to several sources, Mauritius will not continue to observe
+# DST the coming summer...
+#
+# Some sources, in French:
+# 
+# http://www.defimedia.info/news/946/Rashid-Beebeejaun-:-%C2%AB-L%E2%80%99heure-d%E2%80%99%C3%A9t%C3%A9-ne-sera-pas-appliqu%C3%A9e-cette-ann%C3%A9e-%C2%BB
+# 
+# 
+# http://lexpress.mu/Story/3398~Beebeejaun---Les-objectifs-d-%C3%A9conomie-d-%C3%A9nergie-de-l-heure-d-%C3%A9t%C3%A9-ont-%C3%A9t%C3%A9-atteints-
+# 
+#
+# Our wrap-up:
+# 
+# http://www.timeanddate.com/news/time/mauritius-dst-will-not-repeat.html
+# 
+
+# From Arthur David Olson (2009-07-11):
+# The "mauritius-dst-will-not-repeat" wrapup includes this: 
+# "The trial ended on March 29, 2009, when the clocks moved back by one hour
+# at 2am (or 02:00) local time..."
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule Mauritius	1982	only	-	Oct	10	0:00	1:00	S
 Rule Mauritius	1983	only	-	Mar	21	0:00	0	-
-Rule Mauritius	2008	max	-	Oct	lastSun	2:00s	1:00	S
-Rule Mauritius	2009	max	-	Mar	lastSun	2:00s	0	-
+Rule Mauritius	2008	only	-	Oct	lastSun	2:00	1:00	S
+Rule Mauritius	2009	only	-	Mar	lastSun	2:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Indian/Mauritius	3:50:00 -	LMT	1907		# Port Louis
 			4:00 Mauritius	MU%sT	# Mauritius Time

Modified: head/share/zoneinfo/asia
==============================================================================
--- head/share/zoneinfo/asia	Thu Aug 27 08:40:51 2009	(r196580)
+++ head/share/zoneinfo/asia	Thu Aug 27 12:22:50 2009	(r196581)
@@ -1,5 +1,5 @@
 # 
-# @(#)asia	8.35
+# @(#)asia	8.36
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -172,6 +172,12 @@ Zone	Asia/Bahrain	3:22:20 -	LMT	1920		# 
 #
 # No DST end date has been announced yet.
 
+# From Arthur David Olson (2009-07-11):
+# Arbitrarily end DST at the end of 2009 so that a POSIX-sytle time zone string
+# can appear in the Dhaka binary file and for the benefit of old glibc
+# reimplementations of the time zone software that mishandle permanent DST.
+# A change will be required once the end date is known.
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Dhaka	6:01:40 -	LMT	1890
 			5:53:20	-	HMT	1941 Oct    # Howrah Mean Time?
@@ -180,7 +186,8 @@ Zone	Asia/Dhaka	6:01:40 -	LMT	1890
 			6:30	-	BURT	1951 Sep 30
 			6:00	-	DACT	1971 Mar 26 # Dacca Time
 			6:00	-	BDT	2009 Jun 19 23:00 # Bangladesh Time
-			6:00	1:00	BDST
+			6:00	1:00	BDST	2010
+			6:00	-	BDT
 
 # Bhutan
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]

Modified: head/share/zoneinfo/europe
==============================================================================
--- head/share/zoneinfo/europe	Thu Aug 27 08:40:51 2009	(r196580)
+++ head/share/zoneinfo/europe	Thu Aug 27 12:22:50 2009	(r196581)
@@ -1,5 +1,5 @@
 # 
-# @(#)europe	8.21
+# @(#)europe	8.22
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -459,7 +459,7 @@ Rule	EU	1979	1995	-	Sep	lastSun	 1:00u	0
 Rule	EU	1981	max	-	Mar	lastSun	 1:00u	1:00	S
 Rule	EU	1996	max	-	Oct	lastSun	 1:00u	0	-
 # The most recent directive covers the years starting in 2002.  See:
-# 
+# 
 # Directive 2000/84/EC of the European Parliament and of the Council
 # of 19 January 2001 on summer-time arrangements.
 # 

Modified: head/share/zoneinfo/leapseconds
==============================================================================
--- head/share/zoneinfo/leapseconds	Thu Aug 27 08:40:51 2009	(r196580)
+++ head/share/zoneinfo/leapseconds	Thu Aug 27 12:22:50 2009	(r196581)
@@ -1,5 +1,5 @@
 # 
-# @(#)leapseconds	8.8
+# @(#)leapseconds	8.9
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -58,29 +58,30 @@ Leap	2008	Dec	31	23:59:60	+	S
 # 61, Av. de l'Observatoire 75014 PARIS (France)
 # Tel.      : 33 (0) 1 40 51 22 26
 # FAX       : 33 (0) 1 40 51 22 91
-# e-mail    : services.iers@obspm.fr
-# http://hpiers.obspm.fr/eop-pc
+# Internet  : services.iers@obspm.fr
 #
-# Paris, 15 January 2009
+# Paris, 4 July 2009
 #
-# Bulletin C 37
+# Bulletin C 38
 #
 # To authorities responsible
 # for the measurement and
 # distribution of time
 #
-# NO positive leap second will be introduced at the end of June 2009.
-# The difference between Coordinated Universal Time UTC and the 
-# International Atomic Time TAI is :             
-#                
-#     from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
+# INFORMATION ON UTC - TAI
+#
+# NO positive leap second will be introduced at the end of December 2009.
+# The difference between Coordinated Universal Time UTC and the
+# International Atomic Time TAI is :		
+#
+# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
 #
 # Leap seconds can be introduced in UTC at the end of the months of December
-# or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
-# six months, either to announce a time step in UTC or to confirm that there
+# or June,  depending on the evolution of UT1-TAI. Bulletin C is mailed every
+# six months, either to announce a time step in UTC, or to confirm that there
 # will be no time step at the next possible date.
 #
 # Daniel GAMBIS
-# Head		
+# Director			
 # Earth Orientation Center of IERS
 # Observatoire de Paris, France

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 12:24:21 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8ED20106568C;
	Thu, 27 Aug 2009 12:24:21 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 737638FC41;
	Thu, 27 Aug 2009 12:24:21 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RCOLTm095729;
	Thu, 27 Aug 2009 12:24:21 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RCOL25095726;
	Thu, 27 Aug 2009 12:24:21 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200908271224.n7RCOL25095726@svn.freebsd.org>
From: Edwin Groothuis 
Date: Thu, 27 Aug 2009 12:24:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196582 - head/share/zoneinfo
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 12:24:21 -0000

Author: edwin
Date: Thu Aug 27 12:24:21 2009
New Revision: 196582
URL: http://svn.freebsd.org/changeset/base/196582

Log:
  MFV of r196350
  
  Import of tzdata2009l
  
  - Egypt will go to Wintertime on 21 August 2009
  - Heads up for a possible DST in Samoa

Modified:
  head/share/zoneinfo/   (props changed)
  head/share/zoneinfo/africa
  head/share/zoneinfo/australasia

Modified: head/share/zoneinfo/africa
==============================================================================
--- head/share/zoneinfo/africa	Thu Aug 27 12:22:50 2009	(r196581)
+++ head/share/zoneinfo/africa	Thu Aug 27 12:24:21 2009	(r196582)
@@ -1,5 +1,5 @@
 # 
-# @(#)africa	8.22
+# @(#)africa	8.23
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -276,8 +276,27 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	23:00s
 # In 2009 (and for the next several years), Ramadan ends before the fourth
 # Thursday in September; Egypt is expected to revert to the last Thursday
 # in September.
+
+# From Steffen Thorsen (2009-08-11):
+# We have been able to confirm the August change with the Egyptian Cabinet 
+# Information and Decision Support Center:
+# 
+# http://www.timeanddate.com/news/time/egypt-dst-ends-2009.html
+# 
+# 
+# The Middle East News Agency
+# 
+# http://www.mena.org.eg/index.aspx
+# 
+# also reports "Egypt starts winter time on August 21"
+# today in article numbered "71, 11/08/2009 12:25 GMT." 
+# Only the title above is available without a subscription to their service,
+# and can be found by searching for "winter" in their search engine
+# (at least today).
+
 Rule	Egypt	2008	only	-	Aug	lastThu	23:00s	0	-
-Rule	Egypt	2009	max	-	Sep	lastThu	23:00s	0	-
+Rule	Egypt	2009	only	-	Aug	20	23:00s	0	-
+Rule	Egypt	2010	max	-	Sep	lastThu	23:00s	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Cairo	2:05:00 -	LMT	1900 Oct

Modified: head/share/zoneinfo/australasia
==============================================================================
--- head/share/zoneinfo/australasia	Thu Aug 27 12:22:50 2009	(r196581)
+++ head/share/zoneinfo/australasia	Thu Aug 27 12:24:21 2009	(r196582)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.11
+# @(#)australasia	8.12
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -427,6 +427,22 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 			-11:00	-	SST			# S=Samoa
 
 # Samoa
+
+# From Alexander Krivenyshev (2008-12-06):
+# The Samoa government (Western Samoa) may implement DST on the first Sunday of 
+# October 2009 (October 4, 2009) until the last Sunday of March 2010 (March 28, 
+# 2010). 
+# 
+# "Selected Committee reports to Cabinet on Daylight Saving Time",
+# Government of Samoa:
+# 
+# http://www.govt.ws/pr_article.cfm?pr_id=560
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_samoa01.html
+# 
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 12:27:06 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 74C51106568B;
	Thu, 27 Aug 2009 12:27:06 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 625A18FC3C;
	Thu, 27 Aug 2009 12:27:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RCR66a095862;
	Thu, 27 Aug 2009 12:27:06 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RCR6FB095857;
	Thu, 27 Aug 2009 12:27:06 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200908271227.n7RCR6FB095857@svn.freebsd.org>
From: Edwin Groothuis 
Date: Thu, 27 Aug 2009 12:27:06 +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: r196583 - stable/7/share/zoneinfo
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 12:27:06 -0000

Author: edwin
Date: Thu Aug 27 12:27:06 2009
New Revision: 196583
URL: http://svn.freebsd.org/changeset/base/196583

Log:
  MFC of r196581: Import of tzdata2009k
  
  - Changes in Mauritius and Bangladesh
  - No leapsecond at the end of December 2009

Modified:
  stable/7/share/zoneinfo/   (props changed)
  stable/7/share/zoneinfo/africa
  stable/7/share/zoneinfo/asia
  stable/7/share/zoneinfo/europe
  stable/7/share/zoneinfo/leapseconds

Modified: stable/7/share/zoneinfo/africa
==============================================================================
--- stable/7/share/zoneinfo/africa	Thu Aug 27 12:24:21 2009	(r196582)
+++ stable/7/share/zoneinfo/africa	Thu Aug 27 12:27:06 2009	(r196583)
@@ -1,5 +1,5 @@
 # 
-# @(#)africa	8.21
+# @(#)africa	8.22
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -502,11 +502,33 @@ Zone Africa/Nouakchott	-1:03:48 -	LMT	19
 # http://www.gov.mu/portal/goc/assemblysite/file/bill2708.pdf
 # 
 
+# From Steffen Thorsen (2009-06-05):
+# According to several sources, Mauritius will not continue to observe
+# DST the coming summer...
+#
+# Some sources, in French:
+# 
+# http://www.defimedia.info/news/946/Rashid-Beebeejaun-:-%C2%AB-L%E2%80%99heure-d%E2%80%99%C3%A9t%C3%A9-ne-sera-pas-appliqu%C3%A9e-cette-ann%C3%A9e-%C2%BB
+# 
+# 
+# http://lexpress.mu/Story/3398~Beebeejaun---Les-objectifs-d-%C3%A9conomie-d-%C3%A9nergie-de-l-heure-d-%C3%A9t%C3%A9-ont-%C3%A9t%C3%A9-atteints-
+# 
+#
+# Our wrap-up:
+# 
+# http://www.timeanddate.com/news/time/mauritius-dst-will-not-repeat.html
+# 
+
+# From Arthur David Olson (2009-07-11):
+# The "mauritius-dst-will-not-repeat" wrapup includes this: 
+# "The trial ended on March 29, 2009, when the clocks moved back by one hour
+# at 2am (or 02:00) local time..."
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule Mauritius	1982	only	-	Oct	10	0:00	1:00	S
 Rule Mauritius	1983	only	-	Mar	21	0:00	0	-
-Rule Mauritius	2008	max	-	Oct	lastSun	2:00s	1:00	S
-Rule Mauritius	2009	max	-	Mar	lastSun	2:00s	0	-
+Rule Mauritius	2008	only	-	Oct	lastSun	2:00	1:00	S
+Rule Mauritius	2009	only	-	Mar	lastSun	2:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Indian/Mauritius	3:50:00 -	LMT	1907		# Port Louis
 			4:00 Mauritius	MU%sT	# Mauritius Time

Modified: stable/7/share/zoneinfo/asia
==============================================================================
--- stable/7/share/zoneinfo/asia	Thu Aug 27 12:24:21 2009	(r196582)
+++ stable/7/share/zoneinfo/asia	Thu Aug 27 12:27:06 2009	(r196583)
@@ -1,5 +1,5 @@
 # 
-# @(#)asia	8.35
+# @(#)asia	8.36
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -172,6 +172,12 @@ Zone	Asia/Bahrain	3:22:20 -	LMT	1920		# 
 #
 # No DST end date has been announced yet.
 
+# From Arthur David Olson (2009-07-11):
+# Arbitrarily end DST at the end of 2009 so that a POSIX-sytle time zone string
+# can appear in the Dhaka binary file and for the benefit of old glibc
+# reimplementations of the time zone software that mishandle permanent DST.
+# A change will be required once the end date is known.
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Dhaka	6:01:40 -	LMT	1890
 			5:53:20	-	HMT	1941 Oct    # Howrah Mean Time?
@@ -180,7 +186,8 @@ Zone	Asia/Dhaka	6:01:40 -	LMT	1890
 			6:30	-	BURT	1951 Sep 30
 			6:00	-	DACT	1971 Mar 26 # Dacca Time
 			6:00	-	BDT	2009 Jun 19 23:00 # Bangladesh Time
-			6:00	1:00	BDST
+			6:00	1:00	BDST	2010
+			6:00	-	BDT
 
 # Bhutan
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]

Modified: stable/7/share/zoneinfo/europe
==============================================================================
--- stable/7/share/zoneinfo/europe	Thu Aug 27 12:24:21 2009	(r196582)
+++ stable/7/share/zoneinfo/europe	Thu Aug 27 12:27:06 2009	(r196583)
@@ -1,5 +1,5 @@
 # 
-# @(#)europe	8.21
+# @(#)europe	8.22
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -459,7 +459,7 @@ Rule	EU	1979	1995	-	Sep	lastSun	 1:00u	0
 Rule	EU	1981	max	-	Mar	lastSun	 1:00u	1:00	S
 Rule	EU	1996	max	-	Oct	lastSun	 1:00u	0	-
 # The most recent directive covers the years starting in 2002.  See:
-# 
+# 
 # Directive 2000/84/EC of the European Parliament and of the Council
 # of 19 January 2001 on summer-time arrangements.
 # 

Modified: stable/7/share/zoneinfo/leapseconds
==============================================================================
--- stable/7/share/zoneinfo/leapseconds	Thu Aug 27 12:24:21 2009	(r196582)
+++ stable/7/share/zoneinfo/leapseconds	Thu Aug 27 12:27:06 2009	(r196583)
@@ -1,5 +1,5 @@
 # 
-# @(#)leapseconds	8.8
+# @(#)leapseconds	8.9
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -58,29 +58,30 @@ Leap	2008	Dec	31	23:59:60	+	S
 # 61, Av. de l'Observatoire 75014 PARIS (France)
 # Tel.      : 33 (0) 1 40 51 22 26
 # FAX       : 33 (0) 1 40 51 22 91
-# e-mail    : services.iers@obspm.fr
-# http://hpiers.obspm.fr/eop-pc
+# Internet  : services.iers@obspm.fr
 #
-# Paris, 15 January 2009
+# Paris, 4 July 2009
 #
-# Bulletin C 37
+# Bulletin C 38
 #
 # To authorities responsible
 # for the measurement and
 # distribution of time
 #
-# NO positive leap second will be introduced at the end of June 2009.
-# The difference between Coordinated Universal Time UTC and the 
-# International Atomic Time TAI is :             
-#                
-#     from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
+# INFORMATION ON UTC - TAI
+#
+# NO positive leap second will be introduced at the end of December 2009.
+# The difference between Coordinated Universal Time UTC and the
+# International Atomic Time TAI is :		
+#
+# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
 #
 # Leap seconds can be introduced in UTC at the end of the months of December
-# or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
-# six months, either to announce a time step in UTC or to confirm that there
+# or June,  depending on the evolution of UT1-TAI. Bulletin C is mailed every
+# six months, either to announce a time step in UTC, or to confirm that there
 # will be no time step at the next possible date.
 #
 # Daniel GAMBIS
-# Head		
+# Director			
 # Earth Orientation Center of IERS
 # Observatoire de Paris, France

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 12:27:20 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 49D5F106568E;
	Thu, 27 Aug 2009 12:27:20 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id ED93A8FC48;
	Thu, 27 Aug 2009 12:27:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RCRJPO095908;
	Thu, 27 Aug 2009 12:27:19 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RCRJaK095903;
	Thu, 27 Aug 2009 12:27:19 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200908271227.n7RCRJaK095903@svn.freebsd.org>
From: Edwin Groothuis 
Date: Thu, 27 Aug 2009 12:27:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196584 - stable/6/share/zoneinfo
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 12:27:20 -0000

Author: edwin
Date: Thu Aug 27 12:27:19 2009
New Revision: 196584
URL: http://svn.freebsd.org/changeset/base/196584

Log:
  MFC of r196581: Import of tzdata2009k
  
  - Changes in Mauritius and Bangladesh
  - No leapsecond at the end of December 2009

Modified:
  stable/6/share/zoneinfo/   (props changed)
  stable/6/share/zoneinfo/africa
  stable/6/share/zoneinfo/asia
  stable/6/share/zoneinfo/europe
  stable/6/share/zoneinfo/leapseconds

Modified: stable/6/share/zoneinfo/africa
==============================================================================
--- stable/6/share/zoneinfo/africa	Thu Aug 27 12:27:06 2009	(r196583)
+++ stable/6/share/zoneinfo/africa	Thu Aug 27 12:27:19 2009	(r196584)
@@ -1,5 +1,5 @@
 # 
-# @(#)africa	8.21
+# @(#)africa	8.22
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -502,11 +502,33 @@ Zone Africa/Nouakchott	-1:03:48 -	LMT	19
 # http://www.gov.mu/portal/goc/assemblysite/file/bill2708.pdf
 # 
 
+# From Steffen Thorsen (2009-06-05):
+# According to several sources, Mauritius will not continue to observe
+# DST the coming summer...
+#
+# Some sources, in French:
+# 
+# http://www.defimedia.info/news/946/Rashid-Beebeejaun-:-%C2%AB-L%E2%80%99heure-d%E2%80%99%C3%A9t%C3%A9-ne-sera-pas-appliqu%C3%A9e-cette-ann%C3%A9e-%C2%BB
+# 
+# 
+# http://lexpress.mu/Story/3398~Beebeejaun---Les-objectifs-d-%C3%A9conomie-d-%C3%A9nergie-de-l-heure-d-%C3%A9t%C3%A9-ont-%C3%A9t%C3%A9-atteints-
+# 
+#
+# Our wrap-up:
+# 
+# http://www.timeanddate.com/news/time/mauritius-dst-will-not-repeat.html
+# 
+
+# From Arthur David Olson (2009-07-11):
+# The "mauritius-dst-will-not-repeat" wrapup includes this: 
+# "The trial ended on March 29, 2009, when the clocks moved back by one hour
+# at 2am (or 02:00) local time..."
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule Mauritius	1982	only	-	Oct	10	0:00	1:00	S
 Rule Mauritius	1983	only	-	Mar	21	0:00	0	-
-Rule Mauritius	2008	max	-	Oct	lastSun	2:00s	1:00	S
-Rule Mauritius	2009	max	-	Mar	lastSun	2:00s	0	-
+Rule Mauritius	2008	only	-	Oct	lastSun	2:00	1:00	S
+Rule Mauritius	2009	only	-	Mar	lastSun	2:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Indian/Mauritius	3:50:00 -	LMT	1907		# Port Louis
 			4:00 Mauritius	MU%sT	# Mauritius Time

Modified: stable/6/share/zoneinfo/asia
==============================================================================
--- stable/6/share/zoneinfo/asia	Thu Aug 27 12:27:06 2009	(r196583)
+++ stable/6/share/zoneinfo/asia	Thu Aug 27 12:27:19 2009	(r196584)
@@ -1,5 +1,5 @@
 # 
-# @(#)asia	8.35
+# @(#)asia	8.36
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -172,6 +172,12 @@ Zone	Asia/Bahrain	3:22:20 -	LMT	1920		# 
 #
 # No DST end date has been announced yet.
 
+# From Arthur David Olson (2009-07-11):
+# Arbitrarily end DST at the end of 2009 so that a POSIX-sytle time zone string
+# can appear in the Dhaka binary file and for the benefit of old glibc
+# reimplementations of the time zone software that mishandle permanent DST.
+# A change will be required once the end date is known.
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Dhaka	6:01:40 -	LMT	1890
 			5:53:20	-	HMT	1941 Oct    # Howrah Mean Time?
@@ -180,7 +186,8 @@ Zone	Asia/Dhaka	6:01:40 -	LMT	1890
 			6:30	-	BURT	1951 Sep 30
 			6:00	-	DACT	1971 Mar 26 # Dacca Time
 			6:00	-	BDT	2009 Jun 19 23:00 # Bangladesh Time
-			6:00	1:00	BDST
+			6:00	1:00	BDST	2010
+			6:00	-	BDT
 
 # Bhutan
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]

Modified: stable/6/share/zoneinfo/europe
==============================================================================
--- stable/6/share/zoneinfo/europe	Thu Aug 27 12:27:06 2009	(r196583)
+++ stable/6/share/zoneinfo/europe	Thu Aug 27 12:27:19 2009	(r196584)
@@ -1,5 +1,5 @@
 # 
-# @(#)europe	8.21
+# @(#)europe	8.22
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -459,7 +459,7 @@ Rule	EU	1979	1995	-	Sep	lastSun	 1:00u	0
 Rule	EU	1981	max	-	Mar	lastSun	 1:00u	1:00	S
 Rule	EU	1996	max	-	Oct	lastSun	 1:00u	0	-
 # The most recent directive covers the years starting in 2002.  See:
-# 
+# 
 # Directive 2000/84/EC of the European Parliament and of the Council
 # of 19 January 2001 on summer-time arrangements.
 # 

Modified: stable/6/share/zoneinfo/leapseconds
==============================================================================
--- stable/6/share/zoneinfo/leapseconds	Thu Aug 27 12:27:06 2009	(r196583)
+++ stable/6/share/zoneinfo/leapseconds	Thu Aug 27 12:27:19 2009	(r196584)
@@ -1,5 +1,5 @@
 # 
-# @(#)leapseconds	8.8
+# @(#)leapseconds	8.9
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -58,29 +58,30 @@ Leap	2008	Dec	31	23:59:60	+	S
 # 61, Av. de l'Observatoire 75014 PARIS (France)
 # Tel.      : 33 (0) 1 40 51 22 26
 # FAX       : 33 (0) 1 40 51 22 91
-# e-mail    : services.iers@obspm.fr
-# http://hpiers.obspm.fr/eop-pc
+# Internet  : services.iers@obspm.fr
 #
-# Paris, 15 January 2009
+# Paris, 4 July 2009
 #
-# Bulletin C 37
+# Bulletin C 38
 #
 # To authorities responsible
 # for the measurement and
 # distribution of time
 #
-# NO positive leap second will be introduced at the end of June 2009.
-# The difference between Coordinated Universal Time UTC and the 
-# International Atomic Time TAI is :             
-#                
-#     from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
+# INFORMATION ON UTC - TAI
+#
+# NO positive leap second will be introduced at the end of December 2009.
+# The difference between Coordinated Universal Time UTC and the
+# International Atomic Time TAI is :		
+#
+# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
 #
 # Leap seconds can be introduced in UTC at the end of the months of December
-# or June, depending on the evolution of UT1-TAI. Bulletin C is mailed every
-# six months, either to announce a time step in UTC or to confirm that there
+# or June,  depending on the evolution of UT1-TAI. Bulletin C is mailed every
+# six months, either to announce a time step in UTC, or to confirm that there
 # will be no time step at the next possible date.
 #
 # Daniel GAMBIS
-# Head		
+# Director			
 # Earth Orientation Center of IERS
 # Observatoire de Paris, France

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 12:29:23 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 63640106568C;
	Thu, 27 Aug 2009 12:29:23 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 47FBC8FC46;
	Thu, 27 Aug 2009 12:29:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RCTNHJ096042;
	Thu, 27 Aug 2009 12:29:23 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RCTNGV096036;
	Thu, 27 Aug 2009 12:29:23 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200908271229.n7RCTNGV096036@svn.freebsd.org>
From: Edwin Groothuis 
Date: Thu, 27 Aug 2009 12:29:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196585 - stable/6/share/zoneinfo
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 12:29:23 -0000

Author: edwin
Date: Thu Aug 27 12:29:22 2009
New Revision: 196585
URL: http://svn.freebsd.org/changeset/base/196585

Log:
  MFC of r196582: Import of tzdata2009l
  
  - Egypt will go to Wintertime on 21 August 2009
  - Heads up for a possible DST in Samoa

Modified:
  stable/6/share/zoneinfo/   (props changed)
  stable/6/share/zoneinfo/africa
  stable/6/share/zoneinfo/australasia

Modified: stable/6/share/zoneinfo/africa
==============================================================================
--- stable/6/share/zoneinfo/africa	Thu Aug 27 12:27:19 2009	(r196584)
+++ stable/6/share/zoneinfo/africa	Thu Aug 27 12:29:22 2009	(r196585)
@@ -1,5 +1,5 @@
 # 
-# @(#)africa	8.22
+# @(#)africa	8.23
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -276,8 +276,27 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	23:00s
 # In 2009 (and for the next several years), Ramadan ends before the fourth
 # Thursday in September; Egypt is expected to revert to the last Thursday
 # in September.
+
+# From Steffen Thorsen (2009-08-11):
+# We have been able to confirm the August change with the Egyptian Cabinet 
+# Information and Decision Support Center:
+# 
+# http://www.timeanddate.com/news/time/egypt-dst-ends-2009.html
+# 
+# 
+# The Middle East News Agency
+# 
+# http://www.mena.org.eg/index.aspx
+# 
+# also reports "Egypt starts winter time on August 21"
+# today in article numbered "71, 11/08/2009 12:25 GMT." 
+# Only the title above is available without a subscription to their service,
+# and can be found by searching for "winter" in their search engine
+# (at least today).
+
 Rule	Egypt	2008	only	-	Aug	lastThu	23:00s	0	-
-Rule	Egypt	2009	max	-	Sep	lastThu	23:00s	0	-
+Rule	Egypt	2009	only	-	Aug	20	23:00s	0	-
+Rule	Egypt	2010	max	-	Sep	lastThu	23:00s	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Cairo	2:05:00 -	LMT	1900 Oct

Modified: stable/6/share/zoneinfo/australasia
==============================================================================
--- stable/6/share/zoneinfo/australasia	Thu Aug 27 12:27:19 2009	(r196584)
+++ stable/6/share/zoneinfo/australasia	Thu Aug 27 12:29:22 2009	(r196585)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.11
+# @(#)australasia	8.12
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -427,6 +427,22 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 			-11:00	-	SST			# S=Samoa
 
 # Samoa
+
+# From Alexander Krivenyshev (2008-12-06):
+# The Samoa government (Western Samoa) may implement DST on the first Sunday of 
+# October 2009 (October 4, 2009) until the last Sunday of March 2010 (March 28, 
+# 2010). 
+# 
+# "Selected Committee reports to Cabinet on Daylight Saving Time",
+# Government of Samoa:
+# 
+# http://www.govt.ws/pr_article.cfm?pr_id=560
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_samoa01.html
+# 
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 12:29:24 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 167D41065698;
	Thu, 27 Aug 2009 12:29:24 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F04A68FC41;
	Thu, 27 Aug 2009 12:29:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RCTNuq096073;
	Thu, 27 Aug 2009 12:29:23 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RCTNOv096070;
	Thu, 27 Aug 2009 12:29:23 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200908271229.n7RCTNOv096070@svn.freebsd.org>
From: Edwin Groothuis 
Date: Thu, 27 Aug 2009 12:29:23 +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: r196586 - stable/7/share/zoneinfo
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 12:29:24 -0000

Author: edwin
Date: Thu Aug 27 12:29:23 2009
New Revision: 196586
URL: http://svn.freebsd.org/changeset/base/196586

Log:
  MFC of r196582: Import of tzdata2009l
  
  - Egypt will go to Wintertime on 21 August 2009
  - Heads up for a possible DST in Samoa

Modified:
  stable/7/share/zoneinfo/   (props changed)
  stable/7/share/zoneinfo/africa
  stable/7/share/zoneinfo/australasia

Modified: stable/7/share/zoneinfo/africa
==============================================================================
--- stable/7/share/zoneinfo/africa	Thu Aug 27 12:29:22 2009	(r196585)
+++ stable/7/share/zoneinfo/africa	Thu Aug 27 12:29:23 2009	(r196586)
@@ -1,5 +1,5 @@
 # 
-# @(#)africa	8.22
+# @(#)africa	8.23
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -276,8 +276,27 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	23:00s
 # In 2009 (and for the next several years), Ramadan ends before the fourth
 # Thursday in September; Egypt is expected to revert to the last Thursday
 # in September.
+
+# From Steffen Thorsen (2009-08-11):
+# We have been able to confirm the August change with the Egyptian Cabinet 
+# Information and Decision Support Center:
+# 
+# http://www.timeanddate.com/news/time/egypt-dst-ends-2009.html
+# 
+# 
+# The Middle East News Agency
+# 
+# http://www.mena.org.eg/index.aspx
+# 
+# also reports "Egypt starts winter time on August 21"
+# today in article numbered "71, 11/08/2009 12:25 GMT." 
+# Only the title above is available without a subscription to their service,
+# and can be found by searching for "winter" in their search engine
+# (at least today).
+
 Rule	Egypt	2008	only	-	Aug	lastThu	23:00s	0	-
-Rule	Egypt	2009	max	-	Sep	lastThu	23:00s	0	-
+Rule	Egypt	2009	only	-	Aug	20	23:00s	0	-
+Rule	Egypt	2010	max	-	Sep	lastThu	23:00s	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Cairo	2:05:00 -	LMT	1900 Oct

Modified: stable/7/share/zoneinfo/australasia
==============================================================================
--- stable/7/share/zoneinfo/australasia	Thu Aug 27 12:29:22 2009	(r196585)
+++ stable/7/share/zoneinfo/australasia	Thu Aug 27 12:29:23 2009	(r196586)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.11
+# @(#)australasia	8.12
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -427,6 +427,22 @@ Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1
 			-11:00	-	SST			# S=Samoa
 
 # Samoa
+
+# From Alexander Krivenyshev (2008-12-06):
+# The Samoa government (Western Samoa) may implement DST on the first Sunday of 
+# October 2009 (October 4, 2009) until the last Sunday of March 2010 (March 28, 
+# 2010). 
+# 
+# "Selected Committee reports to Cabinet on Daylight Saving Time",
+# Government of Samoa:
+# 
+# http://www.govt.ws/pr_article.cfm?pr_id=560
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_samoa01.html
+# 
+
 Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
 			-11:26:56 -	LMT	1911
 			-11:30	-	SAMT	1950		# Samoa Time

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 12:36:16 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0EE69106564A;
	Thu, 27 Aug 2009 12:36:16 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id F26708FC4F;
	Thu, 27 Aug 2009 12:36:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RCaFdh096358;
	Thu, 27 Aug 2009 12:36:15 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RCaFm0096356;
	Thu, 27 Aug 2009 12:36:15 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200908271236.n7RCaFm0096356@svn.freebsd.org>
From: Edwin Groothuis 
Date: Thu, 27 Aug 2009 12:36:15 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196587 - head/usr.sbin/zic
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 12:36:16 -0000

Author: edwin
Date: Thu Aug 27 12:36:15 2009
New Revision: 196587
URL: http://svn.freebsd.org/changeset/base/196587

Log:
  MFV of r195794
  
  MFV of tzcode2009k
  
  zic.c:
      Do not end a binary file with a POSIX-style time zone string
      for locations that end up in permanent DST (thanks to Andreas
      Schwab).

Modified:
  head/usr.sbin/zic/   (props changed)
  head/usr.sbin/zic/zic.c

Modified: head/usr.sbin/zic/zic.c
==============================================================================
--- head/usr.sbin/zic/zic.c	Thu Aug 27 12:29:23 2009	(r196586)
+++ head/usr.sbin/zic/zic.c	Thu Aug 27 12:36:15 2009	(r196587)
@@ -3,7 +3,7 @@
 ** 2006-07-17 by Arthur David Olson.
 */
 
-static const char	elsieid[] = "@(#)zic.c	8.19";
+static const char	elsieid[] = "@(#)zic.c	8.20";
 
 #ifndef lint
 static const char rcsid[] =
@@ -1892,7 +1892,7 @@ const int			zonecount;
 		if (stdrp != NULL && stdrp->r_hiyear == 2037)
 			return;
 	}
-	if (stdrp == NULL && zp->z_nrules != 0)
+	if (stdrp == NULL && (zp->z_nrules != 0 || zp->z_stdoff != 0))
 		return;
 	abbrvar = (stdrp == NULL) ? "" : stdrp->r_abbrvar;
 	doabbr(result, zp->z_format, abbrvar, FALSE, TRUE);

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 13:18:59 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A59401065690;
	Thu, 27 Aug 2009 13:18:59 +0000 (UTC)
	(envelope-from blackend@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 952AB8FC2E;
	Thu, 27 Aug 2009 13:18:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RDIxuW097347;
	Thu, 27 Aug 2009 13:18:59 GMT
	(envelope-from blackend@svn.freebsd.org)
Received: (from blackend@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RDIxOG097345;
	Thu, 27 Aug 2009 13:18:59 GMT
	(envelope-from blackend@svn.freebsd.org)
Message-Id: <200908271318.n7RDIxOG097345@svn.freebsd.org>
From: Marc Fonvieille 
Date: Thu, 27 Aug 2009 13:18:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196588 - head/release
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 13:18:59 -0000

Author: blackend (doc committer)
Date: Thu Aug 27 13:18:59 2009
New Revision: 196588
URL: http://svn.freebsd.org/changeset/base/196588

Log:
  Update some comments to match the removal of the docset compilation
  during the release build.

Modified:
  head/release/Makefile

Modified: head/release/Makefile
==============================================================================
--- head/release/Makefile	Thu Aug 27 12:36:15 2009	(r196587)
+++ head/release/Makefile	Thu Aug 27 13:18:59 2009	(r196588)
@@ -1163,10 +1163,10 @@ iso.1:
 .endif
 
 #
-# --==## Documentation Project files such as the Handbook and FAQ ##==--
+# --==## Documentation Project tools required to build the release notes ##==--
 #
 doc.1:
-	@echo "Making docs..."
+	@echo "Making docproj tools..."
 	@for i in ${DOCPORTS}; do \
 	    cd /usr/ports/$$i && \
 	    env -i FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-no} PATH=$${PATH} \

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 13:55:31 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F1923106568E;
	Thu, 27 Aug 2009 13:55:31 +0000 (UTC)
	(envelope-from pjd@garage.freebsd.pl)
Received: from mail.garage.freebsd.pl (chello087206049004.chello.pl
	[87.206.49.4]) by mx1.freebsd.org (Postfix) with ESMTP id 3B4898FC2D;
	Thu, 27 Aug 2009 13:55:30 +0000 (UTC)
Received: by mail.garage.freebsd.pl (Postfix, from userid 65534)
	id 8FA2C45CA6; Thu, 27 Aug 2009 15:55:28 +0200 (CEST)
Received: from localhost (pdawidek.wheel.pl [10.0.1.1])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.garage.freebsd.pl (Postfix) with ESMTP id 9038645684;
	Thu, 27 Aug 2009 15:55:23 +0200 (CEST)
Date: Thu, 27 Aug 2009 15:55:27 +0200
From: Pawel Jakub Dawidek 
To: Doug Barton 
Message-ID: <20090827135526.GI1752@garage.freebsd.pl>
References: <200908251907.n7PJ7QiO036868@svn.freebsd.org>
	<20090825194258.GB1471@tops>
	<20090826101953.GC3055@garage.freebsd.pl>
	<4A959020.4040606@FreeBSD.org>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="KR/qxknboQ7+Tpez"
Content-Disposition: inline
In-Reply-To: <4A959020.4040606@FreeBSD.org>
User-Agent: Mutt/1.4.2.3i
X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc
X-OS: FreeBSD 8.0-CURRENT i386
X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on 
	mail.garage.freebsd.pl
X-Spam-Level: 
X-Spam-Status: No, score=-5.9 required=4.5 tests=ALL_TRUSTED,BAYES_00 
	autolearn=ham version=3.0.4
Cc: svn-src-head@freebsd.org, Gleb Kurtsou ,
	src-committers@freebsd.org, Xin LI ,
	svn-src-all@freebsd.org
Subject: Re: svn commit: r196550 - in head: etc/defaults etc/rc.d
	share/man/man5
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 13:55:32 -0000


--KR/qxknboQ7+Tpez
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Aug 26, 2009 at 12:42:24PM -0700, Doug Barton wrote:
> Pawel Jakub Dawidek wrote:
>=20
> > I put '/usr/sbin/arp -f /etc/arp.conf' into /etc/rc.local on almost all
> > of my servers, which is very handy, indeed. And with your patch proposed
> > in another e-mail to be able to remove entries defined in a file seems
> > to be a complete solution. I'd also like to see support for it.
>=20
> What would the relative value be of adding support for files vs. using
> the method that Xin already created? I understand that you will have a
> one-time cost of migrating your conf file to Xin's format ....

I don't think I'm the only one. -f option for arp(8) is available for
some time now (if not from day 1) and while being quite handy it is
possible that someone out there is using it as well.

I think that keeping MAC/IP pairs in file is less error-prone and more
elegant, especially if you have a lot of such entires.

But giving multiple tools to accomplish the same thing might confuse our
users, so its probably not worth it. The proposed solution is good enough.

--=20
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

--KR/qxknboQ7+Tpez
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQFKlpBOForvXbEpPzQRAm7wAKD3A+ycFyJBFb5HaDbDc9A2Y22E4ACg+Gmr
4ChCOkQNWTHsKte6ZE9GNyw=
=vuKJ
-----END PGP SIGNATURE-----

--KR/qxknboQ7+Tpez--

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 14:16:49 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D4AD7106568B;
	Thu, 27 Aug 2009 14:16:49 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id A5CDE8FC3C;
	Thu, 27 Aug 2009 14:16:49 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 5817446B86;
	Thu, 27 Aug 2009 10:16:49 -0400 (EDT)
Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id 7DFFB8A02E;
	Thu, 27 Aug 2009 10:16:48 -0400 (EDT)
From: John Baldwin 
To: Marius Strobl 
Date: Thu, 27 Aug 2009 08:28:53 -0400
User-Agent: KMail/1.9.7
References: <200908262110.n7QLAlgm074474@svn.freebsd.org>
	<200908261733.38270.jhb@freebsd.org>
	<20090826215641.GH94142@alchemy.franken.de>
In-Reply-To: <20090826215641.GH94142@alchemy.franken.de>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200908270828.53550.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Thu, 27 Aug 2009 10:16:48 -0400 (EDT)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE
	autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r196567 - head/sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 14:16:49 -0000

On Wednesday 26 August 2009 5:56:41 pm Marius Strobl wrote:
> On Wed, Aug 26, 2009 at 05:33:37PM -0400, John Baldwin wrote:
> > On Wednesday 26 August 2009 5:10:47 pm Marius Strobl wrote:
> > > Author: marius
> > > Date: Wed Aug 26 21:10:47 2009
> > > New Revision: 196567
> > > URL: http://svn.freebsd.org/changeset/base/196567
> > > 
> > > Log:
> > >   Add a temporary workaround which just lets init die instead of
> > >   causing a panic if it is killed due to a unsolved stack overflow
> > >   seen very late during shutdown on sparc64 when the gmirror worker
> > >   process exists, which is a regression introduced in 8.0.
> > 
> > Maybe still whine about it and just not panic() so that there is a reminder to 
> > fix this and remove the workaround?
> > 
> 
> Well, with a default configuration one still gets the usual
> "pid 1 (init), uid 0: exited on signal 4" on the console,
> which I thought would be sufficient whining.

Ah, ok, that seems sufficient to me as well then.

-- 
John Baldwin

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 15:24:27 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 038D7106568C;
	Thu, 27 Aug 2009 15:24:27 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E77C18FC2F;
	Thu, 27 Aug 2009 15:24:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RFOQft099839;
	Thu, 27 Aug 2009 15:24:26 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RFOQr9099837;
	Thu, 27 Aug 2009 15:24:26 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <200908271524.n7RFOQr9099837@svn.freebsd.org>
From: Doug Barton 
Date: Thu, 27 Aug 2009 15:24:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196589 - head/etc
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 15:24:27 -0000

Author: dougb
Date: Thu Aug 27 15:24:26 2009
New Revision: 196589
URL: http://svn.freebsd.org/changeset/base/196589

Log:
  In the loop through the list of interfaces in network6_interface_setup()
  rtsol_interface gets reset to "yes" each time through the loop, but
  rtsol_available does not. If a user has lo0 first in their list of
  interfaces rtsol_available will get set to "no" the first time through
  the loop and subsequent interfaces will not get rtsol'ed when they should.
  
  Therefore change the conditional for the is_wired() test to _interface.
  
  Noticed by:	Dimitry Andric 

Modified:
  head/etc/network.subr

Modified: head/etc/network.subr
==============================================================================
--- head/etc/network.subr	Thu Aug 27 13:18:59 2009	(r196588)
+++ head/etc/network.subr	Thu Aug 27 15:24:26 2009	(r196589)
@@ -879,8 +879,8 @@ network6_interface_setup()
 		# Wireless NIC cards are virtualized through the wlan interface
 		if ! is_wired_interface ${i}; then
 			case "${i}" in
-			wlan*)	rtsol_available=yes ;;
-			*)	rtsol_available=no ;;
+			wlan*)	rtsol_interface=yes ;;
+			*)	rtsol_interface=no ;;
 			esac
 		fi
 

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 15:48:59 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 51878106564A;
	Thu, 27 Aug 2009 15:48:59 +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 39AFC8FC2E;
	Thu, 27 Aug 2009 15:48:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RFmxud000461;
	Thu, 27 Aug 2009 15:48:59 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RFmxVj000457;
	Thu, 27 Aug 2009 15:48:59 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908271548.n7RFmxVj000457@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 27 Aug 2009 15:48:59 +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: r196590 - in stable/7/sys: . contrib/pf vm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 15:48:59 -0000

Author: jhb
Date: Thu Aug 27 15:48:58 2009
New Revision: 196590
URL: http://svn.freebsd.org/changeset/base/196590

Log:
  MFC 181019, 183474, 191277, and 191626:
  - Move the code for doing out-of-memory grass from vm_pageout_scan()
    into the separate function vm_pageout_oom(). Supply a parameter for
    vm_pageout_oom() describing a reason for the call.
  - Call vm_pageout_oom() from the swp_pager_meta_build() when swap zone
    is exhausted.
  - In both pageout oom handler and vm_daemon, acquire the reference to
    the vmspace of the examined process instead of directly accessing its
    vmspace, that may change. Also, as an optimization, check for P_INEXEC
    flag before examining the process.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/vm/swap_pager.c
  stable/7/sys/vm/vm_pageout.c
  stable/7/sys/vm/vm_pageout.h

Modified: stable/7/sys/vm/swap_pager.c
==============================================================================
--- stable/7/sys/vm/swap_pager.c	Thu Aug 27 15:24:26 2009	(r196589)
+++ stable/7/sys/vm/swap_pager.c	Thu Aug 27 15:48:58 2009	(r196590)
@@ -1711,9 +1711,12 @@ retry:
 		if (swap == NULL) {
 			mtx_unlock(&swhash_mtx);
 			VM_OBJECT_UNLOCK(object);
-			if (uma_zone_exhausted(swap_zone))
+			if (uma_zone_exhausted(swap_zone)) {
 				printf("swap zone exhausted, increase kern.maxswzone\n");
-			VM_WAIT;
+				vm_pageout_oom(VM_OOM_SWAPZ);
+				pause("swzonex", 10);
+			} else
+				VM_WAIT;
 			VM_OBJECT_LOCK(object);
 			goto retry;
 		}

Modified: stable/7/sys/vm/vm_pageout.c
==============================================================================
--- stable/7/sys/vm/vm_pageout.c	Thu Aug 27 15:24:26 2009	(r196589)
+++ stable/7/sys/vm/vm_pageout.c	Thu Aug 27 15:48:58 2009	(r196590)
@@ -681,9 +681,6 @@ vm_pageout_scan(int pass)
 	struct vm_page marker;
 	int page_shortage, maxscan, pcount;
 	int addl_page_shortage, addl_page_shortage_init;
-	struct proc *p, *bigproc;
-	struct thread *td;
-	vm_offset_t size, bigsize;
 	vm_object_t object;
 	int actcount;
 	int vnodes_skipped = 0;
@@ -1173,7 +1170,23 @@ unlock_and_continue:
 	 * doing this on the first pass in order to give ourselves a
 	 * chance to flush out dirty vnode-backed pages and to allow
 	 * active pages to be moved to the inactive queue and reclaimed.
-	 *
+	 */
+	if (pass != 0 &&
+	    ((swap_pager_avail < 64 && vm_page_count_min()) ||
+	     (swap_pager_full && vm_paging_target() > 0)))
+		vm_pageout_oom(VM_OOM_MEM);
+}
+
+
+void
+vm_pageout_oom(int shortage)
+{
+	struct proc *p, *bigproc;
+	vm_offset_t size, bigsize;
+	struct thread *td;
+	struct vmspace *vm;
+
+	/*
 	 * We keep the process bigproc locked once we find it to keep anyone
 	 * from messing with it; however, there is a possibility of
 	 * deadlock if process B is bigproc and one of it's child processes
@@ -1181,79 +1194,83 @@ unlock_and_continue:
 	 * lock while walking this list.  To avoid this, we don't block on
 	 * the process lock but just skip a process if it is already locked.
 	 */
-	if (pass != 0 &&
-	    ((swap_pager_avail < 64 && vm_page_count_min()) ||
-	     (swap_pager_full && vm_paging_target() > 0))) {
-		bigproc = NULL;
-		bigsize = 0;
-		sx_slock(&allproc_lock);
-		FOREACH_PROC_IN_SYSTEM(p) {
-			int breakout;
+	bigproc = NULL;
+	bigsize = 0;
+	sx_slock(&allproc_lock);
+	FOREACH_PROC_IN_SYSTEM(p) {
+		int breakout;
 
-			if (PROC_TRYLOCK(p) == 0)
-				continue;
-			/*
-			 * If this is a system or protected process, skip it.
-			 */
-			if ((p->p_flag & P_SYSTEM) || (p->p_pid == 1) ||
-			    (p->p_flag & P_PROTECTED) ||
-			    ((p->p_pid < 48) && (swap_pager_avail != 0))) {
-				PROC_UNLOCK(p);
-				continue;
-			}
-			/*
-			 * If the process is in a non-running type state,
-			 * don't touch it.  Check all the threads individually.
-			 */
-			PROC_SLOCK(p);
-			breakout = 0;
-			FOREACH_THREAD_IN_PROC(p, td) {
-				thread_lock(td);
-				if (!TD_ON_RUNQ(td) &&
-				    !TD_IS_RUNNING(td) &&
-				    !TD_IS_SLEEPING(td)) {
-					thread_unlock(td);
-					breakout = 1;
-					break;
-				}
+		if (PROC_TRYLOCK(p) == 0)
+			continue;
+		/*
+		 * If this is a system or protected process, skip it.
+		 */
+		if ((p->p_flag & (P_INEXEC | P_PROTECTED | P_SYSTEM)) ||
+		    (p->p_pid == 1) ||
+		    ((p->p_pid < 48) && (swap_pager_avail != 0))) {
+			PROC_UNLOCK(p);
+			continue;
+		}
+		/*
+		 * If the process is in a non-running type state,
+		 * don't touch it.  Check all the threads individually.
+		 */
+		PROC_SLOCK(p);
+		breakout = 0;
+		FOREACH_THREAD_IN_PROC(p, td) {
+			thread_lock(td);
+			if (!TD_ON_RUNQ(td) &&
+			    !TD_IS_RUNNING(td) &&
+			    !TD_IS_SLEEPING(td)) {
 				thread_unlock(td);
+				breakout = 1;
+				break;
 			}
-			PROC_SUNLOCK(p);
-			if (breakout) {
-				PROC_UNLOCK(p);
-				continue;
-			}
-			/*
-			 * get the process size
-			 */
-			if (!vm_map_trylock_read(&p->p_vmspace->vm_map)) {
-				PROC_UNLOCK(p);
-				continue;
-			}
-			size = vmspace_swap_count(p->p_vmspace);
-			vm_map_unlock_read(&p->p_vmspace->vm_map);
-			size += vmspace_resident_count(p->p_vmspace);
-			/*
-			 * if the this process is bigger than the biggest one
-			 * remember it.
-			 */
-			if (size > bigsize) {
-				if (bigproc != NULL)
-					PROC_UNLOCK(bigproc);
-				bigproc = p;
-				bigsize = size;
-			} else
-				PROC_UNLOCK(p);
+			thread_unlock(td);
 		}
-		sx_sunlock(&allproc_lock);
-		if (bigproc != NULL) {
-			killproc(bigproc, "out of swap space");
-			PROC_SLOCK(bigproc);
-			sched_nice(bigproc, PRIO_MIN);
-			PROC_SUNLOCK(bigproc);
-			PROC_UNLOCK(bigproc);
-			wakeup(&cnt.v_free_count);
+		PROC_SUNLOCK(p);
+		if (breakout) {
+			PROC_UNLOCK(p);
+			continue;
+		}
+		/*
+		 * get the process size
+		 */
+		vm = vmspace_acquire_ref(p);
+		if (vm == NULL) {
+			PROC_UNLOCK(p);
+			continue;
 		}
+		if (!vm_map_trylock_read(&vm->vm_map)) {
+			vmspace_free(vm);
+			PROC_UNLOCK(p);
+			continue;
+		}
+		size = vmspace_swap_count(vm);
+		vm_map_unlock_read(&vm->vm_map);
+		if (shortage == VM_OOM_MEM)
+			size += vmspace_resident_count(vm);
+		vmspace_free(vm);
+		/*
+		 * if the this process is bigger than the biggest one
+		 * remember it.
+		 */
+		if (size > bigsize) {
+			if (bigproc != NULL)
+				PROC_UNLOCK(bigproc);
+			bigproc = p;
+			bigsize = size;
+		} else
+			PROC_UNLOCK(p);
+	}
+	sx_sunlock(&allproc_lock);
+	if (bigproc != NULL) {
+		killproc(bigproc, "out of swap space");
+		PROC_SLOCK(bigproc);
+		sched_nice(bigproc, PRIO_MIN);
+		PROC_SUNLOCK(bigproc);
+		PROC_UNLOCK(bigproc);
+		wakeup(&cnt.v_free_count);
 	}
 }
 
@@ -1528,6 +1545,7 @@ vm_daemon()
 	struct rlimit rsslim;
 	struct proc *p;
 	struct thread *td;
+	struct vmspace *vm;
 	int breakout, swapout_flags;
 
 	while (TRUE) {
@@ -1552,7 +1570,7 @@ vm_daemon()
 			 * looked at this process, skip it.
 			 */
 			PROC_LOCK(p);
-			if (p->p_flag & (P_SYSTEM | P_WEXIT)) {
+			if (p->p_flag & (P_INEXEC | P_SYSTEM | P_WEXIT)) {
 				PROC_UNLOCK(p);
 				continue;
 			}
@@ -1592,13 +1610,17 @@ vm_daemon()
 			 */
 			if ((p->p_flag & P_INMEM) == 0)
 				limit = 0;	/* XXX */
+			vm = vmspace_acquire_ref(p);
 			PROC_UNLOCK(p);
+			if (vm == NULL)
+				continue;
 
-			size = vmspace_resident_count(p->p_vmspace);
+			size = vmspace_resident_count(vm);
 			if (limit >= 0 && size >= limit) {
 				vm_pageout_map_deactivate_pages(
-				    &p->p_vmspace->vm_map, limit);
+				    &vm->vm_map, limit);
 			}
+			vmspace_free(vm);
 		}
 		sx_sunlock(&allproc_lock);
 	}

Modified: stable/7/sys/vm/vm_pageout.h
==============================================================================
--- stable/7/sys/vm/vm_pageout.h	Thu Aug 27 15:24:26 2009	(r196589)
+++ stable/7/sys/vm/vm_pageout.h	Thu Aug 27 15:48:58 2009	(r196590)
@@ -83,6 +83,9 @@ extern int vm_pageout_page_count;
 #define VM_SWAP_NORMAL 1
 #define VM_SWAP_IDLE 2
 
+#define	VM_OOM_MEM	1
+#define	VM_OOM_SWAPZ	2
+
 /*
  *	Exported routines.
  */
@@ -100,5 +103,6 @@ extern void vm_waitpfault(void);
 #ifdef _KERNEL
 boolean_t vm_pageout_fallback_object_lock(vm_page_t, vm_page_t *);
 int vm_pageout_flush(vm_page_t *, int, int);
+void vm_pageout_oom(int shortage);
 #endif
 #endif	/* _VM_VM_PAGEOUT_H_ */

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 16:15:32 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BDCF5106568D;
	Thu, 27 Aug 2009 16:15:32 +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 ACA0B8FC36;
	Thu, 27 Aug 2009 16:15:32 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RGFW7C001121;
	Thu, 27 Aug 2009 16:15:32 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RGFW8g001119;
	Thu, 27 Aug 2009 16:15:32 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908271615.n7RGFW8g001119@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 27 Aug 2009 16:15:32 +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: r196591 - stable/7/contrib/top
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 16:15:32 -0000

Author: jhb
Date: Thu Aug 27 16:15:32 2009
New Revision: 196591
URL: http://svn.freebsd.org/changeset/base/196591

Log:
  MFC 196382:
  Explicitly line up the CPU state labels with the calculated starting column
  that takes into account the width of the largest CPU ID.

Modified:
  stable/7/contrib/top/   (props changed)
  stable/7/contrib/top/display.c

Modified: stable/7/contrib/top/display.c
==============================================================================
--- stable/7/contrib/top/display.c	Thu Aug 27 15:48:58 2009	(r196590)
+++ stable/7/contrib/top/display.c	Thu Aug 27 16:15:32 2009	(r196591)
@@ -452,6 +452,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
     lastline++;
 
     /* now walk thru the names and print the line */
+    Move_to(cpustates_column, y_cpustates + cpu);
     while ((thisname = *names++) != NULL)
     {
 	if (*thisname != '\0')
@@ -543,6 +544,7 @@ for (cpu = 0; cpu < num_cpus; cpu++) {
 	printf("\nCPU %d: ", cpu);
     lastline++;
 
+    Move_to(cpustates_column, y_cpustates + cpu);
     while ((thisname = *names++) != NULL)
     {
 	if (*thisname != '\0')

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 16:15:51 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E7E4C1065741;
	Thu, 27 Aug 2009 16:15:51 +0000 (UTC)
	(envelope-from jamie@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D748B8FC3A;
	Thu, 27 Aug 2009 16:15:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RGFpOb001163;
	Thu, 27 Aug 2009 16:15:51 GMT (envelope-from jamie@svn.freebsd.org)
Received: (from jamie@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RGFpeu001161;
	Thu, 27 Aug 2009 16:15:51 GMT (envelope-from jamie@svn.freebsd.org)
Message-Id: <200908271615.n7RGFpeu001161@svn.freebsd.org>
From: Jamie Gritton 
Date: Thu, 27 Aug 2009 16:15:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196592 - head/sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 16:15:52 -0000

Author: jamie
Date: Thu Aug 27 16:15:51 2009
New Revision: 196592
URL: http://svn.freebsd.org/changeset/base/196592

Log:
  Fix a LOR between allprison_lock and vnode locks by releasing
  allprison_lock before releasing a prison's root vnode.
  
  PR:		kern/138004
  Reviewed by:	kib
  Approved by:	bz (mentor)
  MFC after:	3 days

Modified:
  head/sys/kern/kern_jail.c

Modified: head/sys/kern/kern_jail.c
==============================================================================
--- head/sys/kern/kern_jail.c	Thu Aug 27 16:15:32 2009	(r196591)
+++ head/sys/kern/kern_jail.c	Thu Aug 27 16:15:51 2009	(r196592)
@@ -2453,7 +2453,7 @@ prison_deref(struct prison *pr, int flag
 		ppr = pr->pr_parent;
 		for (tpr = ppr; tpr != NULL; tpr = tpr->pr_parent)
 			tpr->pr_childcount--;
-		sx_downgrade(&allprison_lock);
+		sx_xunlock(&allprison_lock);
 
 #ifdef VIMAGE
 		if (pr->pr_vnet != ppr->pr_vnet)
@@ -2479,7 +2479,7 @@ prison_deref(struct prison *pr, int flag
 		/* Removing a prison frees a reference on its parent. */
 		pr = ppr;
 		mtx_lock(&pr->pr_mtx);
-		flags = PD_DEREF | PD_LIST_SLOCKED;
+		flags = PD_DEREF;
 	}
 }
 

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 16:34:04 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EB74F106568C;
	Thu, 27 Aug 2009 16:34:04 +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 D820A8FC3A;
	Thu, 27 Aug 2009 16:34:04 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RGY4Rn001532;
	Thu, 27 Aug 2009 16:34:04 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RGY4FV001529;
	Thu, 27 Aug 2009 16:34:04 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908271634.n7RGY4FV001529@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 27 Aug 2009 16:34:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196593 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/acpica dev/xen/xenpci isa
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 16:34:05 -0000

Author: jhb
Date: Thu Aug 27 16:34:04 2009
New Revision: 196593
URL: http://svn.freebsd.org/changeset/base/196593

Log:
  MFC 196520:
  Tweak the way that the ACPI and ISA bus drivers match hint devices to
  BIOS-enumerated devices:
  - Assume a device is a match if the memory and I/O ports match even if the
    IRQ or DRQ is wrong or missing.  Some BIOSes don't include an IRQ for
    the atrtc device for example.
  - Add a hack to better match floppy controller devices.  Many BIOSes do not
    include the starting port of the floppy controller listed in the hints
    (0x3f0) in the resources for the device.  So far, however, all the BIOS
    variations encountered do include the 'port + 2' resource (0x3f2), so
    adjust the matching for "fdc" devices to look for 'port + 2'.
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/acpica/acpi.c
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/isa/isahint.c

Modified: stable/8/sys/dev/acpica/acpi.c
==============================================================================
--- stable/8/sys/dev/acpica/acpi.c	Thu Aug 27 16:15:51 2009	(r196592)
+++ stable/8/sys/dev/acpica/acpi.c	Thu Aug 27 16:34:04 2009	(r196593)
@@ -1014,14 +1014,27 @@ acpi_hint_device_unit(device_t acdev, de
 	    continue;
 
 	/*
-	 * Check for matching resources.  We must have at least one,
-	 * and all resources specified have to match.
+	 * Check for matching resources.  We must have at least one match.
+	 * Since I/O and memory resources cannot be shared, if we get a
+	 * match on either of those, ignore any mismatches in IRQs or DRQs.
 	 *
 	 * XXX: We may want to revisit this to be more lenient and wire
 	 * as long as it gets one match.
 	 */
 	matches = 0;
 	if (resource_long_value(name, unit, "port", &value) == 0) {
+	    /*
+	     * Floppy drive controllers are notorious for having a
+	     * wide variety of resources not all of which include the
+	     * first port that is specified by the hint (typically
+	     * 0x3f0) (see the comment above fdc_isa_alloc_resources()
+	     * in fdc_isa.c).  However, they do all seem to include
+	     * port + 2 (e.g. 0x3f2) so for a floppy device, look for
+	     * 'value + 2' in the port resources instead of the hint
+	     * value.
+	     */
+	    if (strcmp(name, "fdc") == 0)
+		value += 2;
 	    if (acpi_match_resource_hint(child, SYS_RES_IOPORT, value))
 		matches++;
 	    else
@@ -1033,6 +1046,8 @@ acpi_hint_device_unit(device_t acdev, de
 	    else
 		continue;
 	}
+	if (matches > 0)
+	    goto matched;
 	if (resource_long_value(name, unit, "irq", &value) == 0) {
 	    if (acpi_match_resource_hint(child, SYS_RES_IRQ, value))
 		matches++;
@@ -1046,6 +1061,7 @@ acpi_hint_device_unit(device_t acdev, de
 		continue;
 	}
 
+    matched:
 	if (matches > 0) {
 	    /* We have a winner! */
 	    *unitp = unit;

Modified: stable/8/sys/isa/isahint.c
==============================================================================
--- stable/8/sys/isa/isahint.c	Thu Aug 27 16:15:51 2009	(r196592)
+++ stable/8/sys/isa/isahint.c	Thu Aug 27 16:34:04 2009	(r196593)
@@ -118,14 +118,30 @@ isa_hint_device_unit(device_t bus, devic
 			continue;
 
 		/*
-		 * Check for matching resources.  We must have at least one,
-		 * and all resources specified have to match.
+		 * Check for matching resources.  We must have at
+		 * least one match.  Since I/O and memory resources
+		 * cannot be shared, if we get a match on either of
+		 * those, ignore any mismatches in IRQs or DRQs.
 		 *
-		 * XXX: We may want to revisit this to be more lenient and wire
-		 * as long as it gets one match.
+		 * XXX: We may want to revisit this to be more lenient
+		 * and wire as long as it gets one match.
 		 */
 		matches = 0;
 		if (resource_long_value(name, unit, "port", &value) == 0) {
+			/*
+			 * Floppy drive controllers are notorious for
+			 * having a wide variety of resources not all
+			 * of which include the first port that is
+			 * specified by the hint (typically 0x3f0)
+			 * (see the comment above
+			 * fdc_isa_alloc_resources() in fdc_isa.c).
+			 * However, they do all seem to include port +
+			 * 2 (e.g. 0x3f2) so for a floppy device, look
+			 * for 'value + 2' in the port resources
+			 * instead of the hint value.
+			 */
+			if (strcmp(name, "fdc") == 0)
+				value += 2;
 			if (isa_match_resource_hint(child, SYS_RES_IOPORT,
 			    value))
 				matches++;
@@ -139,6 +155,8 @@ isa_hint_device_unit(device_t bus, devic
 			else
 				continue;
 		}
+		if (matches > 0)
+			goto matched;
 		if (resource_long_value(name, unit, "irq", &value) == 0) {
 			if (isa_match_resource_hint(child, SYS_RES_IRQ, value))
 				matches++;
@@ -152,6 +170,7 @@ isa_hint_device_unit(device_t bus, devic
 				continue;
 		}
 
+	matched:
 		if (matches > 0) {
 			/* We have a winner! */
 			*unitp = unit;

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 17:16:24 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 51D87106568D;
	Thu, 27 Aug 2009 17:16:24 +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 36E798FC4D;
	Thu, 27 Aug 2009 17:16:24 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RHGOS7002503;
	Thu, 27 Aug 2009 17:16:24 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RHGOXm002500;
	Thu, 27 Aug 2009 17:16:24 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908271716.n7RHGOXm002500@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 27 Aug 2009 17:16: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: r196594 - in stable/8/release: . doc scripts
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:16:24 -0000

Author: jhb
Date: Thu Aug 27 17:16:23 2009
New Revision: 196594
URL: http://svn.freebsd.org/changeset/base/196594

Log:
  MFC 196521:
  Fix a few issues with the lib32 dist so that it includes ldd32.
  - Use a better find invocation to purge empty directories from all the dist
    trees during a release build.  The previous version did not purge
    directories whose contents were all empty directories.
  - Explicitly blacklist a few files from the lib32 dist instead of using a
    whitelist.  A better longterm solution is to fix the few offenders to not
    install data files during a lib32 install.
  
  Approved by:	re (kib)

Modified:
  stable/8/release/   (props changed)
  stable/8/release/Makefile
  stable/8/release/doc/   (props changed)
  stable/8/release/scripts/lib32-make.sh

Modified: stable/8/release/Makefile
==============================================================================
--- stable/8/release/Makefile	Thu Aug 27 16:34:04 2009	(r196593)
+++ stable/8/release/Makefile	Thu Aug 27 17:16:23 2009	(r196594)
@@ -696,7 +696,7 @@ release.5:
 	# Remove all the directories we don't need.
 	-cd ${RD}/trees && \
 		(find ${OTHER_DISTS} -path '*/var/empty' | xargs chflags noschg; \
-		find ${OTHER_DISTS} -depth -type d -empty -print | xargs rmdir)
+		find ${OTHER_DISTS} -depth -type d -empty -delete)
 	touch ${.TARGET}
 
 #

Modified: stable/8/release/scripts/lib32-make.sh
==============================================================================
--- stable/8/release/scripts/lib32-make.sh	Thu Aug 27 16:34:04 2009	(r196593)
+++ stable/8/release/scripts/lib32-make.sh	Thu Aug 27 17:16:23 2009	(r196594)
@@ -5,4 +5,4 @@
 
 # Clean the dust.
 cd ${RD}/trees/lib32 && \
-    find . ! -path '*/libexec/*' ! -path '*/usr/lib32/*' -delete
+    find . '(' -path '*/usr/share/*' -or -path '*/usr/lib/*' ')' -delete

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 17:16:43 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4052B1065691;
	Thu, 27 Aug 2009 17:16:43 +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 2EECA8FC2F;
	Thu, 27 Aug 2009 17:16:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RHGheu002544;
	Thu, 27 Aug 2009 17:16:43 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RHGhme002541;
	Thu, 27 Aug 2009 17:16:43 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908271716.n7RHGhme002541@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 27 Aug 2009 17:16:43 +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: r196595 - in stable/7/release: . scripts
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:16:43 -0000

Author: jhb
Date: Thu Aug 27 17:16:42 2009
New Revision: 196595
URL: http://svn.freebsd.org/changeset/base/196595

Log:
  MFC 196521:
  Fix a few issues with the lib32 dist so that it includes ldd32.
  - Use a better find invocation to purge empty directories from all the dist
    trees during a release build.  The previous version did not purge
    directories whose contents were all empty directories.
  - Explicitly blacklist a few files from the lib32 dist instead of using a
    whitelist.  A better longterm solution is to fix the few offenders to not
    install data files during a lib32 install.

Modified:
  stable/7/release/   (props changed)
  stable/7/release/Makefile
  stable/7/release/scripts/lib32-make.sh
  stable/7/release/scripts/src-install.sh   (props changed)

Modified: stable/7/release/Makefile
==============================================================================
--- stable/7/release/Makefile	Thu Aug 27 17:16:23 2009	(r196594)
+++ stable/7/release/Makefile	Thu Aug 27 17:16:42 2009	(r196595)
@@ -653,7 +653,7 @@ release.5:
 	# Remove all the directories we don't need.
 	-cd ${RD}/trees && \
 		(find ${OTHER_DISTS} -path '*/var/empty' | xargs chflags noschg; \
-		find ${OTHER_DISTS} -depth -type d -empty -print | xargs rmdir)
+		find ${OTHER_DISTS} -depth -type d -empty -delete)
 	touch ${.TARGET}
 
 #

Modified: stable/7/release/scripts/lib32-make.sh
==============================================================================
--- stable/7/release/scripts/lib32-make.sh	Thu Aug 27 17:16:23 2009	(r196594)
+++ stable/7/release/scripts/lib32-make.sh	Thu Aug 27 17:16:42 2009	(r196595)
@@ -5,4 +5,4 @@
 
 # Clean the dust.
 cd ${RD}/trees/lib32 && \
-    find . ! -path '*/libexec/*' ! -path '*/usr/lib32/*' -delete
+    find . '(' -path '*/usr/share/*' -or -path '*/usr/lib/*' ')' -delete

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 17:24:05 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6D8001065691;
	Thu, 27 Aug 2009 17:24:05 +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 4363D8FC3E;
	Thu, 27 Aug 2009 17:24:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RHO5gA002764;
	Thu, 27 Aug 2009 17:24:05 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RHO56p002763;
	Thu, 27 Aug 2009 17:24:05 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908271724.n7RHO56p002763@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 27 Aug 2009 17:24:05 +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: r196596 - in stable/7/release: . scripts
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:24:05 -0000

Author: jhb
Date: Thu Aug 27 17:24:05 2009
New Revision: 196596
URL: http://svn.freebsd.org/changeset/base/196596

Log:
  Move mergeinfo for 180008 up to src/release.

Modified:
  stable/7/release/   (props changed)
  stable/7/release/scripts/src-install.sh   (props changed)

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 17:25:59 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 28B1710656A4;
	Thu, 27 Aug 2009 17:25:59 +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 179DA8FC42;
	Thu, 27 Aug 2009 17:25:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RHPwTA002889;
	Thu, 27 Aug 2009 17:25:58 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RHPwdM002887;
	Thu, 27 Aug 2009 17:25:58 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908271725.n7RHPwdM002887@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 27 Aug 2009 17:25:58 +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: r196597 - in stable/8/release: . doc
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:25:59 -0000

Author: jhb
Date: Thu Aug 27 17:25:58 2009
New Revision: 196597
URL: http://svn.freebsd.org/changeset/base/196597

Log:
  MFC 196522:
  Invoke the recently added mm-mtree.sh release script to store a pre-built
  mergemaster mtree database in the 'base' dist.
  
  Approved by:	re (kib)

Modified:
  stable/8/release/   (props changed)
  stable/8/release/Makefile
  stable/8/release/doc/   (props changed)

Modified: stable/8/release/Makefile
==============================================================================
--- stable/8/release/Makefile	Thu Aug 27 17:24:05 2009	(r196596)
+++ stable/8/release/Makefile	Thu Aug 27 17:25:58 2009	(r196597)
@@ -646,6 +646,7 @@ release.2:
 	cd ${.CURDIR}/.. && ${CROSSMAKE} distrib-dirs DESTDIR=${RD}/trees/base
 	cd ${.CURDIR}/.. && ${CROSSMAKE} ${WORLD_FLAGS} distributeworld \
 	    DISTDIR=${RD}/trees
+	sh ${.CURDIR}/scripts/mm-mtree.sh -F "${CROSSENV}" -D "${RD}/trees/base"
 	touch ${.TARGET}
 
 # Make and install the generic kernel(s).

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 17:26:09 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C9A081065741;
	Thu, 27 Aug 2009 17:26:09 +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 B8D8C8FC2F;
	Thu, 27 Aug 2009 17:26:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RHQ9lV002937;
	Thu, 27 Aug 2009 17:26:09 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RHQ9Ol002935;
	Thu, 27 Aug 2009 17:26:09 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908271726.n7RHQ9Ol002935@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 27 Aug 2009 17:26:09 +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: r196598 - stable/7/release
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:26:09 -0000

Author: jhb
Date: Thu Aug 27 17:26:09 2009
New Revision: 196598
URL: http://svn.freebsd.org/changeset/base/196598

Log:
  MFC 196522:
  Invoke the recently added mm-mtree.sh release script to store a pre-built
  mergemaster mtree database in the 'base' dist.

Modified:
  stable/7/release/   (props changed)
  stable/7/release/Makefile

Modified: stable/7/release/Makefile
==============================================================================
--- stable/7/release/Makefile	Thu Aug 27 17:25:58 2009	(r196597)
+++ stable/7/release/Makefile	Thu Aug 27 17:26:09 2009	(r196598)
@@ -603,6 +603,7 @@ release.2:
 	cd ${.CURDIR}/.. && ${CROSSMAKE} distrib-dirs DESTDIR=${RD}/trees/base
 	cd ${.CURDIR}/.. && ${CROSSMAKE} ${WORLD_FLAGS} distributeworld \
 	    DISTDIR=${RD}/trees
+	sh ${.CURDIR}/scripts/mm-mtree.sh -F "${CROSSENV}" -D "${RD}/trees/base"
 	touch ${.TARGET}
 
 # Make and install the generic kernel(s).

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 17:32:59 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 261881065690;
	Thu, 27 Aug 2009 17:32:59 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 158388FC1C;
	Thu, 27 Aug 2009 17:32:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RHWw8k003106;
	Thu, 27 Aug 2009 17:32:58 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RHWwDQ003104;
	Thu, 27 Aug 2009 17:32:58 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200908271732.n7RHWwDQ003104@svn.freebsd.org>
From: Sam Leffler 
Date: Thu, 27 Aug 2009 17:32:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196599 - head/tools/tools/ath/athpoke
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:32:59 -0000

Author: sam
Date: Thu Aug 27 17:32:58 2009
New Revision: 196599
URL: http://svn.freebsd.org/changeset/base/196599

Log:
  recognie invalid register names

Modified:
  head/tools/tools/ath/athpoke/athpoke.c

Modified: head/tools/tools/ath/athpoke/athpoke.c
==============================================================================
--- head/tools/tools/ath/athpoke/athpoke.c	Thu Aug 27 17:26:09 2009	(r196598)
+++ head/tools/tools/ath/athpoke/athpoke.c	Thu Aug 27 17:32:58 2009	(r196599)
@@ -39,6 +39,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 typedef struct {
 	HAL_REVS revs;
@@ -64,6 +66,7 @@ main(int argc, char *argv[])
 {
 	struct ath_diag atd;
 	const char *ifname;
+	char *eptr;
 	int c, s;
 
 	s = socket(AF_INET, SOCK_DGRAM, 0);
@@ -102,7 +105,13 @@ main(int argc, char *argv[])
 		if (cp != NULL)
 			*cp++ = '\0';
 		dr = reglookup(argv[0]);
-		reg = (dr != NULL) ? dr->addr : (uint32_t) strtoul(argv[0], NULL, 0);
+		if (dr == NULL) {
+			errno = 0;
+			reg = (uint32_t) strtoul(argv[0], &eptr, 0);
+			if (argv[0] == eptr || eptr[0] != '\0')
+				errx(1, "invalid register \"%s\"", argv[0]);
+		} else
+			reg = dr->addr;
 		if (cp != NULL)
 			regwrite(s, &atd, reg, (uint32_t) strtoul(cp, NULL, 0));
 		printf("%s = %08x\n", argv[0], regread(s, &atd, reg));

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 17:33:45 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2D649106568E;
	Thu, 27 Aug 2009 17:33:45 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1D1FB8FC2C;
	Thu, 27 Aug 2009 17:33:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RHXjpO003171;
	Thu, 27 Aug 2009 17:33:45 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RHXjqH003169;
	Thu, 27 Aug 2009 17:33:45 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200908271733.n7RHXjqH003169@svn.freebsd.org>
From: Sam Leffler 
Date: Thu, 27 Aug 2009 17:33:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196600 - head/sys/arm/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:33:45 -0000

Author: sam
Date: Thu Aug 27 17:33:44 2009
New Revision: 196600
URL: http://svn.freebsd.org/changeset/base/196600

Log:
  enable mesh by default

Modified:
  head/sys/arm/conf/CAMBRIA

Modified: head/sys/arm/conf/CAMBRIA
==============================================================================
--- head/sys/arm/conf/CAMBRIA	Thu Aug 27 17:32:58 2009	(r196599)
+++ head/sys/arm/conf/CAMBRIA	Thu Aug 27 17:33:44 2009	(r196600)
@@ -107,6 +107,7 @@ device		random		# Entropy device
 # Wireless NIC cards
 device		wlan		# 802.11 support
 options 	IEEE80211_DEBUG
+options 	IEEE80211_SUPPORT_MESH
 options 	IEEE80211_SUPPORT_TDMA
 options 	IEEE80211_SUPPORT_MESH
 device		wlan_wep	# 802.11 WEP support

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 17:34:14 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 05C9D106568D;
	Thu, 27 Aug 2009 17:34:14 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E4FAA8FC3F;
	Thu, 27 Aug 2009 17:34:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RHYDoO003228;
	Thu, 27 Aug 2009 17:34:13 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RHYDRe003218;
	Thu, 27 Aug 2009 17:34:13 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <200908271734.n7RHYDRe003218@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Thu, 27 Aug 2009 17:34:13 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196601 - in stable/8/sys: . amd64/amd64
	amd64/include/xen amd64/linux32 cddl/contrib/opensolaris
	compat/ia32 contrib/dev/acpica contrib/pf dev/xen/xenpci
	i386/i386 i386/linux kern sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:34:14 -0000

Author: bz
Date: Thu Aug 27 17:34:13 2009
New Revision: 196601
URL: http://svn.freebsd.org/changeset/base/196601

Log:
  MFC r196512:
  
    Fix handling of .note.ABI-tag section for GNU systems [1].
    Handle GNU/Linux according to LSB Core Specification 4.0,
    Chapter 11. Object Format, 11.8. ABI note tag.
  
    Also check the first word of desc, not only name, according to
    glibc abi-tags specification to distinguish between Linux and
    kFreeBSD.
  
    Add explicit handling for Debian GNU/kFreeBSD, which runs
    on our kernels as well [2].
  
    In {amd64,i386}/trap.c, when checking osrel of the current process,
    also check the ABI to not change the signal behaviour for Linux
    binary processes, now that we save an osrel version for all three
    from the lists above in struct proc [2].
  
    These changes make it possible to run FreeBSD, Debian GNU/kFreeBSD
    and Linux binaries on the same machine again for at least i386 and
    amd64, and no longer break kFreeBSD which was detected as GNU(/Linux).
  
  PR:		kern/135468
  Submitted by:	dchagin [1] (initial patch)
  Suggested by:	kib [2]
  Tested by:	Petr Salinger (Petr.Salinger seznam.cz) for kFreeBSD
  Reviewed by:	kib
  Approved by:	re (kensmith)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/amd64/elf_machdep.c
  stable/8/sys/amd64/amd64/trap.c
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/amd64/linux32/linux32_sysvec.c
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/compat/ia32/ia32_sysvec.c
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/i386/i386/elf_machdep.c
  stable/8/sys/i386/i386/trap.c
  stable/8/sys/i386/linux/linux_sysvec.c
  stable/8/sys/kern/imgact_elf.c
  stable/8/sys/sys/imgact_elf.h

Modified: stable/8/sys/amd64/amd64/elf_machdep.c
==============================================================================
--- stable/8/sys/amd64/amd64/elf_machdep.c	Thu Aug 27 17:33:44 2009	(r196600)
+++ stable/8/sys/amd64/amd64/elf_machdep.c	Thu Aug 27 17:34:13 2009	(r196601)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -108,6 +109,22 @@ SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_AN
 	(sysinit_cfunc_t) elf64_insert_brand_entry,
 	&freebsd_brand_oinfo);
 
+static Elf64_Brandinfo kfreebsd_brand_info = {
+	.brand		= ELFOSABI_FREEBSD,
+	.machine	= EM_X86_64,
+	.compat_3_brand	= "FreeBSD",
+	.emul_path	= NULL,
+	.interp_path	= "/lib/ld-kfreebsd-x86-64.so.1",
+	.sysvec		= &elf64_freebsd_sysvec,
+	.interp_newpath	= NULL,
+	.brand_note	= &elf64_kfreebsd_brandnote,
+	.flags		= BI_CAN_EXEC_DYN | BI_BRAND_NOTE
+};
+
+SYSINIT(kelf64, SI_SUB_EXEC, SI_ORDER_ANY,
+	(sysinit_cfunc_t) elf64_insert_brand_entry,
+	&kfreebsd_brand_info);
+
 
 void
 elf64_dump_thread(struct thread *td __unused, void *dst __unused,

Modified: stable/8/sys/amd64/amd64/trap.c
==============================================================================
--- stable/8/sys/amd64/amd64/trap.c	Thu Aug 27 17:33:44 2009	(r196600)
+++ stable/8/sys/amd64/amd64/trap.c	Thu Aug 27 17:34:13 2009	(r196601)
@@ -409,7 +409,9 @@ trap(struct trapframe *frame)
 					 * This check also covers the images
 					 * without the ABI-tag ELF note.
 					 */
-					if (p->p_osrel >= 700004) {
+					if (SV_CURPROC_ABI() ==
+					    SV_ABI_FREEBSD &&
+					    p->p_osrel >= 700004) {
 						i = SIGSEGV;
 						ucode = SEGV_ACCERR;
 					} else {

Modified: stable/8/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- stable/8/sys/amd64/linux32/linux32_sysvec.c	Thu Aug 27 17:33:44 2009	(r196600)
+++ stable/8/sys/amd64/linux32/linux32_sysvec.c	Thu Aug 27 17:34:13 2009	(r196601)
@@ -127,6 +127,7 @@ static void     linux_sendsig(sig_t catc
 static void	exec_linux_setregs(struct thread *td, u_long entry,
 				   u_long stack, u_long ps_strings);
 static void	linux32_fixlimit(struct rlimit *rl, int which);
+static boolean_t linux32_trans_osrel(const Elf_Note *note, int32_t *osrel);
 
 static eventhandler_tag linux_exit_tag;
 static eventhandler_tag linux_schedtail_tag;
@@ -1066,14 +1067,38 @@ struct sysentvec elf_linux_sysvec = {
 	.sv_flags	= SV_ABI_LINUX | SV_ILP32 | SV_IA32
 };
 
-static char GNULINUX_ABI_VENDOR[] = "GNU";
+static char GNU_ABI_VENDOR[] = "GNU";
+static int GNULINUX_ABI_DESC = 0;
+
+static boolean_t
+linux32_trans_osrel(const Elf_Note *note, int32_t *osrel)
+{
+	const Elf32_Word *desc;
+	uintptr_t p;
+
+	p = (uintptr_t)(note + 1);
+	p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
+
+	desc = (const Elf32_Word *)p;
+	if (desc[0] != GNULINUX_ABI_DESC)
+		return (FALSE);
+
+	/*
+	 * For linux we encode osrel as follows (see linux_mib.c):
+	 * VVVMMMIII (version, major, minor), see linux_mib.c.
+	 */
+	*osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3];
+
+	return (TRUE);
+}
 
 static Elf_Brandnote linux32_brandnote = {
-	.hdr.n_namesz	= sizeof(GNULINUX_ABI_VENDOR),
-	.hdr.n_descsz	= 16,
+	.hdr.n_namesz	= sizeof(GNU_ABI_VENDOR),
+	.hdr.n_descsz	= 16,	/* XXX at least 16 */
 	.hdr.n_type	= 1,
-	.vendor		= GNULINUX_ABI_VENDOR,
-	.flags		= 0
+	.vendor		= GNU_ABI_VENDOR,
+	.flags		= BN_TRANSLATE_OSREL,
+	.trans_osrel	= linux32_trans_osrel
 };
 
 static Elf32_Brandinfo linux_brand = {

Modified: stable/8/sys/compat/ia32/ia32_sysvec.c
==============================================================================
--- stable/8/sys/compat/ia32/ia32_sysvec.c	Thu Aug 27 17:33:44 2009	(r196600)
+++ stable/8/sys/compat/ia32/ia32_sysvec.c	Thu Aug 27 17:34:13 2009	(r196601)
@@ -172,6 +172,21 @@ SYSINIT(oia32, SI_SUB_EXEC, SI_ORDER_ANY
 	(sysinit_cfunc_t) elf32_insert_brand_entry,
 	&ia32_brand_oinfo);
 
+static Elf32_Brandinfo kia32_brand_info = {
+	.brand		= ELFOSABI_FREEBSD,
+	.machine	= EM_386,
+	.compat_3_brand	= "FreeBSD",
+	.emul_path	= NULL,
+	.interp_path	= "/lib/ld.so.1",
+	.sysvec		= &ia32_freebsd_sysvec,
+	.brand_note	= &elf32_kfreebsd_brandnote,
+	.flags		= BI_CAN_EXEC_DYN | BI_BRAND_NOTE
+};
+
+SYSINIT(kia32, SI_SUB_EXEC, SI_ORDER_ANY,
+	(sysinit_cfunc_t) elf32_insert_brand_entry,
+	&kia32_brand_info);
+
 
 void
 elf32_dump_thread(struct thread *td __unused, void *dst __unused,

Modified: stable/8/sys/i386/i386/elf_machdep.c
==============================================================================
--- stable/8/sys/i386/i386/elf_machdep.c	Thu Aug 27 17:33:44 2009	(r196600)
+++ stable/8/sys/i386/i386/elf_machdep.c	Thu Aug 27 17:34:13 2009	(r196601)
@@ -108,6 +108,22 @@ SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_AN
 	(sysinit_cfunc_t) elf32_insert_brand_entry,
 	&freebsd_brand_oinfo);
 
+static Elf32_Brandinfo kfreebsd_brand_info = {
+	.brand		= ELFOSABI_FREEBSD,
+	.machine	= EM_386,
+	.compat_3_brand	= "FreeBSD",
+	.emul_path	= NULL,
+	.interp_path	= "/lib/ld.so.1",
+	.sysvec		= &elf32_freebsd_sysvec,
+	.interp_newpath	= NULL,
+	.brand_note	= &elf32_kfreebsd_brandnote,
+	.flags		= BI_CAN_EXEC_DYN | BI_BRAND_NOTE
+};
+
+SYSINIT(kelf32, SI_SUB_EXEC, SI_ORDER_ANY,
+	(sysinit_cfunc_t) elf32_insert_brand_entry,
+	&kfreebsd_brand_info);
+
 
 void
 elf32_dump_thread(struct thread *td __unused, void *dst __unused,

Modified: stable/8/sys/i386/i386/trap.c
==============================================================================
--- stable/8/sys/i386/i386/trap.c	Thu Aug 27 17:33:44 2009	(r196600)
+++ stable/8/sys/i386/i386/trap.c	Thu Aug 27 17:34:13 2009	(r196601)
@@ -423,7 +423,9 @@ trap(struct trapframe *frame)
 					 * This check also covers the images
 					 * without the ABI-tag ELF note.
 					 */
-					if (p->p_osrel >= 700004) {
+					if (SV_CURPROC_ABI() ==
+					    SV_ABI_FREEBSD &&
+					    p->p_osrel >= 700004) {
 						i = SIGSEGV;
 						ucode = SEGV_ACCERR;
 					} else {

Modified: stable/8/sys/i386/linux/linux_sysvec.c
==============================================================================
--- stable/8/sys/i386/linux/linux_sysvec.c	Thu Aug 27 17:33:44 2009	(r196600)
+++ stable/8/sys/i386/linux/linux_sysvec.c	Thu Aug 27 17:34:13 2009	(r196601)
@@ -108,6 +108,7 @@ static void     linux_sendsig(sig_t catc
 static void	exec_linux_setregs(struct thread *td, u_long entry,
 				   u_long stack, u_long ps_strings);
 static register_t *linux_copyout_strings(struct image_params *imgp);
+static boolean_t linux_trans_osrel(const Elf_Note *note, int32_t *osrel);
 
 static int linux_szplatform;
 const char *linux_platform;
@@ -1027,14 +1028,38 @@ struct sysentvec elf_linux_sysvec = {
 	.sv_flags	= SV_ABI_LINUX | SV_IA32 | SV_ILP32
 };
 
-static char GNULINUX_ABI_VENDOR[] = "GNU";
+static char GNU_ABI_VENDOR[] = "GNU";
+static int GNULINUX_ABI_DESC = 0;
+
+static boolean_t
+linux_trans_osrel(const Elf_Note *note, int32_t *osrel)
+{
+	const Elf32_Word *desc;
+	uintptr_t p;
+
+	p = (uintptr_t)(note + 1);
+	p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
+
+	desc = (const Elf32_Word *)p;
+	if (desc[0] != GNULINUX_ABI_DESC)
+		return (FALSE);
+
+	/*
+	 * For linux we encode osrel as follows (see linux_mib.c):
+	 * VVVMMMIII (version, major, minor), see linux_mib.c.
+	 */
+	*osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3];
+
+	return (TRUE);
+}
 
 static Elf_Brandnote linux_brandnote = {
-	.hdr.n_namesz	= sizeof(GNULINUX_ABI_VENDOR),
-	.hdr.n_descsz	= 16,
+	.hdr.n_namesz	= sizeof(GNU_ABI_VENDOR),
+	.hdr.n_descsz	= 16,	/* XXX at least 16 */
 	.hdr.n_type	= 1,
-	.vendor		= GNULINUX_ABI_VENDOR,
-	.flags		= 0
+	.vendor		= GNU_ABI_VENDOR,
+	.flags		= BN_TRANSLATE_OSREL,
+	.trans_osrel	= linux_trans_osrel
 };
 
 static Elf32_Brandinfo linux_brand = {

Modified: stable/8/sys/kern/imgact_elf.c
==============================================================================
--- stable/8/sys/kern/imgact_elf.c	Thu Aug 27 17:33:44 2009	(r196600)
+++ stable/8/sys/kern/imgact_elf.c	Thu Aug 27 17:34:13 2009	(r196601)
@@ -86,6 +86,9 @@ static int __elfN(load_section)(struct v
     vm_offset_t offset, caddr_t vmaddr, size_t memsz, size_t filsz,
     vm_prot_t prot, size_t pagesize);
 static int __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp);
+static boolean_t __elfN(freebsd_trans_osrel)(const Elf_Note *note,
+    int32_t *osrel);
+static boolean_t kfreebsd_trans_osrel(const Elf_Note *note, int32_t *osrel);
 static boolean_t __elfN(check_note)(struct image_params *imgp,
     Elf_Brandnote *checknote, int32_t *osrel);
 
@@ -116,9 +119,56 @@ Elf_Brandnote __elfN(freebsd_brandnote) 
 	.hdr.n_descsz	= sizeof(int32_t),
 	.hdr.n_type	= 1,
 	.vendor		= FREEBSD_ABI_VENDOR,
-	.flags		= BN_CAN_FETCH_OSREL
+	.flags		= BN_TRANSLATE_OSREL,
+	.trans_osrel	= __elfN(freebsd_trans_osrel)
 };
 
+static boolean_t
+__elfN(freebsd_trans_osrel)(const Elf_Note *note, int32_t *osrel)
+{
+	uintptr_t p;
+
+	p = (uintptr_t)(note + 1);
+	p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
+	*osrel = *(const int32_t *)(p);
+
+	return (TRUE);
+}
+
+static const char GNU_ABI_VENDOR[] = "GNU";
+static int GNU_KFREEBSD_ABI_DESC = 3;
+
+Elf_Brandnote __elfN(kfreebsd_brandnote) = {
+	.hdr.n_namesz	= sizeof(GNU_ABI_VENDOR),
+	.hdr.n_descsz	= 16,	/* XXX at least 16 */
+	.hdr.n_type	= 1,
+	.vendor		= GNU_ABI_VENDOR,
+	.flags		= BN_TRANSLATE_OSREL,
+	.trans_osrel	= kfreebsd_trans_osrel
+};
+
+static boolean_t
+kfreebsd_trans_osrel(const Elf_Note *note, int32_t *osrel)
+{
+	const Elf32_Word *desc;
+	uintptr_t p;
+
+	p = (uintptr_t)(note + 1);
+	p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
+
+	desc = (const Elf32_Word *)p;
+	if (desc[0] != GNU_KFREEBSD_ABI_DESC)
+		return (FALSE);
+
+	/*
+	 * Debian GNU/kFreeBSD embed the earliest compatible kernel version
+	 * (__FreeBSD_version: Rxx) in the LSB way.
+	 */
+	*osrel = desc[1] * 100000 + desc[2] * 1000 + desc[3];
+
+	return (TRUE);
+}
+
 int
 __elfN(insert_brand_entry)(Elf_Brandinfo *entry)
 {
@@ -1371,11 +1421,9 @@ __elfN(check_note)(struct image_params *
 		 * Fetch the osreldate for binary
 		 * from the ELF OSABI-note if necessary.
 		 */
-		if ((checknote->flags & BN_CAN_FETCH_OSREL) != 0 &&
-		    osrel != NULL)
-			*osrel = *(const int32_t *) (note_name +
-			    roundup2(checknote->hdr.n_namesz,
-			    sizeof(Elf32_Addr)));
+		if ((checknote->flags & BN_TRANSLATE_OSREL) != 0 &&
+		    checknote->trans_osrel != NULL)
+			return (checknote->trans_osrel(note, osrel));
 		return (TRUE);
 
 nextnote:

Modified: stable/8/sys/sys/imgact_elf.h
==============================================================================
--- stable/8/sys/sys/imgact_elf.h	Thu Aug 27 17:33:44 2009	(r196600)
+++ stable/8/sys/sys/imgact_elf.h	Thu Aug 27 17:34:13 2009	(r196601)
@@ -58,7 +58,10 @@ typedef struct {
 	Elf_Note	hdr;
 	const char *	vendor;
 	int		flags;
-#define	BN_CAN_FETCH_OSREL	0x0001
+	boolean_t	(*trans_osrel)(const Elf_Note *, int32_t *);
+#define	BN_CAN_FETCH_OSREL	0x0001	/* Deprecated. */
+#define	BN_TRANSLATE_OSREL	0x0002	/* Use trans_osrel fetch osrel after */
+					/* checking ABI contraint if needed. */
 } Elf_Brandnote;
 
 typedef struct {
@@ -91,6 +94,7 @@ void	__elfN(dump_thread)(struct thread *
 
 extern int __elfN(fallback_brand);
 extern Elf_Brandnote __elfN(freebsd_brandnote);
+extern Elf_Brandnote __elfN(kfreebsd_brandnote);
 #endif /* _KERNEL */
 
 #endif /* !_SYS_IMGACT_ELF_H_ */

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 17:37:00 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 51CD3106564A;
	Thu, 27 Aug 2009 17:37:00 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3E18E8FC3A;
	Thu, 27 Aug 2009 17:37:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RHb0PA003323;
	Thu, 27 Aug 2009 17:37:00 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RHb0KM003313;
	Thu, 27 Aug 2009 17:37:00 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <200908271737.n7RHb0KM003313@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Thu, 27 Aug 2009 17:37:00 +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: r196602 - in stable/7/sys: . amd64/amd64 amd64/linux32
	compat/ia32 conf contrib/pf i386/i386 i386/linux kern sys
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:37:00 -0000

Author: bz
Date: Thu Aug 27 17:36:59 2009
New Revision: 196602
URL: http://svn.freebsd.org/changeset/base/196602

Log:
  MFC r196512:
  
    Fix handling of .note.ABI-tag section for GNU systems [1].
    Handle GNU/Linux according to LSB Core Specification 4.0,
    Chapter 11. Object Format, 11.8. ABI note tag.
  
    Also check the first word of desc, not only name, according to
    glibc abi-tags specification to distinguish between Linux and
    kFreeBSD.
  
    Add explicit handling for Debian GNU/kFreeBSD, which runs
    on our kernels as well [2].
  
    In {amd64,i386}/trap.c, when checking osrel of the current process,
    also check the ABI to not change the signal behaviour for Linux
    binary processes, now that we save an osrel version for all three
    from the lists above in struct proc [2] (slightly different to HEAD).
  
    These changes make it possible to run FreeBSD, Debian GNU/kFreeBSD
    and Linux binaries on the same machine again for at least i386 and
    amd64, and no longer break kFreeBSD which was detected as GNU(/Linux).
  
  PR:		kern/135468
  Submitted by:	dchagin [1] (initial patch)
  Suggested by:	kib [2]
  Tested by:	Petr Salinger (Petr.Salinger seznam.cz) for kFreeBSD
  Reviewed by:	kib

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/amd64/amd64/elf_machdep.c
  stable/7/sys/amd64/amd64/trap.c
  stable/7/sys/amd64/linux32/linux32_sysvec.c
  stable/7/sys/compat/ia32/ia32_sysvec.c
  stable/7/sys/conf/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/i386/i386/elf_machdep.c
  stable/7/sys/i386/i386/trap.c
  stable/7/sys/i386/linux/linux_sysvec.c
  stable/7/sys/kern/imgact_elf.c
  stable/7/sys/sys/imgact_elf.h

Modified: stable/7/sys/amd64/amd64/elf_machdep.c
==============================================================================
--- stable/7/sys/amd64/amd64/elf_machdep.c	Thu Aug 27 17:34:13 2009	(r196601)
+++ stable/7/sys/amd64/amd64/elf_machdep.c	Thu Aug 27 17:36:59 2009	(r196602)
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -107,6 +108,22 @@ SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_AN
 	(sysinit_cfunc_t) elf64_insert_brand_entry,
 	&freebsd_brand_oinfo);
 
+static Elf64_Brandinfo kfreebsd_brand_info = {
+	.brand		= ELFOSABI_FREEBSD,
+	.machine	= EM_X86_64,
+	.compat_3_brand	= "FreeBSD",
+	.emul_path	= NULL,
+	.interp_path	= "/lib/ld-kfreebsd-x86-64.so.1",
+	.sysvec		= &elf64_freebsd_sysvec,
+	.interp_newpath	= NULL,
+	.brand_note	= &elf64_kfreebsd_brandnote,
+	.flags		= BI_CAN_EXEC_DYN | BI_BRAND_NOTE
+};
+
+SYSINIT(kelf64, SI_SUB_EXEC, SI_ORDER_ANY,
+	(sysinit_cfunc_t) elf64_insert_brand_entry,
+	&kfreebsd_brand_info);
+
 
 void
 elf64_dump_thread(struct thread *td __unused, void *dst __unused,

Modified: stable/7/sys/amd64/amd64/trap.c
==============================================================================
--- stable/7/sys/amd64/amd64/trap.c	Thu Aug 27 17:34:13 2009	(r196601)
+++ stable/7/sys/amd64/amd64/trap.c	Thu Aug 27 17:36:59 2009	(r196602)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
  */
 
 #include "opt_clock.h"
+#include "opt_compat.h"
 #include "opt_cpu.h"
 #include "opt_hwpmc_hooks.h"
 #include "opt_isa.h"
@@ -115,6 +116,13 @@ dtrace_doubletrap_func_t	dtrace_doubletr
 systrace_probe_func_t	systrace_probe_func;
 #endif
 
+/* Defined in amd64/amd64/elf_machdep.c. */
+extern struct sysentvec elf64_freebsd_sysvec;
+#ifdef COMPAT_IA32
+/* Defined in compat/ia32/ia32_sysvec.c. */
+extern struct sysentvec ia32_freebsd_sysvec;
+#endif
+
 extern void trap(struct trapframe *frame);
 extern void syscall(struct trapframe *frame);
 void dblfault_handler(struct trapframe *frame);
@@ -359,7 +367,13 @@ trap(struct trapframe *frame)
 					 * This check also covers the images
 					 * without the ABI-tag ELF note.
 					 */
-					if (p->p_osrel >= 700004) {
+					if ((curproc->p_sysent ==
+					    &elf64_freebsd_sysvec
+#ifdef COMPAT_IA32
+					    || curproc->p_sysent ==
+					    &ia32_freebsd_sysvec
+#endif
+					    ) && p->p_osrel >= 700004) {
 						i = SIGSEGV;
 						ucode = SEGV_ACCERR;
 					} else {

Modified: stable/7/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- stable/7/sys/amd64/linux32/linux32_sysvec.c	Thu Aug 27 17:34:13 2009	(r196601)
+++ stable/7/sys/amd64/linux32/linux32_sysvec.c	Thu Aug 27 17:36:59 2009	(r196602)
@@ -126,6 +126,7 @@ static void     linux_sendsig(sig_t catc
 static void	exec_linux_setregs(struct thread *td, u_long entry,
 				   u_long stack, u_long ps_strings);
 static void	linux32_fixlimit(struct rlimit *rl, int which);
+static boolean_t linux32_trans_osrel(const Elf_Note *note, int32_t *osrel);
 
 static eventhandler_tag linux_exit_tag;
 static eventhandler_tag linux_schedtail_tag;
@@ -1055,14 +1056,38 @@ struct sysentvec elf_linux_sysvec = {
 	.sv_maxssiz	= &linux32_maxssiz,
 };
 
-static char GNULINUX_ABI_VENDOR[] = "GNU";
+static char GNU_ABI_VENDOR[] = "GNU";
+static int GNULINUX_ABI_DESC = 0;
+
+static boolean_t
+linux32_trans_osrel(const Elf_Note *note, int32_t *osrel)
+{
+	const Elf32_Word *desc;
+	uintptr_t p;
+
+	p = (uintptr_t)(note + 1);
+	p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
+
+	desc = (const Elf32_Word *)p;
+	if (desc[0] != GNULINUX_ABI_DESC)
+		return (FALSE);
+
+	/*
+	 * For linux we encode osrel as follows (see linux_mib.c):
+	 * VVVMMMIII (version, major, minor), see linux_mib.c.
+	 */
+	*osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3];
+
+	return (TRUE);
+}
 
 static Elf_Brandnote linux32_brandnote = {
-	.hdr.n_namesz	= sizeof(GNULINUX_ABI_VENDOR),
-	.hdr.n_descsz	= 16,
+	.hdr.n_namesz	= sizeof(GNU_ABI_VENDOR),
+	.hdr.n_descsz	= 16,	/* XXX at least 16 */
 	.hdr.n_type	= 1,
-	.vendor		= GNULINUX_ABI_VENDOR,
-	.flags		= 0
+	.vendor		= GNU_ABI_VENDOR,
+	.flags		= BN_TRANSLATE_OSREL,
+	.trans_osrel	= linux32_trans_osrel
 };
 
 static Elf32_Brandinfo linux_brand = {

Modified: stable/7/sys/compat/ia32/ia32_sysvec.c
==============================================================================
--- stable/7/sys/compat/ia32/ia32_sysvec.c	Thu Aug 27 17:34:13 2009	(r196601)
+++ stable/7/sys/compat/ia32/ia32_sysvec.c	Thu Aug 27 17:36:59 2009	(r196602)
@@ -171,6 +171,21 @@ SYSINIT(oia32, SI_SUB_EXEC, SI_ORDER_ANY
 	(sysinit_cfunc_t) elf32_insert_brand_entry,
 	&ia32_brand_oinfo);
 
+static Elf32_Brandinfo kia32_brand_info = {
+	.brand		= ELFOSABI_FREEBSD,
+	.machine	= EM_386,
+	.compat_3_brand	= "FreeBSD",
+	.emul_path	= NULL,
+	.interp_path	= "/lib/ld.so.1",
+	.sysvec		= &ia32_freebsd_sysvec,
+	.brand_note	= &elf32_kfreebsd_brandnote,
+	.flags		= BI_CAN_EXEC_DYN | BI_BRAND_NOTE
+};
+
+SYSINIT(kia32, SI_SUB_EXEC, SI_ORDER_ANY,
+	(sysinit_cfunc_t) elf32_insert_brand_entry,
+	&kia32_brand_info);
+
 
 void
 elf32_dump_thread(struct thread *td __unused, void *dst __unused,

Modified: stable/7/sys/i386/i386/elf_machdep.c
==============================================================================
--- stable/7/sys/i386/i386/elf_machdep.c	Thu Aug 27 17:34:13 2009	(r196601)
+++ stable/7/sys/i386/i386/elf_machdep.c	Thu Aug 27 17:36:59 2009	(r196602)
@@ -107,6 +107,22 @@ SYSINIT(oelf32, SI_SUB_EXEC, SI_ORDER_AN
 	(sysinit_cfunc_t) elf32_insert_brand_entry,
 	&freebsd_brand_oinfo);
 
+static Elf32_Brandinfo kfreebsd_brand_info = {
+	.brand		= ELFOSABI_FREEBSD,
+	.machine	= EM_386,
+	.compat_3_brand	= "FreeBSD",
+	.emul_path	= NULL,
+	.interp_path	= "/lib/ld.so.1",
+	.sysvec		= &elf32_freebsd_sysvec,
+	.interp_newpath	= NULL,
+	.brand_note	= &elf32_kfreebsd_brandnote,
+	.flags		= BI_CAN_EXEC_DYN | BI_BRAND_NOTE
+};
+
+SYSINIT(kelf32, SI_SUB_EXEC, SI_ORDER_ANY,
+	(sysinit_cfunc_t) elf32_insert_brand_entry,
+	&kfreebsd_brand_info);
+
 
 void
 elf32_dump_thread(struct thread *td __unused, void *dst __unused,

Modified: stable/7/sys/i386/i386/trap.c
==============================================================================
--- stable/7/sys/i386/i386/trap.c	Thu Aug 27 17:34:13 2009	(r196601)
+++ stable/7/sys/i386/i386/trap.c	Thu Aug 27 17:36:59 2009	(r196602)
@@ -123,6 +123,9 @@ dtrace_doubletrap_func_t	dtrace_doubletr
 systrace_probe_func_t	systrace_probe_func;
 #endif
 
+/* Defined in i386/i386/elf_machdep.c. */
+extern struct sysentvec elf32_freebsd_sysvec;
+
 extern void trap(struct trapframe *frame);
 extern void syscall(struct trapframe *frame);
 
@@ -423,7 +426,9 @@ trap(struct trapframe *frame)
 					 * This check also covers the images
 					 * without the ABI-tag ELF note.
 					 */
-					if (p->p_osrel >= 700004) {
+					if (curproc->p_sysent ==
+					    &elf32_freebsd_sysvec &&
+					    p->p_osrel >= 700004) {
 						i = SIGSEGV;
 						ucode = SEGV_ACCERR;
 					} else {

Modified: stable/7/sys/i386/linux/linux_sysvec.c
==============================================================================
--- stable/7/sys/i386/linux/linux_sysvec.c	Thu Aug 27 17:34:13 2009	(r196601)
+++ stable/7/sys/i386/linux/linux_sysvec.c	Thu Aug 27 17:36:59 2009	(r196602)
@@ -107,6 +107,7 @@ static void     linux_sendsig(sig_t catc
 static void	exec_linux_setregs(struct thread *td, u_long entry,
 				   u_long stack, u_long ps_strings);
 static register_t *linux_copyout_strings(struct image_params *imgp);
+static boolean_t linux_trans_osrel(const Elf_Note *note, int32_t *osrel);
 
 static int linux_szplatform;
 const char *linux_platform;
@@ -1025,14 +1026,38 @@ struct sysentvec elf_linux_sysvec = {
 	.sv_maxssiz	= NULL
 };
 
-static char GNULINUX_ABI_VENDOR[] = "GNU";
+static char GNU_ABI_VENDOR[] = "GNU";
+static int GNULINUX_ABI_DESC = 0;
+
+static boolean_t
+linux_trans_osrel(const Elf_Note *note, int32_t *osrel)
+{
+	const Elf32_Word *desc;
+	uintptr_t p;
+
+	p = (uintptr_t)(note + 1);
+	p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
+
+	desc = (const Elf32_Word *)p;
+	if (desc[0] != GNULINUX_ABI_DESC)
+		return (FALSE);
+
+	/*
+	 * For linux we encode osrel as follows (see linux_mib.c):
+	 * VVVMMMIII (version, major, minor), see linux_mib.c.
+	 */
+	*osrel = desc[1] * 1000000 + desc[2] * 1000 + desc[3];
+
+	return (TRUE);
+}
 
 static Elf_Brandnote linux_brandnote = {
-	.hdr.n_namesz	= sizeof(GNULINUX_ABI_VENDOR),
-	.hdr.n_descsz	= 16,
+	.hdr.n_namesz	= sizeof(GNU_ABI_VENDOR),
+	.hdr.n_descsz	= 16,	/* XXX at least 16 */
 	.hdr.n_type	= 1,
-	.vendor		= GNULINUX_ABI_VENDOR,
-	.flags		= 0
+	.vendor		= GNU_ABI_VENDOR,
+	.flags		= BN_TRANSLATE_OSREL,
+	.trans_osrel	= linux_trans_osrel
 };
 
 static Elf32_Brandinfo linux_brand = {

Modified: stable/7/sys/kern/imgact_elf.c
==============================================================================
--- stable/7/sys/kern/imgact_elf.c	Thu Aug 27 17:34:13 2009	(r196601)
+++ stable/7/sys/kern/imgact_elf.c	Thu Aug 27 17:36:59 2009	(r196602)
@@ -86,6 +86,9 @@ static int __elfN(load_section)(struct v
     vm_offset_t offset, caddr_t vmaddr, size_t memsz, size_t filsz,
     vm_prot_t prot, size_t pagesize);
 static int __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp);
+static boolean_t __elfN(freebsd_trans_osrel)(const Elf_Note *note,
+    int32_t *osrel);
+static boolean_t kfreebsd_trans_osrel(const Elf_Note *note, int32_t *osrel);
 static boolean_t __elfN(check_note)(struct image_params *imgp,
     Elf_Brandnote *checknote, int32_t *osrel);
 
@@ -119,9 +122,56 @@ Elf_Brandnote __elfN(freebsd_brandnote) 
 	.hdr.n_descsz	= sizeof(int32_t),
 	.hdr.n_type	= 1,
 	.vendor		= FREEBSD_ABI_VENDOR,
-	.flags		= BN_CAN_FETCH_OSREL
+	.flags		= BN_TRANSLATE_OSREL,
+	.trans_osrel	= __elfN(freebsd_trans_osrel)
 };
 
+static boolean_t
+__elfN(freebsd_trans_osrel)(const Elf_Note *note, int32_t *osrel)
+{
+	uintptr_t p;
+
+	p = (uintptr_t)(note + 1);
+	p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
+	*osrel = *(const int32_t *)(p);
+
+	return (TRUE);
+}
+
+static const char GNU_ABI_VENDOR[] = "GNU";
+static int GNU_KFREEBSD_ABI_DESC = 3;
+
+Elf_Brandnote __elfN(kfreebsd_brandnote) = {
+	.hdr.n_namesz	= sizeof(GNU_ABI_VENDOR),
+	.hdr.n_descsz	= 16,	/* XXX at least 16 */
+	.hdr.n_type	= 1,
+	.vendor		= GNU_ABI_VENDOR,
+	.flags		= BN_TRANSLATE_OSREL,
+	.trans_osrel	= kfreebsd_trans_osrel
+};
+
+static boolean_t
+kfreebsd_trans_osrel(const Elf_Note *note, int32_t *osrel)
+{
+	const Elf32_Word *desc;
+	uintptr_t p;
+
+	p = (uintptr_t)(note + 1);
+	p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
+
+	desc = (const Elf32_Word *)p;
+	if (desc[0] != GNU_KFREEBSD_ABI_DESC)
+		return (FALSE);
+
+	/*
+	 * Debian GNU/kFreeBSD embed the earliest compatible kernel version
+	 * (__FreeBSD_version: Rxx) in the LSB way.
+	 */
+	*osrel = desc[1] * 100000 + desc[2] * 1000 + desc[3];
+
+	return (TRUE);
+}
+
 int
 __elfN(insert_brand_entry)(Elf_Brandinfo *entry)
 {
@@ -1382,11 +1432,9 @@ __elfN(check_note)(struct image_params *
 		 * Fetch the osreldate for binary
 		 * from the ELF OSABI-note if necessary.
 		 */
-		if ((checknote->flags & BN_CAN_FETCH_OSREL) != 0 &&
-		    osrel != NULL)
-			*osrel = *(const int32_t *) (note_name +
-			    roundup2(checknote->hdr.n_namesz,
-			    sizeof(Elf32_Addr)));
+		if ((checknote->flags & BN_TRANSLATE_OSREL) != 0 &&
+		    checknote->trans_osrel != NULL)
+			return (checknote->trans_osrel(note, osrel));
 		return (TRUE);
 
 nextnote:

Modified: stable/7/sys/sys/imgact_elf.h
==============================================================================
--- stable/7/sys/sys/imgact_elf.h	Thu Aug 27 17:34:13 2009	(r196601)
+++ stable/7/sys/sys/imgact_elf.h	Thu Aug 27 17:36:59 2009	(r196602)
@@ -59,7 +59,10 @@ typedef struct {
 	Elf_Note	hdr;
 	const char *	vendor;
 	int		flags;
-#define	BN_CAN_FETCH_OSREL	0x0001
+	boolean_t	(*trans_osrel)(const Elf_Note *, int32_t *);
+#define	BN_CAN_FETCH_OSREL	0x0001	/* Deprecated. */
+#define	BN_TRANSLATE_OSREL	0x0002	/* Use trans_osrel fetch osrel after */
+					/* checking ABI contraint if needed. */
 } Elf_Brandnote;
 
 typedef struct {
@@ -92,6 +95,7 @@ void	__elfN(dump_thread)(struct thread *
 
 extern	int __elfN(fallback_brand);
 extern Elf_Brandnote __elfN(freebsd_brandnote);
+extern Elf_Brandnote __elfN(kfreebsd_brandnote);
 #endif /* _KERNEL */
 
 #endif /* !_SYS_IMGACT_ELF_H_ */

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 17:42:38 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1E05A106568F;
	Thu, 27 Aug 2009 17:42:38 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0D8E78FC2C;
	Thu, 27 Aug 2009 17:42:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RHgbAZ003463;
	Thu, 27 Aug 2009 17:42:37 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RHgb0r003461;
	Thu, 27 Aug 2009 17:42:37 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200908271742.n7RHgb0r003461@svn.freebsd.org>
From: Sam Leffler 
Date: Thu, 27 Aug 2009 17:42:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196603 - head/sys/dev/ath/ath_hal
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:42:38 -0000

Author: sam
Date: Thu Aug 27 17:42:37 2009
New Revision: 196603
URL: http://svn.freebsd.org/changeset/base/196603

Log:
  change default regdomain for thailand
  
  Obtained from:	linux-wireless@kernel.org

Modified:
  head/sys/dev/ath/ath_hal/ah_regdomain.c

Modified: head/sys/dev/ath/ath_hal/ah_regdomain.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ah_regdomain.c	Thu Aug 27 17:36:59 2009	(r196602)
+++ head/sys/dev/ath/ath_hal/ah_regdomain.c	Thu Aug 27 17:42:37 2009	(r196603)
@@ -573,7 +573,7 @@ static COUNTRY_CODE_TO_ENUM_RD allCountr
 	{ CTRY_SWITZERLAND, ETSI1_WORLD },
 	{ CTRY_SYRIA,       NULL1_WORLD },
 	{ CTRY_TAIWAN,      APL3_FCCA },
-	{ CTRY_THAILAND,    NULL1_WORLD },
+	{ CTRY_THAILAND,    FCC3_WORLD },
 	{ CTRY_TRINIDAD_Y_TOBAGO,ETSI4_WORLD },
 	{ CTRY_TUNISIA,     ETSI3_WORLD },
 	{ CTRY_TURKEY,      ETSI3_WORLD },

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 17:49:11 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 58F4D106568E;
	Thu, 27 Aug 2009 17:49:11 +0000 (UTC)
	(envelope-from serenity@exscape.org)
Received: from ch-smtp01.sth.basefarm.net (ch-smtp01.sth.basefarm.net
	[80.76.149.212])
	by mx1.freebsd.org (Postfix) with ESMTP id 1537B8FC2C;
	Thu, 27 Aug 2009 17:49:10 +0000 (UTC)
Received: from c83-253-252-234.bredband.comhem.se ([83.253.252.234]:55954
	helo=mx.exscape.org)
	by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.68)
	(envelope-from )
	id 1Mgj2Q-0000yK-3K; Thu, 27 Aug 2009 19:45:31 +0200
Received: from [192.168.1.5] (macbookpro [192.168.1.5])
	(using TLSv1 with cipher AES128-SHA (128/128 bits))
	(No client certificate requested)
	by mx.exscape.org (Postfix) with ESMTPSA id D28A926DB6;
	Thu, 27 Aug 2009 19:45:22 +0200 (CEST)
Mime-Version: 1.0 (Apple Message framework v1075.2)
Content-Type: text/plain; charset=us-ascii; format=flowed
From: Thomas Backman 
In-Reply-To: <200908271733.n7RHXjqH003169@svn.freebsd.org>
Date: Thu, 27 Aug 2009 19:45:20 +0200
Content-Transfer-Encoding: 7bit
Message-Id: <08F89168-3D10-4D06-AE88-8618D5F771B1@exscape.org>
References: <200908271733.n7RHXjqH003169@svn.freebsd.org>
To: Sam Leffler 
X-Mailer: Apple Mail (2.1075.2)
X-Originating-IP: 83.253.252.234
X-Scan-Result: No virus found in message 1Mgj2Q-0000yK-3K.
X-Scan-Signature: ch-smtp01.sth.basefarm.net 1Mgj2Q-0000yK-3K
	8bdd632eee5c977cc904f3c0291d1f38
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org
Subject: Re: svn commit: r196600 - head/sys/arm/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:49:11 -0000

On Aug 27, 2009, at 7:33 PM, Sam Leffler wrote:

> Log:
>  enable mesh by default
>
> +options 	IEEE80211_SUPPORT_MESH
> options 	IEEE80211_SUPPORT_TDMA
> options 	IEEE80211_SUPPORT_MESH
Hmm?

Regards,
Thomas

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 17:53:26 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0AC2E106568D;
	Thu, 27 Aug 2009 17:53:26 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id ED8988FC1C;
	Thu, 27 Aug 2009 17:53:25 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RHrPRa003721;
	Thu, 27 Aug 2009 17:53:25 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RHrPaK003719;
	Thu, 27 Aug 2009 17:53:25 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <200908271753.n7RHrPaK003719@svn.freebsd.org>
From: Doug Barton 
Date: Thu, 27 Aug 2009 17:53:25 +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: r196604 - stable/8/etc
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:53:26 -0000

Author: dougb
Date: Thu Aug 27 17:53:25 2009
New Revision: 196604
URL: http://svn.freebsd.org/changeset/base/196604

Log:
  MFC 196589:
  
  In the loop through the list of interfaces in network6_interface_setup()
  rtsol_interface gets reset to "yes" each time through the loop, but
  rtsol_available does not. If a user has lo0 first in their list of
  interfaces rtsol_available will get set to "no" the first time through
  the loop and subsequent interfaces will not get rtsol'ed when they should.
  
  Therefore change the conditional for the is_wired() test to _interface.
  
  Approved by:	re (kib)

Modified:
  stable/8/etc/   (props changed)
  stable/8/etc/network.subr

Modified: stable/8/etc/network.subr
==============================================================================
--- stable/8/etc/network.subr	Thu Aug 27 17:42:37 2009	(r196603)
+++ stable/8/etc/network.subr	Thu Aug 27 17:53:25 2009	(r196604)
@@ -872,8 +872,8 @@ network6_interface_setup()
 		# Wireless NIC cards are virtualized through the wlan interface
 		if ! is_wired_interface ${i}; then
 			case "${i}" in
-			wlan*)	rtsol_available=yes ;;
-			*)	rtsol_available=no ;;
+			wlan*)	rtsol_interface=yes ;;
+			*)	rtsol_interface=no ;;
 			esac
 		fi
 

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 17:55:44 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AA890106568B;
	Thu, 27 Aug 2009 17:55:44 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 99FB68FC3C;
	Thu, 27 Aug 2009 17:55:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RHtiNw003825;
	Thu, 27 Aug 2009 17:55:44 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RHtiCT003823;
	Thu, 27 Aug 2009 17:55:44 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200908271755.n7RHtiCT003823@svn.freebsd.org>
From: Sam Leffler 
Date: Thu, 27 Aug 2009 17:55:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196605 - head/sys/arm/conf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 17:55:44 -0000

Author: sam
Date: Thu Aug 27 17:55:44 2009
New Revision: 196605
URL: http://svn.freebsd.org/changeset/base/196605

Log:
  revert r196600; didn't notice it'd been done already
  
  Submitted by:	jhay

Modified:
  head/sys/arm/conf/CAMBRIA

Modified: head/sys/arm/conf/CAMBRIA
==============================================================================
--- head/sys/arm/conf/CAMBRIA	Thu Aug 27 17:53:25 2009	(r196604)
+++ head/sys/arm/conf/CAMBRIA	Thu Aug 27 17:55:44 2009	(r196605)
@@ -107,7 +107,6 @@ device		random		# Entropy device
 # Wireless NIC cards
 device		wlan		# 802.11 support
 options 	IEEE80211_DEBUG
-options 	IEEE80211_SUPPORT_MESH
 options 	IEEE80211_SUPPORT_TDMA
 options 	IEEE80211_SUPPORT_MESH
 device		wlan_wep	# 802.11 WEP support

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 18:18:55 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5AFAA106568F
	for ; Thu, 27 Aug 2009 18:18:55 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4])
	by mx1.freebsd.org (Postfix) with ESMTP id D7E348FC3F
	for ; Thu, 27 Aug 2009 18:18:54 +0000 (UTC)
Received: (qmail 1790 invoked by uid 399); 27 Aug 2009 18:18:51 -0000
Received: from localhost (HELO foreign.dougb.net)
	(dougb@dougbarton.us@127.0.0.1)
	by localhost with ESMTPAM; 27 Aug 2009 18:18:51 -0000
X-Originating-IP: 127.0.0.1
X-Sender: dougb@dougbarton.us
Message-ID: <4A96CE01.3010904@FreeBSD.org>
Date: Thu, 27 Aug 2009 11:18:41 -0700
From: Doug Barton 
Organization: http://www.FreeBSD.org/
User-Agent: Thunderbird 2.0.0.23 (X11/20090822)
MIME-Version: 1.0
To: Pawel Jakub Dawidek 
References: <200908251907.n7PJ7QiO036868@svn.freebsd.org>
	<20090825194258.GB1471@tops>
	<20090826101953.GC3055@garage.freebsd.pl>
	<4A959020.4040606@FreeBSD.org>
	<20090827135526.GI1752@garage.freebsd.pl>
In-Reply-To: <20090827135526.GI1752@garage.freebsd.pl>
X-Enigmail-Version: 0.96.0
OpenPGP: id=D5B2F0FB
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, Gleb Kurtsou ,
	src-committers@freebsd.org, Xin LI ,
	svn-src-all@freebsd.org
Subject: Re: svn commit: r196550 - in head: etc/defaults etc/rc.d
	share/man/man5
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 18:18:55 -0000

Pawel Jakub Dawidek wrote:

> But giving multiple tools to accomplish the same thing might confuse our
> users, so its probably not worth it. The proposed solution is good enough.

That was the primary focus of my initial concern but enough people
have chimed in saying that this would be useful that I have no
objections to adding support for 'arp -f' if there is someone who
wants to do the work.


Doug

-- 

    This .signature sanitized for your protection


From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 18:52:55 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A99EA106568E;
	Thu, 27 Aug 2009 18:52:55 +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 7EB9E8FC36;
	Thu, 27 Aug 2009 18:52:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RIqtHX005106;
	Thu, 27 Aug 2009 18:52:55 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RIqtdX005105;
	Thu, 27 Aug 2009 18:52:55 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908271852.n7RIqtdX005105@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 27 Aug 2009 18:52:55 +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: r196606 - in stable/7/sys: . conf contrib/pf
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 18:52:55 -0000

Author: jhb
Date: Thu Aug 27 18:52:55 2009
New Revision: 196606
URL: http://svn.freebsd.org/changeset/base/196606

Log:
  Tidy up some confused mergeinfo in sys/.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/conf/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 19:02:04 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8C72F10656C1;
	Thu, 27 Aug 2009 19:02:04 +0000 (UTC)
	(envelope-from rpaulo@gmail.com)
Received: from mail-ew0-f209.google.com (mail-ew0-f209.google.com
	[209.85.219.209])
	by mx1.freebsd.org (Postfix) with ESMTP id 946A18FC33;
	Thu, 27 Aug 2009 19:02:03 +0000 (UTC)
Received: by ewy5 with SMTP id 5so514907ewy.36
	for ; Thu, 27 Aug 2009 12:02:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:sender:cc:message-id:from:to
	:in-reply-to:content-type:content-transfer-encoding:mime-version
	:subject:date:references:x-mailer;
	bh=chZ7P+gX+wjQ+41yig9ob523k7YmUY1Nj+c3Zqea3+Y=;
	b=Z6xZRzx1sL953gue7F1af3FLMTUsk4dXUT10Vj7xGGbS1Fdl4ZzC2pOmjJvEQgr+eK
	7LP6kSTbPPkQ4yTxAik12UkYUTK2uT7yXa2HAVDiyRLLv/I3KjQB3UFF1b3e1g9C+nHz
	69BCRmOtrt8Rv8/p5ytKQsWRmd4hIiRoBYLMw=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=sender:cc:message-id:from:to:in-reply-to:content-type
	:content-transfer-encoding:mime-version:subject:date:references
	:x-mailer;
	b=uwtbeW9+CzaYvE2d5lv5ok/Ss+nDWYVa3890iFl2UY5/nDZauL5KJpp85UdM70d0iy
	OiQwMH9EnVUVZF2gvc987YpHvoxlvQnhSX9pB4wOdK3wx905r/WObUlbevRTdn0Jd93N
	Yq3/85sYmapOJo//TspRMy3tL3iWC5VkpCTnc=
Received: by 10.210.9.17 with SMTP id 17mr76825ebi.23.1251399722354;
	Thu, 27 Aug 2009 12:02:02 -0700 (PDT)
Received: from mac-mini.lan (bl6-145-127.dsl.telepac.pt [82.155.145.127])
	by mx.google.com with ESMTPS id 7sm186023eyg.24.2009.08.27.12.02.00
	(version=TLSv1/SSLv3 cipher=RC4-MD5);
	Thu, 27 Aug 2009 12:02:01 -0700 (PDT)
Sender: Rui Paulo 
Message-Id: <75F18CF7-EFF9-4D5F-89C6-4EF8EC062339@FreeBSD.org>
From: Rui Paulo 
To: Roman Divacky 
In-Reply-To: <20090826190119.GB39075@freebsd.org>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0 (Apple Message framework v936)
Date: Thu, 27 Aug 2009 20:01:58 +0100
References: <200908230955.n7N9t6Go053499@svn.freebsd.org>
	<20090826190119.GB39075@freebsd.org>
X-Mailer: Apple Mail (2.936)
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r196454 - head/sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 19:02:04 -0000

On 26 Aug 2009, at 20:01, Roman Divacky wrote:

> On Sun, Aug 23, 2009 at 09:55:06AM +0000, Rui Paulo wrote:
>> Author: rpaulo
>> Date: Sun Aug 23 09:55:06 2009
>> New Revision: 196454
>> URL: http://svn.freebsd.org/changeset/base/196454
>>
>> Log:
>>  Constify prime numbers.
>>
>> Modified:
>>  head/sys/kern/kern_subr.c
>>
>> Modified: head/sys/kern/kern_subr.c
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- head/sys/kern/kern_subr.c	Sun Aug 23 08:49:32 2009	(r196453)
>> +++ head/sys/kern/kern_subr.c	Sun Aug 23 09:55:06 2009	(r196454)
>> @@ -419,9 +419,9 @@ hashdestroy(void *vhashtbl, struct mallo
>> 	free(hashtbl, type);
>> }
>>
>> -static int primes[] = { 1, 13, 31, 61, 127, 251, 509, 761, 1021,  
>> 1531, 2039,
>> -			2557, 3067, 3583, 4093, 4603, 5119, 5623, 6143, 6653,
>> -			7159, 7673, 8191, 12281, 16381, 24571, 32749 };
>> +static const int primes[] = { 1, 13, 31, 61, 127, 251, 509, 761,  
>> 1021, 1531,
>> +			2039, 2557, 3067, 3583, 4093, 4603, 5119, 5623, 6143,
>> +			6653, 7159, 7673, 8191, 12281, 16381, 24571, 32749 };
>> #define NPRIMES (sizeof(primes) / sizeof(primes[0]))
>>
>> /*
>
> btw... this is currently unused as we dont use the "prime hash".  
> maybe we
> can remove this completely?


I don't mind if we mark it as deprecated.

--
Rui Paulo


From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 19:49:29 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.ORG
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 22AB1106568E;
	Thu, 27 Aug 2009 19:49:29 +0000 (UTC)
	(envelope-from delphij@delphij.net)
Received: from tarsier.delphij.net (delphij-pt.tunnel.tserv2.fmt.ipv6.he.net
	[IPv6:2001:470:1f03:2c9::2])
	by mx1.freebsd.org (Postfix) with ESMTP id BAE588FC1C;
	Thu, 27 Aug 2009 19:49:28 +0000 (UTC)
Received: from tarsier.geekcn.org (tarsier.geekcn.org [211.166.10.233])
	(using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by tarsier.delphij.net (Postfix) with ESMTPS id BA2B65C025;
	Fri, 28 Aug 2009 03:49:27 +0800 (CST)
Received: from localhost (tarsier.geekcn.org [211.166.10.233])
	by tarsier.geekcn.org (Postfix) with ESMTP id 872C855CDD45;
	Fri, 28 Aug 2009 03:49:27 +0800 (CST)
X-Virus-Scanned: amavisd-new at geekcn.org
Received: from tarsier.geekcn.org ([211.166.10.233])
	by localhost (mail.geekcn.org [211.166.10.233]) (amavisd-new,
	port 10024)
	with ESMTP id KU3TZtVk+fIo; Fri, 28 Aug 2009 03:48:34 +0800 (CST)
Received: from charlie.delphij.net (adsl-76-237-33-62.dsl.pltn13.sbcglobal.net
	[76.237.33.62])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by tarsier.geekcn.org (Postfix) with ESMTPSA id 47B7D55CDD42;
	Fri, 28 Aug 2009 03:48:25 +0800 (CST)
DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns;
	h=message-id:date:from:reply-to:organization:user-agent:
	mime-version:to:cc:subject:references:in-reply-to:
	x-enigmail-version:openpgp:content-type:content-transfer-encoding;
	b=BSB4uKu6VGTJ5ChnBpqJ48vxla4bwZsKE+EUNE87AVieijzDKa024Uoq1rWzA5fe4
	39Ji8KJU5vSB0sdU93sGw==
Message-ID: <4A96E2F3.4080506@delphij.net>
Date: Thu, 27 Aug 2009 12:48:03 -0700
From: Xin LI 
Organization: The FreeBSD Project
User-Agent: Thunderbird 2.0.0.22 (X11/20090803)
MIME-Version: 1.0
To: Doug Barton 
References: <200908251907.n7PJ7QiO036868@svn.freebsd.org>
	<20090825194258.GB1471@tops>
	<20090826101953.GC3055@garage.freebsd.pl>
	<4A959020.4040606@FreeBSD.org>
	<20090827135526.GI1752@garage.freebsd.pl>
	<4A96CE01.3010904@FreeBSD.org>
In-Reply-To: <4A96CE01.3010904@FreeBSD.org>
X-Enigmail-Version: 0.96.0
OpenPGP: id=18EDEBA0;
	url=http://www.delphij.net/delphij.asc
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: Gleb Kurtsou , src-committers@FreeBSD.ORG,
	Pawel Jakub Dawidek , svn-src-all@FreeBSD.ORG,
	Xin LI , svn-src-head@FreeBSD.ORG
Subject: Re: svn commit: r196550 - in head: etc/defaults etc/rc.d
	share/man/man5
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: d@delphij.net
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 19:49:29 -0000

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Doug Barton wrote:
> Pawel Jakub Dawidek wrote:
> 
>> But giving multiple tools to accomplish the same thing might confuse our
>> users, so its probably not worth it. The proposed solution is good enough.
> 
> That was the primary focus of my initial concern but enough people
> have chimed in saying that this would be useful that I have no
> objections to adding support for 'arp -f' if there is someone who
> wants to do the work.

I can do that but I'm afraid that the arp(8) part of the change would
have to wait until 8.0-RELEASE since it would be a new bin feature?
I'll post a proposed patch for review at freebsd-rc@ shortly.

Cheers,
- --
Xin LI 	http://www.delphij.net/
FreeBSD - The Power to Serve!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (FreeBSD)

iEYEARECAAYFAkqW4vMACgkQi+vbBBjt66A0owCgqlALKjf/nUAjWAwzTZ54vjbv
hsUAnjKBvIlxB3qwpx38HnoCXDGwXrnP
=7YMb
-----END PGP SIGNATURE-----

From owner-svn-src-all@FreeBSD.ORG  Thu Aug 27 22:46:55 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.ORG
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 31D49106568C
	for ; Thu, 27 Aug 2009 22:46:55 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4])
	by mx1.freebsd.org (Postfix) with ESMTP id D426D8FC3E
	for ; Thu, 27 Aug 2009 20:55:58 +0000 (UTC)
Received: (qmail 31467 invoked by uid 399); 27 Aug 2009 20:55:38 -0000
Received: from localhost (HELO ?192.168.0.100?) (dougb@dougbarton.us@127.0.0.1)
	by localhost with ESMTPAM; 27 Aug 2009 20:55:38 -0000
X-Originating-IP: 127.0.0.1
X-Sender: dougb@dougbarton.us
Message-ID: <4A96F2C4.7020207@FreeBSD.org>
Date: Thu, 27 Aug 2009 13:55:32 -0700
From: Doug Barton 
Organization: http://www.FreeBSD.org/
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
To: d@delphij.net
References: <200908251907.n7PJ7QiO036868@svn.freebsd.org>
	<20090825194258.GB1471@tops>
	<20090826101953.GC3055@garage.freebsd.pl>
	<4A959020.4040606@FreeBSD.org>
	<20090827135526.GI1752@garage.freebsd.pl>
	<4A96CE01.3010904@FreeBSD.org> <4A96E2F3.4080506@delphij.net>
In-Reply-To: <4A96E2F3.4080506@delphij.net>
X-Enigmail-Version: 0.96.0
OpenPGP: id=D5B2F0FB
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: Gleb Kurtsou , src-committers@FreeBSD.ORG,
	Pawel Jakub Dawidek , svn-src-all@FreeBSD.ORG,
	Xin LI , svn-src-head@FreeBSD.ORG
Subject: Re: svn commit: r196550 - in head: etc/defaults etc/rc.d
	share/man/man5
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 27 Aug 2009 22:46:55 -0000

Xin LI wrote:
> Doug Barton wrote:
>> Pawel Jakub Dawidek wrote:
> 
>>> But giving multiple tools to accomplish the same thing might confuse our
>>> users, so its probably not worth it. The proposed solution is good enough.
>> That was the primary focus of my initial concern but enough people
>> have chimed in saying that this would be useful that I have no
>> objections to adding support for 'arp -f' if there is someone who
>> wants to do the work.
> 
> I can do that

You're under no obligation, but if you want to volunteer that's fine. :)

> but I'm afraid that the arp(8) part of the change would
> have to wait until 8.0-RELEASE since it would be a new bin feature?
> I'll post a proposed patch for review at freebsd-rc@ shortly.

I'm confused why arp(8) would need to be modified. Xin, what are your
concerns? And can someone post a working example of this kind of file?


Doug

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 00:38:18 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.ORG
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C15A8106568D;
	Fri, 28 Aug 2009 00:38:18 +0000 (UTC)
	(envelope-from delphij@delphij.net)
Received: from tarsier.delphij.net (delphij-pt.tunnel.tserv2.fmt.ipv6.he.net
	[IPv6:2001:470:1f03:2c9::2])
	by mx1.freebsd.org (Postfix) with ESMTP id 3682B8FFFC;
	Thu, 27 Aug 2009 21:12:52 +0000 (UTC)
Received: from tarsier.geekcn.org (tarsier.geekcn.org [211.166.10.233])
	(using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by tarsier.delphij.net (Postfix) with ESMTPS id 2EAA05C025;
	Fri, 28 Aug 2009 05:12:36 +0800 (CST)
Received: from localhost (tarsier.geekcn.org [211.166.10.233])
	by tarsier.geekcn.org (Postfix) with ESMTP id E004855CDD44;
	Fri, 28 Aug 2009 05:12:35 +0800 (CST)
X-Virus-Scanned: amavisd-new at geekcn.org
Received: from tarsier.geekcn.org ([211.166.10.233])
	by localhost (mail.geekcn.org [211.166.10.233]) (amavisd-new,
	port 10024)
	with ESMTP id T5cjBDVHehah; Fri, 28 Aug 2009 05:11:37 +0800 (CST)
Received: from charlie.delphij.net (adsl-76-237-33-62.dsl.pltn13.sbcglobal.net
	[76.237.33.62])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by tarsier.geekcn.org (Postfix) with ESMTPSA id 329B255CDD42;
	Fri, 28 Aug 2009 05:11:30 +0800 (CST)
DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns;
	h=message-id:date:from:reply-to:organization:user-agent:
	mime-version:to:cc:subject:references:in-reply-to:
	x-enigmail-version:openpgp:content-type:content-transfer-encoding;
	b=uDJZ+Qjn8EjQvRo0Q6RafN+0fbhAprMhab43CK+18RCs1tzu9mq6gmXOYFkv5Lc+z
	bjrj86Sh5Sc7ErA/Vzy+g==
Message-ID: <4A96F66B.9040205@delphij.net>
Date: Thu, 27 Aug 2009 14:11:07 -0700
From: Xin LI 
Organization: The FreeBSD Project
User-Agent: Thunderbird 2.0.0.22 (X11/20090803)
MIME-Version: 1.0
To: Doug Barton 
References: <200908251907.n7PJ7QiO036868@svn.freebsd.org>
	<20090825194258.GB1471@tops>
	<20090826101953.GC3055@garage.freebsd.pl>
	<4A959020.4040606@FreeBSD.org>
	<20090827135526.GI1752@garage.freebsd.pl>
	<4A96CE01.3010904@FreeBSD.org> <4A96E2F3.4080506@delphij.net>
	<4A96F2C4.7020207@FreeBSD.org>
In-Reply-To: <4A96F2C4.7020207@FreeBSD.org>
X-Enigmail-Version: 0.96.0
OpenPGP: id=18EDEBA0;
	url=http://www.delphij.net/delphij.asc
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: Gleb Kurtsou , src-committers@FreeBSD.ORG,
	Pawel Jakub Dawidek , svn-src-all@FreeBSD.ORG,
	Xin LI , svn-src-head@FreeBSD.ORG, d@delphij.net
Subject: Re: svn commit: r196550 - in head: etc/defaults etc/rc.d
	share/man/man5
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: d@delphij.net
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 00:38:19 -0000

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi, Doug,

Doug Barton wrote:
> Xin LI wrote:
>> Doug Barton wrote:
>>> Pawel Jakub Dawidek wrote:
>>>> But giving multiple tools to accomplish the same thing might confuse our
>>>> users, so its probably not worth it. The proposed solution is good enough.
>>> That was the primary focus of my initial concern but enough people
>>> have chimed in saying that this would be useful that I have no
>>> objections to adding support for 'arp -f' if there is someone who
>>> wants to do the work.
>> I can do that
> 
> You're under no obligation, but if you want to volunteer that's fine. :)
> 
>> but I'm afraid that the arp(8) part of the change would
>> have to wait until 8.0-RELEASE since it would be a new bin feature?
>> I'll post a proposed patch for review at freebsd-rc@ shortly.
> 
> I'm confused why arp(8) would need to be modified. Xin, what are your
> concerns? And can someone post a working example of this kind of file?

I think /etc/rc.d/static_arp stop should revert what was done by
static_arp start by removing entries from the ARP table.  Gleb has
kindly worked out a patch that adds '-d -f' functionality.

Cheers,
- --
Xin LI 	http://www.delphij.net/
FreeBSD - The Power to Serve!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (FreeBSD)

iEYEARECAAYFAkqW9msACgkQi+vbBBjt66CUkwCeLEPWrf9lBJNpGuOSoClomLQp
O14An3nigQbiYLlqcx4+U9Joo1aA9o9K
=0kFu
-----END PGP SIGNATURE-----

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 05:24:22 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id ACC6D1065672;
	Fri, 28 Aug 2009 05:24:22 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7BAB7903ED;
	Thu, 27 Aug 2009 22:24:24 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7RMNhvr008877;
	Thu, 27 Aug 2009 22:23:53 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7RMNXM6008874;
	Thu, 27 Aug 2009 22:23:33 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <200908272223.n7RMNXM6008874@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Thu, 27 Aug 2009 22:23:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196607 - head/tools/regression/bin/sh/builtins
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 05:24:22 -0000

Author: jilles
Date: Thu Aug 27 22:23:23 2009
New Revision: 196607
URL: http://svn.freebsd.org/changeset/base/196607

Log:
  Add some tests for a fixed bug in an uncommitted patch.
  (Trying to get syntax errors for sh -c ':; do' and `:; do`.)

Added:
  head/tools/regression/bin/sh/builtins/eval3.0   (contents, props changed)

Added: head/tools/regression/bin/sh/builtins/eval3.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/bin/sh/builtins/eval3.0	Thu Aug 27 22:23:23 2009	(r196607)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+eval 'false;' && exit 1
+eval 'true;' || exit 1
+eval 'false;
+' && exit 1
+eval 'true;
+' || exit 1
+exit 0

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 07:26:47 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2EB10106639B;
	Fri, 28 Aug 2009 07:26:47 +0000 (UTC)
	(envelope-from qingli@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0A9BB92016;
	Fri, 28 Aug 2009 05:38:33 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7S5bq4p014804;
	Fri, 28 Aug 2009 05:38:02 GMT (envelope-from qingli@svn.freebsd.org)
Received: (from qingli@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7S5bguZ014799;
	Fri, 28 Aug 2009 05:37:42 GMT (envelope-from qingli@svn.freebsd.org)
Message-Id: <200908280537.n7S5bguZ014799@svn.freebsd.org>
From: Qing Li 
Date: Fri, 28 Aug 2009 05:37:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196608 - head/sys/netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 07:26:51 -0000

Author: qingli
Date: Fri Aug 28 05:37:31 2009
New Revision: 196608
URL: http://svn.freebsd.org/changeset/base/196608

Log:
  Do not try to free the rt_lle entry of the cached route in
  ip_output() if the cached route was not initialized from the
  flow-table. The rt_lle entry is invalid unless it has been
  initialized through the flow-table.
  
  Reviewed by:	kmacy, rwatson
  MFC after:	immediately

Modified:
  head/sys/netinet/ip_output.c

Modified: head/sys/netinet/ip_output.c
==============================================================================
--- head/sys/netinet/ip_output.c	Thu Aug 27 22:23:23 2009	(r196607)
+++ head/sys/netinet/ip_output.c	Fri Aug 28 05:37:31 2009	(r196608)
@@ -202,10 +202,8 @@ again:
 	if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 ||
 			  dst->sin_family != AF_INET ||
 			  dst->sin_addr.s_addr != ip->ip_dst.s_addr)) {
-		if (!nortfree) {
+		if (!nortfree)
 			RTFREE(ro->ro_rt);
-			LLE_FREE(ro->ro_lle);
-		}
 		ro->ro_rt = (struct rtentry *)NULL;
 		ro->ro_lle = (struct llentry *)NULL;
 	}

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 07:27:52 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.ORG
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8B77F1066A2F;
	Fri, 28 Aug 2009 07:27:52 +0000 (UTC)
	(envelope-from delphij@delphij.net)
Received: from tarsier.delphij.net (delphij-pt.tunnel.tserv2.fmt.ipv6.he.net
	[IPv6:2001:470:1f03:2c9::2])
	by mx1.freebsd.org (Postfix) with ESMTP id 81A5691BD2;
	Fri, 28 Aug 2009 04:03:45 +0000 (UTC)
Received: from tarsier.geekcn.org (tarsier.geekcn.org [211.166.10.233])
	(using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by tarsier.delphij.net (Postfix) with ESMTPS id 22EAB5C06F;
	Fri, 28 Aug 2009 12:03:28 +0800 (CST)
Received: from localhost (tarsier.geekcn.org [211.166.10.233])
	by tarsier.geekcn.org (Postfix) with ESMTP id 932C855CDD50;
	Fri, 28 Aug 2009 12:03:26 +0800 (CST)
X-Virus-Scanned: amavisd-new at geekcn.org
Received: from tarsier.geekcn.org ([211.166.10.233])
	by localhost (mail.geekcn.org [211.166.10.233]) (amavisd-new,
	port 10024)
	with ESMTP id I2ZwGR1ZbkRd; Fri, 28 Aug 2009 12:02:33 +0800 (CST)
Received: from charlie.delphij.net (c-67-188-2-183.hsd1.ca.comcast.net
	[67.188.2.183])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by tarsier.geekcn.org (Postfix) with ESMTPSA id CF05855CDD42;
	Fri, 28 Aug 2009 12:02:25 +0800 (CST)
DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns;
	h=message-id:date:from:reply-to:organization:user-agent:
	mime-version:to:cc:subject:references:in-reply-to:
	x-enigmail-version:openpgp:content-type:content-transfer-encoding;
	b=otpUCaI+f1Z1TfgOTK6t+AZPT4cGvvi4b6wGL5rItJx4/aAqGoIrz0dVvtOb/EJlS
	u59NAF3rjCbtVlDFy26sg==
Message-ID: <4A9756BF.2060905@delphij.net>
Date: Thu, 27 Aug 2009 21:02:07 -0700
From: Xin LI 
Organization: The FreeBSD Project
User-Agent: Thunderbird 2.0.0.22 (X11/20090803)
MIME-Version: 1.0
To: Doug Barton 
References: <200908251907.n7PJ7QiO036868@svn.freebsd.org>
	<20090825194258.GB1471@tops>
	<20090826101953.GC3055@garage.freebsd.pl>
	<4A959020.4040606@FreeBSD.org>
	<20090827135526.GI1752@garage.freebsd.pl>
	<4A96CE01.3010904@FreeBSD.org> <4A96E2F3.4080506@delphij.net>
	<4A96F2C4.7020207@FreeBSD.org> <4A96F66B.9040205@delphij.net>
	<4A975542.1060600@FreeBSD.org>
In-Reply-To: <4A975542.1060600@FreeBSD.org>
X-Enigmail-Version: 0.96.0
OpenPGP: id=18EDEBA0;
	url=http://www.delphij.net/delphij.asc
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: Gleb Kurtsou , src-committers@FreeBSD.ORG,
	Pawel Jakub Dawidek , svn-src-all@FreeBSD.ORG,
	Xin LI , svn-src-head@FreeBSD.ORG, d@delphij.net
Subject: Re: svn commit: r196550 - in head: etc/defaults etc/rc.d
	share/man/man5
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: d@delphij.net
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 07:27:56 -0000

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Doug Barton wrote:
> Xin LI wrote:
> 
>> I think /etc/rc.d/static_arp stop should revert what was done by
>> static_arp start by removing entries from the ARP table. 
> 
> I agree with you.
> 
>> Gleb has
>> kindly worked out a patch that adds '-d -f' functionality.
> 
> But wouldn't it be easier to just parse the file and undo whatever arp
> -f does? It's up to you, but I would not be supportive of making
> changes to the arp binary this late in the release cycle.

Yes this is done by Gleb's patch.  I think it's more reasonable to teach
arp(8) about this for completeness reasons.  I.e. I feel sensible that
if arp(8) can do '-f' then it is supposed to undo the effect.  My $0.02 :)

Cheers,
- --
Xin LI 	http://www.delphij.net/
FreeBSD - The Power to Serve!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (FreeBSD)

iEYEARECAAYFAkqXVr8ACgkQi+vbBBjt66CPHQCgmkIQQoAZSlmy+ooPVfRzRwvx
gCkAn0GgjhXX0ahYK0cQvWjIs3XIuiCm
=qSU/
-----END PGP SIGNATURE-----

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 07:33:08 2009
Return-Path: 
Delivered-To: svn-src-all@FreeBSD.ORG
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9E289106696D
	for ; Fri, 28 Aug 2009 07:33:08 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4])
	by mx1.freebsd.org (Postfix) with ESMTP id 3E81C91BAC
	for ; Fri, 28 Aug 2009 03:56:09 +0000 (UTC)
Received: (qmail 4048 invoked by uid 399); 28 Aug 2009 03:55:52 -0000
Received: from localhost (HELO ?192.168.0.100?) (dougb@dougbarton.us@127.0.0.1)
	by localhost with ESMTPAM; 28 Aug 2009 03:55:52 -0000
X-Originating-IP: 127.0.0.1
X-Sender: dougb@dougbarton.us
Message-ID: <4A975542.1060600@FreeBSD.org>
Date: Thu, 27 Aug 2009 20:55:46 -0700
From: Doug Barton 
Organization: http://www.FreeBSD.org/
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
To: d@delphij.net
References: <200908251907.n7PJ7QiO036868@svn.freebsd.org>
	<20090825194258.GB1471@tops>
	<20090826101953.GC3055@garage.freebsd.pl>
	<4A959020.4040606@FreeBSD.org>
	<20090827135526.GI1752@garage.freebsd.pl>
	<4A96CE01.3010904@FreeBSD.org> <4A96E2F3.4080506@delphij.net>
	<4A96F2C4.7020207@FreeBSD.org> <4A96F66B.9040205@delphij.net>
In-Reply-To: <4A96F66B.9040205@delphij.net>
X-Enigmail-Version: 0.96.0
OpenPGP: id=D5B2F0FB
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: Gleb Kurtsou , src-committers@FreeBSD.ORG,
	Pawel Jakub Dawidek , svn-src-all@FreeBSD.ORG,
	Xin LI , svn-src-head@FreeBSD.ORG
Subject: Re: svn commit: r196550 - in head: etc/defaults etc/rc.d
	share/man/man5
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 07:33:14 -0000

Xin LI wrote:

> I think /etc/rc.d/static_arp stop should revert what was done by
> static_arp start by removing entries from the ARP table. 

I agree with you.

> Gleb has
> kindly worked out a patch that adds '-d -f' functionality.

But wouldn't it be easier to just parse the file and undo whatever arp
-f does? It's up to you, but I would not be supportive of making
changes to the arp binary this late in the release cycle.


Doug

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 07:33:22 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B9B371069909;
	Fri, 28 Aug 2009 07:33:22 +0000 (UTC)
	(envelope-from qingli@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9823090530;
	Fri, 28 Aug 2009 07:02:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7S71TrH015830;
	Fri, 28 Aug 2009 07:01:39 GMT (envelope-from qingli@svn.freebsd.org)
Received: (from qingli@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7S71JB7015826;
	Fri, 28 Aug 2009 07:01:19 GMT (envelope-from qingli@svn.freebsd.org)
Message-Id: <200908280701.n7S71JB7015826@svn.freebsd.org>
From: Qing Li 
Date: Fri, 28 Aug 2009 07:01:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196609 - head/sys/net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 07:33:28 -0000

Author: qingli
Date: Fri Aug 28 07:01:09 2009
New Revision: 196609
URL: http://svn.freebsd.org/changeset/base/196609

Log:
  In ip_output(), the flow-table module must not try to cache L2/L3
  information for interface of IFF_POINTOPOINT or IFF_LOOPBACK type.
  Since the L2 information (rt_lle) is invalid for these interface
  types, accidental caching attempt will trigger panic when the invalid
  rt_lle reference is accessed.
  
  When installing a new route, or when updating an existing route, the
  user supplied gateway address may be an interface address (this is
  particularly true for point-to-point interface related modules such
  as ppp, if_tun, if_gif). Currently the routing command handler always
  set the RTF_GATEWAY flag if the gateway address is given as part of the
  command paramters. Therefore the gateway address must be verified against
  interface addresses or else the route would be treated as an indirect
  route, thus making that route unusable.
  
  Reviewed by:	kmacy, julia, rwatson
  Verified by:	marcus
  MFC after:	3 days

Modified:
  head/sys/net/flowtable.c
  head/sys/net/rtsock.c

Modified: head/sys/net/flowtable.c
==============================================================================
--- head/sys/net/flowtable.c	Fri Aug 28 05:37:31 2009	(r196608)
+++ head/sys/net/flowtable.c	Fri Aug 28 07:01:09 2009	(r196609)
@@ -692,6 +692,12 @@ uncached:
 		struct rtentry *rt = ro->ro_rt;
 		struct ifnet *ifp = rt->rt_ifp;
 
+		if (ifp->if_flags & (IFF_POINTOPOINT | IFF_LOOPBACK)) {
+			RTFREE(rt);
+			ro->ro_rt = NULL;
+			return (ENOENT);
+		}
+
 		if (rt->rt_flags & RTF_GATEWAY)
 			l3addr = rt->rt_gateway;
 		else

Modified: head/sys/net/rtsock.c
==============================================================================
--- head/sys/net/rtsock.c	Fri Aug 28 05:37:31 2009	(r196608)
+++ head/sys/net/rtsock.c	Fri Aug 28 07:01:09 2009	(r196609)
@@ -513,6 +513,39 @@ route_output(struct mbuf *m, struct sock
 			senderr(error);
 	}
 
+	/*
+	 * The given gateway address may be an interface address.
+	 * For example, issuing a "route change" command on a route
+	 * entry that was created from a tunnel, and the gateway
+	 * address given is the local end point. In this case the 
+	 * RTF_GATEWAY flag must be cleared or the destination will
+	 * not be reachable even though there is no error message.
+	 */
+	if (info.rti_info[RTAX_GATEWAY] != NULL &&
+	    info.rti_info[RTAX_GATEWAY]->sa_family != AF_LINK) {
+		struct route gw_ro;
+
+		bzero(&gw_ro, sizeof(gw_ro));
+		gw_ro.ro_dst = *info.rti_info[RTAX_GATEWAY];
+		rtalloc_ign(&gw_ro, 0);
+		/* 
+		 * A host route through the loopback interface is 
+		 * installed for each interface adddress. In pre 8.0
+		 * releases the interface address of a PPP link type
+		 * is not reachable locally. This behavior is fixed as 
+		 * part of the new L2/L3 redesign and rewrite work. The
+		 * signature of this interface address route is the
+		 * AF_LINK sa_family type of the rt_gateway, and the
+		 * rt_ifp has the IFF_LOOPBACK flag set.
+		 */
+		if (gw_ro.ro_rt != NULL &&
+		    gw_ro.ro_rt->rt_gateway->sa_family == AF_LINK &&
+		    gw_ro.ro_rt->rt_ifp->if_flags & IFF_LOOPBACK)
+			info.rti_flags &= ~RTF_GATEWAY;
+		if (gw_ro.ro_rt != NULL)
+			RTFREE(gw_ro.ro_rt);
+	}
+
 	switch (rtm->rtm_type) {
 		struct rtentry *saved_nrt;
 
@@ -714,7 +747,7 @@ route_output(struct mbuf *m, struct sock
 					RT_UNLOCK(rt);
 					senderr(error);
 				}
-				rt->rt_flags |= RTF_GATEWAY;
+				rt->rt_flags |= (RTF_GATEWAY & info.rti_flags);
 			}
 			if (info.rti_ifa != NULL &&
 			    info.rti_ifa != rt->rt_ifa) {

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 08:42:01 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 64832106567B;
	Fri, 28 Aug 2009 08:42:01 +0000 (UTC)
	(envelope-from tuexen@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 459198FC08;
	Fri, 28 Aug 2009 08:42:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7S8fxIU017230;
	Fri, 28 Aug 2009 08:41:59 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7S8fx8l017228;
	Fri, 28 Aug 2009 08:41:59 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <200908280841.n7S8fx8l017228@svn.freebsd.org>
From: Michael Tuexen 
Date: Fri, 28 Aug 2009 08:41:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196610 - head/sys/netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 08:42:01 -0000

Author: tuexen
Date: Fri Aug 28 08:41:59 2009
New Revision: 196610
URL: http://svn.freebsd.org/changeset/base/196610

Log:
  Fix a bug where vlan interfaces are not supported by SCTP.
  
  Approved by: rrs (mentor)
  MFC after: 3 days

Modified:
  head/sys/netinet/sctp_bsd_addr.c

Modified: head/sys/netinet/sctp_bsd_addr.c
==============================================================================
--- head/sys/netinet/sctp_bsd_addr.c	Fri Aug 28 07:01:09 2009	(r196609)
+++ head/sys/netinet/sctp_bsd_addr.c	Fri Aug 28 08:41:59 2009	(r196610)
@@ -175,6 +175,7 @@ sctp_is_desired_interface_type(struct if
 	case IFT_LOOP:
 	case IFT_SLIP:
 	case IFT_GIF:
+	case IFT_L2VLAN:
 	case IFT_IP:
 	case IFT_IPOVERCDLC:
 	case IFT_IPOVERCLAW:

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 10:10:08 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1728F1065675;
	Fri, 28 Aug 2009 10:10:08 +0000 (UTC)
	(envelope-from bzeeb-lists@lists.zabbadoz.net)
Received: from mail.cksoft.de (mail.cksoft.de [195.88.108.3])
	by mx1.freebsd.org (Postfix) with ESMTP id BE6048FC08;
	Fri, 28 Aug 2009 10:10:07 +0000 (UTC)
Received: from localhost (amavis.fra.cksoft.de [192.168.74.71])
	by mail.cksoft.de (Postfix) with ESMTP id A9FAD41C6BB;
	Fri, 28 Aug 2009 12:10:06 +0200 (CEST)
X-Virus-Scanned: amavisd-new at cksoft.de
Received: from mail.cksoft.de ([195.88.108.3])
	by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new,
	port 10024)
	with ESMTP id gLguBnj9Vv36; Fri, 28 Aug 2009 12:10:06 +0200 (CEST)
Received: by mail.cksoft.de (Postfix, from userid 66)
	id 2DECF41C6A7; Fri, 28 Aug 2009 12:10:06 +0200 (CEST)
Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net
	[10.111.66.10])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.int.zabbadoz.net (Postfix) with ESMTP id 040FB4448E6;
	Fri, 28 Aug 2009 10:05:54 +0000 (UTC)
Date: Fri, 28 Aug 2009 10:05:54 +0000 (UTC)
From: "Bjoern A. Zeeb" 
X-X-Sender: bz@maildrop.int.zabbadoz.net
To: Qing Li 
In-Reply-To: <200908280701.n7S71JB7015826@svn.freebsd.org>
Message-ID: <20090828094234.G93661@maildrop.int.zabbadoz.net>
References: <200908280701.n7S71JB7015826@svn.freebsd.org>
X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r196609 - head/sys/net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 10:10:08 -0000

On Fri, 28 Aug 2009, Qing Li wrote:

> Author: qingli
> Date: Fri Aug 28 07:01:09 2009
> New Revision: 196609
> URL: http://svn.freebsd.org/changeset/base/196609
>
> Log:
>  In ip_output(), the flow-table module must not try to cache L2/L3
>  information for interface of IFF_POINTOPOINT or IFF_LOOPBACK type.
>  Since the L2 information (rt_lle) is invalid for these interface
>  types, accidental caching attempt will trigger panic when the invalid
>  rt_lle reference is accessed.
>
>  When installing a new route, or when updating an existing route, the
>  user supplied gateway address may be an interface address (this is
>  particularly true for point-to-point interface related modules such
>  as ppp, if_tun, if_gif). Currently the routing command handler always
>  set the RTF_GATEWAY flag if the gateway address is given as part of the
>  command paramters. Therefore the gateway address must be verified against
>  interface addresses or else the route would be treated as an indirect
>  route, thus making that route unusable.
>
>  Reviewed by:	kmacy, julia, rwatson
>  Verified by:	marcus
>  MFC after:	3 days


Am I right that this is two entirely separate issues in one commit?



> Modified:
>  head/sys/net/flowtable.c
>  head/sys/net/rtsock.c
>
> Modified: head/sys/net/flowtable.c
> ==============================================================================
> --- head/sys/net/flowtable.c	Fri Aug 28 05:37:31 2009	(r196608)
> +++ head/sys/net/flowtable.c	Fri Aug 28 07:01:09 2009	(r196609)
> @@ -692,6 +692,12 @@ uncached:
> 		struct rtentry *rt = ro->ro_rt;
> 		struct ifnet *ifp = rt->rt_ifp;
>
> +		if (ifp->if_flags & (IFF_POINTOPOINT | IFF_LOOPBACK)) {
> +			RTFREE(rt);
> +			ro->ro_rt = NULL;
> +			return (ENOENT);
> +		}
> +
> 		if (rt->rt_flags & RTF_GATEWAY)
> 			l3addr = rt->rt_gateway;
> 		else
>
> Modified: head/sys/net/rtsock.c
> ==============================================================================
> --- head/sys/net/rtsock.c	Fri Aug 28 05:37:31 2009	(r196608)
> +++ head/sys/net/rtsock.c	Fri Aug 28 07:01:09 2009	(r196609)
> @@ -513,6 +513,39 @@ route_output(struct mbuf *m, struct sock
> 			senderr(error);
> 	}
>
> +	/*
> +	 * The given gateway address may be an interface address.
> +	 * For example, issuing a "route change" command on a route
> +	 * entry that was created from a tunnel, and the gateway
> +	 * address given is the local end point. In this case the
> +	 * RTF_GATEWAY flag must be cleared or the destination will
> +	 * not be reachable even though there is no error message.
> +	 */
> +	if (info.rti_info[RTAX_GATEWAY] != NULL &&
> +	    info.rti_info[RTAX_GATEWAY]->sa_family != AF_LINK) {
> +		struct route gw_ro;
> +
> +		bzero(&gw_ro, sizeof(gw_ro));
> +		gw_ro.ro_dst = *info.rti_info[RTAX_GATEWAY];
> +		rtalloc_ign(&gw_ro, 0);

This ignores the FIB?  Shouldn't it be:
 	rtalloc_ign_fib(&gw_ro, 0, so->so_fibnum);

Considering that "julia" reviewed it, I wonder what I am missing here?



> +		/*
> +		 * A host route through the loopback interface is
> +		 * installed for each interface adddress. In pre 8.0
> +		 * releases the interface address of a PPP link type
> +		 * is not reachable locally. This behavior is fixed as
> +		 * part of the new L2/L3 redesign and rewrite work. The
> +		 * signature of this interface address route is the
> +		 * AF_LINK sa_family type of the rt_gateway, and the
> +		 * rt_ifp has the IFF_LOOPBACK flag set.
> +		 */
> +		if (gw_ro.ro_rt != NULL &&
> +		    gw_ro.ro_rt->rt_gateway->sa_family == AF_LINK &&
> +		    gw_ro.ro_rt->rt_ifp->if_flags & IFF_LOOPBACK)
> +			info.rti_flags &= ~RTF_GATEWAY;
> +		if (gw_ro.ro_rt != NULL)
> +			RTFREE(gw_ro.ro_rt);
> +	}
> +
> 	switch (rtm->rtm_type) {
> 		struct rtentry *saved_nrt;
>
> @@ -714,7 +747,7 @@ route_output(struct mbuf *m, struct sock
> 					RT_UNLOCK(rt);
> 					senderr(error);
> 				}
> -				rt->rt_flags |= RTF_GATEWAY;
> +				rt->rt_flags |= (RTF_GATEWAY & info.rti_flags);
> 			}
> 			if (info.rti_ifa != NULL &&
> 			    info.rti_ifa != rt->rt_ifa) {


Thanks for handling this!


/bz

-- 
Bjoern A. Zeeb           What was I talking about and who are you again?

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 10:23:41 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 38D74106566B;
	Fri, 28 Aug 2009 10:23:41 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0EFA68FC12;
	Fri, 28 Aug 2009 10:23:41 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SANeTl022343;
	Fri, 28 Aug 2009 10:23:40 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SANeJO022341;
	Fri, 28 Aug 2009 10:23:40 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200908281023.n7SANeJO022341@svn.freebsd.org>
From: Ed Schouten 
Date: Fri, 28 Aug 2009 10:23:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196612 - head/sys/modules
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 10:23:41 -0000

Author: ed
Date: Fri Aug 28 10:23:40 2009
New Revision: 196612
URL: http://svn.freebsd.org/changeset/base/196612

Log:
  Hook up the pty(4) module to the build.

Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==============================================================================
--- head/sys/modules/Makefile	Fri Aug 28 08:49:35 2009	(r196611)
+++ head/sys/modules/Makefile	Fri Aug 28 10:23:40 2009	(r196612)
@@ -225,6 +225,7 @@ SUBDIR=	${_3dfx} \
 	procfs \
 	pseudofs \
 	${_pst} \
+	pty  \
 	puc \
 	ral \
 	ralfw \

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 10:25:26 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9B984106567D;
	Fri, 28 Aug 2009 10:25:26 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6FC8F8FC22;
	Fri, 28 Aug 2009 10:25:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SAPQgb022473;
	Fri, 28 Aug 2009 10:25:26 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SAPQXD022471;
	Fri, 28 Aug 2009 10:25:26 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200908281025.n7SAPQXD022471@svn.freebsd.org>
From: Ed Schouten 
Date: Fri, 28 Aug 2009 10:25:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196614 - in stable/8/lib/libc: . stdio stdlib stdtime
	string
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 10:25:26 -0000

Author: ed
Date: Fri Aug 28 10:25:26 2009
New Revision: 196614
URL: http://svn.freebsd.org/changeset/base/196614

Log:
  MFC r196508:
    Our implementation of granpt(3) could be valid in the future.
  
    When I wrote the pseudo-terminal driver for the MPSAFE TTY code, Robert
    Watson and I agreed the best way to implement this, would be to let
    posix_openpt() create a pseudo-terminal with proper permissions in place
    and let grantpt() and unlockpt() be no-ops.
  
    This isn't valid behaviour when looking at the spec. Because I thought
    it was an elegant solution, I filed a bug report at the Austin Group
    about this. In their last teleconference, they agreed on this subject.
    This means that future revisions of POSIX may allow grantpt() and
    unlockpt() to be no-ops if an open() on /dev/ptmx (if the implementation
    has such a device) and posix_openpt() already do the right thing.
  
    I'd rather put this in the manpage, because simply mentioning we don't
    comply to any standard makes it look worse than it is. Right now we
    don't, but at least we took care of it.
  
    Approved by:  re (kib)

Modified:
  stable/8/lib/libc/   (props changed)
  stable/8/lib/libc/stdio/asprintf.c   (props changed)
  stable/8/lib/libc/stdlib/ptsname.3
  stable/8/lib/libc/stdtime/   (props changed)
  stable/8/lib/libc/string/ffsll.c   (props changed)
  stable/8/lib/libc/string/flsll.c   (props changed)
  stable/8/lib/libc/string/wcpcpy.c   (props changed)
  stable/8/lib/libc/string/wcpncpy.c   (props changed)

Modified: stable/8/lib/libc/stdlib/ptsname.3
==============================================================================
--- stable/8/lib/libc/stdlib/ptsname.3	Fri Aug 28 10:25:01 2009	(r196613)
+++ stable/8/lib/libc/stdlib/ptsname.3	Fri Aug 28 10:25:26 2009	(r196614)
@@ -134,14 +134,22 @@ The slave pseudo-terminal device could n
 The
 .Fn ptsname
 function conforms to
-.St -p1003.1-2001 .
+.St -p1003.1-2008 .
 .Pp
 This implementation of
 .Fn grantpt
 and
 .Fn unlockpt
-does not comply with any standard, because these functions assume the
-pseudo-terminal has the correct attributes upon creation.
+does not conform to
+.St -p1003.1-2008 ,
+because it depends on
+.Xr posix_openpt 2
+to create the pseudo-terminal device with proper permissions in place.
+It only validates whether
+.Fa fildes
+is a valid pseudo-terminal master device.
+Future revisions of the specification will likely allow this behaviour,
+as stated by the Austin Group.
 .Sh HISTORY
 The
 .Fn grantpt ,
@@ -150,15 +158,3 @@ and
 .Fn unlockpt
 functions appeared in
 .Fx 5.0 .
-.Sh NOTES
-The purpose of the
-.Fn grantpt
-and
-.Fn unlockpt
-functions has no meaning in
-.Fx ,
-because pseudo-terminals obtained by
-.Xr posix_openpt 2
-are created on demand.
-Because these devices are created with proper permissions in place, they
-are guaranteed to be unused by unprivileged processes.

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 14:06:56 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B5831106566C;
	Fri, 28 Aug 2009 14:06:56 +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 A39D88FC0C;
	Fri, 28 Aug 2009 14:06:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SE6u9U026807;
	Fri, 28 Aug 2009 14:06:56 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SE6uK6026804;
	Fri, 28 Aug 2009 14:06:56 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908281406.n7SE6uK6026804@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 28 Aug 2009 14:06:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196615 - in head/sys: kern sys vm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 14:06:56 -0000

Author: jhb
Date: Fri Aug 28 14:06:55 2009
New Revision: 196615
URL: http://svn.freebsd.org/changeset/base/196615

Log:
  Extend the device pager to support different memory attributes on different
  pages in an object.
  - Add a new variant of d_mmap() currently called d_mmap2() which accepts
    an additional in/out parameter that is the memory attribute to use for
    the requested page.
  - A driver either uses d_mmap() or d_mmap2() for all requests but not both.
    The current implementation uses a flag in the cdevsw (D_MMAP2) to indicate
    that the driver provides a d_mmap2() handler instead of d_mmap().  This
    is done to make the change ABI compatible with existing drivers and
    MFC'able to 7 and 8.
  
  Submitted by:	alc
  MFC after:	1 month

Modified:
  head/sys/kern/kern_conf.c
  head/sys/sys/conf.h
  head/sys/sys/types.h
  head/sys/vm/device_pager.c
  head/sys/vm/vm.h

Modified: head/sys/kern/kern_conf.c
==============================================================================
--- head/sys/kern/kern_conf.c	Fri Aug 28 10:25:26 2009	(r196614)
+++ head/sys/kern/kern_conf.c	Fri Aug 28 14:06:55 2009	(r196615)
@@ -302,7 +302,7 @@ static struct cdevsw dead_cdevsw = {
 #define no_read		(d_read_t *)enodev
 #define no_write	(d_write_t *)enodev
 #define no_ioctl	(d_ioctl_t *)enodev
-#define no_mmap		(d_mmap_t *)enodev
+#define no_mmap		(d_mmap2_t *)enodev
 #define no_kqfilter	(d_kqfilter_t *)enodev
 #define no_mmap_single	(d_mmap_single_t *)enodev
 
@@ -469,7 +469,8 @@ giant_kqfilter(struct cdev *dev, struct 
 }
 
 static int
-giant_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot)
+giant_mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot,
+    vm_memattr_t *memattr)
 {
 	struct cdevsw *dsw;
 	int retval;
@@ -478,7 +479,11 @@ giant_mmap(struct cdev *dev, vm_offset_t
 	if (dsw == NULL)
 		return (ENXIO);
 	mtx_lock(&Giant);
-	retval = dsw->d_gianttrick->d_mmap(dev, offset, paddr, nprot);
+	if (dsw->d_gianttrick->d_flags & D_MMAP2)
+		retval = dsw->d_gianttrick->d_mmap2(dev, offset, paddr, nprot,
+		    memattr);
+	else
+		retval = dsw->d_gianttrick->d_mmap(dev, offset, paddr, nprot);
 	mtx_unlock(&Giant);
 	dev_relthread(dev);
 	return (retval);
@@ -614,6 +619,7 @@ prep_cdevsw(struct cdevsw *devsw)
 		if (devsw->d_gianttrick == NULL) {
 			memcpy(dsw2, devsw, sizeof *dsw2);
 			devsw->d_gianttrick = dsw2;
+			devsw->d_flags |= D_MMAP2;
 			dsw2 = NULL;
 		}
 	}
@@ -634,7 +640,7 @@ prep_cdevsw(struct cdevsw *devsw)
 	FIXUP(d_write,		no_write,	giant_write);
 	FIXUP(d_ioctl,		no_ioctl,	giant_ioctl);
 	FIXUP(d_poll,		no_poll,	giant_poll);
-	FIXUP(d_mmap,		no_mmap,	giant_mmap);
+	FIXUP(d_mmap2,		no_mmap,	giant_mmap);
 	FIXUP(d_strategy,	no_strategy,	giant_strategy);
 	FIXUP(d_kqfilter,	no_kqfilter,	giant_kqfilter);
 	FIXUP(d_mmap_single,	no_mmap_single,	giant_mmap_single);

Modified: head/sys/sys/conf.h
==============================================================================
--- head/sys/sys/conf.h	Fri Aug 28 10:25:26 2009	(r196614)
+++ head/sys/sys/conf.h	Fri Aug 28 14:06:55 2009	(r196615)
@@ -137,6 +137,8 @@ typedef int d_poll_t(struct cdev *dev, i
 typedef int d_kqfilter_t(struct cdev *dev, struct knote *kn);
 typedef int d_mmap_t(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr,
    		     int nprot);
+typedef int d_mmap2_t(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr,
+		     int nprot, vm_memattr_t *memattr);
 typedef int d_mmap_single_t(struct cdev *cdev, vm_ooffset_t *offset,
     vm_size_t size, struct vm_object **object, int nprot);
 typedef void d_purge_t(struct cdev *dev);
@@ -170,6 +172,7 @@ typedef int dumper_t(
 #define D_PSEUDO	0x00200000	/* make_dev() can return NULL */
 #define D_NEEDGIANT	0x00400000	/* driver want Giant */
 #define	D_NEEDMINOR	0x00800000	/* driver uses clone_create() */
+#define	D_MMAP2		0x01000000	/* driver uses d_mmap2() */
 
 /*
  * Version numbers.
@@ -198,7 +201,10 @@ struct cdevsw {
 	d_write_t		*d_write;
 	d_ioctl_t		*d_ioctl;
 	d_poll_t		*d_poll;
-	d_mmap_t		*d_mmap;
+	union {
+		d_mmap_t		*old;
+		d_mmap2_t		*new;
+	} __d_mmap;
 	d_strategy_t		*d_strategy;
 	dumper_t		*d_dump;
 	d_kqfilter_t		*d_kqfilter;
@@ -218,6 +224,8 @@ struct cdevsw {
 		SLIST_ENTRY(cdevsw)	postfree_list;
 	} __d_giant;
 };
+#define	d_mmap			__d_mmap.old
+#define	d_mmap2			__d_mmap.new
 #define	d_gianttrick		__d_giant.gianttrick
 #define	d_postfree_list		__d_giant.postfree_list
 

Modified: head/sys/sys/types.h
==============================================================================
--- head/sys/sys/types.h	Fri Aug 28 10:25:26 2009	(r196614)
+++ head/sys/sys/types.h	Fri Aug 28 14:06:55 2009	(r196615)
@@ -299,6 +299,7 @@ typedef	__uint32_t	intrmask_t;	/* Interr
 
 typedef	__uintfptr_t	uintfptr_t;
 typedef	__uint64_t	uoff_t;
+typedef	char		vm_memattr_t;	/* memory attribute codes */
 typedef	struct vm_page	*vm_page_t;
 
 #define offsetof(type, field) __offsetof(type, field)

Modified: head/sys/vm/device_pager.c
==============================================================================
--- head/sys/vm/device_pager.c	Fri Aug 28 10:25:26 2009	(r196614)
+++ head/sys/vm/device_pager.c	Fri Aug 28 14:06:55 2009	(r196615)
@@ -93,6 +93,17 @@ dev_pager_init()
 	    UMA_ZONE_NOFREE|UMA_ZONE_VM); 
 }
 
+static __inline int
+dev_mmap(struct cdevsw *csw, struct cdev *dev, vm_offset_t offset,
+    vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr)
+{
+
+	if (csw->d_flags & D_MMAP2)
+		return (csw->d_mmap2(dev, offset, paddr, nprot, memattr));
+	else
+		return (csw->d_mmap(dev, offset, paddr, nprot));
+}
+
 /*
  * MPSAFE
  */
@@ -106,6 +117,7 @@ dev_pager_alloc(void *handle, vm_ooffset
 	unsigned int npages;
 	vm_paddr_t paddr;
 	vm_offset_t off;
+	vm_memattr_t dummy;
 	struct cdevsw *csw;
 
 	/*
@@ -133,7 +145,7 @@ dev_pager_alloc(void *handle, vm_ooffset
 	 */
 	npages = OFF_TO_IDX(size);
 	for (off = foff; npages--; off += PAGE_SIZE)
-		if ((*csw->d_mmap)(dev, off, &paddr, (int)prot) != 0) {
+		if (dev_mmap(csw, dev, off, &paddr, (int)prot, &dummy) != 0) {
 			dev_relthread(dev);
 			return (NULL);
 		}
@@ -214,7 +226,6 @@ dev_pager_getpages(object, m, count, req
 	vm_memattr_t memattr;
 	struct cdev *dev;
 	int i, ret;
-	int prot;
 	struct cdevsw *csw;
 	struct thread *td;
 	struct file *fpop;
@@ -228,12 +239,11 @@ dev_pager_getpages(object, m, count, req
 	csw = dev_refthread(dev);
 	if (csw == NULL)
 		panic("dev_pager_getpage: no cdevsw");
-	prot = PROT_READ;	/* XXX should pass in? */
-
 	td = curthread;
 	fpop = td->td_fpop;
 	td->td_fpop = NULL;
-	ret = (*csw->d_mmap)(dev, (vm_offset_t)offset << PAGE_SHIFT, &paddr, prot);
+	ret = dev_mmap(csw, dev, (vm_offset_t)offset << PAGE_SHIFT, &paddr,
+	    PROT_READ, &memattr);
 	KASSERT(ret == 0, ("dev_pager_getpage: map function returns error"));
 	td->td_fpop = fpop;
 	dev_relthread(dev);

Modified: head/sys/vm/vm.h
==============================================================================
--- head/sys/vm/vm.h	Fri Aug 28 10:25:26 2009	(r196614)
+++ head/sys/vm/vm.h	Fri Aug 28 14:06:55 2009	(r196615)
@@ -63,12 +63,6 @@
 
 #include 
 
-/*
- * The exact set of memory attributes is machine dependent.  However, every
- * machine is required to define VM_MEMATTR_DEFAULT.
- */
-typedef	char vm_memattr_t;	/* memory attribute codes */
-
 typedef char vm_inherit_t;	/* inheritance codes */
 
 #define	VM_INHERIT_SHARE	((vm_inherit_t) 0)
@@ -115,6 +109,12 @@ typedef struct vm_object *vm_object_t;
 typedef int boolean_t;
 
 /*
+ * The exact set of memory attributes is machine dependent.  However, every
+ * machine is required to define VM_MEMATTR_DEFAULT.
+ */
+typedef	char vm_memattr_t;	/* memory attribute codes */
+
+/*
  * This is defined in  for the kernel so that vnode_if.h
  * doesn't have to include .
  */

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 14:22:01 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6902B1065670;
	Fri, 28 Aug 2009 14:22:01 +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 54C8C8FC0A;
	Fri, 28 Aug 2009 14:22:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SEM1KE027225;
	Fri, 28 Aug 2009 14:22:01 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SEM13j027214;
	Fri, 28 Aug 2009 14:22:01 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908281422.n7SEM13j027214@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 28 Aug 2009 14:22:01 +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: r196616 - in stable/7/sys: . amd64/amd64 amd64/include
	contrib/pf dev/hwpmc i386/i386 i386/include
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 14:22:01 -0000

Author: jhb
Date: Fri Aug 28 14:22:01 2009
New Revision: 196616
URL: http://svn.freebsd.org/changeset/base/196616

Log:
  MFC 196224:
  Adjust the handling of the local APIC PMC interrupt vector:
  - Provide lapic_disable_pmc(), lapic_enable_pmc(), and lapic_reenable_pmc()
    routines in the local APIC code that the hwpmc(4) driver can use to
    manage the local APIC PMC interrupt vector.
  - Do not enable the local APIC PMC interrupt vector by default when
    HWPMC_HOOKS is enabled.  Instead, the hwpmc(4) driver explicitly
    enables the interrupt when it is succesfully initialized and disables
    the interrupt when it is unloaded.  This avoids enabling the interrupt
    on unsupported CPUs which may result in spurious NMIs.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/amd64/amd64/local_apic.c
  stable/7/sys/amd64/include/apicvar.h
  stable/7/sys/amd64/include/pmc_mdep.h
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/hwpmc/hwpmc_core.c
  stable/7/sys/dev/hwpmc/hwpmc_piv.c
  stable/7/sys/dev/hwpmc/hwpmc_ppro.c
  stable/7/sys/dev/hwpmc/hwpmc_x86.c
  stable/7/sys/i386/i386/local_apic.c
  stable/7/sys/i386/include/apicvar.h
  stable/7/sys/i386/include/pmc_mdep.h

Modified: stable/7/sys/amd64/amd64/local_apic.c
==============================================================================
--- stable/7/sys/amd64/amd64/local_apic.c	Fri Aug 28 14:06:55 2009	(r196615)
+++ stable/7/sys/amd64/amd64/local_apic.c	Fri Aug 28 14:22:01 2009	(r196616)
@@ -119,7 +119,7 @@ static struct lvt lvts[LVT_MAX + 1] = {
 	{ 1, 1, 0, 1, APIC_LVT_DM_NMI, 0 },	/* LINT1: NMI */
 	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_TIMER_INT },	/* Timer */
 	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_ERROR_INT },	/* Error */
-	{ 1, 1, 0, 1, APIC_LVT_DM_NMI, 0 },	/* PMC */
+	{ 1, 1, 1, 1, APIC_LVT_DM_NMI, 0 },	/* PMC */
 	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_THERMAL_INT },	/* Thermal */
 };
 
@@ -299,11 +299,9 @@ lapic_setup(int boot)
 	/* Program LINT[01] LVT entries. */
 	lapic->lvt_lint0 = lvt_mode(la, LVT_LINT0, lapic->lvt_lint0);
 	lapic->lvt_lint1 = lvt_mode(la, LVT_LINT1, lapic->lvt_lint1);
-#ifdef	HWPMC_HOOKS
 	/* Program the PMC LVT entry if present. */
 	if (maxlvt >= LVT_PMC)
 		lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint);
-#endif
 
 	/* Program timer LVT and setup handler. */
 	lapic->lvt_timer = lvt_mode(la, LVT_TIMER, lapic->lvt_timer);
@@ -349,6 +347,88 @@ lapic_setup(int boot)
 	intr_restore(eflags);
 }
 
+void
+lapic_reenable_pmc(void)
+{
+#ifdef HWPMC_HOOKS
+	uint32_t value;
+
+	value =  lapic->lvt_pcint;
+	value &= ~APIC_LVT_M;
+	lapic->lvt_pcint = value;
+#endif
+}
+
+#ifdef HWPMC_HOOKS
+static void
+lapic_update_pmc(void *dummy)
+{
+	struct lapic *la;
+
+	la = &lapics[lapic_id()];
+	lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint);
+}
+#endif
+
+int
+lapic_enable_pmc(void)
+{
+#ifdef HWPMC_HOOKS
+	u_int32_t maxlvt;
+
+	/* Fail if the local APIC is not present. */
+	if (lapic == NULL)
+		return (0);
+
+	/* Fail if the PMC LVT is not present. */
+	maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT;
+	if (maxlvt < LVT_PMC)
+		return (0);
+
+	lvts[LVT_PMC].lvt_masked = 0;
+
+#ifdef SMP
+	/*
+	 * If hwpmc was loaded at boot time then the APs may not be
+	 * started yet.  In that case, don't forward the request to
+	 * them as they will program the lvt when they start.
+	 */
+	if (smp_started)
+		smp_rendezvous(NULL, lapic_update_pmc, NULL, NULL);
+	else
+#endif
+		lapic_update_pmc(NULL);
+	return (1);
+#else
+	return (0);
+#endif
+}
+
+void
+lapic_disable_pmc(void)
+{
+#ifdef HWPMC_HOOKS
+	u_int32_t maxlvt;
+
+	/* Fail if the local APIC is not present. */
+	if (lapic == NULL)
+		return;
+
+	/* Fail if the PMC LVT is not present. */
+	maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT;
+	if (maxlvt < LVT_PMC)
+		return;
+
+	lvts[LVT_PMC].lvt_masked = 1;
+
+#ifdef SMP
+	/* The APs should always be started when hwpmc is unloaded. */
+	KASSERT(mp_ncpus == 1 || smp_started, ("hwpmc unloaded too early"));
+#endif
+	smp_rendezvous(NULL, lapic_update_pmc, NULL, NULL);
+#endif
+}
+
 /*
  * Called by cpu_initclocks() on the BSP to setup the local APIC timer so
  * that it can drive hardclock, statclock, and profclock.  This function

Modified: stable/7/sys/amd64/include/apicvar.h
==============================================================================
--- stable/7/sys/amd64/include/apicvar.h	Fri Aug 28 14:06:55 2009	(r196615)
+++ stable/7/sys/amd64/include/apicvar.h	Fri Aug 28 14:22:01 2009	(r196616)
@@ -198,7 +198,9 @@ int	ioapic_set_triggermode(void *cookie,
 int	ioapic_set_smi(void *cookie, u_int pin);
 void	lapic_create(u_int apic_id, int boot_cpu);
 void	lapic_disable(void);
+void	lapic_disable_pmc(void);
 void	lapic_dump(const char *str);
+int	lapic_enable_pmc(void);
 void	lapic_eoi(void);
 int	lapic_id(void);
 void	lapic_init(vm_paddr_t addr);
@@ -208,6 +210,7 @@ void	lapic_ipi_vectored(u_int vector, in
 int	lapic_ipi_wait(int delay);
 void	lapic_handle_intr(int vector, struct trapframe *frame);
 void	lapic_handle_timer(struct trapframe *frame);
+void	lapic_reenable_pmc(void);
 void	lapic_set_logical_id(u_int apic_id, u_int cluster, u_int cluster_id);
 int	lapic_set_lvt_mask(u_int apic_id, u_int lvt, u_char masked);
 int	lapic_set_lvt_mode(u_int apic_id, u_int lvt, u_int32_t mode);

Modified: stable/7/sys/amd64/include/pmc_mdep.h
==============================================================================
--- stable/7/sys/amd64/include/pmc_mdep.h	Fri Aug 28 14:06:55 2009	(r196615)
+++ stable/7/sys/amd64/include/pmc_mdep.h	Fri Aug 28 14:22:01 2009	(r196616)
@@ -115,7 +115,6 @@ union pmc_md_pmc {
  */
 
 void	start_exceptions(void), end_exceptions(void);
-void	pmc_x86_lapic_enable_pmc_interrupt(void);
 
 struct pmc_mdep *pmc_amd_initialize(void);
 void	pmc_amd_finalize(struct pmc_mdep *_md);

Modified: stable/7/sys/dev/hwpmc/hwpmc_core.c
==============================================================================
--- stable/7/sys/dev/hwpmc/hwpmc_core.c	Fri Aug 28 14:06:55 2009	(r196615)
+++ stable/7/sys/dev/hwpmc/hwpmc_core.c	Fri Aug 28 14:22:01 2009	(r196616)
@@ -32,10 +32,13 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #include 
 #include 
 #include 
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -1771,7 +1774,7 @@ core_intr(int cpu, struct trapframe *tf)
 	}
 
 	if (found_interrupt)
-		pmc_x86_lapic_enable_pmc_interrupt();
+		lapic_reenable_pmc();
 
 	atomic_add_int(found_interrupt ? &pmc_stats.pm_intr_processed :
 	    &pmc_stats.pm_intr_ignored, 1);
@@ -1895,7 +1898,7 @@ core2_intr(int cpu, struct trapframe *tf
 	    (uintmax_t) rdmsr(IA_GLOBAL_OVF_CTRL));
 
 	if (found_interrupt)
-		pmc_x86_lapic_enable_pmc_interrupt();
+		lapic_reenable_pmc();
 
 	atomic_add_int(found_interrupt ? &pmc_stats.pm_intr_processed :
 	    &pmc_stats.pm_intr_ignored, 1);

Modified: stable/7/sys/dev/hwpmc/hwpmc_piv.c
==============================================================================
--- stable/7/sys/dev/hwpmc/hwpmc_piv.c	Fri Aug 28 14:06:55 2009	(r196615)
+++ stable/7/sys/dev/hwpmc/hwpmc_piv.c	Fri Aug 28 14:22:01 2009	(r196616)
@@ -32,6 +32,7 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -39,6 +40,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -1537,7 +1540,7 @@ p4_intr(int cpu, struct trapframe *tf)
 	 */
 
 	if (did_interrupt)
-		pmc_x86_lapic_enable_pmc_interrupt();
+		lapic_reenable_pmc();
 
 	atomic_add_int(did_interrupt ? &pmc_stats.pm_intr_processed :
 	    &pmc_stats.pm_intr_ignored, 1);

Modified: stable/7/sys/dev/hwpmc/hwpmc_ppro.c
==============================================================================
--- stable/7/sys/dev/hwpmc/hwpmc_ppro.c	Fri Aug 28 14:06:55 2009	(r196615)
+++ stable/7/sys/dev/hwpmc/hwpmc_ppro.c	Fri Aug 28 14:22:01 2009	(r196616)
@@ -32,6 +32,7 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -39,6 +40,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -718,7 +721,7 @@ p6_intr(int cpu, struct trapframe *tf)
 	 * unmasked after a PMC interrupt.
 	 */
 	if (retval)
-		pmc_x86_lapic_enable_pmc_interrupt();
+		lapic_reenable_pmc();
 
 	atomic_add_int(retval ? &pmc_stats.pm_intr_processed :
 	    &pmc_stats.pm_intr_ignored, 1);

Modified: stable/7/sys/dev/hwpmc/hwpmc_x86.c
==============================================================================
--- stable/7/sys/dev/hwpmc/hwpmc_x86.c	Fri Aug 28 14:06:55 2009	(r196615)
+++ stable/7/sys/dev/hwpmc/hwpmc_x86.c	Fri Aug 28 14:22:01 2009	(r196616)
@@ -39,7 +39,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
+#include 
+#include 
 #include 
 #include 
 
@@ -47,18 +48,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-extern volatile lapic_t *lapic;
-
-void
-pmc_x86_lapic_enable_pmc_interrupt(void)
-{
-	uint32_t value;
-
-	value =  lapic->lvt_pcint;
-	value &= ~APIC_LVT_M;
-	lapic->lvt_pcint = value;
-}
-
 /*
  * Attempt to walk a user call stack using a too-simple algorithm.
  * In the general case we need unwind information associated with
@@ -252,16 +241,15 @@ pmc_md_initialize()
 	struct pmc_mdep *md;
 
 	/* determine the CPU kind */
-	md = NULL;
 	if (cpu_vendor_id == CPU_VENDOR_AMD)
 		md = pmc_amd_initialize();
 	else if (cpu_vendor_id == CPU_VENDOR_INTEL)
 		md = pmc_intel_initialize();
 	else
-		KASSERT(0, ("[x86,%d] Unknown vendor", __LINE__));
+		return (NULL);
 
 	/* disallow sampling if we do not have an LAPIC */
-	if (md != NULL && lapic == NULL)
+	if (!lapic_enable_pmc())
 		for (i = 1; i < md->pmd_nclass; i++)
 			md->pmd_classdep[i].pcd_caps &= ~PMC_CAP_INTERRUPT;
 
@@ -271,6 +259,8 @@ pmc_md_initialize()
 void
 pmc_md_finalize(struct pmc_mdep *md)
 {
+
+	lapic_disable_pmc();
 	if (cpu_vendor_id == CPU_VENDOR_AMD)
 		pmc_amd_finalize(md);
 	else if (cpu_vendor_id == CPU_VENDOR_INTEL)

Modified: stable/7/sys/i386/i386/local_apic.c
==============================================================================
--- stable/7/sys/i386/i386/local_apic.c	Fri Aug 28 14:06:55 2009	(r196615)
+++ stable/7/sys/i386/i386/local_apic.c	Fri Aug 28 14:22:01 2009	(r196616)
@@ -119,7 +119,7 @@ static struct lvt lvts[LVT_MAX + 1] = {
 	{ 1, 1, 0, 1, APIC_LVT_DM_NMI, 0 },	/* LINT1: NMI */
 	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_TIMER_INT },	/* Timer */
 	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_ERROR_INT },	/* Error */
-	{ 1, 1, 0, 1, APIC_LVT_DM_NMI, 0 },	/* PMC */
+	{ 1, 1, 1, 1, APIC_LVT_DM_NMI, 0 },	/* PMC */
 	{ 1, 1, 1, 1, APIC_LVT_DM_FIXED, APIC_THERMAL_INT },	/* Thermal */
 };
 
@@ -301,11 +301,9 @@ lapic_setup(int boot)
 	/* Program LINT[01] LVT entries. */
 	lapic->lvt_lint0 = lvt_mode(la, LVT_LINT0, lapic->lvt_lint0);
 	lapic->lvt_lint1 = lvt_mode(la, LVT_LINT1, lapic->lvt_lint1);
-#ifdef	HWPMC_HOOKS
 	/* Program the PMC LVT entry if present. */
 	if (maxlvt >= LVT_PMC)
 		lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint);
-#endif
 
 	/* Program timer LVT and setup handler. */
 	lapic->lvt_timer = lvt_mode(la, LVT_TIMER, lapic->lvt_timer);
@@ -351,6 +349,88 @@ lapic_setup(int boot)
 	intr_restore(eflags);
 }
 
+void
+lapic_reenable_pmc(void)
+{
+#ifdef HWPMC_HOOKS
+	uint32_t value;
+
+	value =  lapic->lvt_pcint;
+	value &= ~APIC_LVT_M;
+	lapic->lvt_pcint = value;
+#endif
+}
+
+#ifdef HWPMC_HOOKS
+static void
+lapic_update_pmc(void *dummy)
+{
+	struct lapic *la;
+
+	la = &lapics[lapic_id()];
+	lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint);
+}
+#endif
+
+int
+lapic_enable_pmc(void)
+{
+#ifdef HWPMC_HOOKS
+	u_int32_t maxlvt;
+
+	/* Fail if the local APIC is not present. */
+	if (lapic == NULL)
+		return (0);
+
+	/* Fail if the PMC LVT is not present. */
+	maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT;
+	if (maxlvt < LVT_PMC)
+		return (0);
+
+	lvts[LVT_PMC].lvt_masked = 0;
+
+#ifdef SMP
+	/*
+	 * If hwpmc was loaded at boot time then the APs may not be
+	 * started yet.  In that case, don't forward the request to
+	 * them as they will program the lvt when they start.
+	 */
+	if (smp_started)
+		smp_rendezvous(NULL, lapic_update_pmc, NULL, NULL);
+	else
+#endif
+		lapic_update_pmc(NULL);
+	return (1);
+#else
+	return (0);
+#endif
+}
+
+void
+lapic_disable_pmc(void)
+{
+#ifdef HWPMC_HOOKS
+	u_int32_t maxlvt;
+
+	/* Fail if the local APIC is not present. */
+	if (lapic == NULL)
+		return;
+
+	/* Fail if the PMC LVT is not present. */
+	maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT;
+	if (maxlvt < LVT_PMC)
+		return;
+
+	lvts[LVT_PMC].lvt_masked = 1;
+
+#ifdef SMP
+	/* The APs should always be started when hwpmc is unloaded. */
+	KASSERT(mp_ncpus == 1 || smp_started, ("hwpmc unloaded too early"));
+#endif
+	smp_rendezvous(NULL, lapic_update_pmc, NULL, NULL);
+#endif
+}
+
 /*
  * Called by cpu_initclocks() on the BSP to setup the local APIC timer so
  * that it can drive hardclock, statclock, and profclock.  This function

Modified: stable/7/sys/i386/include/apicvar.h
==============================================================================
--- stable/7/sys/i386/include/apicvar.h	Fri Aug 28 14:06:55 2009	(r196615)
+++ stable/7/sys/i386/include/apicvar.h	Fri Aug 28 14:22:01 2009	(r196616)
@@ -197,7 +197,9 @@ int	ioapic_set_triggermode(void *cookie,
 int	ioapic_set_smi(void *cookie, u_int pin);
 void	lapic_create(u_int apic_id, int boot_cpu);
 void	lapic_disable(void);
+void	lapic_disable_pmc(void);
 void	lapic_dump(const char *str);
+int	lapic_enable_pmc(void);
 void	lapic_eoi(void);
 int	lapic_id(void);
 void	lapic_init(vm_paddr_t addr);
@@ -207,6 +209,7 @@ void	lapic_ipi_vectored(u_int vector, in
 int	lapic_ipi_wait(int delay);
 void	lapic_handle_intr(int vector, struct trapframe *frame);
 void	lapic_handle_timer(struct trapframe *frame);
+void	lapic_reenable_pmc(void);
 void	lapic_set_logical_id(u_int apic_id, u_int cluster, u_int cluster_id);
 int	lapic_set_lvt_mask(u_int apic_id, u_int lvt, u_char masked);
 int	lapic_set_lvt_mode(u_int apic_id, u_int lvt, u_int32_t mode);

Modified: stable/7/sys/i386/include/pmc_mdep.h
==============================================================================
--- stable/7/sys/i386/include/pmc_mdep.h	Fri Aug 28 14:06:55 2009	(r196615)
+++ stable/7/sys/i386/include/pmc_mdep.h	Fri Aug 28 14:22:01 2009	(r196616)
@@ -150,7 +150,6 @@ struct pmc_mdep;
  */
 
 void	start_exceptions(void), end_exceptions(void);
-void	pmc_x86_lapic_enable_pmc_interrupt(void);
 
 struct pmc_mdep *pmc_amd_initialize(void);
 void	pmc_amd_finalize(struct pmc_mdep *_md);

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 14:24:04 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3F98A106566C;
	Fri, 28 Aug 2009 14:24:04 +0000 (UTC) (envelope-from jhb@freebsd.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 11C6F8FC1E;
	Fri, 28 Aug 2009 14:24:04 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 7BAD046B32;
	Fri, 28 Aug 2009 10:24:03 -0400 (EDT)
Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id A67DC8A02B;
	Fri, 28 Aug 2009 10:24:02 -0400 (EDT)
From: John Baldwin 
To: src-committers@freebsd.org
Date: Fri, 28 Aug 2009 10:23:57 -0400
User-Agent: KMail/1.9.7
References: <200908281406.n7SE6uK6026804@svn.freebsd.org>
In-Reply-To: <200908281406.n7SE6uK6026804@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200908281023.57489.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Fri, 28 Aug 2009 10:24:02 -0400 (EDT)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-1.3 required=4.2 tests=AWL,BAYES_00,RDNS_NONE
	autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org
Subject: Re: svn commit: r196615 - in head/sys: kern sys vm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 14:24:04 -0000

On Friday 28 August 2009 10:06:56 am John Baldwin wrote:
> Author: jhb
> Date: Fri Aug 28 14:06:55 2009
> New Revision: 196615
> URL: http://svn.freebsd.org/changeset/base/196615
> 
> Log:
>   Extend the device pager to support different memory attributes on different
>   pages in an object.
>   - Add a new variant of d_mmap() currently called d_mmap2() which accepts
>     an additional in/out parameter that is the memory attribute to use for
>     the requested page.
>   - A driver either uses d_mmap() or d_mmap2() for all requests but not both.
>     The current implementation uses a flag in the cdevsw (D_MMAP2) to indicate
>     that the driver provides a d_mmap2() handler instead of d_mmap().  This
>     is done to make the change ABI compatible with existing drivers and
>     MFC'able to 7 and 8.

The future plan for 9.0 is to just convert d_mmap() to the newer API/ABI and
remove d_mmap2().  However, the current version of this patch is MFC'able
without need changes to drivers that do not use the new parameter.

-- 
John Baldwin

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 17:34:22 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C6830106564A;
	Fri, 28 Aug 2009 17:34:22 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 99EB08FC16;
	Fri, 28 Aug 2009 17:34:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SHYMq2031276;
	Fri, 28 Aug 2009 17:34:22 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SHYMNg031273;
	Fri, 28 Aug 2009 17:34:22 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200908281734.n7SHYMNg031273@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 28 Aug 2009 17:34:22 +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: r196618 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/re
	dev/xen/xenpci pci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 17:34:22 -0000

Author: yongari
Date: Fri Aug 28 17:34:22 2009
New Revision: 196618
URL: http://svn.freebsd.org/changeset/base/196618

Log:
  MFC r196516:
    Add RTL8168DP/RTL8111DP device id. While I'm here append "8111D" to
    the description of RTL8168D as RL_HWREV_8168D can be either
    RTL8168D or RTL8111D.
  
    PR:	kern/137672
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/re/if_re.c
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/pci/if_rlreg.h

Modified: stable/8/sys/dev/re/if_re.c
==============================================================================
--- stable/8/sys/dev/re/if_re.c	Fri Aug 28 16:45:34 2009	(r196617)
+++ stable/8/sys/dev/re/if_re.c	Fri Aug 28 17:34:22 2009	(r196618)
@@ -174,8 +174,8 @@ static struct rl_type re_devs[] = {
 	{ RT_VENDORID, RT_DEVICEID_8101E, 0,
 	    "RealTek 8101E/8102E/8102EL PCIe 10/100baseTX" },
 	{ RT_VENDORID, RT_DEVICEID_8168, 0,
-	    "RealTek 8168/8168B/8168C/8168CP/8168D/8111B/8111C/8111CP PCIe "
-	    "Gigabit Ethernet" },
+	    "RealTek 8168/8168B/8168C/8168CP/8168D/8168DP/"
+	    "8111B/8111C/8111CP/8111DP PCIe Gigabit Ethernet" },
 	{ RT_VENDORID, RT_DEVICEID_8169, 0,
 	    "RealTek 8169/8169S/8169SB(L)/8110S/8110SB(L) Gigabit Ethernet" },
 	{ RT_VENDORID, RT_DEVICEID_8169SC, 0,
@@ -217,7 +217,8 @@ static struct rl_hwrev re_hwrevs[] = {
 	{ RL_HWREV_8168C, RL_8169, "8168C/8111C"},
 	{ RL_HWREV_8168C_SPIN2, RL_8169, "8168C/8111C"},
 	{ RL_HWREV_8168CP, RL_8169, "8168CP/8111CP"},
-	{ RL_HWREV_8168D, RL_8169, "8168D"},
+	{ RL_HWREV_8168D, RL_8169, "8168D/8111D"},
+	{ RL_HWREV_8168DP, RL_8169, "8168DP/8111DP"},
 	{ 0, 0, NULL }
 };
 
@@ -1282,6 +1283,7 @@ re_attach(device_t dev)
 		/* FALLTHROUGH */
 	case RL_HWREV_8168CP:
 	case RL_HWREV_8168D:
+	case RL_HWREV_8168DP:
 		sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR |
 		    RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP |
 		    RL_FLAG_AUTOPAD;

Modified: stable/8/sys/pci/if_rlreg.h
==============================================================================
--- stable/8/sys/pci/if_rlreg.h	Fri Aug 28 16:45:34 2009	(r196617)
+++ stable/8/sys/pci/if_rlreg.h	Fri Aug 28 17:34:22 2009	(r196618)
@@ -161,6 +161,7 @@
 #define RL_HWREV_8102EL		0x24800000
 #define RL_HWREV_8102EL_SPIN1	0x24c00000
 #define RL_HWREV_8168D		0x28000000
+#define RL_HWREV_8168DP		0x28800000
 #define RL_HWREV_8168_SPIN1	0x30000000
 #define RL_HWREV_8100E		0x30800000
 #define RL_HWREV_8101E		0x34000000

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 18:01:37 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 99D73106564A;
	Fri, 28 Aug 2009 18:01:37 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 874948FC18;
	Fri, 28 Aug 2009 18:01:37 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SI1bRQ031848;
	Fri, 28 Aug 2009 18:01:37 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SI1bpp031846;
	Fri, 28 Aug 2009 18:01:37 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200908281801.n7SI1bpp031846@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 28 Aug 2009 18:01: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: r196619 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/alc dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 18:01:37 -0000

Author: yongari
Date: Fri Aug 28 18:01:37 2009
New Revision: 196619
URL: http://svn.freebsd.org/changeset/base/196619

Log:
  MFC r196517:
    Don't try to power down PHY when alc(4) failed to map the device.
    This fixes system crash when mapping alc(4) device failed in device
    attach.
  
    Reported by:	Jim < stapleton.41 <> gmail DOT com >
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/alc/if_alc.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/alc/if_alc.c
==============================================================================
--- stable/8/sys/dev/alc/if_alc.c	Fri Aug 28 17:34:22 2009	(r196618)
+++ stable/8/sys/dev/alc/if_alc.c	Fri Aug 28 18:01:37 2009	(r196619)
@@ -858,7 +858,8 @@ alc_detach(device_t dev)
 			sc->alc_intrhand[i] = NULL;
 		}
 	}
-	alc_phy_down(sc);
+	if (sc->alc_res[0] != NULL)
+		alc_phy_down(sc);
 	bus_release_resources(dev, sc->alc_irq_spec, sc->alc_irq);
 	if ((sc->alc_flags & (ALC_FLAG_MSI | ALC_FLAG_MSIX)) != 0)
 		pci_release_msi(dev);

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 19:08:57 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 50D731065670;
	Fri, 28 Aug 2009 19:08:57 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3E2E38FC14;
	Fri, 28 Aug 2009 19:08:57 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SJ8vZ2033494;
	Fri, 28 Aug 2009 19:08:57 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SJ8uW7033493;
	Fri, 28 Aug 2009 19:08:56 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <200908281908.n7SJ8uW7033493@svn.freebsd.org>
From: Marko Zec 
Date: Fri, 28 Aug 2009 19:08:56 +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: r196620 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 19:08:57 -0000

Author: zec
Date: Fri Aug 28 19:08:56 2009
New Revision: 196620
URL: http://svn.freebsd.org/changeset/base/196620

Log:
  MFC r196501:
  
    When registering a protocol to an existing protocol domain via
    pf_proto_register(), iterate over all existing vnets to call protosw_init()
    and thus the appropriate .pr_init() handler in the context of each vnet.
    NB in the future we probably want to separate pr_init() handlers into
    two, i.e. per-vnet and global, functions.
  
    This change has no impact on nooptions VIMAGE builds.
  
    Approved by:  re (rwatson), julian (mentor)
  
  Approved by:	re (rwatson)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/kern/uipc_domain.c

Modified: stable/8/sys/kern/uipc_domain.c
==============================================================================
--- stable/8/sys/kern/uipc_domain.c	Fri Aug 28 18:01:37 2009	(r196619)
+++ stable/8/sys/kern/uipc_domain.c	Fri Aug 28 19:08:56 2009	(r196620)
@@ -336,6 +336,7 @@ found:
 int
 pf_proto_register(int family, struct protosw *npr)
 {
+	VNET_ITERATOR_DECL(vnet_iter);
 	struct domain *dp;
 	struct protosw *pr, *fpr;
 
@@ -391,7 +392,13 @@ found:
 	mtx_unlock(&dom_mtx);
 
 	/* Initialize and activate the protocol. */
-	protosw_init(fpr);
+	VNET_LIST_RLOCK();
+	VNET_FOREACH(vnet_iter) {
+		CURVNET_SET_QUIET(vnet_iter);
+		protosw_init(fpr);
+		CURVNET_RESTORE();
+	}
+	VNET_LIST_RUNLOCK();
 
 	return (0);
 }

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 19:10:58 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5DBB2106566B;
	Fri, 28 Aug 2009 19:10:58 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4AAFC8FC1B;
	Fri, 28 Aug 2009 19:10:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SJAwJp033610;
	Fri, 28 Aug 2009 19:10:58 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SJAwV4033607;
	Fri, 28 Aug 2009 19:10:58 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <200908281910.n7SJAwV4033607@svn.freebsd.org>
From: Marko Zec 
Date: Fri, 28 Aug 2009 19:10:58 +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: r196621 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci netinet
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 19:10:58 -0000

Author: zec
Date: Fri Aug 28 19:10:58 2009
New Revision: 196621
URL: http://svn.freebsd.org/changeset/base/196621

Log:
  MFC r196502:
  
    Introduce a div_destroy() function which takes over per-vnet cleanup tasks
    from the existing modevent / MOD_UNLOAD handler, and register div_destroy()
    in protosw as per-vnet .pr_destroy() handler for options VIMAGE builds.  In
    nooptions VIMAGE builds, div_destroy() will be invoked from the modevent
    handler, resulting in effectively identical operation as it was prior this
    change.  div_destroy() also tears down hashtables used by ipdivert, which
    were previously left behind on ipdivert kldunloads.
  
    For options VIMAGE builds only, temporarily disable kldunloading of ipdivert,
    because without introducing additional locking logic it is impossible to
    atomically check whether all ipdivert instances in all vnets are idle, and
    proceed with cleanup without opening a race window for a vnet to open an
    ipdivert socket while ipdivert tear-down is in progress.
  
    While here, staticize div_init(), because it is not used outside of
    ip_divert.c.
  
    In cooperation with:  julian
    Approved by:  re (rwatson), julian (mentor)
  
  Approved by:	re (rwatson)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/netinet/ip_divert.c
  stable/8/sys/netinet/ip_divert.h

Modified: stable/8/sys/netinet/ip_divert.c
==============================================================================
--- stable/8/sys/netinet/ip_divert.c	Fri Aug 28 19:08:56 2009	(r196620)
+++ stable/8/sys/netinet/ip_divert.c	Fri Aug 28 19:10:58 2009	(r196621)
@@ -125,6 +125,8 @@ static VNET_DEFINE(struct inpcbinfo, div
 static u_long	div_sendspace = DIVSNDQ;	/* XXX sysctl ? */
 static u_long	div_recvspace = DIVRCVQ;	/* XXX sysctl ? */
 
+static eventhandler_tag ip_divert_event_tag;
+
 /*
  * Initialize divert connection block queue.
  */
@@ -152,7 +154,7 @@ div_inpcb_fini(void *mem, int size)
 	INP_LOCK_DESTROY(inp);
 }
 
-void
+static void
 div_init(void)
 {
 
@@ -174,8 +176,17 @@ div_init(void)
 	    NULL, NULL, div_inpcb_init, div_inpcb_fini, UMA_ALIGN_PTR,
 	    UMA_ZONE_NOFREE);
 	uma_zone_set_max(V_divcbinfo.ipi_zone, maxsockets);
-	EVENTHANDLER_REGISTER(maxsockets_change, div_zone_change,
-		NULL, EVENTHANDLER_PRI_ANY);
+}
+
+static void
+div_destroy(void)
+{
+
+	INP_INFO_LOCK_DESTROY(&V_divcbinfo);
+	uma_zdestroy(V_divcbinfo.ipi_zone);
+	hashdestroy(V_divcbinfo.ipi_hashbase, M_PCB, V_divcbinfo.ipi_hashmask);
+	hashdestroy(V_divcbinfo.ipi_porthashbase, M_PCB,
+	    V_divcbinfo.ipi_porthashmask);
 }
 
 /*
@@ -709,6 +720,9 @@ struct protosw div_protosw = {
 	.pr_ctlinput =		div_ctlinput,
 	.pr_ctloutput =		ip_ctloutput,
 	.pr_init =		div_init,
+#ifdef VIMAGE
+	.pr_destroy =		div_destroy,
+#endif
 	.pr_usrreqs =		&div_usrreqs
 };
 
@@ -716,7 +730,9 @@ static int
 div_modevent(module_t mod, int type, void *unused)
 {
 	int err = 0;
+#ifndef VIMAGE
 	int n;
+#endif
 
 	switch (type) {
 	case MOD_LOAD:
@@ -726,7 +742,11 @@ div_modevent(module_t mod, int type, voi
 		 * a true IP protocol that goes over the wire.
 		 */
 		err = pf_proto_register(PF_INET, &div_protosw);
+		if (err != 0)
+			return (err);
 		ip_divert_ptr = divert_packet;
+		ip_divert_event_tag = EVENTHANDLER_REGISTER(maxsockets_change,
+		    div_zone_change, NULL, EVENTHANDLER_PRI_ANY);
 		break;
 	case MOD_QUIESCE:
 		/*
@@ -737,6 +757,10 @@ div_modevent(module_t mod, int type, voi
 		err = EPERM;
 		break;
 	case MOD_UNLOAD:
+#ifdef VIMAGE
+		err = EPERM;
+		break;
+#else
 		/*
 		 * Forced unload.
 		 *
@@ -758,9 +782,10 @@ div_modevent(module_t mod, int type, voi
 		ip_divert_ptr = NULL;
 		err = pf_proto_unregister(PF_INET, IPPROTO_DIVERT, SOCK_RAW);
 		INP_INFO_WUNLOCK(&V_divcbinfo);
-		INP_INFO_LOCK_DESTROY(&V_divcbinfo);
-		uma_zdestroy(V_divcbinfo.ipi_zone);
+		div_destroy();
+		EVENTHANDLER_DEREGISTER(maxsockets_change, ip_divert_event_tag);
 		break;
+#endif /* !VIMAGE */
 	default:
 		err = EOPNOTSUPP;
 		break;

Modified: stable/8/sys/netinet/ip_divert.h
==============================================================================
--- stable/8/sys/netinet/ip_divert.h	Fri Aug 28 19:08:56 2009	(r196620)
+++ stable/8/sys/netinet/ip_divert.h	Fri Aug 28 19:10:58 2009	(r196621)
@@ -83,7 +83,6 @@ divert_find_info(struct mbuf *m)
 typedef	void ip_divert_packet_t(struct mbuf *m, int incoming);
 extern	ip_divert_packet_t *ip_divert_ptr;
 
-extern	void div_init(void);
 extern	void div_input(struct mbuf *, int);
 extern	void div_ctlinput(int, struct sockaddr *, void *);
 #endif /* _NETINET_IP_DIVERT_H_ */

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 19:12:45 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EFD2A106564A;
	Fri, 28 Aug 2009 19:12:44 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DC3148FC28;
	Fri, 28 Aug 2009 19:12:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SJCifP033736;
	Fri, 28 Aug 2009 19:12:44 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SJCiv0033726;
	Fri, 28 Aug 2009 19:12:44 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <200908281912.n7SJCiv0033726@svn.freebsd.org>
From: Marko Zec 
Date: Fri, 28 Aug 2009 19:12:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196622 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci fs/nfsclient nfsclient rpc
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 19:12:45 -0000

Author: zec
Date: Fri Aug 28 19:12:44 2009
New Revision: 196622
URL: http://svn.freebsd.org/changeset/base/196622

Log:
  MFC r196503:
  
    Fix NFS panics with options VIMAGE kernels by apropriately setting curvnet
    context inside the RPC code.
  
    Temporarily set td's cred to mount's cred before calling socreate() via
    __rpc_nconf2socket().
  
    Submitted by: rmacklem (in part)
    Reviewed by:  rmacklem, rwatson
    Discussed with:       dfr, bz
    Approved by:  re (rwatson), julian (mentor)
  
  Approved by:	re (rwatson)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/fs/nfsclient/nfs_clvnops.c
  stable/8/sys/nfsclient/nfs_vnops.c
  stable/8/sys/rpc/clnt_dg.c
  stable/8/sys/rpc/clnt_rc.c
  stable/8/sys/rpc/clnt_vc.c
  stable/8/sys/rpc/rpc_generic.c
  stable/8/sys/rpc/svc_dg.c
  stable/8/sys/rpc/svc_generic.c
  stable/8/sys/rpc/svc_vc.c

Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clvnops.c	Fri Aug 28 19:10:58 2009	(r196621)
+++ stable/8/sys/fs/nfsclient/nfs_clvnops.c	Fri Aug 28 19:12:44 2009	(r196622)
@@ -1405,8 +1405,8 @@ again:
 	}
 	mtx_unlock(&dnp->n_mtx);
 
-	CURVNET_SET(P_TO_VNET(&proc0));
 #ifdef INET
+	CURVNET_SET(CRED_TO_VNET(cnp->cn_cred));
 	IN_IFADDR_RLOCK();
 	if (!TAILQ_EMPTY(&V_in_ifaddrhead))
 		cverf.lval[0] = IA_SIN(TAILQ_FIRST(&V_in_ifaddrhead))->sin_addr.s_addr;
@@ -1415,9 +1415,9 @@ again:
 		cverf.lval[0] = create_verf;
 #ifdef INET
 	IN_IFADDR_RUNLOCK();
+	CURVNET_RESTORE();
 #endif
 	cverf.lval[1] = ++create_verf;
-	CURVNET_RESTORE();
 	error = nfsrpc_create(dvp, cnp->cn_nameptr, cnp->cn_namelen,
 	    vap, cverf, fmode, cnp->cn_cred, cnp->cn_thread, &dnfsva, &nfsva,
 	    &nfhp, &attrflag, &dattrflag, NULL);

Modified: stable/8/sys/nfsclient/nfs_vnops.c
==============================================================================
--- stable/8/sys/nfsclient/nfs_vnops.c	Fri Aug 28 19:10:58 2009	(r196621)
+++ stable/8/sys/nfsclient/nfs_vnops.c	Fri Aug 28 19:12:44 2009	(r196622)
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1552,6 +1553,7 @@ again:
 			*tl = txdr_unsigned(NFSV3CREATE_EXCLUSIVE);
 			tl = nfsm_build(u_int32_t *, NFSX_V3CREATEVERF);
 #ifdef INET
+			CURVNET_SET(CRED_TO_VNET(cnp->cn_cred));
 			IN_IFADDR_RLOCK();
 			if (!TAILQ_EMPTY(&V_in_ifaddrhead))
 				*tl++ = IA_SIN(TAILQ_FIRST(&V_in_ifaddrhead))->sin_addr.s_addr;
@@ -1560,6 +1562,7 @@ again:
 				*tl++ = create_verf;
 #ifdef INET
 			IN_IFADDR_RUNLOCK();
+			CURVNET_RESTORE();
 #endif
 			*tl = ++create_verf;
 		} else {

Modified: stable/8/sys/rpc/clnt_dg.c
==============================================================================
--- stable/8/sys/rpc/clnt_dg.c	Fri Aug 28 19:10:58 2009	(r196621)
+++ stable/8/sys/rpc/clnt_dg.c	Fri Aug 28 19:12:44 2009	(r196622)
@@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 
@@ -197,11 +199,14 @@ clnt_dg_create(
 		return (NULL);
 	}
 
+	CURVNET_SET(so->so_vnet);
 	if (!__rpc_socket2sockinfo(so, &si)) {
 		rpc_createerr.cf_stat = RPC_TLIERROR;
 		rpc_createerr.cf_error.re_errno = 0;
+		CURVNET_RESTORE();
 		return (NULL);
 	}
+	CURVNET_RESTORE();
 
 	/*
 	 * Find the receive and the send size

Modified: stable/8/sys/rpc/clnt_rc.c
==============================================================================
--- stable/8/sys/rpc/clnt_rc.c	Fri Aug 28 19:10:58 2009	(r196621)
+++ stable/8/sys/rpc/clnt_rc.c	Fri Aug 28 19:12:44 2009	(r196622)
@@ -175,15 +175,16 @@ clnt_reconnect_connect(CLIENT *cl)
 	rc->rc_connecting = TRUE;
 	mtx_unlock(&rc->rc_lock);
 
+	oldcred = td->td_ucred;
+	td->td_ucred = rc->rc_ucred;
 	so = __rpc_nconf2socket(rc->rc_nconf);
 	if (!so) {
 		stat = rpc_createerr.cf_stat = RPC_TLIERROR;
 		rpc_createerr.cf_error.re_errno = 0;
+		td->td_ucred = oldcred;
 		goto out;
 	}
 
-	oldcred = td->td_ucred;
-	td->td_ucred = rc->rc_ucred;
 	if (rc->rc_privport)
 		bindresvport(so, NULL);
 

Modified: stable/8/sys/rpc/clnt_vc.c
==============================================================================
--- stable/8/sys/rpc/clnt_vc.c	Fri Aug 28 19:10:58 2009	(r196621)
+++ stable/8/sys/rpc/clnt_vc.c	Fri Aug 28 19:12:44 2009	(r196622)
@@ -70,6 +70,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+
+#include 
+
 #include 
 
 #include 
@@ -217,8 +220,11 @@ clnt_vc_create(
 		}
 	}
 
-	if (!__rpc_socket2sockinfo(so, &si))
+	CURVNET_SET(so->so_vnet);
+	if (!__rpc_socket2sockinfo(so, &si)) {
+		CURVNET_RESTORE();
 		goto err;
+	}
 
 	if (so->so_proto->pr_flags & PR_CONNREQUIRED) {
 		bzero(&sopt, sizeof(sopt));
@@ -239,6 +245,7 @@ clnt_vc_create(
 		sopt.sopt_valsize = sizeof(one);
 		sosetopt(so, &sopt);
 	}
+	CURVNET_RESTORE();
 
 	ct->ct_closeit = FALSE;
 

Modified: stable/8/sys/rpc/rpc_generic.c
==============================================================================
--- stable/8/sys/rpc/rpc_generic.c	Fri Aug 28 19:10:58 2009	(r196621)
+++ stable/8/sys/rpc/rpc_generic.c	Fri Aug 28 19:12:44 2009	(r196622)
@@ -56,6 +56,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 
@@ -822,6 +824,7 @@ bindresvport(struct socket *so, struct s
 	sa->sa_len = salen;
 
 	if (*portp == 0) {
+		CURVNET_SET(so->so_vnet);
 		bzero(&opt, sizeof(opt));
 		opt.sopt_dir = SOPT_GET;
 		opt.sopt_level = proto;
@@ -829,12 +832,15 @@ bindresvport(struct socket *so, struct s
 		opt.sopt_val = &old;
 		opt.sopt_valsize = sizeof(old);
 		error = sogetopt(so, &opt);
-		if (error)
+		if (error) {
+			CURVNET_RESTORE();
 			goto out;
+		}
 
 		opt.sopt_dir = SOPT_SET;
 		opt.sopt_val = &portlow;
 		error = sosetopt(so, &opt);
+		CURVNET_RESTORE();
 		if (error)
 			goto out;
 	}
@@ -845,7 +851,9 @@ bindresvport(struct socket *so, struct s
 		if (error) {
 			opt.sopt_dir = SOPT_SET;
 			opt.sopt_val = &old;
+			CURVNET_SET(so->so_vnet);
 			sosetopt(so, &opt);
+			CURVNET_RESTORE();
 		}
 	}
 out:

Modified: stable/8/sys/rpc/svc_dg.c
==============================================================================
--- stable/8/sys/rpc/svc_dg.c	Fri Aug 28 19:10:58 2009	(r196621)
+++ stable/8/sys/rpc/svc_dg.c	Fri Aug 28 19:12:44 2009	(r196622)
@@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include 
 
 #include 
@@ -101,8 +103,10 @@ svc_dg_create(SVCPOOL *pool, struct sock
 	struct sockaddr* sa;
 	int error;
 
+	CURVNET_SET(so->so_vnet);
 	if (!__rpc_socket2sockinfo(so, &si)) {
 		printf(svc_dg_str, svc_dg_err1);
+		CURVNET_RESTORE();
 		return (NULL);
 	}
 	/*
@@ -112,6 +116,7 @@ svc_dg_create(SVCPOOL *pool, struct sock
 	recvsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsize);
 	if ((sendsize == 0) || (recvsize == 0)) {
 		printf(svc_dg_str, svc_dg_err2);
+		CURVNET_RESTORE();
 		return (NULL);
 	}
 
@@ -124,6 +129,7 @@ svc_dg_create(SVCPOOL *pool, struct sock
 	xprt->xp_ops = &svc_dg_ops;
 
 	error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa);
+	CURVNET_RESTORE();
 	if (error)
 		goto freedata;
 

Modified: stable/8/sys/rpc/svc_generic.c
==============================================================================
--- stable/8/sys/rpc/svc_generic.c	Fri Aug 28 19:10:58 2009	(r196621)
+++ stable/8/sys/rpc/svc_generic.c	Fri Aug 28 19:12:44 2009	(r196622)
@@ -60,6 +60,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -228,11 +230,14 @@ svc_tli_create(
 		/*
 		 * It is an open socket. Get the transport info.
 		 */
+		CURVNET_SET(so->so_vnet);
 		if (!__rpc_socket2sockinfo(so, &si)) {
 			printf(
 		"svc_tli_create: could not get transport information\n");
+			CURVNET_RESTORE();
 			return (NULL);
 		}
+		CURVNET_RESTORE();
 	}
 
 	/*
@@ -259,7 +264,9 @@ svc_tli_create(
 		"svc_tli_create: could not bind to requested address\n");
 				goto freedata;
 			}
+			CURVNET_SET(so->so_vnet);
 			solisten(so, (int)bindaddr->qlen, curthread);
+			CURVNET_RESTORE();
 		}
 			
 	}

Modified: stable/8/sys/rpc/svc_vc.c
==============================================================================
--- stable/8/sys/rpc/svc_vc.c	Fri Aug 28 19:10:58 2009	(r196621)
+++ stable/8/sys/rpc/svc_vc.c	Fri Aug 28 19:12:44 2009	(r196622)
@@ -58,6 +58,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+
+#include 
+
 #include 
 
 #include 
@@ -151,9 +154,12 @@ svc_vc_create(SVCPOOL *pool, struct sock
 	xprt->xp_p2 = NULL;
 	xprt->xp_ops = &svc_vc_rendezvous_ops;
 
+	CURVNET_SET(so->so_vnet);
 	error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa);
-	if (error)
+	if (error) {
+		CURVNET_RESTORE();
 		goto cleanup_svc_vc_create;
+	}
 
 	memcpy(&xprt->xp_ltaddr, sa, sa->sa_len);
 	free(sa, M_SONAME);
@@ -161,6 +167,7 @@ svc_vc_create(SVCPOOL *pool, struct sock
 	xprt_register(xprt);
 
 	solisten(so, SOMAXCONN, curthread);
+	CURVNET_RESTORE();
 
 	SOCKBUF_LOCK(&so->so_rcv);
 	xprt->xp_upcallset = 1;
@@ -193,9 +200,12 @@ svc_vc_create_conn(SVCPOOL *pool, struct
 	opt.sopt_name = SO_KEEPALIVE;
 	opt.sopt_val = &one;
 	opt.sopt_valsize = sizeof(one);
+	CURVNET_SET(so->so_vnet);
 	error = sosetopt(so, &opt);
-	if (error)
+	if (error) {
+		CURVNET_RESTORE();
 		return (NULL);
+	}
 
 	if (so->so_proto->pr_protocol == IPPROTO_TCP) {
 		bzero(&opt, sizeof(struct sockopt));
@@ -205,9 +215,12 @@ svc_vc_create_conn(SVCPOOL *pool, struct
 		opt.sopt_val = &one;
 		opt.sopt_valsize = sizeof(one);
 		error = sosetopt(so, &opt);
-		if (error)
+		if (error) {
+			CURVNET_RESTORE();
 			return (NULL);
+		}
 	}
+	CURVNET_RESTORE();
 
 	cd = mem_alloc(sizeof(*cd));
 	cd->strm_stat = XPRT_IDLE;
@@ -625,8 +638,10 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms
 		uio.uio_td = curthread;
 		m = NULL;
 		rcvflag = MSG_DONTWAIT;
+		CURVNET_SET(xprt->xp_socket->so_vnet);
 		error = soreceive(xprt->xp_socket, NULL, &uio, &m, NULL,
 		    &rcvflag);
+		CURVNET_RESTORE();
 
 		if (error == EWOULDBLOCK) {
 			/*

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 19:15:17 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D199F1065675;
	Fri, 28 Aug 2009 19:15:17 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BF6DC8FC14;
	Fri, 28 Aug 2009 19:15:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SJFH1o033858;
	Fri, 28 Aug 2009 19:15:17 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SJFHe6033856;
	Fri, 28 Aug 2009 19:15:17 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <200908281915.n7SJFHe6033856@svn.freebsd.org>
From: Marko Zec 
Date: Fri, 28 Aug 2009 19:15: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: r196623 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 19:15:17 -0000

Author: zec
Date: Fri Aug 28 19:15:17 2009
New Revision: 196623
URL: http://svn.freebsd.org/changeset/base/196623

Log:
  MFC r196505:
  
    When "jail -c vnet" request fails, the current code actually creates and
    leaves behind an orphaned vnet.  This change ensures that such vnets get
    released.
  
    This change affects only options VIMAGE builds.
  
    Submitted by: jamie
    Discussed with:       bz
    Approved by:  re (rwatson), julian (mentor)
  
  Approved by:	re (rwatson)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/kern/kern_jail.c

Modified: stable/8/sys/kern/kern_jail.c
==============================================================================
--- stable/8/sys/kern/kern_jail.c	Fri Aug 28 19:12:44 2009	(r196622)
+++ stable/8/sys/kern/kern_jail.c	Fri Aug 28 19:15:17 2009	(r196623)
@@ -2456,7 +2456,7 @@ prison_deref(struct prison *pr, int flag
 		sx_downgrade(&allprison_lock);
 
 #ifdef VIMAGE
-		if (pr->pr_flags & PR_VNET)
+		if (pr->pr_vnet != ppr->pr_vnet)
 			vnet_destroy(pr->pr_vnet);
 #endif
 		if (pr->pr_root != NULL) {

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 19:18:21 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 67C0B106566C;
	Fri, 28 Aug 2009 19:18:21 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5597C8FC18;
	Fri, 28 Aug 2009 19:18:21 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SJILls033982;
	Fri, 28 Aug 2009 19:18:21 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SJIL9I033980;
	Fri, 28 Aug 2009 19:18:21 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <200908281918.n7SJIL9I033980@svn.freebsd.org>
From: Marko Zec 
Date: Fri, 28 Aug 2009 19:18:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196624 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 19:18:21 -0000

Author: zec
Date: Fri Aug 28 19:18:20 2009
New Revision: 196624
URL: http://svn.freebsd.org/changeset/base/196624

Log:
  MFC r196504:
  
    When moving ifnets from one vnet to another, and the ifnet
    has ifaddresses of AF_LINK type which thus have an embedded
    if_index "backpointer", we must update that if_index backpointer
    to reflect the new if_index that our ifnet just got assigned.
  
    This change affects only options VIMAGE builds.
  
    Submitted by: bz
    Reviewed by:  bz
    Approved by:  re (rwatson), julian (mentor)
  
  Approved by:	re (rwatson)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/net/if.c

Modified: stable/8/sys/net/if.c
==============================================================================
--- stable/8/sys/net/if.c	Fri Aug 28 19:15:17 2009	(r196623)
+++ stable/8/sys/net/if.c	Fri Aug 28 19:18:20 2009	(r196624)
@@ -570,6 +570,21 @@ if_attach_internal(struct ifnet *ifp, in
 		/* Reliably crash if used uninitialized. */
 		ifp->if_broadcastaddr = NULL;
 	}
+#ifdef VIMAGE
+	else {
+		/*
+		 * Update the interface index in the link layer address
+		 * of the interface.
+		 */
+		for (ifa = ifp->if_addr; ifa != NULL;
+		    ifa = TAILQ_NEXT(ifa, ifa_link)) {
+			if (ifa->ifa_addr->sa_family == AF_LINK) {
+				sdl = (struct sockaddr_dl *)ifa->ifa_addr;
+				sdl->sdl_index = ifp->if_index;
+			}
+		}
+	}
+#endif
 
 	IFNET_WLOCK();
 	TAILQ_INSERT_TAIL(&V_ifnet, ifp, if_link);

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 19:48:07 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3CE82106564A;
	Fri, 28 Aug 2009 19:48:07 +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 2B2878FC15;
	Fri, 28 Aug 2009 19:48:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SJm6uR034606;
	Fri, 28 Aug 2009 19:48:06 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SJm6PZ034604;
	Fri, 28 Aug 2009 19:48:06 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200908281948.n7SJm6PZ034604@svn.freebsd.org>
From: Xin LI 
Date: Fri, 28 Aug 2009 19:48:06 +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: r196625 - in stable/8/lib/libc: . db/hash
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 19:48:07 -0000

Author: delphij
Date: Fri Aug 28 19:48:06 2009
New Revision: 196625
URL: http://svn.freebsd.org/changeset/base/196625

Log:
  MFC r196525:
  
  Consider flag == 0 as the same of flag == R_NEXT.  This change will restore
  a historical behavior that has been changed by revision 190491, and has seen
  to break exim.
  
  Approved by:	re (kib)

Modified:
  stable/8/lib/libc/   (props changed)
  stable/8/lib/libc/db/hash/hash.c

Modified: stable/8/lib/libc/db/hash/hash.c
==============================================================================
--- stable/8/lib/libc/db/hash/hash.c	Fri Aug 28 19:18:20 2009	(r196624)
+++ stable/8/lib/libc/db/hash/hash.c	Fri Aug 28 19:48:06 2009	(r196625)
@@ -711,7 +711,7 @@ hash_seq(const DB *dbp, DBT *key, DBT *d
 		hashp->cndx = 1;
 		hashp->cpage = NULL;
 	}
- next_bucket:
+next_bucket:
 	for (bp = NULL; !bp || !bp[0]; ) {
 		if (!(bufp = hashp->cpage)) {
 			for (bucket = hashp->cbucket;
@@ -732,7 +732,7 @@ hash_seq(const DB *dbp, DBT *key, DBT *d
 			}
 		} else {
 			bp = (u_int16_t *)hashp->cpage->page;
-			if (flag == R_NEXT) {
+			if (flag == R_NEXT || flag == 0) {
 				hashp->cndx += 2;
 				if (hashp->cndx > bp[0]) {
 					hashp->cpage = NULL;

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 20:06:02 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CE61C1065670;
	Fri, 28 Aug 2009 20:06:02 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B90BE8FC15;
	Fri, 28 Aug 2009 20:06:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SK62ZD035098;
	Fri, 28 Aug 2009 20:06:02 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SK62cq035081;
	Fri, 28 Aug 2009 20:06:02 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200908282006.n7SK62cq035081@svn.freebsd.org>
From: Robert Watson 
Date: Fri, 28 Aug 2009 20:06:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196626 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris compat/linux contrib/altq/altq
	contrib/dev/acpica contrib/pf dev/xen/xenpci kern net
	netgraph netinet netinet6 ne...
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 20:06:02 -0000

Author: rwatson
Date: Fri Aug 28 20:06:02 2009
New Revision: 196626
URL: http://svn.freebsd.org/changeset/base/196626

Log:
  Merge r196481 from head to stable/8:
  
    Rework global locks for interface list and index management, correcting
    several critical bugs, including race conditions and lock order issues:
  
    Replace the single rwlock, ifnet_lock, with two locks, an rwlock and an
    sxlock.  Either can be held to stablize the lists and indexes, but both
    are required to write.  This allows the list to be held stable in both
    network interrupt contexts and sleepable user threads across sleeping
    memory allocations or device driver interactions.  As before, writes to
    the interface list must occur from sleepable contexts.
  
    Reviewed by:  bz, julian
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/compat/linux/linux_ioctl.c
  stable/8/sys/contrib/altq/altq/altq_subr.c
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/kern/kern_uuid.c
  stable/8/sys/net/bridgestp.c
  stable/8/sys/net/if.c
  stable/8/sys/net/if_llatbl.c
  stable/8/sys/net/if_var.h
  stable/8/sys/net/if_vlan.c
  stable/8/sys/netgraph/ng_gif.c
  stable/8/sys/netinet/in.c
  stable/8/sys/netinet6/icmp6.c
  stable/8/sys/netinet6/in6.c
  stable/8/sys/netinet6/in6_ifattach.c
  stable/8/sys/netinet6/nd6.c
  stable/8/sys/netipsec/xform_ipip.c
  stable/8/sys/nfsclient/bootp_subr.c

Modified: stable/8/sys/compat/linux/linux_ioctl.c
==============================================================================
--- stable/8/sys/compat/linux/linux_ioctl.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/compat/linux/linux_ioctl.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -2061,22 +2061,20 @@ linux_ifname(struct ifnet *ifp, char *bu
 	struct ifnet *ifscan;
 	int ethno;
 
+	IFNET_RLOCK_ASSERT();
+
 	/* Short-circuit non ethernet interfaces */
 	if (!IFP_IS_ETH(ifp))
 		return (strlcpy(buffer, ifp->if_xname, buflen));
 
 	/* Determine the (relative) unit number for ethernet interfaces */
 	ethno = 0;
-	IFNET_RLOCK();
 	TAILQ_FOREACH(ifscan, &V_ifnet, if_link) {
-		if (ifscan == ifp) {
-			IFNET_RUNLOCK();
+		if (ifscan == ifp)
 			return (snprintf(buffer, buflen, "eth%d", ethno));
-		}
 		if (IFP_IS_ETH(ifscan))
 			ethno++;
 	}
-	IFNET_RUNLOCK();
 
 	return (0);
 }
@@ -2177,7 +2175,7 @@ again:
 	valid_len = 0;
 
 	/* Return all AF_INET addresses of all interfaces */
-	IFNET_RLOCK();		/* could sleep XXX */
+	IFNET_RLOCK();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		int addrs = 0;
 

Modified: stable/8/sys/contrib/altq/altq/altq_subr.c
==============================================================================
--- stable/8/sys/contrib/altq/altq/altq_subr.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/contrib/altq/altq/altq_subr.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -462,8 +462,8 @@ tbr_timeout(arg)
 	s = splimp();
 #endif
 #if defined(__FreeBSD__) && (__FreeBSD_version >= 500000)
-	IFNET_RLOCK();
-	VNET_LIST_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
+	VNET_LIST_RLOCK_NOSLEEP();
 	VNET_FOREACH(vnet_iter) {
 		CURVNET_SET(vnet_iter);
 #endif
@@ -480,8 +480,8 @@ tbr_timeout(arg)
 #if defined(__FreeBSD__) && (__FreeBSD_version >= 500000)
 		CURVNET_RESTORE();
 	}
-	VNET_LIST_RUNLOCK();
-	IFNET_RUNLOCK();
+	VNET_LIST_RUNLOCK_NOSLEEP();
+	IFNET_RUNLOCK_NOSLEEP();
 #endif
 	splx(s);
 	if (active > 0)

Modified: stable/8/sys/kern/kern_uuid.c
==============================================================================
--- stable/8/sys/kern/kern_uuid.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/kern/kern_uuid.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -95,7 +95,7 @@ uuid_node(uint16_t *node)
 	int i;
 
 	CURVNET_SET(TD_TO_VNET(curthread));
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		/* Walk the address list */
 		IF_ADDR_LOCK(ifp);
@@ -106,14 +106,14 @@ uuid_node(uint16_t *node)
 				/* Got a MAC address. */
 				bcopy(LLADDR(sdl), node, UUID_NODE_LEN);
 				IF_ADDR_UNLOCK(ifp);
-				IFNET_RUNLOCK();
+				IFNET_RUNLOCK_NOSLEEP();
 				CURVNET_RESTORE();
 				return;
 			}
 		}
 		IF_ADDR_UNLOCK(ifp);
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 
 	for (i = 0; i < (UUID_NODE_LEN>>1); i++)
 		node[i] = (uint16_t)arc4random();

Modified: stable/8/sys/net/bridgestp.c
==============================================================================
--- stable/8/sys/net/bridgestp.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/net/bridgestp.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -2019,7 +2019,7 @@ bstp_reinit(struct bstp_state *bs)
 	 * not need to be part of the bridge, it just needs to be a unique
 	 * value.
 	 */
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		if (ifp->if_type != IFT_ETHER)
 			continue;
@@ -2036,7 +2036,7 @@ bstp_reinit(struct bstp_state *bs)
 			continue;
 		}
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 
 	if (LIST_EMPTY(&bs->bs_bplist) || mif == NULL) {
 		/* Set the bridge and root id (lower bits) to zero */

Modified: stable/8/sys/net/if.c
==============================================================================
--- stable/8/sys/net/if.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/net/if.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -154,14 +154,26 @@ VNET_DEFINE(struct ifgrouphead, ifg_head
 VNET_DEFINE(int, if_index);
 static VNET_DEFINE(int, if_indexlim) = 8;
 
-/* Table of ifnet by index.  Locked with ifnet_lock. */
+/* Table of ifnet by index. */
 static VNET_DEFINE(struct ifindex_entry *, ifindex_table);
 
 #define	V_if_indexlim		VNET(if_indexlim)
 #define	V_ifindex_table		VNET(ifindex_table)
 
 int	ifqmaxlen = IFQ_MAXLEN;
-struct rwlock ifnet_lock;
+
+/*
+ * The global network interface list (V_ifnet) and related state (such as
+ * if_index, if_indexlim, and ifindex_table) are protected by an sxlock and
+ * an rwlock.  Either may be acquired shared to stablize the list, but both
+ * must be acquired writable to modify the list.  This model allows us to
+ * both stablize the interface list during interrupt thread processing, but
+ * also to stablize it over long-running ioctls, without introducing priority
+ * inversions and deadlocks.
+ */
+struct rwlock ifnet_rwlock;
+struct sx ifnet_sxlock;
+
 static	if_com_alloc_t *if_com_alloc[256];
 static	if_com_free_t *if_com_free[256];
 
@@ -188,9 +200,9 @@ ifnet_byindex(u_short idx)
 {
 	struct ifnet *ifp;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	ifp = ifnet_byindex_locked(idx);
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	return (ifp);
 }
 
@@ -199,19 +211,19 @@ ifnet_byindex_ref(u_short idx)
 {
 	struct ifnet *ifp;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	ifp = ifnet_byindex_locked(idx);
 	if (ifp == NULL || (ifp->if_flags & IFF_DYING)) {
-		IFNET_RUNLOCK();
+		IFNET_RUNLOCK_NOSLEEP();
 		return (NULL);
 	}
 	if_ref(ifp);
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	return (ifp);
 }
 
 static void
-ifnet_setbyindex(u_short idx, struct ifnet *ifp)
+ifnet_setbyindex_locked(u_short idx, struct ifnet *ifp)
 {
 
 	IFNET_WLOCK_ASSERT();
@@ -219,16 +231,25 @@ ifnet_setbyindex(u_short idx, struct ifn
 	V_ifindex_table[idx].ife_ifnet = ifp;
 }
 
+static void
+ifnet_setbyindex(u_short idx, struct ifnet *ifp)
+{
+
+	IFNET_WLOCK();
+	ifnet_setbyindex_locked(idx, ifp);
+	IFNET_WUNLOCK();
+}
+
 struct ifaddr *
 ifaddr_byindex(u_short idx)
 {
 	struct ifaddr *ifa;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	ifa = ifnet_byindex_locked(idx)->if_addr;
 	if (ifa != NULL)
 		ifa_ref(ifa);
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	return (ifa);
 }
 
@@ -361,9 +382,7 @@ if_alloc(u_char type)
 	ifq_init(&ifp->if_snd, ifp);
 
 	refcount_init(&ifp->if_refcount, 1);	/* Index reference. */
-	IFNET_WLOCK();
 	ifnet_setbyindex(ifp->if_index, ifp);
-	IFNET_WUNLOCK();
 	return (ifp);
 }
 
@@ -383,7 +402,7 @@ if_free_internal(struct ifnet *ifp)
 	KASSERT(ifp == ifnet_byindex_locked(ifp->if_index),
 	    ("%s: freeing unallocated ifnet", ifp->if_xname));
 
-	ifnet_setbyindex(ifp->if_index, NULL);
+	ifnet_setbyindex_locked(ifp->if_index, NULL);
 	while (V_if_index > 0 && ifnet_byindex_locked(V_if_index) == NULL)
 		V_if_index--;
 	IFNET_WUNLOCK();
@@ -870,11 +889,14 @@ if_vmove(struct ifnet *ifp, struct vnet 
 	if_detach_internal(ifp, 1);
 
 	/*
-	 * Unlink the ifnet from ifindex_table[] in current vnet,
-	 * and shrink the if_index for that vnet if possible.
+	 * Unlink the ifnet from ifindex_table[] in current vnet, and shrink
+	 * the if_index for that vnet if possible.
+	 *
+	 * NOTE: IFNET_WLOCK/IFNET_WUNLOCK() are assumed to be unvirtualized,
+	 * or we'd lock on one vnet and unlock on another.
 	 */
 	IFNET_WLOCK();
-	ifnet_setbyindex(ifp->if_index, NULL);
+	ifnet_setbyindex_locked(ifp->if_index, NULL);
 	while (V_if_index > 0 && ifnet_byindex_locked(V_if_index) == NULL)
 		V_if_index--;
 	IFNET_WUNLOCK();
@@ -901,7 +923,7 @@ if_vmove(struct ifnet *ifp, struct vnet 
 		V_if_index = ifp->if_index;
 	if (V_if_index >= V_if_indexlim)
 		if_grow();
-	ifnet_setbyindex(ifp->if_index, ifp);
+	ifnet_setbyindex_locked(ifp->if_index, ifp);
 	IFNET_WUNLOCK();
 
 	if_attach_internal(ifp, 1);
@@ -1383,7 +1405,7 @@ ifa_ifwithaddr_internal(struct sockaddr 
 	struct ifnet *ifp;
 	struct ifaddr *ifa;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		IF_ADDR_LOCK(ifp);
 		TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
@@ -1410,7 +1432,7 @@ ifa_ifwithaddr_internal(struct sockaddr 
 	}
 	ifa = NULL;
 done:
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	return (ifa);
 }
 
@@ -1438,7 +1460,7 @@ ifa_ifwithbroadaddr(struct sockaddr *add
 	struct ifnet *ifp;
 	struct ifaddr *ifa;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		IF_ADDR_LOCK(ifp);
 		TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
@@ -1457,7 +1479,7 @@ ifa_ifwithbroadaddr(struct sockaddr *add
 	}
 	ifa = NULL;
 done:
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	return (ifa);
 }
 
@@ -1471,7 +1493,7 @@ ifa_ifwithdstaddr(struct sockaddr *addr)
 	struct ifnet *ifp;
 	struct ifaddr *ifa;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		if ((ifp->if_flags & IFF_POINTOPOINT) == 0)
 			continue;
@@ -1490,7 +1512,7 @@ ifa_ifwithdstaddr(struct sockaddr *addr)
 	}
 	ifa = NULL;
 done:
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	return (ifa);
 }
 
@@ -1523,7 +1545,7 @@ ifa_ifwithnet(struct sockaddr *addr)
 	 * we find one, as we release the IF_ADDR_LOCK() that kept it stable
 	 * when we move onto the next interface.
 	 */
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		IF_ADDR_LOCK(ifp);
 		TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
@@ -1599,7 +1621,7 @@ next:				continue;
 	ifa = ifa_maybe;
 	ifa_maybe = NULL;
 done:
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	if (ifa_maybe != NULL)
 		ifa_free(ifa_maybe);
 	return (ifa);
@@ -1878,7 +1900,7 @@ if_slowtimo(void *arg)
 	int s = splimp();
 
 	VNET_LIST_RLOCK_NOSLEEP();
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	VNET_FOREACH(vnet_iter) {
 		CURVNET_SET(vnet_iter);
 		TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
@@ -1889,7 +1911,7 @@ if_slowtimo(void *arg)
 		}
 		CURVNET_RESTORE();
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	VNET_LIST_RUNLOCK_NOSLEEP();
 	splx(s);
 	timeout(if_slowtimo, (void *)0, hz / IFNET_SLOWHZ);
@@ -1904,7 +1926,7 @@ ifunit_ref(const char *name)
 {
 	struct ifnet *ifp;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		if (strncmp(name, ifp->if_xname, IFNAMSIZ) == 0 &&
 		    !(ifp->if_flags & IFF_DYING))
@@ -1912,7 +1934,7 @@ ifunit_ref(const char *name)
 	}
 	if (ifp != NULL)
 		if_ref(ifp);
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	return (ifp);
 }
 
@@ -1921,12 +1943,12 @@ ifunit(const char *name)
 {
 	struct ifnet *ifp;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		if (strncmp(name, ifp->if_xname, IFNAMSIZ) == 0)
 			break;
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	return (ifp);
 }
 
@@ -2536,7 +2558,7 @@ again:
 	max_len = 0;
 	valid_len = 0;
 
-	IFNET_RLOCK();		/* could sleep XXX */
+	IFNET_RLOCK();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		int addrs;
 
@@ -2861,13 +2883,13 @@ if_delmulti(struct ifnet *ifp, struct so
 #ifdef INVARIANTS
 	struct ifnet *oifp;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(oifp, &V_ifnet, if_link)
 		if (ifp == oifp)
 			break;
 	if (ifp != oifp)
 		ifp = NULL;
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 
 	KASSERT(ifp != NULL, ("%s: ifnet went away", __func__));
 #endif
@@ -2910,7 +2932,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifm
 	} else {
 		struct ifnet *oifp;
 
-		IFNET_RLOCK();
+		IFNET_RLOCK_NOSLEEP();
 		TAILQ_FOREACH(oifp, &V_ifnet, if_link)
 			if (ifp == oifp)
 				break;
@@ -2918,7 +2940,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifm
 			printf("%s: ifnet %p disappeared\n", __func__, ifp);
 			ifp = NULL;
 		}
-		IFNET_RUNLOCK();
+		IFNET_RUNLOCK_NOSLEEP();
 	}
 #endif
 	/*

Modified: stable/8/sys/net/if_llatbl.c
==============================================================================
--- stable/8/sys/net/if_llatbl.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/net/if_llatbl.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -200,14 +200,14 @@ lltable_prefix_free(int af, struct socka
 {
 	struct lltable *llt;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	SLIST_FOREACH(llt, &lltables, llt_link) {
 		if (llt->llt_af != af)
 			continue;
 
 		llt->llt_prefix_free(llt, prefix, mask);
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 }
 
 
@@ -300,13 +300,13 @@ lla_rt_output(struct rt_msghdr *rtm, str
 	}
 
 	/* XXX linked list may be too expensive */
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	SLIST_FOREACH(llt, &lltables, llt_link) {
 		if (llt->llt_af == dst->sa_family &&
 		    llt->llt_ifp == ifp)
 			break;
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	KASSERT(llt != NULL, ("Yep, ugly hacks are bad\n"));
 
 	if (flags && LLE_CREATE)

Modified: stable/8/sys/net/if_var.h
==============================================================================
--- stable/8/sys/net/if_var.h	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/net/if_var.h	Fri Aug 28 20:06:02 2009	(r196626)
@@ -85,6 +85,7 @@ struct	vnet;
 #include 		/* XXX */
 #include 		/* XXX */
 #include 		/* XXX */
+#include 		/* XXX */
 #include 		/* XXX */
 #include 
 
@@ -754,14 +755,39 @@ struct ifmultiaddr {
 
 #ifdef _KERNEL
 
-extern	struct rwlock ifnet_lock;
-#define	IFNET_LOCK_INIT() \
-   rw_init_flags(&ifnet_lock, "ifnet",  RW_RECURSE)
-#define	IFNET_WLOCK()		rw_wlock(&ifnet_lock)
-#define	IFNET_WUNLOCK()		rw_wunlock(&ifnet_lock)
-#define	IFNET_WLOCK_ASSERT()	rw_assert(&ifnet_lock, RA_LOCKED)
-#define	IFNET_RLOCK()		rw_rlock(&ifnet_lock)
-#define	IFNET_RUNLOCK()		rw_runlock(&ifnet_lock)	
+extern	struct rwlock ifnet_rwlock;
+extern	struct sx ifnet_sxlock;
+
+#define	IFNET_LOCK_INIT() do {						\
+	rw_init_flags(&ifnet_rwlock, "ifnet_rw",  RW_RECURSE);		\
+	sx_init_flags(&ifnet_sxlock, "ifnet_sx",  SX_RECURSE);		\
+} while(0)
+
+#define	IFNET_WLOCK() do {						\
+	sx_xlock(&ifnet_sxlock);					\
+	rw_wlock(&ifnet_rwlock);					\
+} while (0)
+
+#define	IFNET_WUNLOCK() do {						\
+	rw_wunlock(&ifnet_rwlock);					\
+	sx_xunlock(&ifnet_sxlock);					\
+} while (0)
+
+/*
+ * To assert the ifnet lock, you must know not only whether it's for read or
+ * write, but also whether it was acquired with sleep support or not.
+ */
+#define	IFNET_RLOCK_ASSERT()		sx_assert(&ifnet_sxlock, SA_SLOCKED)
+#define	IFNET_RLOCK_NOSLEEP_ASSERT()	rw_assert(&ifnet_rwlock, RA_RLOCKED)
+#define	IFNET_WLOCK_ASSERT() do {					\
+	sx_assert(&ifnet_sxlock, SA_XLOCKED);				\
+	rw_assert(&ifnet_rwlock, RA_WLOCKED);				\
+} while (0)
+
+#define	IFNET_RLOCK()		sx_slock(&ifnet_sxlock)
+#define	IFNET_RLOCK_NOSLEEP()	rw_rlock(&ifnet_rwlock)
+#define	IFNET_RUNLOCK()		sx_sunlock(&ifnet_sxlock)
+#define	IFNET_RUNLOCK_NOSLEEP()	rw_runlock(&ifnet_rwlock)
 
 /*
  * Look up an ifnet given its index; the _ref variant also acquires a

Modified: stable/8/sys/net/if_vlan.c
==============================================================================
--- stable/8/sys/net/if_vlan.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/net/if_vlan.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -580,7 +580,7 @@ vlan_clone_match_ethertag(struct if_clon
 	int t = 0;
 
 	/* Check for . style interface names. */
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		if (ifp->if_type != IFT_ETHER)
 			continue;
@@ -598,7 +598,7 @@ vlan_clone_match_ethertag(struct if_clon
 			*tag = t;
 		break;
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 
 	return (ifp);
 }

Modified: stable/8/sys/netgraph/ng_gif.c
==============================================================================
--- stable/8/sys/netgraph/ng_gif.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/netgraph/ng_gif.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -560,7 +560,7 @@ ng_gif_mod_event(module_t mod, int event
 		ng_gif_input_orphan_p = ng_gif_input_orphan;
 
 		/* Create nodes for any already-existing gif interfaces */
-		VNET_LIST_RLOCK_NOSLEEP();
+		VNET_LIST_RLOCK();
 		IFNET_RLOCK();
 		VNET_FOREACH(vnet_iter) {
 			CURVNET_SET_QUIET(vnet_iter); /* XXX revisit quiet */
@@ -571,7 +571,7 @@ ng_gif_mod_event(module_t mod, int event
 			CURVNET_RESTORE();
 		}
 		IFNET_RUNLOCK();
-		VNET_LIST_RUNLOCK_NOSLEEP();
+		VNET_LIST_RUNLOCK();
 		break;
 
 	case MOD_UNLOAD:

Modified: stable/8/sys/netinet/in.c
==============================================================================
--- stable/8/sys/netinet/in.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/netinet/in.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -1407,12 +1407,7 @@ in_lltable_dump(struct lltable *llt, str
 	} arpc;
 	int error, i;
 
-	/* XXXXX
-	 * current IFNET_RLOCK() is mapped to IFNET_WLOCK()
-	 * so it is okay to use this ASSERT, change it when
-	 * IFNET lock is finalized
-	 */
-	IFNET_WLOCK_ASSERT();
+	IFNET_RLOCK_ASSERT();
 
 	error = 0;
 	for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) {

Modified: stable/8/sys/netinet6/icmp6.c
==============================================================================
--- stable/8/sys/netinet6/icmp6.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/netinet6/icmp6.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -1705,7 +1705,7 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, st
 		}
 	}
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	for (ifp = TAILQ_FIRST(&V_ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) {
 		addrsofif = 0;
 		IF_ADDR_LOCK(ifp);
@@ -1762,13 +1762,13 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, st
 		IF_ADDR_UNLOCK(ifp);
 		if (iffound) {
 			*ifpp = ifp;
-			IFNET_RUNLOCK();
+			IFNET_RUNLOCK_NOSLEEP();
 			return (addrsofif);
 		}
 
 		addrs += addrsofif;
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 
 	return (addrs);
 }
@@ -1789,7 +1789,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *n
 	if (ifp0 == NULL && !(niflags & NI_NODEADDR_FLAG_ALL))
 		return (0);	/* needless to copy */
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
   again:
 
 	for (; ifp; ifp = TAILQ_NEXT(ifp, if_list)) {
@@ -1854,7 +1854,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *n
 				 * Set the truncate flag and return.
 				 */
 				nni6->ni_flags |= NI_NODEADDR_FLAG_TRUNCATE;
-				IFNET_RUNLOCK();
+				IFNET_RUNLOCK_NOSLEEP();
 				return (copied);
 			}
 
@@ -1907,7 +1907,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *n
 		goto again;
 	}
 
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 
 	return (copied);
 }

Modified: stable/8/sys/netinet6/in6.c
==============================================================================
--- stable/8/sys/netinet6/in6.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/netinet6/in6.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -2234,7 +2234,7 @@ in6_setmaxmtu(void)
 	unsigned long maxmtu = 0;
 	struct ifnet *ifp;
 
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	for (ifp = TAILQ_FIRST(&V_ifnet); ifp;
 	    ifp = TAILQ_NEXT(ifp, if_list)) {
 		/* this function can be called during ifnet initialization */
@@ -2244,7 +2244,7 @@ in6_setmaxmtu(void)
 		    IN6_LINKMTU(ifp) > maxmtu)
 			maxmtu = IN6_LINKMTU(ifp);
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	if (maxmtu)	     /* update only when maxmtu is positive */
 		V_in6_maxmtu = maxmtu;
 }
@@ -2495,12 +2495,7 @@ in6_lltable_dump(struct lltable *llt, st
 	} ndpc;
 	int i, error;
 
-	/* XXXXX
-	 * current IFNET_RLOCK() is mapped to IFNET_WLOCK()
-	 * so it is okay to use this ASSERT, change it when
-	 * IFNET lock is finalized
-	 */
-	IFNET_WLOCK_ASSERT();
+	IFNET_RLOCK_ASSERT();
 
 	error = 0;
 	for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) {

Modified: stable/8/sys/netinet6/in6_ifattach.c
==============================================================================
--- stable/8/sys/netinet6/in6_ifattach.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/netinet6/in6_ifattach.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -398,7 +398,7 @@ get_ifid(struct ifnet *ifp0, struct ifne
 	}
 
 	/* next, try to get it from some other hardware interface */
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	for (ifp = V_ifnet.tqh_first; ifp; ifp = ifp->if_list.tqe_next) {
 		if (ifp == ifp0)
 			continue;
@@ -413,11 +413,11 @@ get_ifid(struct ifnet *ifp0, struct ifne
 			nd6log((LOG_DEBUG,
 			    "%s: borrow interface identifier from %s\n",
 			    if_name(ifp0), if_name(ifp)));
-			IFNET_RUNLOCK();
+			IFNET_RUNLOCK_NOSLEEP();
 			goto success;
 		}
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 
 	/* last resort: get from random number source */
 	if (get_rand_ifid(ifp, in6) == 0) {

Modified: stable/8/sys/netinet6/nd6.c
==============================================================================
--- stable/8/sys/netinet6/nd6.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/netinet6/nd6.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -1662,7 +1662,7 @@ nd6_slowtimo(void *arg)
 
 	callout_reset(&V_nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz,
 	    nd6_slowtimo, curvnet);
-	IFNET_RLOCK();
+	IFNET_RLOCK_NOSLEEP();
 	for (ifp = TAILQ_FIRST(&V_ifnet); ifp;
 	    ifp = TAILQ_NEXT(ifp, if_list)) {
 		nd6if = ND_IFINFO(ifp);
@@ -1678,7 +1678,7 @@ nd6_slowtimo(void *arg)
 			nd6if->reachable = ND_COMPUTE_RTIME(nd6if->basereachable);
 		}
 	}
-	IFNET_RUNLOCK();
+	IFNET_RUNLOCK_NOSLEEP();
 	CURVNET_RESTORE();
 }
 

Modified: stable/8/sys/netipsec/xform_ipip.c
==============================================================================
--- stable/8/sys/netipsec/xform_ipip.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/netipsec/xform_ipip.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -303,7 +303,7 @@ _ipip_input(struct mbuf *m, int iphlen, 
 	if ((m->m_pkthdr.rcvif == NULL ||
 	    !(m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK)) &&
 	    V_ipip_allow != 2) {
-	    	IFNET_RLOCK();
+	    	IFNET_RLOCK_NOSLEEP();
 		TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 			TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
 #ifdef INET
@@ -318,7 +318,7 @@ _ipip_input(struct mbuf *m, int iphlen, 
 					    ipo->ip_src.s_addr)	{
 						V_ipipstat.ipips_spoof++;
 						m_freem(m);
-						IFNET_RUNLOCK();
+						IFNET_RUNLOCK_NOSLEEP();
 						return;
 					}
 				}
@@ -335,7 +335,7 @@ _ipip_input(struct mbuf *m, int iphlen, 
 					if (IN6_ARE_ADDR_EQUAL(&sin6->sin6_addr, &ip6->ip6_src)) {
 						V_ipipstat.ipips_spoof++;
 						m_freem(m);
-						IFNET_RUNLOCK();
+						IFNET_RUNLOCK_NOSLEEP();
 						return;
 					}
 
@@ -343,7 +343,7 @@ _ipip_input(struct mbuf *m, int iphlen, 
 #endif /* INET6 */
 			}
 		}
-		IFNET_RUNLOCK();
+		IFNET_RUNLOCK_NOSLEEP();
 	}
 
 	/* Statistics */

Modified: stable/8/sys/nfsclient/bootp_subr.c
==============================================================================
--- stable/8/sys/nfsclient/bootp_subr.c	Fri Aug 28 19:48:06 2009	(r196625)
+++ stable/8/sys/nfsclient/bootp_subr.c	Fri Aug 28 20:06:02 2009	(r196626)
@@ -389,7 +389,7 @@ bootpboot_p_iflist(void)
 	struct ifaddr *ifa;
 
 	printf("Interface list:\n");
-	IFNET_RLOCK(); /* could sleep, but okay for debugging XXX */
+	IFNET_RLOCK();
 	for (ifp = TAILQ_FIRST(&V_ifnet);
 	     ifp != NULL;
 	     ifp = TAILQ_NEXT(ifp, if_link)) {

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 20:07:39 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 060B41065670;
	Fri, 28 Aug 2009 20:07:39 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CD6D68FC16;
	Fri, 28 Aug 2009 20:07:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SK7cgW035168;
	Fri, 28 Aug 2009 20:07:38 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SK7cxk035166;
	Fri, 28 Aug 2009 20:07:38 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200908282007.n7SK7cxk035166@svn.freebsd.org>
From: Robert Watson 
Date: Fri, 28 Aug 2009 20:07:38 +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: r196627 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 20:07:39 -0000

Author: rwatson
Date: Fri Aug 28 20:07:38 2009
New Revision: 196627
URL: http://svn.freebsd.org/changeset/base/196627

Log:
  Merge r196482 from head to stable/8:
  
    Rather than using IFNET_RLOCK() when iterating over (and modifying) the
    ifnet list during if_ef load, directly acquire the ifnet_sxlock
    exclusively.  That way when if_alloc() recurses the lock, it's a write
    recursion rather than a read->write recursion.
  
    This code structure is arguably a bug, so add a comment indicating that
    this is the case.  Post-8.0, we should fix this, but this commit
    resolves panic-on-load for if_ef.
  
    Discussed with:       bz, julian
    Reported by:  phk
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/net/if_ef.c

Modified: stable/8/sys/net/if_ef.c
==============================================================================
--- stable/8/sys/net/if_ef.c	Fri Aug 28 20:06:02 2009	(r196626)
+++ stable/8/sys/net/if_ef.c	Fri Aug 28 20:07:38 2009	(r196627)
@@ -492,7 +492,20 @@ ef_load(void)
 	VNET_LIST_RLOCK();
 	VNET_FOREACH(vnet_iter) {
 		CURVNET_SET(vnet_iter);
-		IFNET_RLOCK();
+
+		/*
+		 * XXXRW: The following loop walks the ifnet list while
+		 * modifying it, something not well-supported by ifnet
+		 * locking.  To avoid lock upgrade/recursion issues, manually
+		 * acquire a write lock of ifnet_sxlock here, rather than a
+		 * read lock, so that when if_alloc() recurses the lock, we
+		 * don't panic.  This structure, in which if_ef automatically
+		 * attaches to all ethernet interfaces, should be replaced
+		 * with a model like that found in if_vlan, in which
+		 * interfaces are explicitly configured, which would avoid
+		 * this (and other) problems.
+		 */
+		sx_xlock(&ifnet_sxlock);
 		TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 			if (ifp->if_type != IFT_ETHER) continue;
 			EFDEBUG("Found interface %s\n", ifp->if_xname);
@@ -523,7 +536,7 @@ ef_load(void)
 			efcount++;
 			SLIST_INSERT_HEAD(&efdev, efl, el_next);
 		}
-		IFNET_RUNLOCK();
+		sx_xunlock(&ifnet_sxlock);
 		CURVNET_RESTORE();
 	}
 	VNET_LIST_RUNLOCK();

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 20:26:00 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B212F106564A;
	Fri, 28 Aug 2009 20:26:00 +0000 (UTC)
	(envelope-from mlaier@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9EA8B8FC0A;
	Fri, 28 Aug 2009 20:26:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SKQ0lq035575;
	Fri, 28 Aug 2009 20:26:00 GMT (envelope-from mlaier@svn.freebsd.org)
Received: (from mlaier@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SKQ0Oc035573;
	Fri, 28 Aug 2009 20:26:00 GMT (envelope-from mlaier@svn.freebsd.org)
Message-Id: <200908282026.n7SKQ0Oc035573@svn.freebsd.org>
From: Max Laier 
Date: Fri, 28 Aug 2009 20:26:00 +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: r196628 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	contrib/pf/net dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 20:26:00 -0000

Author: mlaier
Date: Fri Aug 28 20:26:00 2009
New Revision: 196628
URL: http://svn.freebsd.org/changeset/base/196628

Log:
  MFC r196551:
    Fix argument ordering to memcpy as well as the size of the copy in the
    (theoretical) case that pfi_buffer_cnt should be greater than ~_max.
  
    Submitted by:	pjd
    Reviewed by:	{krw,sthen,markus}@openbsd.org
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/contrib/pf/net/pf_if.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/contrib/pf/net/pf_if.c
==============================================================================
--- stable/8/sys/contrib/pf/net/pf_if.c	Fri Aug 28 20:07:38 2009	(r196627)
+++ stable/8/sys/contrib/pf/net/pf_if.c	Fri Aug 28 20:26:00 2009	(r196628)
@@ -663,7 +663,7 @@ pfi_address_add(struct sockaddr *sa, int
 			    "(%d/%d)\n", pfi_buffer_cnt, PFI_BUFFER_MAX);
 			return;
 		}
-		memcpy(pfi_buffer, p, pfi_buffer_cnt * sizeof(*pfi_buffer));
+		memcpy(p, pfi_buffer, pfi_buffer_max * sizeof(*pfi_buffer));
 		/* no need to zero buffer */
 		free(pfi_buffer, PFI_MTYPE);
 		pfi_buffer = p;

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 21:07:47 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 01D731065672;
	Fri, 28 Aug 2009 21:07:47 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C8C7E8FC17;
	Fri, 28 Aug 2009 21:07:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SL7kBU036514;
	Fri, 28 Aug 2009 21:07:46 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SL7j7b036513;
	Fri, 28 Aug 2009 21:07:45 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200908282107.n7SL7j7b036513@svn.freebsd.org>
From: Robert Watson 
Date: Fri, 28 Aug 2009 21:07:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196629 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 21:07:47 -0000

Author: rwatson
Date: Fri Aug 28 21:07:43 2009
New Revision: 196629
URL: http://svn.freebsd.org/changeset/base/196629

Log:
  Merge r196510 from head to stable/8:
  
    Make if_grow static -- it's not used outside of if.c, and with the
    internals destined to change, it's better if it remains that way.
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/net/if.c
  stable/8/sys/net/if_var.h

Modified: stable/8/sys/net/if.c
==============================================================================
--- stable/8/sys/net/if.c	Fri Aug 28 20:26:00 2009	(r196628)
+++ stable/8/sys/net/if.c	Fri Aug 28 21:07:43 2009	(r196629)
@@ -124,6 +124,7 @@ static void	if_attachdomain1(struct ifne
 static int	ifconf(u_long, caddr_t);
 static void	if_freemulti(struct ifmultiaddr *);
 static void	if_init(void *);
+static void	if_grow(void);
 static void	if_check(void *);
 static void	if_route(struct ifnet *, int flag, int fam);
 static int	if_setflag(struct ifnet *, int, int, int *, int);
@@ -297,7 +298,7 @@ VNET_SYSUNINIT(vnet_if_uninit, SI_SUB_IN
     vnet_if_uninit, NULL);
 #endif
 
-void
+static void
 if_grow(void)
 {
 	u_int n;

Modified: stable/8/sys/net/if_var.h
==============================================================================
--- stable/8/sys/net/if_var.h	Fri Aug 28 20:26:00 2009	(r196628)
+++ stable/8/sys/net/if_var.h	Fri Aug 28 21:07:43 2009	(r196629)
@@ -826,7 +826,6 @@ int	if_allmulti(struct ifnet *, int);
 struct	ifnet* if_alloc(u_char);
 void	if_attach(struct ifnet *);
 void	if_dead(struct ifnet *);
-void	if_grow(void);
 int	if_delmulti(struct ifnet *, struct sockaddr *);
 void	if_delmulti_ifma(struct ifmultiaddr *);
 void	if_detach(struct ifnet *);

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 21:10:27 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3CBE61065670;
	Fri, 28 Aug 2009 21:10:27 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 288E98FC08;
	Fri, 28 Aug 2009 21:10:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SLAR7g036623;
	Fri, 28 Aug 2009 21:10:27 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SLAQpi036619;
	Fri, 28 Aug 2009 21:10:26 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200908282110.n7SLAQpi036619@svn.freebsd.org>
From: Robert Watson 
Date: Fri, 28 Aug 2009 21:10:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196630 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci net netinet netinet6
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 21:10:27 -0000

Author: rwatson
Date: Fri Aug 28 21:10:26 2009
New Revision: 196630
URL: http://svn.freebsd.org/changeset/base/196630

Log:
  Merge r196535 from head to stable/8:
  
    Use locks specific to the lltable code, rather than borrow the ifnet
    list/index locks, to protect link layer address tables.  This avoids
    lock order issues during interface teardown, but maintains the bug that
    sysctl copy routines may be called while a non-sleepable lock is held.
  
    Reviewed by:  bz, kmacy, qingli
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/net/if_llatbl.c
  stable/8/sys/net/if_llatbl.h
  stable/8/sys/netinet/in.c
  stable/8/sys/netinet6/in6.c

Modified: stable/8/sys/net/if_llatbl.c
==============================================================================
--- stable/8/sys/net/if_llatbl.c	Fri Aug 28 21:07:43 2009	(r196629)
+++ stable/8/sys/net/if_llatbl.c	Fri Aug 28 21:10:26 2009	(r196630)
@@ -62,6 +62,9 @@ static	SLIST_HEAD(, lltable) lltables = 
 extern void arprequest(struct ifnet *, struct in_addr *, struct in_addr *,
 	u_char *);
 
+struct rwlock lltable_rwlock;
+RW_SYSINIT(lltable_rwlock, &lltable_rwlock, "lltable_rwlock");
+
 /*
  * Dump arp state for a specific address family.
  */
@@ -71,7 +74,7 @@ lltable_sysctl_dumparp(int af, struct sy
 	struct lltable *llt;
 	int error = 0;
 
-	IFNET_RLOCK();
+	LLTABLE_RLOCK();
 	SLIST_FOREACH(llt, &lltables, llt_link) {
 		if (llt->llt_af == af) {
 			error = llt->llt_dump(llt, wr);
@@ -80,7 +83,7 @@ lltable_sysctl_dumparp(int af, struct sy
 		}
 	}
 done:
-	IFNET_RUNLOCK();
+	LLTABLE_RUNLOCK();
 	return (error);
 }
 
@@ -144,8 +147,6 @@ llentry_update(struct llentry **llep, st
 
 /*
  * Free all entries from given table and free itself.
- * Since lltables collects from all of the intefaces,
- * the caller of this function must acquire IFNET_WLOCK().
  */
 void
 lltable_free(struct lltable *llt)
@@ -155,9 +156,9 @@ lltable_free(struct lltable *llt)
 
 	KASSERT(llt != NULL, ("%s: llt is NULL", __func__));
 
-	IFNET_WLOCK();
+	LLTABLE_WLOCK();
 	SLIST_REMOVE(&lltables, llt, lltable, llt_link);
-	IFNET_WUNLOCK();
+	LLTABLE_WUNLOCK();
 
 	for (i=0; i < LLTBL_HASHTBL_SIZE; i++) {
 		LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) {
@@ -178,7 +179,7 @@ lltable_drain(int af)
 	struct llentry	*lle;
 	register int i;
 
-	IFNET_RLOCK();
+	LLTABLE_RLOCK();
 	SLIST_FOREACH(llt, &lltables, llt_link) {
 		if (llt->llt_af != af)
 			continue;
@@ -192,7 +193,7 @@ lltable_drain(int af)
 			}
 		}
 	}
-	IFNET_RUNLOCK();
+	LLTABLE_RUNLOCK();
 }
 
 void
@@ -200,14 +201,14 @@ lltable_prefix_free(int af, struct socka
 {
 	struct lltable *llt;
 
-	IFNET_RLOCK_NOSLEEP();
+	LLTABLE_RLOCK();
 	SLIST_FOREACH(llt, &lltables, llt_link) {
 		if (llt->llt_af != af)
 			continue;
 
 		llt->llt_prefix_free(llt, prefix, mask);
 	}
-	IFNET_RUNLOCK_NOSLEEP();
+	LLTABLE_RUNLOCK();
 }
 
 
@@ -230,9 +231,9 @@ lltable_init(struct ifnet *ifp, int af)
 	for (i = 0; i < LLTBL_HASHTBL_SIZE; i++)
 		LIST_INIT(&llt->lle_head[i]);
 
-	IFNET_WLOCK();
+	LLTABLE_WLOCK();
 	SLIST_INSERT_HEAD(&lltables, llt, llt_link);
-	IFNET_WUNLOCK();
+	LLTABLE_WUNLOCK();
 
 	return (llt);
 }
@@ -300,13 +301,13 @@ lla_rt_output(struct rt_msghdr *rtm, str
 	}
 
 	/* XXX linked list may be too expensive */
-	IFNET_RLOCK_NOSLEEP();
+	LLTABLE_RLOCK();
 	SLIST_FOREACH(llt, &lltables, llt_link) {
 		if (llt->llt_af == dst->sa_family &&
 		    llt->llt_ifp == ifp)
 			break;
 	}
-	IFNET_RUNLOCK_NOSLEEP();
+	LLTABLE_RUNLOCK();
 	KASSERT(llt != NULL, ("Yep, ugly hacks are bad\n"));
 
 	if (flags && LLE_CREATE)

Modified: stable/8/sys/net/if_llatbl.h
==============================================================================
--- stable/8/sys/net/if_llatbl.h	Fri Aug 28 21:07:43 2009	(r196629)
+++ stable/8/sys/net/if_llatbl.h	Fri Aug 28 21:10:26 2009	(r196630)
@@ -41,6 +41,13 @@ struct rt_addrinfo;
 struct llentry;
 LIST_HEAD(llentries, llentry);
 
+extern struct rwlock lltable_rwlock;
+#define	LLTABLE_RLOCK()		rw_rlock(&lltable_rwlock)
+#define	LLTABLE_RUNLOCK()	rw_runlock(&lltable_rwlock)
+#define	LLTABLE_WLOCK()		rw_wlock(&lltable_rwlock)
+#define	LLTABLE_WUNLOCK()	rw_wunlock(&lltable_rwlock)
+#define	LLTABLE_LOCK_ASSERT()	rw_assert(&lltable_rwlock, RA_LOCKED)
+
 /*
  * Code referencing llentry must at least hold
  * a shared lock

Modified: stable/8/sys/netinet/in.c
==============================================================================
--- stable/8/sys/netinet/in.c	Fri Aug 28 21:07:43 2009	(r196629)
+++ stable/8/sys/netinet/in.c	Fri Aug 28 21:10:26 2009	(r196630)
@@ -1407,7 +1407,7 @@ in_lltable_dump(struct lltable *llt, str
 	} arpc;
 	int error, i;
 
-	IFNET_RLOCK_ASSERT();
+	LLTABLE_LOCK_ASSERT();
 
 	error = 0;
 	for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) {

Modified: stable/8/sys/netinet6/in6.c
==============================================================================
--- stable/8/sys/netinet6/in6.c	Fri Aug 28 21:07:43 2009	(r196629)
+++ stable/8/sys/netinet6/in6.c	Fri Aug 28 21:10:26 2009	(r196630)
@@ -2495,7 +2495,7 @@ in6_lltable_dump(struct lltable *llt, st
 	} ndpc;
 	int i, error;
 
-	IFNET_RLOCK_ASSERT();
+	LLTABLE_LOCK_ASSERT();
 
 	error = 0;
 	for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) {

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 21:12:39 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 51C0F106566B;
	Fri, 28 Aug 2009 21:12:39 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3987E8FC1E;
	Fri, 28 Aug 2009 21:12:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SLCdiJ036720;
	Fri, 28 Aug 2009 21:12:39 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SLCdeP036718;
	Fri, 28 Aug 2009 21:12:39 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200908282112.n7SLCdeP036718@svn.freebsd.org>
From: Robert Watson 
Date: Fri, 28 Aug 2009 21:12:39 +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: r196631 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 21:12:39 -0000

Author: rwatson
Date: Fri Aug 28 21:12:38 2009
New Revision: 196631
URL: http://svn.freebsd.org/changeset/base/196631

Log:
  Merge r196553 from head to stable/8:
  
    Break out allocation of new ifindex values from if_alloc() and if_vmove(),
    and centralize in a single function ifindex_alloc().  Assert the
    IFNET_WLOCK, and add missing IFNET_WLOCK in if_alloc().  This does not
    close all known races in this code.
  
    Reviewed by:  bz
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/net/if.c

Modified: stable/8/sys/net/if.c
==============================================================================
--- stable/8/sys/net/if.c	Fri Aug 28 21:10:26 2009	(r196630)
+++ stable/8/sys/net/if.c	Fri Aug 28 21:12:38 2009	(r196631)
@@ -223,6 +223,37 @@ ifnet_byindex_ref(u_short idx)
 	return (ifp);
 }
 
+/*
+ * Allocate an ifindex array entry; return 0 on success or an error on
+ * failure.
+ */
+static int
+ifindex_alloc(u_short *idxp)
+{
+	u_short idx;
+
+	IFNET_WLOCK_ASSERT();
+
+	/*
+	 * Try to find an empty slot below if_index.  If we fail, take the
+	 * next slot.
+	 */
+	for (idx = 1; idx <= V_if_index; idx++) {
+		if (ifnet_byindex_locked(idx) == NULL)
+			break;
+	}
+
+	/* Catch if_index overflow. */
+	if (idx < 1)
+		return (ENOSPC);
+	if (idx > V_if_index)
+		V_if_index = idx;
+	if (V_if_index >= V_if_indexlim)
+		if_grow();
+	*idxp = idx;
+	return (0);
+}
+
 static void
 ifnet_setbyindex_locked(u_short idx, struct ifnet *ifp)
 {
@@ -335,32 +366,19 @@ struct ifnet *
 if_alloc(u_char type)
 {
 	struct ifnet *ifp;
+	u_short idx;
 
 	ifp = malloc(sizeof(struct ifnet), M_IFNET, M_WAITOK|M_ZERO);
-
-	/*
-	 * Try to find an empty slot below if_index.  If we fail, take
-	 * the next slot.
-	 *
-	 * XXX: should be locked!
-	 */
-	for (ifp->if_index = 1; ifp->if_index <= V_if_index; ifp->if_index++) {
-		if (ifnet_byindex(ifp->if_index) == NULL)
-			break;
-	}
-	/* Catch if_index overflow. */
-	if (ifp->if_index < 1) {
+	IFNET_WLOCK();
+	if (ifindex_alloc(&idx) != 0) {
+		IFNET_WUNLOCK();
 		free(ifp, M_IFNET);
 		return (NULL);
 	}
-	if (ifp->if_index > V_if_index)
-		V_if_index = ifp->if_index;
-	if (V_if_index >= V_if_indexlim)
-		if_grow();
-
+	IFNET_WUNLOCK();
+	ifp->if_index = idx;
 	ifp->if_type = type;
 	ifp->if_alloctype = type;
-
 	if (if_com_alloc[type] != NULL) {
 		ifp->if_l2com = if_com_alloc[type](type, ifp);
 		if (ifp->if_l2com == NULL) {
@@ -882,6 +900,7 @@ if_detach_internal(struct ifnet *ifp, in
 void
 if_vmove(struct ifnet *ifp, struct vnet *new_vnet)
 {
+	u_short idx;
 
 	/*
 	 * Detach from current vnet, but preserve LLADDR info, do not
@@ -907,23 +926,12 @@ if_vmove(struct ifnet *ifp, struct vnet 
 	 */
 	CURVNET_SET_QUIET(new_vnet);
 
-	/*
-	 * Try to find an empty slot below if_index.  If we fail, take 
-	 * the next slot.
-	 */
 	IFNET_WLOCK();
-	for (ifp->if_index = 1; ifp->if_index <= V_if_index; ifp->if_index++) {
-		if (ifnet_byindex_locked(ifp->if_index) == NULL)
-			break;
-	}
-	/* Catch if_index overflow. */
-	if (ifp->if_index < 1)
+	if (ifindex_alloc(&idx) != 0) {
+		IFNET_WUNLOCK();
 		panic("if_index overflow");
-
-	if (ifp->if_index > V_if_index)
-		V_if_index = ifp->if_index;
-	if (V_if_index >= V_if_indexlim)
-		if_grow();
+	}
+	ifp->if_index = idx;
 	ifnet_setbyindex_locked(ifp->if_index, ifp);
 	IFNET_WUNLOCK();
 

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 21:14:05 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 437F11065672;
	Fri, 28 Aug 2009 21:14:05 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2FF668FC1C;
	Fri, 28 Aug 2009 21:14:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SLE5d6036793;
	Fri, 28 Aug 2009 21:14:05 GMT (envelope-from rwatson@svn.freebsd.org)
Received: (from rwatson@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SLE5m6036791;
	Fri, 28 Aug 2009 21:14:05 GMT (envelope-from rwatson@svn.freebsd.org)
Message-Id: <200908282114.n7SLE5m6036791@svn.freebsd.org>
From: Robert Watson 
Date: Fri, 28 Aug 2009 21:14:05 +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: r196632 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/xen/xenpci net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 21:14:05 -0000

Author: rwatson
Date: Fri Aug 28 21:14:04 2009
New Revision: 196632
URL: http://svn.freebsd.org/changeset/base/196632

Log:
  Merge r196559 from head to stable/8:
  
    Add IFNET_HOLD reserved pointer value for the ifindex ifnet array,
    which allows an index to be reserved for an ifnet without making
    the ifnet available for management operations.  Use this in if_alloc()
    while the ifnet lock is released between initial index allocation and
    completion of ifnet initialization.
  
    Add ifindex_free() to centralize the implementation of releasing an
    ifindex value.  Use in if_free() and if_vmove(), as well as when
    releasing a held index in if_alloc().
  
    Reviewed by:  bz
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/net/if.c

Modified: stable/8/sys/net/if.c
==============================================================================
--- stable/8/sys/net/if.c	Fri Aug 28 21:12:38 2009	(r196631)
+++ stable/8/sys/net/if.c	Fri Aug 28 21:14:04 2009	(r196632)
@@ -175,6 +175,13 @@ int	ifqmaxlen = IFQ_MAXLEN;
 struct rwlock ifnet_rwlock;
 struct sx ifnet_sxlock;
 
+/*
+ * The allocation of network interfaces is a rather non-atomic affair; we
+ * need to select an index before we are ready to expose the interface for
+ * use, so will use this pointer value to indicate reservation.
+ */
+#define	IFNET_HOLD	(void *)(uintptr_t)(-1)
+
 static	if_com_alloc_t *if_com_alloc[256];
 static	if_com_free_t *if_com_free[256];
 
@@ -193,6 +200,8 @@ ifnet_byindex_locked(u_short idx)
 
 	if (idx > V_if_index)
 		return (NULL);
+	if (V_ifindex_table[idx].ife_ifnet == IFNET_HOLD)
+		return (NULL);
 	return (V_ifindex_table[idx].ife_ifnet);
 }
 
@@ -228,18 +237,18 @@ ifnet_byindex_ref(u_short idx)
  * failure.
  */
 static int
-ifindex_alloc(u_short *idxp)
+ifindex_alloc_locked(u_short *idxp)
 {
 	u_short idx;
 
 	IFNET_WLOCK_ASSERT();
 
 	/*
-	 * Try to find an empty slot below if_index.  If we fail, take the
+	 * Try to find an empty slot below V_if_index.  If we fail, take the
 	 * next slot.
 	 */
 	for (idx = 1; idx <= V_if_index; idx++) {
-		if (ifnet_byindex_locked(idx) == NULL)
+		if (V_ifindex_table[idx].ife_ifnet == NULL)
 			break;
 	}
 
@@ -255,6 +264,27 @@ ifindex_alloc(u_short *idxp)
 }
 
 static void
+ifindex_free_locked(u_short idx)
+{
+
+	IFNET_WLOCK_ASSERT();
+
+	V_ifindex_table[idx].ife_ifnet = NULL;
+	while (V_if_index > 0 &&
+	    V_ifindex_table[V_if_index].ife_ifnet == NULL)
+		V_if_index--;
+}
+
+static void
+ifindex_free(u_short idx)
+{
+
+	IFNET_WLOCK();
+	ifindex_free_locked(idx);
+	IFNET_WUNLOCK();
+}
+
+static void
 ifnet_setbyindex_locked(u_short idx, struct ifnet *ifp)
 {
 
@@ -370,11 +400,12 @@ if_alloc(u_char type)
 
 	ifp = malloc(sizeof(struct ifnet), M_IFNET, M_WAITOK|M_ZERO);
 	IFNET_WLOCK();
-	if (ifindex_alloc(&idx) != 0) {
+	if (ifindex_alloc_locked(&idx) != 0) {
 		IFNET_WUNLOCK();
 		free(ifp, M_IFNET);
 		return (NULL);
 	}
+	ifnet_setbyindex_locked(idx, IFNET_HOLD);
 	IFNET_WUNLOCK();
 	ifp->if_index = idx;
 	ifp->if_type = type;
@@ -383,6 +414,7 @@ if_alloc(u_char type)
 		ifp->if_l2com = if_com_alloc[type](type, ifp);
 		if (ifp->if_l2com == NULL) {
 			free(ifp, M_IFNET);
+			ifindex_free(idx);
 			return (NULL);
 		}
 	}
@@ -421,9 +453,7 @@ if_free_internal(struct ifnet *ifp)
 	KASSERT(ifp == ifnet_byindex_locked(ifp->if_index),
 	    ("%s: freeing unallocated ifnet", ifp->if_xname));
 
-	ifnet_setbyindex_locked(ifp->if_index, NULL);
-	while (V_if_index > 0 && ifnet_byindex_locked(V_if_index) == NULL)
-		V_if_index--;
+	ifindex_free_locked(ifp->if_index);
 	IFNET_WUNLOCK();
 
 	if (if_com_free[ifp->if_alloctype] != NULL)
@@ -916,18 +946,14 @@ if_vmove(struct ifnet *ifp, struct vnet 
 	 * or we'd lock on one vnet and unlock on another.
 	 */
 	IFNET_WLOCK();
-	ifnet_setbyindex_locked(ifp->if_index, NULL);
-	while (V_if_index > 0 && ifnet_byindex_locked(V_if_index) == NULL)
-		V_if_index--;
-	IFNET_WUNLOCK();
+	ifindex_free_locked(ifp->if_index);
 
 	/*
 	 * Switch to the context of the target vnet.
 	 */
 	CURVNET_SET_QUIET(new_vnet);
 
-	IFNET_WLOCK();
-	if (ifindex_alloc(&idx) != 0) {
+	if (ifindex_alloc_locked(&idx) != 0) {
 		IFNET_WUNLOCK();
 		panic("if_index overflow");
 	}

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 22:30:56 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1AC90106566B;
	Fri, 28 Aug 2009 22:30:56 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 090D38FC1C;
	Fri, 28 Aug 2009 22:30:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SMUtHX038315;
	Fri, 28 Aug 2009 22:30:55 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SMUtP6038313;
	Fri, 28 Aug 2009 22:30:55 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <200908282230.n7SMUtP6038313@svn.freebsd.org>
From: Marko Zec 
Date: Fri, 28 Aug 2009 22:30:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196633 - head/sys/net
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 22:30:56 -0000

Author: zec
Date: Fri Aug 28 22:30:55 2009
New Revision: 196633
URL: http://svn.freebsd.org/changeset/base/196633

Log:
  Introduce a separate sx lock for protecting lists of vnet sysinit
  and sysuninit handlers.
  
  Previously, sx_vnet, which is a lock designated for protecting
  the vnet list, was (ab)used for protecting vnet sysinit / sysuninit
  handler lists as well.  Holding exclusively the sx_vnet lock while
  invoking sysinit and / or sysuninit handlers turned out to be
  problematic, since some of the handlers may attempt to wake up
  another thread and wait for it to walk over the vnet list, hence
  acquire a shared lock on sx_vnet, which in turn leads to a deadlock.
  Protecting vnet sysinit / sysuninit lists with a separate lock
  mitigates this issue, which was first observed with
  flowtable_flush() / flowtable_cleaner() in sys/net/flowtable.c.
  
  Reviewed by:	rwatson, jhb
  MFC after:	3 days

Modified:
  head/sys/net/vnet.c

Modified: head/sys/net/vnet.c
==============================================================================
--- head/sys/net/vnet.c	Fri Aug 28 21:14:04 2009	(r196632)
+++ head/sys/net/vnet.c	Fri Aug 28 22:30:55 2009	(r196633)
@@ -182,14 +182,21 @@ static VNET_DEFINE(char, modspace[VNET_M
 
 /*
  * Global lists of subsystem constructor and destructors for vnets.  They are
- * registered via VNET_SYSINIT() and VNET_SYSUNINIT().  The lists are
- * protected by the vnet_sxlock global lock.
+ * registered via VNET_SYSINIT() and VNET_SYSUNINIT().  Both lists are
+ * protected by the vnet_sysinit_sxlock global lock.
  */
 static TAILQ_HEAD(vnet_sysinit_head, vnet_sysinit) vnet_constructors =
 	TAILQ_HEAD_INITIALIZER(vnet_constructors);
 static TAILQ_HEAD(vnet_sysuninit_head, vnet_sysinit) vnet_destructors =
 	TAILQ_HEAD_INITIALIZER(vnet_destructors);
 
+struct sx		vnet_sysinit_sxlock;
+
+#define	VNET_SYSINIT_WLOCK()	sx_xlock(&vnet_sysinit_sxlock);
+#define	VNET_SYSINIT_WUNLOCK()	sx_xunlock(&vnet_sysinit_sxlock);
+#define	VNET_SYSINIT_RLOCK()	sx_slock(&vnet_sysinit_sxlock);
+#define	VNET_SYSINIT_RUNLOCK()	sx_sunlock(&vnet_sysinit_sxlock);
+
 struct vnet_data_free {
 	uintptr_t	vnd_start;
 	int		vnd_len;
@@ -228,12 +235,10 @@ vnet_alloc(void)
 
 	/* Initialize / attach vnet module instances. */
 	CURVNET_SET_QUIET(vnet);
-
-	sx_xlock(&vnet_sxlock);
 	vnet_sysinit();
 	CURVNET_RESTORE();
 
-	rw_wlock(&vnet_rwlock);
+	VNET_LIST_WLOCK();
 	LIST_INSERT_HEAD(&vnet_head, vnet, vnet_le);
 	VNET_LIST_WUNLOCK();
 
@@ -253,7 +258,7 @@ vnet_destroy(struct vnet *vnet)
 
 	VNET_LIST_WLOCK();
 	LIST_REMOVE(vnet, vnet_le);
-	rw_wunlock(&vnet_rwlock);
+	VNET_LIST_WUNLOCK();
 
 	CURVNET_SET_QUIET(vnet);
 
@@ -264,8 +269,6 @@ vnet_destroy(struct vnet *vnet)
 	}
 
 	vnet_sysuninit();
-	sx_xunlock(&vnet_sxlock);
-
 	CURVNET_RESTORE();
 
 	/*
@@ -287,6 +290,7 @@ vnet_init_prelink(void *arg)
 
 	rw_init(&vnet_rwlock, "vnet_rwlock");
 	sx_init(&vnet_sxlock, "vnet_sxlock");
+	sx_init(&vnet_sysinit_sxlock, "vnet_sysinit_sxlock");
 	LIST_INIT(&vnet_head);
 }
 SYSINIT(vnet_init_prelink, SI_SUB_VNET_PRELINK, SI_ORDER_FIRST,
@@ -494,7 +498,7 @@ vnet_register_sysinit(void *arg)
 	KASSERT(vs->subsystem > SI_SUB_VNET, ("vnet sysinit too early"));
 
 	/* Add the constructor to the global list of vnet constructors. */
-	sx_xlock(&vnet_sxlock);
+	VNET_SYSINIT_WLOCK();
 	TAILQ_FOREACH(vs2, &vnet_constructors, link) {
 		if (vs2->subsystem > vs->subsystem)
 			break;
@@ -515,7 +519,7 @@ vnet_register_sysinit(void *arg)
 		vs->func(vs->arg);
 		CURVNET_RESTORE();
 	}
-	sx_xunlock(&vnet_sxlock);
+	VNET_SYSINIT_WUNLOCK();
 }
 
 void
@@ -526,9 +530,9 @@ vnet_deregister_sysinit(void *arg)
 	vs = arg;
 
 	/* Remove the constructor from the global list of vnet constructors. */
-	sx_xlock(&vnet_sxlock);
+	VNET_SYSINIT_WLOCK();
 	TAILQ_REMOVE(&vnet_constructors, vs, link);
-	sx_xunlock(&vnet_sxlock);
+	VNET_SYSINIT_WUNLOCK();
 }
 
 void
@@ -539,7 +543,7 @@ vnet_register_sysuninit(void *arg)
 	vs = arg;
 
 	/* Add the destructor to the global list of vnet destructors. */
-	sx_xlock(&vnet_sxlock);
+	VNET_SYSINIT_WLOCK();
 	TAILQ_FOREACH(vs2, &vnet_destructors, link) {
 		if (vs2->subsystem > vs->subsystem)
 			break;
@@ -550,7 +554,7 @@ vnet_register_sysuninit(void *arg)
 		TAILQ_INSERT_BEFORE(vs2, vs, link);
 	else
 		TAILQ_INSERT_TAIL(&vnet_destructors, vs, link);
-	sx_xunlock(&vnet_sxlock);
+	VNET_SYSINIT_WUNLOCK();
 }
 
 void
@@ -565,7 +569,7 @@ vnet_deregister_sysuninit(void *arg)
 	 * Invoke the destructor on all the existing vnets when it is
 	 * deregistered.
 	 */
-	sx_xlock(&vnet_sxlock);
+	VNET_SYSINIT_WLOCK();
 	VNET_FOREACH(vnet) {
 		CURVNET_SET_QUIET(vnet);
 		vs->func(vs->arg);
@@ -574,40 +578,42 @@ vnet_deregister_sysuninit(void *arg)
 
 	/* Remove the destructor from the global list of vnet destructors. */
 	TAILQ_REMOVE(&vnet_destructors, vs, link);
-	sx_xunlock(&vnet_sxlock);
+	VNET_SYSINIT_WUNLOCK();
 }
 
 /*
  * Invoke all registered vnet constructors on the current vnet.  Used during
  * vnet construction.  The caller is responsible for ensuring the new vnet is
- * the current vnet and that the vnet_sxlock lock is locked.
+ * the current vnet and that the vnet_sysinit_sxlock lock is locked.
  */
 void
 vnet_sysinit(void)
 {
 	struct vnet_sysinit *vs;
 
-	sx_assert(&vnet_sxlock, SA_LOCKED);
+	VNET_SYSINIT_RLOCK();
 	TAILQ_FOREACH(vs, &vnet_constructors, link) {
 		vs->func(vs->arg);
 	}
+	VNET_SYSINIT_RUNLOCK();
 }
 
 /*
  * Invoke all registered vnet destructors on the current vnet.  Used during
  * vnet destruction.  The caller is responsible for ensuring the dying vnet
- * is the current vnet and that the vnet_sxlock lock is locked.
+ * the current vnet and that the vnet_sysinit_sxlock lock is locked.
  */
 void
 vnet_sysuninit(void)
 {
 	struct vnet_sysinit *vs;
 
-	sx_assert(&vnet_sxlock, SA_LOCKED);
+	VNET_SYSINIT_RLOCK();
 	TAILQ_FOREACH_REVERSE(vs, &vnet_destructors, vnet_sysuninit_head,
 	    link) {
 		vs->func(vs->arg);
 	}
+	VNET_SYSINIT_RUNLOCK();
 }
 
 #ifdef DDB

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 22:41:25 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 89F95106564A;
	Fri, 28 Aug 2009 22:41:25 +0000 (UTC)
	(envelope-from jilles@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 76DC58FC12;
	Fri, 28 Aug 2009 22:41:25 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SMfPlj038553;
	Fri, 28 Aug 2009 22:41:25 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SMfP6f038547;
	Fri, 28 Aug 2009 22:41:25 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <200908282241.n7SMfP6f038547@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Fri, 28 Aug 2009 22:41:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196634 - in head: bin/sh
	tools/regression/bin/sh/execution
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 22:41:25 -0000

Author: jilles
Date: Fri Aug 28 22:41:25 2009
New Revision: 196634
URL: http://svn.freebsd.org/changeset/base/196634

Log:
  sh: Fix crash with empty functions (f() { }) introduced in r196483
  
  Empty pairs of braces are represented by a NULL node pointer, just like
  empty lines at the top level.
  
  Support for empty pairs of braces may be removed later. They make the code
  more complex, have inconsistent behaviour (may or may not change $?), are
  not specified by POSIX and are not allowed by some other shells like bash,
  dash and ksh93.
  
  Reported by:	kan

Added:
  head/tools/regression/bin/sh/execution/func2.0   (contents, props changed)
Modified:
  head/bin/sh/eval.c
  head/bin/sh/exec.c
  head/bin/sh/mknodes.c
  head/bin/sh/nodes.c.pat

Modified: head/bin/sh/eval.c
==============================================================================
--- head/bin/sh/eval.c	Fri Aug 28 22:30:55 2009	(r196633)
+++ head/bin/sh/eval.c	Fri Aug 28 22:41:25 2009	(r196634)
@@ -807,9 +807,9 @@ evalcommand(union node *cmd, int flags, 
 		funcnest++;
 		exitstatus = oexitstatus;
 		if (flags & EV_TESTED)
-			evaltree(&cmdentry.u.func->n, EV_TESTED);
+			evaltree(getfuncnode(cmdentry.u.func), EV_TESTED);
 		else
-			evaltree(&cmdentry.u.func->n, 0);
+			evaltree(getfuncnode(cmdentry.u.func), 0);
 		funcnest--;
 		INTOFF;
 		unreffunc(cmdentry.u.func);

Modified: head/bin/sh/exec.c
==============================================================================
--- head/bin/sh/exec.c	Fri Aug 28 22:30:55 2009	(r196633)
+++ head/bin/sh/exec.c	Fri Aug 28 22:41:25 2009	(r196634)
@@ -286,7 +286,7 @@ printentry(struct tblentry *cmdp, int ve
 		out1fmt("function %s", cmdp->cmdname);
 		if (verbose) {
 			INTOFF;
-			name = commandtext(&cmdp->param.func->n);
+			name = commandtext(getfuncnode(cmdp->param.func));
 			out1c(' ');
 			out1str(name);
 			ckfree(name);

Modified: head/bin/sh/mknodes.c
==============================================================================
--- head/bin/sh/mknodes.c	Fri Aug 28 22:30:55 2009	(r196633)
+++ head/bin/sh/mknodes.c	Fri Aug 28 22:41:25 2009	(r196634)
@@ -248,11 +248,9 @@ output(char *file)
 	fputs("\tstruct nodelist *next;\n", hfile);
 	fputs("\tunion node *n;\n", hfile);
 	fputs("};\n\n\n", hfile);
-	fputs("struct funcdef {\n", hfile);
-	fputs("\tunsigned int refcount;\n", hfile);
-	fputs("\tunion node n;\n", hfile);
-	fputs("};\n\n\n", hfile);
+	fputs("struct funcdef;\n", hfile);
 	fputs("struct funcdef *copyfunc(union node *);\n", hfile);
+	fputs("union node *getfuncnode(struct funcdef *);\n", hfile);
 	fputs("void reffunc(struct funcdef *);\n", hfile);
 	fputs("void unreffunc(struct funcdef *);\n", hfile);
 

Modified: head/bin/sh/nodes.c.pat
==============================================================================
--- head/bin/sh/nodes.c.pat	Fri Aug 28 22:30:55 2009	(r196633)
+++ head/bin/sh/nodes.c.pat	Fri Aug 28 22:41:25 2009	(r196634)
@@ -61,6 +61,10 @@ STATIC struct nodelist *copynodelist(str
 STATIC char *nodesavestr(char *);
 
 
+struct funcdef {
+	unsigned int refcount;
+	union node n;
+};
 
 /*
  * Make a copy of a parse tree.
@@ -85,6 +89,12 @@ copyfunc(union node *n)
 }
 
 
+union node *
+getfuncnode(struct funcdef *fn)
+{
+	return fn == NULL ? NULL : &fn->n;
+}
+
 
 STATIC void
 calcsize(union node *n)
@@ -153,7 +163,8 @@ nodesavestr(char *s)
 void
 reffunc(struct funcdef *fn)
 {
-	fn->refcount++;
+	if (fn)
+		fn->refcount++;
 }
 
 

Added: head/tools/regression/bin/sh/execution/func2.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/bin/sh/execution/func2.0	Fri Aug 28 22:41:25 2009	(r196634)
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+f() { }
+f
+hash -v f >/dev/null
+f() { { }; }
+f
+hash -v f >/dev/null
+f() { { } }
+f
+hash -v f >/dev/null

From owner-svn-src-all@FreeBSD.ORG  Fri Aug 28 22:51:07 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C62E91065672;
	Fri, 28 Aug 2009 22:51:07 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9B2878FC12;
	Fri, 28 Aug 2009 22:51:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7SMp7Mp038775;
	Fri, 28 Aug 2009 22:51:07 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7SMp75J038772;
	Fri, 28 Aug 2009 22:51:07 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <200908282251.n7SMp75J038772@svn.freebsd.org>
From: Marko Zec 
Date: Fri, 28 Aug 2009 22:51:07 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196635 - in head/sys/compat: linprocfs linux
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 28 Aug 2009 22:51:07 -0000

Author: zec
Date: Fri Aug 28 22:51:07 2009
New Revision: 196635
URL: http://svn.freebsd.org/changeset/base/196635

Log:
  Fix a few panics in linuxulator + VIMAGE due to curvnet not being set.
  
  This change affects only options VIMAGE builds.
  
  Reviewed by:	julian
  MFC after:	3 days

Modified:
  head/sys/compat/linprocfs/linprocfs.c
  head/sys/compat/linux/linux_ioctl.c

Modified: head/sys/compat/linprocfs/linprocfs.c
==============================================================================
--- head/sys/compat/linprocfs/linprocfs.c	Fri Aug 28 22:41:25 2009	(r196634)
+++ head/sys/compat/linprocfs/linprocfs.c	Fri Aug 28 22:51:07 2009	(r196635)
@@ -1085,6 +1085,7 @@ linprocfs_donetdev(PFS_FILL_ARGS)
 	    "bytes    packets errs drop fifo frame compressed",
 	    "bytes    packets errs drop fifo frame compressed");
 
+	CURVNET_SET(TD_TO_VNET(curthread));
 	IFNET_RLOCK();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		linux_ifname(ifp, ifname, sizeof ifname);
@@ -1095,6 +1096,7 @@ linprocfs_donetdev(PFS_FILL_ARGS)
 		    0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL);
 	}
 	IFNET_RUNLOCK();
+	CURVNET_RESTORE();
 
 	return (0);
 }

Modified: head/sys/compat/linux/linux_ioctl.c
==============================================================================
--- head/sys/compat/linux/linux_ioctl.c	Fri Aug 28 22:41:25 2009	(r196634)
+++ head/sys/compat/linux/linux_ioctl.c	Fri Aug 28 22:51:07 2009	(r196635)
@@ -2104,6 +2104,7 @@ ifname_linux_to_bsd(struct thread *td, c
 		return (NULL);
 	index = 0;
 	is_eth = (len == 3 && !strncmp(lxname, "eth", len)) ? 1 : 0;
+	CURVNET_SET(TD_TO_VNET(td));
 	IFNET_RLOCK();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		/*
@@ -2117,6 +2118,7 @@ ifname_linux_to_bsd(struct thread *td, c
 			break;
 	}
 	IFNET_RUNLOCK();
+	CURVNET_RESTORE();
 	if (ifp != NULL)
 		strlcpy(bsdname, ifp->if_xname, IFNAMSIZ);
 	return (ifp);
@@ -2146,6 +2148,7 @@ linux_ifconf(struct thread *td, struct i
 
 	max_len = MAXPHYS - 1;
 
+	CURVNET_SET(TD_TO_VNET(td));
 	/* handle the 'request buffer size' case */
 	if (ifc.ifc_buf == PTROUT(NULL)) {
 		ifc.ifc_len = 0;
@@ -2157,11 +2160,14 @@ linux_ifconf(struct thread *td, struct i
 			}
 		}
 		error = copyout(&ifc, uifc, sizeof(ifc));
+		CURVNET_RESTORE();
 		return (error);
 	}
 
-	if (ifc.ifc_len <= 0)
+	if (ifc.ifc_len <= 0) {
+		CURVNET_RESTORE();
 		return (EINVAL);
+	}
 
 again:
 	/* Keep track of eth interfaces */
@@ -2223,6 +2229,7 @@ again:
 	memcpy(PTRIN(ifc.ifc_buf), sbuf_data(sb), ifc.ifc_len);
 	error = copyout(&ifc, uifc, sizeof(ifc));
 	sbuf_delete(sb);
+	CURVNET_RESTORE();
 
 	return (error);
 }

From owner-svn-src-all@FreeBSD.ORG  Sat Aug 29 01:34:42 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 82332106566C;
	Sat, 29 Aug 2009 01:34:42 +0000 (UTC) (envelope-from imp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 714E38FC17;
	Sat, 29 Aug 2009 01:34:42 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7T1Yg0O041973;
	Sat, 29 Aug 2009 01:34:42 GMT (envelope-from imp@svn.freebsd.org)
Received: (from imp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7T1YgP0041970;
	Sat, 29 Aug 2009 01:34:42 GMT (envelope-from imp@svn.freebsd.org)
Message-Id: <200908290134.n7T1YgP0041970@svn.freebsd.org>
From: Warner Losh 
Date: Sat, 29 Aug 2009 01:34:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196636 - in head/sys: conf modules
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 01:34:42 -0000

Author: imp
Date: Sat Aug 29 01:34:42 2009
New Revision: 196636
URL: http://svn.freebsd.org/changeset/base/196636

Log:
  Connect bwi up to the build.  While there are some problems with this
  driver still, it generally works well for most people most of the
  time.  It is still too green for GENERIC, however.
  
  Submitted by:	many (latest being kwm@)
  MFC after:	2 days (before RC1 if possible)

Modified:
  head/sys/conf/NOTES
  head/sys/modules/Makefile

Modified: head/sys/conf/NOTES
==============================================================================
--- head/sys/conf/NOTES	Fri Aug 28 22:51:07 2009	(r196635)
+++ head/sys/conf/NOTES	Sat Aug 29 01:34:42 2009	(r196636)
@@ -1790,6 +1790,7 @@ device		miibus
 #	BCM570x family of controllers, including the 3Com 3c996-T,
 #	the Netgear GA302T, the SysKonnect SK-9D21 and SK-9D41, and
 #	the embedded gigE NICs on Dell PowerEdge 2550 servers.
+# bwi:	Broadcom BCM430* and BCM431* family of wireless adapters.
 # cas:	Sun Cassini/Cassini+ and National Semiconductor DP83065 Saturn
 # cm:	Arcnet SMC COM90c26 / SMC COM90c56
 #	(and SMC COM90c66 in '56 compatibility mode) adapters.
@@ -1959,6 +1960,7 @@ device		wb		# Winbond W89C840F
 device		xl		# 3Com 3c90x (``Boomerang'', ``Cyclone'')
 
 # PCI Ethernet NICs.
+device		bwi		# Broadcom BCM430* BCM431*
 device		de		# DEC/Intel DC21x4x (``Tulip'')
 device		em		# Intel Pro/1000 Gigabit Ethernet
 device		igb		# Intel Pro/1000 PCIE Gigabit Ethernet

Modified: head/sys/modules/Makefile
==============================================================================
--- head/sys/modules/Makefile	Fri Aug 28 22:51:07 2009	(r196635)
+++ head/sys/modules/Makefile	Sat Aug 29 01:34:42 2009	(r196636)
@@ -40,6 +40,7 @@ SUBDIR=	${_3dfx} \
 	${_bktr} \
 	${_bm} \
 	bridgestp \
+	bwi \
 	cam \
 	${_canbepm} \
 	${_canbus} \

From owner-svn-src-all@FreeBSD.ORG  Sat Aug 29 02:17:41 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1E9D2106564A;
	Sat, 29 Aug 2009 02:17:41 +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 0DC728FC19;
	Sat, 29 Aug 2009 02:17:41 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7T2HeQ4042798;
	Sat, 29 Aug 2009 02:17:40 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7T2He3n042796;
	Sat, 29 Aug 2009 02:17:40 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200908290217.n7T2He3n042796@svn.freebsd.org>
From: John Baldwin 
Date: Sat, 29 Aug 2009 02:17:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196637 - head/sys/vm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 02:17:41 -0000

Author: jhb
Date: Sat Aug 29 02:17:40 2009
New Revision: 196637
URL: http://svn.freebsd.org/changeset/base/196637

Log:
  Mark the fake pages constructed by the OBJT_SG pager valid.  This was
  accidentally lost at one point during the PAT development.  Without this
  fix vm_pager_get_pages() was zeroing each of the pages.
  
  Submitted by:	czander @ NVidia
  MFC after:	3 days

Modified:
  head/sys/vm/sg_pager.c

Modified: head/sys/vm/sg_pager.c
==============================================================================
--- head/sys/vm/sg_pager.c	Sat Aug 29 01:34:42 2009	(r196636)
+++ head/sys/vm/sg_pager.c	Sat Aug 29 02:17:40 2009	(r196637)
@@ -204,6 +204,7 @@ sg_pager_getpages(vm_object_t object, vm
 	vm_page_unlock_queues();
 	vm_page_insert(page, object, offset);
 	m[reqpage] = page;
+	page->valid = VM_PAGE_BITS_ALL;
 
 	return (VM_PAGER_OK);
 }

From owner-svn-src-all@FreeBSD.ORG  Sat Aug 29 03:17:25 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 149CF106566B;
	Sat, 29 Aug 2009 03:17:25 +0000 (UTC)
	(envelope-from kientzle@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DDB6A8FC14;
	Sat, 29 Aug 2009 03:17:24 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7T3HOiZ044346;
	Sat, 29 Aug 2009 03:17:24 GMT
	(envelope-from kientzle@svn.freebsd.org)
Received: (from kientzle@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7T3HOIK044344;
	Sat, 29 Aug 2009 03:17:24 GMT
	(envelope-from kientzle@svn.freebsd.org)
Message-Id: <200908290317.n7T3HOIK044344@svn.freebsd.org>
From: Tim Kientzle 
Date: Sat, 29 Aug 2009 03:17:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196638 - head/lib/libc/posix1e
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 03:17:25 -0000

Author: kientzle
Date: Sat Aug 29 03:17:24 2009
New Revision: 196638
URL: http://svn.freebsd.org/changeset/base/196638

Log:
  Style: Remove trailing whitespace.

Modified:
  head/lib/libc/posix1e/acl_support.c

Modified: head/lib/libc/posix1e/acl_support.c
==============================================================================
--- head/lib/libc/posix1e/acl_support.c	Sat Aug 29 02:17:40 2009	(r196637)
+++ head/lib/libc/posix1e/acl_support.c	Sat Aug 29 03:17:24 2009	(r196638)
@@ -80,7 +80,7 @@ _acl_differs(const acl_t a, const acl_t 
 
 	return (0);
 }
-		    
+
 /*
  * _posix1e_acl_entry_compare -- compare two acl_entry structures to
  * determine the order they should appear in.  Used by _posix1e_acl_sort to
@@ -164,7 +164,7 @@ _posix1e_acl(acl_t acl, acl_type_t type)
  * from code in sys/kern/kern_acl.c, and if changes are made in one, they
  * should be made in the other also.  This copy of acl_check is made
  * available * in userland for the benefit of processes wanting to check ACLs
- * for validity before submitting them to the kernel, or for performing 
+ * for validity before submitting them to the kernel, or for performing
  * in userland file system checking.  Needless to say, the kernel makes
  * the real checks on calls to get/setacl.
  *
@@ -203,7 +203,7 @@ _posix1e_acl_check(acl_t acl)
 			stage = ACL_USER;
 			count_user_obj++;
 			break;
-	
+
 		case ACL_USER:
 			/* printf("_posix1e_acl_check: %d: ACL_USER\n", i); */
 			if (stage > ACL_USER)
@@ -213,8 +213,8 @@ _posix1e_acl_check(acl_t acl)
 				return (EINVAL);
 			highest_uid = entry->ae_id;
 			count_user++;
-			break;	
-	
+			break;
+
 		case ACL_GROUP_OBJ:
 			/* printf("_posix1e_acl_check: %d: ACL_GROUP_OBJ\n",
 			    i); */
@@ -223,7 +223,7 @@ _posix1e_acl_check(acl_t acl)
 			stage = ACL_GROUP;
 			count_group_obj++;
 			break;
-	
+
 		case ACL_GROUP:
 			/* printf("_posix1e_acl_check: %d: ACL_GROUP\n", i); */
 			if (stage > ACL_GROUP)
@@ -234,7 +234,7 @@ _posix1e_acl_check(acl_t acl)
 			highest_gid = entry->ae_id;
 			count_group++;
 			break;
-			
+
 		case ACL_MASK:
 			/* printf("_posix1e_acl_check: %d: ACL_MASK\n", i); */
 			if (stage > ACL_MASK)
@@ -242,7 +242,7 @@ _posix1e_acl_check(acl_t acl)
 			stage = ACL_MASK;
 			count_mask++;
 			break;
-	
+
 		case ACL_OTHER:
 			/* printf("_posix1e_acl_check: %d: ACL_OTHER\n", i); */
 			if (stage > ACL_OTHER)
@@ -250,7 +250,7 @@ _posix1e_acl_check(acl_t acl)
 			stage = ACL_OTHER;
 			count_other++;
 			break;
-	
+
 		default:
 			/* printf("_posix1e_acl_check: %d: INVALID\n", i); */
 			return (EINVAL);
@@ -260,7 +260,7 @@ _posix1e_acl_check(acl_t acl)
 
 	if (count_user_obj != 1)
 		return (EINVAL);
-	
+
 	if (count_group_obj != 1)
 		return (EINVAL);
 
@@ -312,7 +312,7 @@ _posix1e_acl_id_to_name(acl_tag_t tag, u
 			g = NULL;
 		else
 			g = getgrgid(id);
-		if (g == NULL) 
+		if (g == NULL)
 			i = snprintf(buf, buf_len, "%d", id);
 		else
 			i = snprintf(buf, buf_len, "%s", g->gr_name);

From owner-svn-src-all@FreeBSD.ORG  Sat Aug 29 04:15:37 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 755E7106564A;
	Sat, 29 Aug 2009 04:15:37 +0000 (UTC)
	(envelope-from brian@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 62B148FC17;
	Sat, 29 Aug 2009 04:15:37 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7T4FbJv045534;
	Sat, 29 Aug 2009 04:15:37 GMT (envelope-from brian@svn.freebsd.org)
Received: (from brian@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7T4FbQK045532;
	Sat, 29 Aug 2009 04:15:37 GMT (envelope-from brian@svn.freebsd.org)
Message-Id: <200908290415.n7T4FbQK045532@svn.freebsd.org>
From: Brian Somers 
Date: Sat, 29 Aug 2009 04:15: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: r196639 - stable/8/usr.sbin/ppp
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 04:15:37 -0000

Author: brian
Date: Sat Aug 29 04:15:37 2009
New Revision: 196639
URL: http://svn.freebsd.org/changeset/base/196639

Log:
  MFC r196530: Document that ppp handles pipe(2) descriptors specially in
               -direct mode.
  
  Approved by:	re (kib)

Modified:
  stable/8/usr.sbin/ppp/   (props changed)
  stable/8/usr.sbin/ppp/ppp.8.m4

Modified: stable/8/usr.sbin/ppp/ppp.8.m4
==============================================================================
--- stable/8/usr.sbin/ppp/ppp.8.m4	Sat Aug 29 03:17:24 2009	(r196638)
+++ stable/8/usr.sbin/ppp/ppp.8.m4	Sat Aug 29 04:15:37 2009	(r196639)
@@ -27,7 +27,7 @@ changecom(,)dnl
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 24, 2007
+.Dd August 25, 2009
 .Dt PPP 8
 .Os
 .Sh NAME
@@ -171,6 +171,17 @@ If callback is configured,
 will use the
 .Dq set device
 information when dialing back.
+.Pp
+When run in
+.Fl direct
+mode,
+.Nm
+will behave slightly differently if descriptor 0 was created by
+.Xr pipe 2 .
+As pipes are not bi-directional, ppp will redirect all writes to descriptor
+1 (standard output), leaving only reads acting on descriptor 0.
+No special action is taken if descriptor 0 was created by
+.Xr socketpair 2 .
 .It Fl dedicated
 This option is designed for machines connected with a dedicated
 wire.
@@ -6055,6 +6066,8 @@ This socket is used to pass links betwee
 .Xr tcpdump 1 ,
 .Xr telnet 1 ,
 .Xr kldload 2 ,
+.Xr pipe 2 ,
+.Xr socketpair 2 ,
 ifdef({LOCALNAT},{},{.Xr libalias 3 ,
 })dnl
 ifdef({LOCALRAD},{},{.Xr libradius 3 ,

From owner-svn-src-all@FreeBSD.ORG  Sat Aug 29 13:28:03 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 231601065670;
	Sat, 29 Aug 2009 13:28:03 +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 10EDD8FC1A;
	Sat, 29 Aug 2009 13:28:03 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7TDS2vm065471;
	Sat, 29 Aug 2009 13:28:02 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7TDS2Ih065462;
	Sat, 29 Aug 2009 13:28:02 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200908291328.n7TDS2Ih065462@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 29 Aug 2009 13:28:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196640 - in head/sys: arm/arm kern sys vm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 13:28:03 -0000

Author: kib
Date: Sat Aug 29 13:28:02 2009
New Revision: 196640
URL: http://svn.freebsd.org/changeset/base/196640

Log:
  Remove the altkstacks, instead instantiate threads with kernel stack
  allocated with the right size from the start. For the thread that has
  kernel stack cached, verify that requested stack size is equial to the
  actual, and reallocate the stack if sizes differ [1].
  
  This fixes the bug introduced by r173361 that was committed several days
  after r173004 and consisted of kthread_add(9) ignoring the non-default
  kernel stack size.
  
  Also, r173361 removed the caching of the kernel stacks for a non-first
  thread in the process. Introduce separate kernel stack cache that keeps
  some limited amount of preallocated kernel stacks to lower the latency
  of thread allocation. Add vm_lowmem handler to prune the cache on
  low memory condition. This way, system with reasonable amount of the
  threads get lower latency of thread creation, while still not exhausting
  significant portion of KVA for unused kstacks.
  
  Submitted by:	peter [1]
  Discussed with:	jhb, julian, peter
  Reviewed by:	jhb
  Tested by:	pho
  MFC after:	1 week

Modified:
  head/sys/arm/arm/vm_machdep.c
  head/sys/kern/kern_fork.c
  head/sys/kern/kern_kthread.c
  head/sys/kern/kern_proc.c
  head/sys/kern/kern_thr.c
  head/sys/kern/kern_thread.c
  head/sys/sys/proc.h
  head/sys/vm/vm_extern.h
  head/sys/vm/vm_glue.c

Modified: head/sys/arm/arm/vm_machdep.c
==============================================================================
--- head/sys/arm/arm/vm_machdep.c	Sat Aug 29 04:15:37 2009	(r196639)
+++ head/sys/arm/arm/vm_machdep.c	Sat Aug 29 13:28:02 2009	(r196640)
@@ -119,9 +119,6 @@ cpu_fork(register struct thread *td1, re
 #ifdef __XSCALE__
 #ifndef CPU_XSCALE_CORE3
 	pmap_use_minicache(td2->td_kstack, td2->td_kstack_pages * PAGE_SIZE);
-	if (td2->td_altkstack)
-		pmap_use_minicache(td2->td_altkstack, td2->td_altkstack_pages *
-		    PAGE_SIZE);
 #endif
 #endif
 	td2->td_pcb = pcb2;

Modified: head/sys/kern/kern_fork.c
==============================================================================
--- head/sys/kern/kern_fork.c	Sat Aug 29 04:15:37 2009	(r196639)
+++ head/sys/kern/kern_fork.c	Sat Aug 29 13:28:02 2009	(r196640)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
 
 #include "opt_kdtrace.h"
 #include "opt_ktrace.h"
+#include "opt_kstack_pages.h"
 
 #include 
 #include 
@@ -276,25 +277,29 @@ norfproc_fail:
 
 	mem_charged = 0;
 	vm2 = NULL;
+	if (pages == 0)
+		pages = KSTACK_PAGES;
 	/* Allocate new proc. */
 	newproc = uma_zalloc(proc_zone, M_WAITOK);
-	if (TAILQ_EMPTY(&newproc->p_threads)) {
-		td2 = thread_alloc();
+	td2 = FIRST_THREAD_IN_PROC(newproc);
+	if (td2 == NULL) {
+		td2 = thread_alloc(pages);
 		if (td2 == NULL) {
 			error = ENOMEM;
 			goto fail1;
 		}
 		proc_linkup(newproc, td2);
-	} else
-		td2 = FIRST_THREAD_IN_PROC(newproc);
-
-	/* Allocate and switch to an alternate kstack if specified. */
-	if (pages != 0) {
-		if (!vm_thread_new_altkstack(td2, pages)) {
-			error = ENOMEM;
-			goto fail1;
+	} else {
+		if (td2->td_kstack == 0 || td2->td_kstack_pages != pages) {
+			if (td2->td_kstack != 0)
+				vm_thread_dispose(td);
+			if (!thread_alloc_stack(td2, pages)) {
+				error = ENOMEM;
+				goto fail1;
+			}
 		}
 	}
+
 	if ((flags & RFMEM) == 0) {
 		vm2 = vmspace_fork(p1->p_vmspace, &mem_charged);
 		if (vm2 == NULL) {

Modified: head/sys/kern/kern_kthread.c
==============================================================================
--- head/sys/kern/kern_kthread.c	Sat Aug 29 04:15:37 2009	(r196639)
+++ head/sys/kern/kern_kthread.c	Sat Aug 29 13:28:02 2009	(r196640)
@@ -256,7 +256,7 @@ kthread_add(void (*func)(void *), void *
 	}
 
 	/* Initialize our new td  */
-	newtd = thread_alloc();
+	newtd = thread_alloc(pages);
 	if (newtd == NULL)
 		return (ENOMEM);
 
@@ -282,9 +282,6 @@ kthread_add(void (*func)(void *), void *
 
 	newtd->td_pflags |= TDP_KTHREAD;
 	newtd->td_ucred = crhold(p->p_ucred);
-	/* Allocate and switch to an alternate kstack if specified. */
-	if (pages != 0)
-		vm_thread_new_altkstack(newtd, pages);
 
 	/* this code almost the same as create_thread() in kern_thr.c */
 	PROC_LOCK(p);

Modified: head/sys/kern/kern_proc.c
==============================================================================
--- head/sys/kern/kern_proc.c	Sat Aug 29 04:15:37 2009	(r196639)
+++ head/sys/kern/kern_proc.c	Sat Aug 29 13:28:02 2009	(r196640)
@@ -203,14 +203,6 @@ proc_dtor(void *mem, int size, void *arg
 #endif
 		/* Free all OSD associated to this thread. */
 		osd_thread_exit(td);
-
-		/* Dispose of an alternate kstack, if it exists.
-		 * XXX What if there are more than one thread in the proc?
-		 *     The first thread in the proc is special and not
-		 *     freed, so you gotta do this here.
-		 */
-		if (((p->p_flag & P_KTHREAD) != 0) && (td->td_altkstack != 0))
-			vm_thread_dispose_altkstack(td);
 	}
 	EVENTHANDLER_INVOKE(process_dtor, p);
 	if (p->p_ksi != NULL)
@@ -767,8 +759,6 @@ fill_kinfo_proc_only(struct proc *p, str
 		FOREACH_THREAD_IN_PROC(p, td0) {
 			if (!TD_IS_SWAPPED(td0))
 				kp->ki_rssize += td0->td_kstack_pages;
-			if (td0->td_altkstack_obj != NULL)
-				kp->ki_rssize += td0->td_altkstack_pages;
 		}
 		kp->ki_swrss = vm->vm_swrss;
 		kp->ki_tsize = vm->vm_tsize;

Modified: head/sys/kern/kern_thr.c
==============================================================================
--- head/sys/kern/kern_thr.c	Sat Aug 29 04:15:37 2009	(r196639)
+++ head/sys/kern/kern_thr.c	Sat Aug 29 13:28:02 2009	(r196640)
@@ -176,7 +176,7 @@ create_thread(struct thread *td, mcontex
 	}
 
 	/* Initialize our td */
-	newtd = thread_alloc();
+	newtd = thread_alloc(0);
 	if (newtd == NULL)
 		return (ENOMEM);
 

Modified: head/sys/kern/kern_thread.c
==============================================================================
--- head/sys/kern/kern_thread.c	Sat Aug 29 04:15:37 2009	(r196639)
+++ head/sys/kern/kern_thread.c	Sat Aug 29 13:28:02 2009	(r196640)
@@ -283,7 +283,7 @@ thread_reap(void)
  * Allocate a thread.
  */
 struct thread *
-thread_alloc(void)
+thread_alloc(int pages)
 {
 	struct thread *td;
 
@@ -291,7 +291,7 @@ thread_alloc(void)
 
 	td = (struct thread *)uma_zalloc(thread_zone, M_WAITOK);
 	KASSERT(td->td_kstack == 0, ("thread_alloc got thread with kstack"));
-	if (!vm_thread_new(td, 0)) {
+	if (!vm_thread_new(td, pages)) {
 		uma_zfree(thread_zone, td);
 		return (NULL);
 	}
@@ -299,6 +299,17 @@ thread_alloc(void)
 	return (td);
 }
 
+int
+thread_alloc_stack(struct thread *td, int pages)
+{
+
+	KASSERT(td->td_kstack == 0,
+	    ("thread_alloc_stack called on a thread with kstack"));
+	if (!vm_thread_new(td, pages))
+		return (0);
+	cpu_thread_alloc(td);
+	return (1);
+}
 
 /*
  * Deallocate a thread.
@@ -312,8 +323,6 @@ thread_free(struct thread *td)
 		cpuset_rel(td->td_cpuset);
 	td->td_cpuset = NULL;
 	cpu_thread_free(td);
-	if (td->td_altkstack != 0)
-		vm_thread_dispose_altkstack(td);
 	if (td->td_kstack != 0)
 		vm_thread_dispose(td);
 	uma_zfree(thread_zone, td);

Modified: head/sys/sys/proc.h
==============================================================================
--- head/sys/sys/proc.h	Sat Aug 29 04:15:37 2009	(r196639)
+++ head/sys/sys/proc.h	Sat Aug 29 13:28:02 2009	(r196640)
@@ -267,9 +267,6 @@ struct thread {
 	struct vm_object *td_kstack_obj;/* (a) Kstack object. */
 	vm_offset_t	td_kstack;	/* (a) Kernel VA of kstack. */
 	int		td_kstack_pages; /* (a) Size of the kstack. */
-	struct vm_object *td_altkstack_obj;/* (a) Alternate kstack object. */
-	vm_offset_t	td_altkstack;	/* (a) Kernel VA of alternate kstack. */
-	int		td_altkstack_pages; /* (a) Size of alternate kstack. */
 	volatile u_int	td_critnest;	/* (k*) Critical section nest level. */
 	struct mdthread td_md;		/* (k) Any machine-dependent fields. */
 	struct td_sched	*td_sched;	/* (*) Scheduler-specific data. */
@@ -850,7 +847,8 @@ void	cpu_thread_exit(struct thread *);
 void	cpu_thread_free(struct thread *);
 void	cpu_thread_swapin(struct thread *);
 void	cpu_thread_swapout(struct thread *);
-struct	thread *thread_alloc(void);
+struct	thread *thread_alloc(int pages);
+int	thread_alloc_stack(struct thread *, int pages);
 void	thread_exit(void) __dead2;
 void	thread_free(struct thread *td);
 void	thread_link(struct thread *td, struct proc *p);

Modified: head/sys/vm/vm_extern.h
==============================================================================
--- head/sys/vm/vm_extern.h	Sat Aug 29 04:15:37 2009	(r196639)
+++ head/sys/vm/vm_extern.h	Sat Aug 29 13:28:02 2009	(r196640)
@@ -80,9 +80,7 @@ int vm_fault_quick(caddr_t v, int prot);
 struct sf_buf *vm_imgact_map_page(vm_object_t object, vm_ooffset_t offset);
 void vm_imgact_unmap_page(struct sf_buf *sf);
 void vm_thread_dispose(struct thread *td);
-void vm_thread_dispose_altkstack(struct thread *td);
 int vm_thread_new(struct thread *td, int pages);
-int vm_thread_new_altkstack(struct thread *td, int pages);
 void vm_thread_swapin(struct thread *td);
 void vm_thread_swapout(struct thread *td);
 #endif				/* _KERNEL */

Modified: head/sys/vm/vm_glue.c
==============================================================================
--- head/sys/vm/vm_glue.c	Sat Aug 29 04:15:37 2009	(r196639)
+++ head/sys/vm/vm_glue.c	Sat Aug 29 13:28:02 2009	(r196640)
@@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -308,6 +309,20 @@ vm_imgact_unmap_page(struct sf_buf *sf)
 	vm_page_unlock_queues();
 }
 
+struct kstack_cache_entry {
+	vm_object_t ksobj;
+	struct kstack_cache_entry *next_ks_entry;
+};
+
+static struct kstack_cache_entry *kstack_cache;
+static int kstack_cache_size = 128;
+static int kstacks;
+static struct mtx kstack_cache_mtx;
+SYSCTL_INT(_vm, OID_AUTO, kstack_cache_size, CTLFLAG_RW, &kstack_cache_size, 0,
+    "");
+SYSCTL_INT(_vm, OID_AUTO, kstacks, CTLFLAG_RD, &kstacks, 0,
+    "");
+
 #ifndef KSTACK_MAX_PAGES
 #define KSTACK_MAX_PAGES 32
 #endif
@@ -323,6 +338,7 @@ vm_thread_new(struct thread *td, int pag
 	vm_object_t ksobj;
 	vm_offset_t ks;
 	vm_page_t m, ma[KSTACK_MAX_PAGES];
+	struct kstack_cache_entry *ks_ce;
 	int i;
 
 	/* Bounds check */
@@ -330,6 +346,22 @@ vm_thread_new(struct thread *td, int pag
 		pages = KSTACK_PAGES;
 	else if (pages > KSTACK_MAX_PAGES)
 		pages = KSTACK_MAX_PAGES;
+
+	if (pages == KSTACK_PAGES) {
+		mtx_lock(&kstack_cache_mtx);
+		if (kstack_cache != NULL) {
+			ks_ce = kstack_cache;
+			kstack_cache = ks_ce->next_ks_entry;
+			mtx_unlock(&kstack_cache_mtx);
+
+			td->td_kstack_obj = ks_ce->ksobj;
+			td->td_kstack = (vm_offset_t)ks_ce;
+			td->td_kstack_pages = KSTACK_PAGES;
+			return (1);
+		}
+		mtx_unlock(&kstack_cache_mtx);
+	}
+
 	/*
 	 * Allocate an object for the kstack.
 	 */
@@ -345,7 +377,8 @@ vm_thread_new(struct thread *td, int pag
 		vm_object_deallocate(ksobj);
 		return (0);
 	}
-	
+
+	atomic_add_int(&kstacks, 1);
 	if (KSTACK_GUARD_PAGES != 0) {
 		pmap_qremove(ks, KSTACK_GUARD_PAGES);
 		ks += KSTACK_GUARD_PAGES * PAGE_SIZE;
@@ -376,20 +409,13 @@ vm_thread_new(struct thread *td, int pag
 	return (1);
 }
 
-/*
- * Dispose of a thread's kernel stack.
- */
-void
-vm_thread_dispose(struct thread *td)
+static void
+vm_thread_stack_dispose(vm_object_t ksobj, vm_offset_t ks, int pages)
 {
-	vm_object_t ksobj;
-	vm_offset_t ks;
 	vm_page_t m;
-	int i, pages;
+	int i;
 
-	pages = td->td_kstack_pages;
-	ksobj = td->td_kstack_obj;
-	ks = td->td_kstack;
+	atomic_add_int(&kstacks, -1);
 	pmap_qremove(ks, pages);
 	VM_OBJECT_LOCK(ksobj);
 	for (i = 0; i < pages; i++) {
@@ -405,9 +431,66 @@ vm_thread_dispose(struct thread *td)
 	vm_object_deallocate(ksobj);
 	kmem_free(kernel_map, ks - (KSTACK_GUARD_PAGES * PAGE_SIZE),
 	    (pages + KSTACK_GUARD_PAGES) * PAGE_SIZE);
+}
+
+/*
+ * Dispose of a thread's kernel stack.
+ */
+void
+vm_thread_dispose(struct thread *td)
+{
+	vm_object_t ksobj;
+	vm_offset_t ks;
+	struct kstack_cache_entry *ks_ce;
+	int pages;
+
+	pages = td->td_kstack_pages;
+	ksobj = td->td_kstack_obj;
+	ks = td->td_kstack;
+	if (pages == KSTACK_PAGES && kstacks <= kstack_cache_size) {
+		ks_ce = (struct kstack_cache_entry *)ks;
+		ks_ce->ksobj = ksobj;
+		mtx_lock(&kstack_cache_mtx);
+		ks_ce->next_ks_entry = ks_ce;
+		kstack_cache = ks_ce;
+		mtx_unlock(&kstack_cache_mtx);
+		return;
+	}
+	vm_thread_stack_dispose(ksobj, ks, pages);
 	td->td_kstack = 0;
+	td->td_kstack_pages = 0;
+}
+
+static void
+vm_thread_stack_lowmem(void *nulll)
+{
+	struct kstack_cache_entry *ks_ce, *ks_ce1;
+
+	mtx_lock(&kstack_cache_mtx);
+	ks_ce = kstack_cache;
+	kstack_cache = NULL;
+	mtx_unlock(&kstack_cache_mtx);
+
+	while (ks_ce != NULL) {
+		ks_ce1 = ks_ce;
+		ks_ce = ks_ce->next_ks_entry;
+
+		vm_thread_stack_dispose(ks_ce1->ksobj, (vm_offset_t)ks_ce1,
+		    KSTACK_PAGES);
+	}
+}
+
+static void
+kstack_cache_init(void *nulll)
+{
+
+	EVENTHANDLER_REGISTER(vm_lowmem, vm_thread_stack_lowmem, NULL,
+	    EVENTHANDLER_PRI_ANY);
 }
 
+MTX_SYSINIT(kstack_cache, &kstack_cache_mtx, "kstkch", MTX_DEF);
+SYSINIT(vm_kstacks, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY, kstack_cache_init, NULL);
+
 /*
  * Allow a thread's kernel stack to be paged out.
  */
@@ -468,37 +551,6 @@ vm_thread_swapin(struct thread *td)
 }
 
 /*
- * Set up a variable-sized alternate kstack.
- */
-int
-vm_thread_new_altkstack(struct thread *td, int pages)
-{
-
-	td->td_altkstack = td->td_kstack;
-	td->td_altkstack_obj = td->td_kstack_obj;
-	td->td_altkstack_pages = td->td_kstack_pages;
-
-	return (vm_thread_new(td, pages));
-}
-
-/*
- * Restore the original kstack.
- */
-void
-vm_thread_dispose_altkstack(struct thread *td)
-{
-
-	vm_thread_dispose(td);
-
-	td->td_kstack = td->td_altkstack;
-	td->td_kstack_obj = td->td_altkstack_obj;
-	td->td_kstack_pages = td->td_altkstack_pages;
-	td->td_altkstack = 0;
-	td->td_altkstack_obj = NULL;
-	td->td_altkstack_pages = 0;
-}
-
-/*
  * Implement fork's actions on an address space.
  * Here we arrange for the address space to be copied or referenced,
  * allocate a user struct (pcb and kernel stack), then call the

From owner-svn-src-all@FreeBSD.ORG  Sat Aug 29 13:47:25 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: by hub.freebsd.org (Postfix, from userid 1033)
	id 226BC106566B; Sat, 29 Aug 2009 13:47:25 +0000 (UTC)
Date: Sat, 29 Aug 2009 13:47:25 +0000
From: Alexey Dokuchaev 
To: Xin LI 
Message-ID: <20090829134724.GA35926@FreeBSD.org>
References: <200908242235.n7OMZrs6008394@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=koi8-r
Content-Disposition: inline
In-Reply-To: <200908242235.n7OMZrs6008394@svn.freebsd.org>
User-Agent: Mutt/1.4.2.1i
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r196524 - in head/sys: dev/syscons i386/isa
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 13:47:25 -0000

On Mon, Aug 24, 2009 at 10:35:53PM +0000, Xin LI wrote:
> Author: delphij
> Date: Mon Aug 24 22:35:53 2009
> New Revision: 196524
> URL: http://svn.freebsd.org/changeset/base/196524
> 
> Log:
>   Fix VESA modes and allow 8bit depth modes.
>   
>   PR:		i386/124902
>   Submitted by:	paradox 
>   MFC after:	2 months
> 
> Modified:
>   head/sys/dev/syscons/scvgarndr.c
>   head/sys/dev/syscons/scvidctl.c
>   head/sys/i386/isa/vesa.c

This commit broke logo screensaver with vesa on my NEC Versa S950
laptop.  Reverting and rebuilding/reloading vesa module restored correct
behavior.  I'm not familiar with our VESA implementation internals to
give you sufficient analysis right now, but will take a look.

Who did review these changes, BTW?

./danfe

From owner-svn-src-all@FreeBSD.ORG  Sat Aug 29 15:21:50 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C2097106566C;
	Sat, 29 Aug 2009 15:21:50 +0000 (UTC)
	(envelope-from simon@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A63038FC0A;
	Sat, 29 Aug 2009 15:21:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7TFLo7v067796;
	Sat, 29 Aug 2009 15:21:50 GMT (envelope-from simon@svn.freebsd.org)
Received: (from simon@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7TFLo0D067791;
	Sat, 29 Aug 2009 15:21:50 GMT (envelope-from simon@svn.freebsd.org)
Message-Id: <200908291521.n7TFLo0D067791@svn.freebsd.org>
From: "Simon L. Nielsen" 
Date: Sat, 29 Aug 2009 15:21:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
X-SVN-Group: stable-8
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196641 - in stable/8/crypto/openssl: . crypto/pqueue
	ssl
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 15:21:50 -0000

Author: simon
Date: Sat Aug 29 15:21:50 2009
New Revision: 196641
URL: http://svn.freebsd.org/changeset/base/196641

Log:
  MFC r196474:
  
    Merge DTLS fixes from vendor-crypto/openssl/dist:
  
    - Fix memory consumption bug with "future epoch" DTLS records.
    - Fix fragment handling memory leak.
    - Do not access freed data structure.
    - Fix DTLS fragment bug - out-of-sequence message handling which could
      result in NULL pointer dereference in
      dtls1_process_out_of_seq_message().
  
    Note that this will not get FreeBSD Security Advisory as DTLS is
    experimental in OpenSSL.
  
    Security:	CVE-2009-1377 CVE-2009-1378 CVE-2009-1379 CVE-2009-1387
  
  Approved by:	re (kib)

Modified:
  stable/8/crypto/openssl/   (props changed)
  stable/8/crypto/openssl/crypto/pqueue/pqueue.c
  stable/8/crypto/openssl/crypto/pqueue/pqueue.h
  stable/8/crypto/openssl/ssl/d1_both.c
  stable/8/crypto/openssl/ssl/d1_pkt.c

Modified: stable/8/crypto/openssl/crypto/pqueue/pqueue.c
==============================================================================
--- stable/8/crypto/openssl/crypto/pqueue/pqueue.c	Sat Aug 29 13:28:02 2009	(r196640)
+++ stable/8/crypto/openssl/crypto/pqueue/pqueue.c	Sat Aug 29 15:21:50 2009	(r196641)
@@ -234,3 +234,17 @@ pqueue_next(pitem **item)
 
 	return ret;
 	}
+
+int
+pqueue_size(pqueue_s *pq)
+{
+	pitem *item = pq->items;
+	int count = 0;
+	
+	while(item != NULL)
+	{
+		count++;
+		item = item->next;
+	}
+	return count;
+}

Modified: stable/8/crypto/openssl/crypto/pqueue/pqueue.h
==============================================================================
--- stable/8/crypto/openssl/crypto/pqueue/pqueue.h	Sat Aug 29 13:28:02 2009	(r196640)
+++ stable/8/crypto/openssl/crypto/pqueue/pqueue.h	Sat Aug 29 15:21:50 2009	(r196641)
@@ -91,5 +91,6 @@ pitem *pqueue_iterator(pqueue pq);
 pitem *pqueue_next(piterator *iter);
 
 void   pqueue_print(pqueue pq);
+int    pqueue_size(pqueue pq);
 
 #endif /* ! HEADER_PQUEUE_H */

Modified: stable/8/crypto/openssl/ssl/d1_both.c
==============================================================================
--- stable/8/crypto/openssl/ssl/d1_both.c	Sat Aug 29 13:28:02 2009	(r196640)
+++ stable/8/crypto/openssl/ssl/d1_both.c	Sat Aug 29 15:21:50 2009	(r196641)
@@ -519,6 +519,7 @@ dtls1_retrieve_buffered_fragment(SSL *s,
 
 	if ( s->d1->handshake_read_seq == frag->msg_header.seq)
 		{
+		unsigned long frag_len = frag->msg_header.frag_len;
 		pqueue_pop(s->d1->buffered_messages);
 
 		al=dtls1_preprocess_fragment(s,&frag->msg_header,max);
@@ -536,7 +537,7 @@ dtls1_retrieve_buffered_fragment(SSL *s,
 		if (al==0)
 			{
 			*ok = 1;
-			return frag->msg_header.frag_len;
+			return frag_len;
 			}
 
 		ssl3_send_alert(s,SSL3_AL_FATAL,al);
@@ -561,7 +562,16 @@ dtls1_process_out_of_seq_message(SSL *s,
 	if ((msg_hdr->frag_off+frag_len) > msg_hdr->msg_len)
 		goto err;
 
-	if (msg_hdr->seq <= s->d1->handshake_read_seq)
+	/* Try to find item in queue, to prevent duplicate entries */
+	pq_64bit_init(&seq64);
+	pq_64bit_assign_word(&seq64, msg_hdr->seq);
+	item = pqueue_find(s->d1->buffered_messages, seq64);
+	pq_64bit_free(&seq64);
+	
+	/* Discard the message if sequence number was already there, is
+	 * too far in the future or the fragment is already in the queue */
+	if (msg_hdr->seq <= s->d1->handshake_read_seq ||
+		msg_hdr->seq > s->d1->handshake_read_seq + 10 || item != NULL)
 		{
 		unsigned char devnull [256];
 
@@ -575,30 +585,31 @@ dtls1_process_out_of_seq_message(SSL *s,
 			}
 		}
 
-	frag = dtls1_hm_fragment_new(frag_len);
-	if ( frag == NULL)
-		goto err;
+	if (frag_len)
+	{
+		frag = dtls1_hm_fragment_new(frag_len);
+		if ( frag == NULL)
+			goto err;
 
-	memcpy(&(frag->msg_header), msg_hdr, sizeof(*msg_hdr));
+		memcpy(&(frag->msg_header), msg_hdr, sizeof(*msg_hdr));
 
-	if (frag_len)
-		{
-		/* read the body of the fragment (header has already been read */
+		/* read the body of the fragment (header has already been read) */
 		i = s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE,
 			frag->fragment,frag_len,0);
 		if (i<=0 || (unsigned long)i!=frag_len)
 			goto err;
-		}
 
-	pq_64bit_init(&seq64);
-	pq_64bit_assign_word(&seq64, msg_hdr->seq);
+		pq_64bit_init(&seq64);
+		pq_64bit_assign_word(&seq64, msg_hdr->seq);
 
-	item = pitem_new(seq64, frag);
-	pq_64bit_free(&seq64);
-	if ( item == NULL)
-		goto err;
+		item = pitem_new(seq64, frag);
+		pq_64bit_free(&seq64);
+		if ( item == NULL)
+			goto err;
+
+		pqueue_insert(s->d1->buffered_messages, item);
+	}
 
-	pqueue_insert(s->d1->buffered_messages, item);
 	return DTLS1_HM_FRAGMENT_RETRY;
 
 err:

Modified: stable/8/crypto/openssl/ssl/d1_pkt.c
==============================================================================
--- stable/8/crypto/openssl/ssl/d1_pkt.c	Sat Aug 29 13:28:02 2009	(r196640)
+++ stable/8/crypto/openssl/ssl/d1_pkt.c	Sat Aug 29 15:21:50 2009	(r196641)
@@ -167,6 +167,10 @@ dtls1_buffer_record(SSL *s, record_pqueu
     DTLS1_RECORD_DATA *rdata;
 	pitem *item;
 
+	/* Limit the size of the queue to prevent DOS attacks */
+	if (pqueue_size(queue->q) >= 100)
+		return 0;
+		
 	rdata = OPENSSL_malloc(sizeof(DTLS1_RECORD_DATA));
 	item = pitem_new(priority, rdata);
 	if (rdata == NULL || item == NULL)

From owner-svn-src-all@FreeBSD.ORG  Sat Aug 29 15:42:06 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C7E69106564A;
	Sat, 29 Aug 2009 15:42:06 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B4B738FC22;
	Sat, 29 Aug 2009 15:42:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7TFg69i068240;
	Sat, 29 Aug 2009 15:42:06 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7TFg6On068238;
	Sat, 29 Aug 2009 15:42:06 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200908291542.n7TFg6On068238@svn.freebsd.org>
From: Andrew Thompson 
Date: Sat, 29 Aug 2009 15:42:06 +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: r196642 - in stable/8/sys: . amd64/include/xen
	cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
	dev/usb dev/xen/xenpci
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 15:42:06 -0000

Author: thompsa
Date: Sat Aug 29 15:42:06 2009
New Revision: 196642
URL: http://svn.freebsd.org/changeset/base/196642

Log:
  MFC r196547
  
   It is possible for all the kthreads to exit (hci modules unloaded) which in
   turn ends our usb process. This means the proc pointer becomes invalid and will
   panic if a new kthread is added. Count the number of threads and clear the proc
   pointer on the last one.
  
  Approved by:	re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/usb/usb_process.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/usb_process.c
==============================================================================
--- stable/8/sys/dev/usb/usb_process.c	Sat Aug 29 15:21:50 2009	(r196641)
+++ stable/8/sys/dev/usb/usb_process.c	Sat Aug 29 15:42:06 2009	(r196642)
@@ -64,6 +64,7 @@
 
 #if (__FreeBSD_version >= 800000)
 static struct proc *usbproc;
+static int usb_pcount;
 #define	USB_THREAD_CREATE(f, s, p, ...) \
 		kproc_kthread_add((f), (s), &usbproc, (p), RFHIGHPID, \
 		    0, "usb", __VA_ARGS__)
@@ -183,6 +184,11 @@ usb_process(void *arg)
 	up->up_ptr = NULL;
 	cv_signal(&up->up_cv);
 	mtx_unlock(up->up_mtx);
+#if (__FreeBSD_version >= 800000)
+	/* Clear the proc pointer if this is the last thread. */
+	if (--usb_pcount == 0)
+		usbproc = NULL;
+#endif
 
 	USB_THREAD_EXIT(0);
 }
@@ -218,6 +224,9 @@ usb_proc_create(struct usb_process *up, 
 		up->up_ptr = NULL;
 		goto error;
 	}
+#if (__FreeBSD_version >= 800000)
+	usb_pcount++;
+#endif
 	return (0);
 
 error:

From owner-svn-src-all@FreeBSD.ORG  Sat Aug 29 16:01:22 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6FDA4106566B;
	Sat, 29 Aug 2009 16:01:22 +0000 (UTC)
	(envelope-from rnoland@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5EB218FC19;
	Sat, 29 Aug 2009 16:01:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7TG1M3s068647;
	Sat, 29 Aug 2009 16:01:22 GMT (envelope-from rnoland@svn.freebsd.org)
Received: (from rnoland@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7TG1Mmx068644;
	Sat, 29 Aug 2009 16:01:22 GMT (envelope-from rnoland@svn.freebsd.org)
Message-Id: <200908291601.n7TG1Mmx068644@svn.freebsd.org>
From: Robert Noland 
Date: Sat, 29 Aug 2009 16:01:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196643 - in head/sys: amd64/amd64 i386/i386
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 16:01:22 -0000

Author: rnoland
Date: Sat Aug 29 16:01:21 2009
New Revision: 196643
URL: http://svn.freebsd.org/changeset/base/196643

Log:
  Swap the start/end virtual addresses in pmap_invalidate_cache_range().
  
  This fixes the functionality on non SelfSnoop hardware.
  
  Found by:	rnoland
  Submitted by:	alc
  Reviewed by:	kib
  MFC after:	3 days

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/i386/i386/pmap.c

Modified: head/sys/amd64/amd64/pmap.c
==============================================================================
--- head/sys/amd64/amd64/pmap.c	Sat Aug 29 15:42:06 2009	(r196642)
+++ head/sys/amd64/amd64/pmap.c	Sat Aug 29 16:01:21 2009	(r196643)
@@ -943,8 +943,8 @@ pmap_invalidate_cache_range(vm_offset_t 
 		 * coherence domain.
 		 */
 		mfence();
-		for (; eva < sva; eva += cpu_clflush_line_size)
-			clflush(eva);
+		for (; sva < eva; sva += cpu_clflush_line_size)
+			clflush(sva);
 		mfence();
 	} else {
 

Modified: head/sys/i386/i386/pmap.c
==============================================================================
--- head/sys/i386/i386/pmap.c	Sat Aug 29 15:42:06 2009	(r196642)
+++ head/sys/i386/i386/pmap.c	Sat Aug 29 16:01:21 2009	(r196643)
@@ -967,8 +967,8 @@ pmap_invalidate_cache_range(vm_offset_t 
 		 * coherence domain.
 		 */
 		mfence();
-		for (; eva < sva; eva += cpu_clflush_line_size)
-			clflush(eva);
+		for (; sva < eva; sva += cpu_clflush_line_size)
+			clflush(sva);
 		mfence();
 	} else {
 

From owner-svn-src-all@FreeBSD.ORG  Sat Aug 29 16:06:01 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 05D90106566C;
	Sat, 29 Aug 2009 16:06:01 +0000 (UTC)
	(envelope-from kostikbel@gmail.com)
Received: from mail.zoral.com.ua (skuns.zoral.com.ua [91.193.166.194])
	by mx1.freebsd.org (Postfix) with ESMTP id 701D38FC1C;
	Sat, 29 Aug 2009 16:06:00 +0000 (UTC)
Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua
	[10.1.1.148])
	by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n7TG5sdC035960
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Sat, 29 Aug 2009 19:05:54 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1])
	by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id
	n7TG5sx3079283; Sat, 29 Aug 2009 19:05:54 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
Received: (from kostik@localhost)
	by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n7TG5soi079282; 
	Sat, 29 Aug 2009 19:05:54 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to
	kostikbel@gmail.com using -f
Date: Sat, 29 Aug 2009 19:05:54 +0300
From: Kostik Belousov 
To: Robert Noland 
Message-ID: <20090829160554.GP1881@deviant.kiev.zoral.com.ua>
References: <200908291601.n7TG1Mmx068644@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="tZCmRiovzb4sxAVa"
Content-Disposition: inline
In-Reply-To: <200908291601.n7TG1Mmx068644@svn.freebsd.org>
User-Agent: Mutt/1.4.2.3i
X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua
X-Virus-Status: Clean
X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00
	autolearn=ham version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
	skuns.kiev.zoral.com.ua
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r196643 - in head/sys: amd64/amd64 i386/i386
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 16:06:01 -0000


--tZCmRiovzb4sxAVa
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Aug 29, 2009 at 04:01:21PM +0000, Robert Noland wrote:
> Author: rnoland
> Date: Sat Aug 29 16:01:21 2009
> New Revision: 196643
> URL: http://svn.freebsd.org/changeset/base/196643
>=20
> Log:
>   Swap the start/end virtual addresses in pmap_invalidate_cache_range().
>  =20
>   This fixes the functionality on non SelfSnoop hardware.
>  =20
>   Found by:	rnoland
>   Submitted by:	alc
>   Reviewed by:	kib
Rather, a Pointy hat to: kib

Thanks for taking care of this.


--tZCmRiovzb4sxAVa
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkqZUeEACgkQC3+MBN1Mb4hvPQCePhu7m+hdP78FMMFMaU1u7+q2
g9UAnjAZJqGu05bj7L18GabJ0sgT/qqi
=E0N6
-----END PGP SIGNATURE-----

--tZCmRiovzb4sxAVa--

From owner-svn-src-all@FreeBSD.ORG  Sat Aug 29 18:01:02 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 733A91065670;
	Sat, 29 Aug 2009 18:01:02 +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 6293A8FC08;
	Sat, 29 Aug 2009 18:01:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7TI12IM071028;
	Sat, 29 Aug 2009 18:01:02 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7TI12fg071026;
	Sat, 29 Aug 2009 18:01:02 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200908291801.n7TI12fg071026@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 29 Aug 2009 18:01:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196644 - head/sys/kern
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 18:01:02 -0000

Author: kib
Date: Sat Aug 29 18:01:02 2009
New Revision: 196644
URL: http://svn.freebsd.org/changeset/base/196644

Log:
  Dispose the kernel stack of the proper thread.
  
  Submitted by:	alc
  MFC after:	1 week

Modified:
  head/sys/kern/kern_fork.c

Modified: head/sys/kern/kern_fork.c
==============================================================================
--- head/sys/kern/kern_fork.c	Sat Aug 29 16:01:21 2009	(r196643)
+++ head/sys/kern/kern_fork.c	Sat Aug 29 18:01:02 2009	(r196644)
@@ -292,7 +292,7 @@ norfproc_fail:
 	} else {
 		if (td2->td_kstack == 0 || td2->td_kstack_pages != pages) {
 			if (td2->td_kstack != 0)
-				vm_thread_dispose(td);
+				vm_thread_dispose(td2);
 			if (!thread_alloc_stack(td2, pages)) {
 				error = ENOMEM;
 				goto fail1;

From owner-svn-src-all@FreeBSD.ORG  Sat Aug 29 19:45:04 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 07F46106564A;
	Sat, 29 Aug 2009 19:45:04 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EABF68FC0C;
	Sat, 29 Aug 2009 19:45:03 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7TJj31k073009;
	Sat, 29 Aug 2009 19:45:03 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7TJj3vT073007;
	Sat, 29 Aug 2009 19:45:03 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <200908291945.n7TJj3vT073007@svn.freebsd.org>
From: Doug Barton 
Date: Sat, 29 Aug 2009 19:45:03 +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: r196645 - stable/8/etc
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 19:45:04 -0000

Author: dougb
Date: Sat Aug 29 19:45:03 2009
New Revision: 196645
URL: http://svn.freebsd.org/changeset/base/196645

Log:
  MFC 196478:
  
  Prior to the dire warning about values of network_interfaces other than
  AUTO the biggest mistake users made was leaving lo0 off the list. Since
  lo0 is effectively mandatory, check for it and add it to the list if
  it's not there.
  
  MFC 196523:
  Improve the case test to detect the presence of lo0 in the list of
  network_interfaces.
  Submitted by:	Christoph Mallon 
  
  Approved by:	re (kib)

Modified:
  stable/8/etc/   (props changed)
  stable/8/etc/network.subr

Modified: stable/8/etc/network.subr
==============================================================================
--- stable/8/etc/network.subr	Sat Aug 29 18:01:02 2009	(r196644)
+++ stable/8/etc/network.subr	Sat Aug 29 19:45:03 2009	(r196645)
@@ -727,6 +727,13 @@ list_net_interfaces()
 		;;
 	*)
 		_tmplist="${network_interfaces} ${cloned_interfaces}"
+
+		# lo0 is effectively mandatory, so help prevent foot-shooting
+		#
+		case "$_tmplist" in
+		lo0|'lo0 '*|*' lo0'|*' lo0 '*) ;; # This is fine, do nothing
+		*)	_tmplist="lo0 ${_tmplist}" ;;
+		esac
 		;;
 	esac
 

From owner-svn-src-all@FreeBSD.ORG  Sat Aug 29 19:47:39 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BDAE61065674;
	Sat, 29 Aug 2009 19:47:39 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AC8408FC14;
	Sat, 29 Aug 2009 19:47:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7TJldHD073103;
	Sat, 29 Aug 2009 19:47:39 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7TJldIb073101;
	Sat, 29 Aug 2009 19:47:39 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <200908291947.n7TJldIb073101@svn.freebsd.org>
From: Doug Barton 
Date: Sat, 29 Aug 2009 19:47:39 +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: r196646 - stable/7/etc
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 19:47:39 -0000

Author: dougb
Date: Sat Aug 29 19:47:39 2009
New Revision: 196646
URL: http://svn.freebsd.org/changeset/base/196646

Log:
  MFC 196478:
  Prior to the dire warning about values of network_interfaces other than
  AUTO the biggest mistake users made was leaving lo0 off the list. Since
  lo0 is effectively mandatory, check for it and add it to the list if
  it's not there.
  
  MFC 196523:
  Improve the case test to detect the presence of lo0 in the list of
  network_interfaces.
  Submitted by:	Christoph Mallon 

Modified:
  stable/7/etc/   (props changed)
  stable/7/etc/network.subr
  stable/7/etc/termcap.small   (props changed)

Modified: stable/7/etc/network.subr
==============================================================================
--- stable/7/etc/network.subr	Sat Aug 29 19:45:03 2009	(r196645)
+++ stable/7/etc/network.subr	Sat Aug 29 19:47:39 2009	(r196646)
@@ -643,6 +643,13 @@ list_net_interfaces()
 			    "AUTO are deprecated"
 		fi
 		_tmplist="${network_interfaces} ${cloned_interfaces}"
+
+		# lo0 is effectively mandatory, so help prevent foot-shooting
+		#
+		case "$_tmplist" in
+		lo0|'lo0 '*|*' lo0'|*' lo0 '*) ;; # This is fine, do nothing
+		*)	_tmplist="lo0 ${_tmplist}" ;;
+		esac
 		;;
 	esac
 

From owner-svn-src-all@FreeBSD.ORG  Sat Aug 29 19:49:17 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DC600106564A;
	Sat, 29 Aug 2009 19:49:17 +0000 (UTC)
	(envelope-from dougb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C84E78FC1A;
	Sat, 29 Aug 2009 19:49:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7TJnHdG073178;
	Sat, 29 Aug 2009 19:49:17 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7TJnHHV073176;
	Sat, 29 Aug 2009 19:49:17 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <200908291949.n7TJnHHV073176@svn.freebsd.org>
From: Doug Barton 
Date: Sat, 29 Aug 2009 19:49:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
X-SVN-Group: stable-6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196647 - in stable/6/etc: . bluetooth defaults
	etc.alpha etc.amd64 etc.arm etc.i386 etc.ia64 etc.powerpc
	etc.sparc64 isdn mail mtree namedb pam.d periodic ppp rc.d
	root sendmail
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 19:49:18 -0000

Author: dougb
Date: Sat Aug 29 19:49:17 2009
New Revision: 196647
URL: http://svn.freebsd.org/changeset/base/196647

Log:
  MFC 196478:
  Prior to the dire warning about values of network_interfaces other than
  AUTO the biggest mistake users made was leaving lo0 off the list. Since
  lo0 is effectively mandatory, check for it and add it to the list if
  it's not there.
  
  MFC 196523:
  Improve the case test to detect the presence of lo0 in the list of
  network_interfaces.
  Submitted by:	Christoph Mallon 

Modified:
  stable/6/etc/   (props changed)
  stable/6/etc/Makefile   (props changed)
  stable/6/etc/amd.map   (props changed)
  stable/6/etc/apmd.conf   (props changed)
  stable/6/etc/auth.conf   (props changed)
  stable/6/etc/bluetooth/   (props changed)
  stable/6/etc/crontab   (props changed)
  stable/6/etc/csh.cshrc   (props changed)
  stable/6/etc/csh.login   (props changed)
  stable/6/etc/csh.logout   (props changed)
  stable/6/etc/defaults/   (props changed)
  stable/6/etc/devd.conf   (props changed)
  stable/6/etc/devfs.conf   (props changed)
  stable/6/etc/dhclient.conf   (props changed)
  stable/6/etc/disktab   (props changed)
  stable/6/etc/etc.alpha/   (props changed)
  stable/6/etc/etc.amd64/   (props changed)
  stable/6/etc/etc.arm/   (props changed)
  stable/6/etc/etc.i386/   (props changed)
  stable/6/etc/etc.ia64/   (props changed)
  stable/6/etc/etc.powerpc/   (props changed)
  stable/6/etc/etc.sparc64/   (props changed)
  stable/6/etc/fbtab   (props changed)
  stable/6/etc/freebsd-update.conf   (props changed)
  stable/6/etc/ftpusers   (props changed)
  stable/6/etc/gettytab   (props changed)
  stable/6/etc/group   (props changed)
  stable/6/etc/hosts   (props changed)
  stable/6/etc/hosts.allow   (props changed)
  stable/6/etc/hosts.equiv   (props changed)
  stable/6/etc/hosts.lpd   (props changed)
  stable/6/etc/inetd.conf   (props changed)
  stable/6/etc/isdn/   (props changed)
  stable/6/etc/login.access   (props changed)
  stable/6/etc/login.conf   (props changed)
  stable/6/etc/mac.conf   (props changed)
  stable/6/etc/mail/   (props changed)
  stable/6/etc/man.alias   (props changed)
  stable/6/etc/master.passwd   (props changed)
  stable/6/etc/minfree   (props changed)
  stable/6/etc/motd   (props changed)
  stable/6/etc/mtree/   (props changed)
  stable/6/etc/namedb/   (props changed)
  stable/6/etc/netconfig   (props changed)
  stable/6/etc/netstart   (props changed)
  stable/6/etc/network.subr   (contents, props changed)
  stable/6/etc/networks   (props changed)
  stable/6/etc/newsyslog.conf   (props changed)
  stable/6/etc/nls.alias   (props changed)
  stable/6/etc/nsmb.conf   (props changed)
  stable/6/etc/opieaccess   (props changed)
  stable/6/etc/pam.d/   (props changed)
  stable/6/etc/pccard_ether   (props changed)
  stable/6/etc/periodic/   (props changed)
  stable/6/etc/pf.conf   (props changed)
  stable/6/etc/pf.os   (props changed)
  stable/6/etc/phones   (props changed)
  stable/6/etc/portsnap.conf   (props changed)
  stable/6/etc/ppp/   (props changed)
  stable/6/etc/printcap   (props changed)
  stable/6/etc/profile   (props changed)
  stable/6/etc/protocols   (props changed)
  stable/6/etc/rc   (props changed)
  stable/6/etc/rc.bsdextended   (props changed)
  stable/6/etc/rc.d/   (props changed)
  stable/6/etc/rc.firewall   (props changed)
  stable/6/etc/rc.firewall6   (props changed)
  stable/6/etc/rc.initdiskless   (props changed)
  stable/6/etc/rc.resume   (props changed)
  stable/6/etc/rc.sendmail   (props changed)
  stable/6/etc/rc.shutdown   (props changed)
  stable/6/etc/rc.subr   (props changed)
  stable/6/etc/rc.suspend   (props changed)
  stable/6/etc/remote   (props changed)
  stable/6/etc/root/   (props changed)
  stable/6/etc/rpc   (props changed)
  stable/6/etc/sendmail/   (props changed)
  stable/6/etc/services   (props changed)
  stable/6/etc/shells   (props changed)
  stable/6/etc/snmpd.config   (props changed)
  stable/6/etc/sysctl.conf   (props changed)
  stable/6/etc/syslog.conf   (props changed)
  stable/6/etc/termcap.small   (props changed)
  stable/6/etc/usbd.conf   (props changed)

Modified: stable/6/etc/network.subr
==============================================================================
--- stable/6/etc/network.subr	Sat Aug 29 19:47:39 2009	(r196646)
+++ stable/6/etc/network.subr	Sat Aug 29 19:49:17 2009	(r196647)
@@ -583,6 +583,13 @@ list_net_interfaces()
 			    "AUTO are deprecated"
 		fi
 		_tmplist="${network_interfaces} ${cloned_interfaces}"
+
+		# lo0 is effectively mandatory, so help prevent foot-shooting
+		#
+		case "$_tmplist" in
+		lo0|'lo0 '*|*' lo0'|*' lo0 '*) ;; # This is fine, do nothing
+		*)	_tmplist="lo0 ${_tmplist}" ;;
+		esac
 		;;
 	esac
 

From owner-svn-src-all@FreeBSD.ORG  Sat Aug 29 20:56:04 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9A3701065673;
	Sat, 29 Aug 2009 20:56:04 +0000 (UTC) (envelope-from alc@cs.rice.edu)
Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31])
	by mx1.freebsd.org (Postfix) with ESMTP id 71AEF8FC0A;
	Sat, 29 Aug 2009 20:56:04 +0000 (UTC)
Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1])
	by mail.cs.rice.edu (Postfix) with ESMTP id DB5332C2B32;
	Sat, 29 Aug 2009 15:35:25 -0500 (CDT)
X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu
Received: from mail.cs.rice.edu ([127.0.0.1])
	by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new,
	port 10024)
	with LMTP id Me299NyGGjgA; Sat, 29 Aug 2009 15:35:18 -0500 (CDT)
Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net
	(adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.cs.rice.edu (Postfix) with ESMTP id D42B22C2B0E;
	Sat, 29 Aug 2009 15:35:17 -0500 (CDT)
Message-ID: <4A999104.9030809@cs.rice.edu>
Date: Sat, 29 Aug 2009 15:35:16 -0500
From: Alan Cox 
User-Agent: Thunderbird 2.0.0.23 (X11/20090822)
MIME-Version: 1.0
To: John Baldwin 
References: <200908260330.n7Q3U61l047845@svn.freebsd.org>
	<200908260734.12893.jhb@freebsd.org>
In-Reply-To: <200908260734.12893.jhb@freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Colin Percival 
Subject: Re: svn commit: r196558 - head/usr.bin/look
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 20:56:04 -0000

John Baldwin wrote:
> On Tuesday 25 August 2009 11:30:06 pm Colin Percival wrote:
>   
>> Author: cperciva
>> Date: Wed Aug 26 03:30:06 2009
>> New Revision: 196558
>> URL: http://svn.freebsd.org/changeset/base/196558
>>
>> Log:
>>   Don't try to mmap the contents of empty files.  This behaviour was harmless
>>   prior to r195693, since historical behaviour of mmap(2) was to silently
>>   ignore length-zero mmap requests; but mmap now returns EINVAL, which caused
>>   look(1) to emit an error message and fail.
>>     
>
> FWIW, it did not silently ignore the request.  Instead it rounded the size up
> to a page and mapped a page of data.  However, if you then passed that pointer
> with a length of 0 to munmap() munmap() would fail.
>
>   

I don't believe that your claim is correct; round_page(0) == 0.  Thus, 
the value of "size" that would be passed to vm_mmap() would be 0, which 
would cause it to immediately return "0", indicating success.  In this 
case, I believe that the virtual address that would be returned by 
mmap(2) would always be the "hint address" for where it should start 
looking for free space, which would be the end of the heap/data segment, 
unless the application specified its own hint.

In short, and the reason why I'm correcting you here, is to make clear 
that we needn't worry about earlier versions of FreeBSD that don't 
implement this change "leaking" or wasting memory from misuse of mmap(2) 
in this way.

Alan


From owner-svn-src-all@FreeBSD.ORG  Sat Aug 29 21:53:09 2009
Return-Path: 
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4FFB41065679;
	Sat, 29 Aug 2009 21:53:09 +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 3E1BC8FC1A;
	Sat, 29 Aug 2009 21:53:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7TLr97U075579;
	Sat, 29 Aug 2009 21:53:09 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7TLr9SW075569;
	Sat, 29 Aug 2009 21:53:09 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200908292153.n7TLr9SW075569@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 29 Aug 2009 21:53:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r196648 - in head/sys: arm/arm kern sys vm
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for "
	user" and " projects" \)" 
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 29 Aug 2009 21:53:09 -0000

Author: kib
Date: Sat Aug 29 21:53:08 2009
New Revision: 196648
URL: http://svn.freebsd.org/changeset/base/196648

Log:
  Reverse r196640 and r196644 for now.

Modified:
  head/sys/arm/arm/vm_machdep.c
  head/sys/kern/kern_fork.c
  head/sys/kern/kern_kthread.c
  head/sys/kern/kern_proc.c
  head/sys/kern/kern_thr.c
  head/sys/kern/kern_thread.c
  head/sys/sys/proc.h
  head/sys/vm/vm_extern.h
  head/sys/vm/vm_glue.c

Modified: head/sys/arm/arm/vm_machdep.c
==============================================================================
--- head/sys/arm/arm/vm_machdep.c	Sat Aug 29 19:49:17 2009	(r196647)
+++ head/sys/arm/arm/vm_machdep.c	Sat Aug 29 21:53:08 2009	(r196648)
@@ -119,6 +119,9 @@ cpu_fork(register struct thread *td1, re
 #ifdef __XSCALE__
 #ifndef CPU_XSCALE_CORE3
 	pmap_use_minicache(td2->td_kstack, td2->td_kstack_pages * PAGE_SIZE);
+	if (td2->td_altkstack)
+		pmap_use_minicache(td2->td_altkstack, td2->td_altkstack_pages *
+		    PAGE_SIZE);
 #endif
 #endif
 	td2->td_pcb = pcb2;

Modified: head/sys/kern/kern_fork.c
==============================================================================
--- head/sys/kern/kern_fork.c	Sat Aug 29 19:49:17 2009	(r196647)
+++ head/sys/kern/kern_fork.c	Sat Aug 29 21:53:08 2009	(r196648)
@@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
 
 #include "opt_kdtrace.h"
 #include "opt_ktrace.h"
-#include "opt_kstack_pages.h"
 
 #include 
 #include 
@@ -277,29 +276,25 @@ norfproc_fail:
 
 	mem_charged = 0;
 	vm2 = NULL;
-	if (pages == 0)
-		pages = KSTACK_PAGES;
 	/* Allocate new proc. */
 	newproc = uma_zalloc(proc_zone, M_WAITOK);
-	td2 = FIRST_THREAD_IN_PROC(newproc);
-	if (td2 == NULL) {
-		td2 = thread_alloc(pages);
+	if (TAILQ_EMPTY(&newproc->p_threads)) {
+		td2 = thread_alloc();
 		if (td2 == NULL) {
 			error = ENOMEM;
 			goto fail1;
 		}
 		proc_linkup(newproc, td2);
-	} else {
-		if (td2->td_kstack == 0 || td2->td_kstack_pages != pages) {
-			if (td2->td_kstack != 0)
-				vm_thread_dispose(td2);
-			if (!thread_alloc_stack(td2, pages)) {
-				error = ENOMEM;
-				goto fail1;
-			}
+	} else
+		td2 = FIRST_THREAD_IN_PROC(newproc);
+
+	/* Allocate and switch to an alternate kstack if specified. */
+	if (pages != 0) {
+		if (!vm_thread_new_altkstack(td2, pages)) {
+			error = ENOMEM;
+			goto fail1;
 		}
 	}
-
 	if ((flags & RFMEM) == 0) {
 		vm2 = vmspace_fork(p1->p_vmspace, &mem_charged);
 		if (vm2 == NULL) {

Modified: head/sys/kern/kern_kthread.c
==============================================================================
--- head/sys/kern/kern_kthread.c	Sat Aug 29 19:49:17 2009	(r196647)
+++ head/sys/kern/kern_kthread.c	Sat Aug 29 21:53:08 2009	(r196648)
@@ -256,7 +256,7 @@ kthread_add(void (*func)(void *), void *
 	}
 
 	/* Initialize our new td  */
-	newtd = thread_alloc(pages);
+	newtd = thread_alloc();
 	if (newtd == NULL)
 		return (ENOMEM);
 
@@ -282,6 +282,9 @@ kthread_add(void (*func)(void *), void *
 
 	newtd->td_pflags |= TDP_KTHREAD;
 	newtd->td_ucred = crhold(p->p_ucred);
+	/* Allocate and switch to an alternate kstack if specified. */
+	if (pages != 0)
+		vm_thread_new_altkstack(newtd, pages);
 
 	/* this code almost the same as create_thread() in kern_thr.c */
 	PROC_LOCK(p);

Modified: head/sys/kern/kern_proc.c
==============================================================================
--- head/sys/kern/kern_proc.c	Sat Aug 29 19:49:17 2009	(r196647)
+++ head/sys/kern/kern_proc.c	Sat Aug 29 21:53:08 2009	(r196648)
@@ -203,6 +203,14 @@ proc_dtor(void *mem, int size, void *arg
 #endif
 		/* Free all OSD associated to this thread. */
 		osd_thread_exit(td);
+
+		/* Dispose of an alternate kstack, if it exists.
+		 * XXX What if there are more than one thread in the proc?
+		 *     The first thread in the proc is special and not
+		 *     freed, so you gotta do this here.
+		 */
+		if (((p->p_flag & P_KTHREAD) != 0) && (td->td_altkstack != 0))
+			vm_thread_dispose_altkstack(td);
 	}
 	EVENTHANDLER_INVOKE(process_dtor, p);
 	if (p->p_ksi != NULL)
@@ -759,6 +767,8 @@ fill_kinfo_proc_only(struct proc *p, str
 		FOREACH_THREAD_IN_PROC(p, td0) {
 			if (!TD_IS_SWAPPED(td0))
 				kp->ki_rssize += td0->td_kstack_pages;
+			if (td0->td_altkstack_obj != NULL)
+				kp->ki_rssize += td0->td_altkstack_pages;
 		}
 		kp->ki_swrss = vm->vm_swrss;
 		kp->ki_tsize = vm->vm_tsize;

Modified: head/sys/kern/kern_thr.c
==============================================================================
--- head/sys/kern/kern_thr.c	Sat Aug 29 19:49:17 2009	(r196647)
+++ head/sys/kern/kern_thr.c	Sat Aug 29 21:53:08 2009	(r196648)
@@ -176,7 +176,7 @@ create_thread(struct thread *td, mcontex
 	}
 
 	/* Initialize our td */
-	newtd = thread_alloc(0);
+	newtd = thread_alloc();
 	if (newtd == NULL)
 		return (ENOMEM);
 

Modified: head/sys/kern/kern_thread.c
==============================================================================
--- head/sys/kern/kern_thread.c	Sat Aug 29 19:49:17 2009	(r196647)
+++ head/sys/kern/kern_thread.c	Sat Aug 29 21:53:08 2009	(r196648)
@@ -283,7 +283,7 @@ thread_reap(void)
  * Allocate a thread.
  */
 struct thread *
-thread_alloc(int pages)
+thread_alloc(void)
 {
 	struct thread *td;
 
@@ -291,7 +291,7 @@ thread_alloc(int pages)
 
 	td = (struct thread *)uma_zalloc(thread_zone, M_WAITOK);
 	KASSERT(td->td_kstack == 0, ("thread_alloc got thread with kstack"));
-	if (!vm_thread_new(td, pages)) {
+	if (!vm_thread_new(td, 0)) {
 		uma_zfree(thread_zone, td);
 		return (NULL);
 	}
@@ -299,17 +299,6 @@ thread_alloc(int pages)
 	return (td);
 }
 
-int
-thread_alloc_stack(struct thread *td, int pages)
-{
-
-	KASSERT(td->td_kstack == 0,
-	    ("thread_alloc_stack called on a thread with kstack"));
-	if (!vm_thread_new(td, pages))
-		return (0);
-	cpu_thread_alloc(td);
-	return (1);
-}
 
 /*
  * Deallocate a thread.
@@ -323,6 +312,8 @@ thread_free(struct thread *td)
 		cpuset_rel(td->td_cpuset);
 	td->td_cpuset = NULL;
 	cpu_thread_free(td);
+	if (td->td_altkstack != 0)
+		vm_thread_dispose_altkstack(td);
 	if (td->td_kstack != 0)
 		vm_thread_dispose(td);
 	uma_zfree(thread_zone, td);

Modified: head/sys/sys/proc.h
==============================================================================
--- head/sys/sys/proc.h	Sat Aug 29 19:49:17 2009	(r196647)
+++ head/sys/sys/proc.h	Sat Aug 29 21:53:08 2009	(r196648)
@@ -267,6 +267,9 @@ struct thread {
 	struct vm_object *td_kstack_obj;/* (a) Kstack object. */
 	vm_offset_t	td_kstack;	/* (a) Kernel VA of kstack. */
 	int		td_kstack_pages; /* (a) Size of the kstack. */
+	struct vm_object *td_altkstack_obj;/* (a) Alternate kstack object. */
+	vm_offset_t	td_altkstack;	/* (a) Kernel VA of alternate kstack. */
+	int		td_altkstack_pages; /* (a) Size of alternate kstack. */
 	volatile u_int	td_critnest;	/* (k*) Critical section nest level. */
 	struct mdthread td_md;		/* (k) Any machine-dependent fields. */
 	struct td_sched	*td_sched;	/* (*) Scheduler-specific data. */
@@ -847,8 +850,7 @@ void	cpu_thread_exit(struct thread *);
 void	cpu_thread_free(struct thread *);
 void	cpu_thread_swapin(struct thread *);
 void	cpu_thread_swapout(struct thread *);
-struct	thread *thread_alloc(int pages);
-int	thread_alloc_stack(struct thread *, int pages);
+struct	thread *thread_alloc(void);
 void	thread_exit(void) __dead2;
 void	thread_free(struct thread *td);
 void	thread_link(struct thread *td, struct proc *p);

Modified: head/sys/vm/vm_extern.h
==============================================================================
--- head/sys/vm/vm_extern.h	Sat Aug 29 19:49:17 2009	(r196647)
+++ head/sys/vm/vm_extern.h	Sat Aug 29 21:53:08 2009	(r196648)
@@ -80,7 +80,9 @@ int vm_fault_quick(caddr_t v, int prot);
 struct sf_buf *vm_imgact_map_page(vm_object_t object, vm_ooffset_t offset);
 void vm_imgact_unmap_page(struct sf_buf *sf);
 void vm_thread_dispose(struct thread *td);
+void vm_thread_dispose_altkstack(struct thread *td);
 int vm_thread_new(struct thread *td, int pages);
+int vm_thread_new_altkstack(struct thread *td, int pages);
 void vm_thread_swapin(struct thread *td);
 void vm_thread_swapout(struct thread *td);
 #endif				/* _KERNEL */

Modified: head/sys/vm/vm_glue.c
==============================================================================
--- head/sys/vm/vm_glue.c	Sat Aug 29 19:49:17 2009	(r196647)
+++ head/sys/vm/vm_glue.c	Sat Aug 29 21:53:08 2009	(r196648)
@@ -77,7 +77,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 
@@ -309,20 +308,6 @@ vm_imgact_unmap_page(struct sf_buf *sf)
 	vm_page_unlock_queues();
 }
 
-struct kstack_cache_entry {
-	vm_object_t ksobj;
-	struct kstack_cache_entry *next_ks_entry;
-};
-
-static struct kstack_cache_entry *kstack_cache;
-static int kstack_cache_size = 128;
-static int kstacks;
-static struct mtx kstack_cache_mtx;
-SYSCTL_INT(_vm, OID_AUTO, kstack_cache_size, CTLFLAG_RW, &kstack_cache_size, 0,
-    "");
-SYSCTL_INT(_vm, OID_AUTO, kstacks, CTLFLAG_RD, &kstacks, 0,
-    "");
-
 #ifndef KSTACK_MAX_PAGES
 #define KSTACK_MAX_PAGES 32
 #endif
@@ -338,7 +323,6 @@ vm_thread_new(struct thread *td, int pag
 	vm_object_t ksobj;
 	vm_offset_t ks;
 	vm_page_t m, ma[KSTACK_MAX_PAGES];
-	struct kstack_cache_entry *ks_ce;
 	int i;
 
 	/* Bounds check */
@@ -346,22 +330,6 @@ vm_thread_new(struct thread *td, int pag
 		pages = KSTACK_PAGES;
 	else if (pages > KSTACK_MAX_PAGES)
 		pages = KSTACK_MAX_PAGES;
-
-	if (pages == KSTACK_PAGES) {
-		mtx_lock(&kstack_cache_mtx);
-		if (kstack_cache != NULL) {
-			ks_ce = kstack_cache;
-			kstack_cache = ks_ce->next_ks_entry;
-			mtx_unlock(&kstack_cache_mtx);
-
-			td->td_kstack_obj = ks_ce->ksobj;
-			td->td_kstack = (vm_offset_t)ks_ce;
-			td->td_kstack_pages = KSTACK_PAGES;
-			return (1);
-		}
-		mtx_unlock(&kstack_cache_mtx);
-	}
-
 	/*
 	 * Allocate an object for the kstack.
 	 */
@@ -377,8 +345,7 @@ vm_thread_new(struct thread *td, int pag
 		vm_object_deallocate(ksobj);
 		return (0);
 	}
-
-	atomic_add_int(&kstacks, 1);
+	
 	if (KSTACK_GUARD_PAGES != 0) {
 		pmap_qremove(ks, KSTACK_GUARD_PAGES);
 		ks += KSTACK_GUARD_PAGES * PAGE_SIZE;
@@ -409,13 +376,20 @@ vm_thread_new(struct thread *td, int pag
 	return (1);
 }
 
-static void
-vm_thread_stack_dispose(vm_object_t ksobj, vm_offset_t ks, int pages)
+/*
+ * Dispose of a thread's kernel stack.
+ */
+void
+vm_thread_dispose(struct thread *td)
 {
+	vm_object_t ksobj;
+	vm_offset_t ks;
 	vm_page_t m;
-	int i;
+	int i, pages;
 
-	atomic_add_int(&kstacks, -1);
+	pages = td->td_kstack_pages;
+	ksobj = td->td_kstack_obj;
+	ks = td->td_kstack;
 	pmap_qremove(ks, pages);
 	VM_OBJECT_LOCK(ksobj);
 	for (i = 0; i < pages; i++) {
@@ -431,66 +405,9 @@ vm_thread_stack_dispose(vm_object_t ksob
 	vm_object_deallocate(ksobj);
 	kmem_free(kernel_map, ks - (KSTACK_GUARD_PAGES * PAGE_SIZE),
 	    (pages + KSTACK_GUARD_PAGES) * PAGE_SIZE);
-}
-
-/*
- * Dispose of a thread's kernel stack.
- */
-void
-vm_thread_dispose(struct thread *td)
-{
-	vm_object_t ksobj;
-	vm_offset_t ks;
-	struct kstack_cache_entry *ks_ce;
-	int pages;
-
-	pages = td->td_kstack_pages;
-	ksobj = td->td_kstack_obj;
-	ks = td->td_kstack;
-	if (pages == KSTACK_PAGES && kstacks <= kstack_cache_size) {
-		ks_ce = (struct kstack_cache_entry *)ks;
-		ks_ce->ksobj = ksobj;
-		mtx_lock(&kstack_cache_mtx);
-		ks_ce->next_ks_entry = ks_ce;
-		kstack_cache = ks_ce;
-		mtx_unlock(&kstack_cache_mtx);
-		return;
-	}
-	vm_thread_stack_dispose(ksobj, ks, pages);
 	td->td_kstack = 0;
-	td->td_kstack_pages = 0;
-}
-
-static void
-vm_thread_stack_lowmem(void *nulll)
-{
-	struct kstack_cache_entry *ks_ce, *ks_ce1;
-
-	mtx_lock(&kstack_cache_mtx);
-	ks_ce = kstack_cache;
-	kstack_cache = NULL;
-	mtx_unlock(&kstack_cache_mtx);
-
-	while (ks_ce != NULL) {
-		ks_ce1 = ks_ce;
-		ks_ce = ks_ce->next_ks_entry;
-
-		vm_thread_stack_dispose(ks_ce1->ksobj, (vm_offset_t)ks_ce1,
-		    KSTACK_PAGES);
-	}
-}
-
-static void
-kstack_cache_init(void *nulll)
-{
-
-	EVENTHANDLER_REGISTER(vm_lowmem, vm_thread_stack_lowmem, NULL,
-	    EVENTHANDLER_PRI_ANY);
 }
 
-MTX_SYSINIT(kstack_cache, &kstack_cache_mtx, "kstkch", MTX_DEF);
-SYSINIT(vm_kstacks, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY, kstack_cache_init, NULL);
-
 /*
  * Allow a thread's kernel stack to be paged out.
  */
@@ -551,6 +468,37 @@ vm_thread_swapin(struct thread *td)
 }
 
 /*
+ * Set up a variable-sized alternate kstack.
+ */
+int
+vm_thread_new_altkstack(struct thread *td, int pages)
+{
+
+	td->td_altkstack = td->td_kstack;
+	td->td_altkstack_obj = td->td_kstack_obj;
+	td->td_altkstack_pages = td->td_kstack_pages;
+
+	return (vm_thread_new(td, pages));
+}
+
+/*
+ * Restore the original kstack.
+ */
+void
+vm_thread_dispose_altkstack(struct thread *td)
+{
+
+	vm_thread_dispose(td);
+
+	td->td_kstack = td->td_altkstack;
+	td->td_kstack_obj = td->td_altkstack_obj;
+	td->td_kstack_pages = td->td_altkstack_pages;
+	td->td_altkstack = 0;
+	td->td_altkstack_obj = NULL;
+	td->td_altkstack_pages = 0;
+}
+
+/*
  * Implement fork's actions on an address space.
  * Here we arrange for the address space to be copied or referenced,
  * allocate a user struct (pcb and kernel stack), then call the