From owner-svn-src-stable-8@FreeBSD.ORG Sun May 6 08:31:57 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFC85106564A; Sun, 6 May 2012 08:31:57 +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 B9D4D8FC08; Sun, 6 May 2012 08:31:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q468VvML004270; Sun, 6 May 2012 08:31:57 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q468Vv2v004268; Sun, 6 May 2012 08:31:57 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201205060831.q468Vv2v004268@svn.freebsd.org> From: Doug Barton Date: Sun, 6 May 2012 08:31:57 +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: r235074 - stable/8/sys/geom/part X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 May 2012 08:31:57 -0000 Author: dougb Date: Sun May 6 08:31:57 2012 New Revision: 235074 URL: http://svn.freebsd.org/changeset/base/235074 Log: MFC r231929: If nested scheme allows dump kernel to its partition, we may allow dump for the parent partition too. Modified: stable/8/sys/geom/part/g_part.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/geom/part/g_part.c ============================================================================== --- stable/8/sys/geom/part/g_part.c Sun May 6 08:28:08 2012 (r235073) +++ stable/8/sys/geom/part/g_part.c Sun May 6 08:31:57 2012 (r235074) @@ -2048,9 +2048,12 @@ g_part_start(struct bio *bp) /* * Check that the partition is suitable for kernel * dumps. Typically only swap partitions should be - * used. + * used. If the request comes from the nested scheme + * we allow dumping there as well. */ - if (!G_PART_DUMPTO(table, entry)) { + if ((bp->bio_from == NULL || + bp->bio_from->geom->class != &g_part_class) && + G_PART_DUMPTO(table, entry) == 0) { g_io_deliver(bp, ENODEV); printf("GEOM_PART: Partition '%s' not suitable" " for kernel dumps (wrong type?)\n", From owner-svn-src-stable-8@FreeBSD.ORG Sun May 6 14:11:51 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C899B1065670; Sun, 6 May 2012 14:11:51 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B2B818FC0C; Sun, 6 May 2012 14:11:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q46EBpVd017301; Sun, 6 May 2012 14:11:51 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q46EBpCD017298; Sun, 6 May 2012 14:11:51 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205061411.q46EBpCD017298@svn.freebsd.org> From: Eitan Adler Date: Sun, 6 May 2012 14:11:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235084 - stable/8/lib/libc/gmon X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 May 2012 14:11:51 -0000 Author: eadler Date: Sun May 6 14:11:51 2012 New Revision: 235084 URL: http://svn.freebsd.org/changeset/base/235084 Log: MFC r234819: Allow users of gprof to get per run output files (using the pid) PR: bin/99800 Approved by: cperciva (implicit) Modified: stable/8/lib/libc/gmon/gmon.c stable/8/lib/libc/gmon/moncontrol.3 Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/gmon/gmon.c ============================================================================== --- stable/8/lib/libc/gmon/gmon.c Sun May 6 14:11:25 2012 (r235083) +++ stable/8/lib/libc/gmon/gmon.c Sun May 6 14:11:51 2012 (r235084) @@ -170,7 +170,12 @@ _mcleanup() } moncontrol(0); - snprintf(outname, sizeof(outname), "%s.gmon", _getprogname()); + if (getenv("PROFIL_USE_PID")) + snprintf(outname, sizeof(outname), "%s.%d.gmon", + _getprogname(), getpid()); + else + snprintf(outname, sizeof(outname), "%s.gmon", _getprogname()); + fd = _open(outname, O_CREAT|O_TRUNC|O_WRONLY, 0666); if (fd < 0) { _warn("_mcleanup: %s", outname); Modified: stable/8/lib/libc/gmon/moncontrol.3 ============================================================================== --- stable/8/lib/libc/gmon/moncontrol.3 Sun May 6 14:11:25 2012 (r235083) +++ stable/8/lib/libc/gmon/moncontrol.3 Sun May 6 14:11:51 2012 (r235084) @@ -98,6 +98,12 @@ however, all functions in that address r have their execution time measured. Profiling begins on return from .Fn monstartup . +.Sh ENVIRONMENT +The following environment variables affect the execution of +.Nm : +.Bl -tag -width ".Ev PROFIL_USE_PID" +.It PROFIL_USE_PID +If set, the pid of the process is inserted into the filename. .Sh FILES .Bl -tag -width progname.gmon -compact .It Pa progname.gmon From owner-svn-src-stable-8@FreeBSD.ORG Sun May 6 14:15:53 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4296B106599A; Sun, 6 May 2012 14:15:53 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2DD648FC15; Sun, 6 May 2012 14:15:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q46EFrTD017500; Sun, 6 May 2012 14:15:53 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q46EFqCZ017498; Sun, 6 May 2012 14:15:52 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205061415.q46EFqCZ017498@svn.freebsd.org> From: Eitan Adler Date: Sun, 6 May 2012 14:15:52 +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: r235086 - stable/8/sys/cam/scsi X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 May 2012 14:15:53 -0000 Author: eadler Date: Sun May 6 14:15:52 2012 New Revision: 235086 URL: http://svn.freebsd.org/changeset/base/235086 Log: MFC r234821: Add support for: Olympus FE-210 camera LG UP3S MP3 player Laser MP3-2GA13 MP3 PR: usb/119201 Approved by: cperciva (implicit) Modified: stable/8/sys/cam/scsi/scsi_da.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Sun May 6 14:15:32 2012 (r235085) +++ stable/8/sys/cam/scsi/scsi_da.c Sun May 6 14:15:52 2012 (r235086) @@ -785,6 +785,27 @@ static struct da_quirk_entry da_quirk_ta { T_DIRECT, SIP_MEDIA_FIXED, "WDC WD??", "???PVT*", "*" }, /*quirks*/DA_Q_4K }, + { + /* + * Olympus FE-210 camera + */ + {T_DIRECT, SIP_MEDIA_REMOVABLE, "OLYMPUS", "FE210*", + "*"}, /*quirks*/ DA_Q_NO_SYNC_CACHE + }, + { + /* + * LG UP3S MP3 player + */ + {T_DIRECT, SIP_MEDIA_REMOVABLE, "LG", "UP3S", + "*"}, /*quirks*/ DA_Q_NO_SYNC_CACHE + }, + { + /* + * Laser MP3-2GA13 MP3 player + */ + {T_DIRECT, SIP_MEDIA_REMOVABLE, "USB 2.0", "(HS) Flash Disk", + "*"}, /*quirks*/ DA_Q_NO_SYNC_CACHE + }, }; static disk_strategy_t dastrategy; From owner-svn-src-stable-8@FreeBSD.ORG Sun May 6 14:23:02 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 110C41065672; Sun, 6 May 2012 14:23:02 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EFA848FC08; Sun, 6 May 2012 14:23:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q46EN1Of017844; Sun, 6 May 2012 14:23:01 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q46EN1lw017842; Sun, 6 May 2012 14:23:01 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205061423.q46EN1lw017842@svn.freebsd.org> From: Eitan Adler Date: Sun, 6 May 2012 14:23:01 +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: r235089 - stable/8/lib/libc/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 May 2012 14:23:02 -0000 Author: eadler Date: Sun May 6 14:23:01 2012 New Revision: 235089 URL: http://svn.freebsd.org/changeset/base/235089 Log: MFC r234820: pread(2) might fail with EBUSY, so document it PR: docs/167201 Approved by: cperciva (implicit) Modified: stable/8/lib/libc/sys/read.2 Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/sys/ (props changed) Modified: stable/8/lib/libc/sys/read.2 ============================================================================== --- stable/8/lib/libc/sys/read.2 Sun May 6 14:22:30 2012 (r235088) +++ stable/8/lib/libc/sys/read.2 Sun May 6 14:23:01 2012 (r235089) @@ -164,6 +164,8 @@ argument points outside the allocated address space. .It Bq Er EIO An I/O error occurred while reading from the file system. +.It Bq Er EBUSY +Failed to read from a file, e.g. /proc//regs while is not stopped .It Bq Er EINTR A read from a slow device (i.e.\& one that might block for an arbitrary amount of time) From owner-svn-src-stable-8@FreeBSD.ORG Sun May 6 15:56:08 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE34D1065670; Sun, 6 May 2012 15:56:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C00098FC1F; Sun, 6 May 2012 15:56:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q46Fu7hP021029; Sun, 6 May 2012 15:56:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q46Fu73b021023; Sun, 6 May 2012 15:56:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201205061556.q46Fu73b021023@svn.freebsd.org> From: Alexander Motin Date: Sun, 6 May 2012 15:56:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235093 - stable/8/sys/geom/raid X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 May 2012 15:56:08 -0000 Author: mav Date: Sun May 6 15:56:07 2012 New Revision: 235093 URL: http://svn.freebsd.org/changeset/base/235093 Log: MFC r234601: Add sos@ copyrights to RAID metadata modules, respecting his efforts in decoding metadata formats in ataraid(4) code. Modified: stable/8/sys/geom/raid/md_intel.c stable/8/sys/geom/raid/md_jmicron.c stable/8/sys/geom/raid/md_nvidia.c stable/8/sys/geom/raid/md_promise.c stable/8/sys/geom/raid/md_sii.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/geom/raid/md_intel.c ============================================================================== --- stable/8/sys/geom/raid/md_intel.c Sun May 6 15:55:01 2012 (r235092) +++ stable/8/sys/geom/raid/md_intel.c Sun May 6 15:56:07 2012 (r235093) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2010 Alexander Motin + * Copyright (c) 2000 - 2008 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/8/sys/geom/raid/md_jmicron.c ============================================================================== --- stable/8/sys/geom/raid/md_jmicron.c Sun May 6 15:55:01 2012 (r235092) +++ stable/8/sys/geom/raid/md_jmicron.c Sun May 6 15:56:07 2012 (r235093) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2010 Alexander Motin + * Copyright (c) 2000 - 2008 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/8/sys/geom/raid/md_nvidia.c ============================================================================== --- stable/8/sys/geom/raid/md_nvidia.c Sun May 6 15:55:01 2012 (r235092) +++ stable/8/sys/geom/raid/md_nvidia.c Sun May 6 15:56:07 2012 (r235093) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2011 Alexander Motin + * Copyright (c) 2000 - 2008 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/8/sys/geom/raid/md_promise.c ============================================================================== --- stable/8/sys/geom/raid/md_promise.c Sun May 6 15:55:01 2012 (r235092) +++ stable/8/sys/geom/raid/md_promise.c Sun May 6 15:56:07 2012 (r235093) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2011 Alexander Motin + * Copyright (c) 2000 - 2008 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: stable/8/sys/geom/raid/md_sii.c ============================================================================== --- stable/8/sys/geom/raid/md_sii.c Sun May 6 15:55:01 2012 (r235092) +++ stable/8/sys/geom/raid/md_sii.c Sun May 6 15:56:07 2012 (r235093) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2011 Alexander Motin + * Copyright (c) 2000 - 2008 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-stable-8@FreeBSD.ORG Sun May 6 20:26:29 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 214F8106564A; Sun, 6 May 2012 20:26:29 +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 E79BA8FC0C; Sun, 6 May 2012 20:26:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q46KQSX1030426; Sun, 6 May 2012 20:26:28 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q46KQS2L030423; Sun, 6 May 2012 20:26:28 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201205062026.q46KQS2L030423@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 6 May 2012 20:26:28 +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: r235104 - stable/8/sys/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 May 2012 20:26:29 -0000 Author: bz Date: Sun May 6 20:26:28 2012 New Revision: 235104 URL: http://svn.freebsd.org/changeset/base/235104 Log: MFC r233113: Hide kernel option ROUTETABLES evaluations in the implementation rather than the header file. With this also move RT_MAXFIBS and RT_NUMFIBS into the implemantion to avoid further usage in other code. rt_numfibs is all that should be needed. This allows users to change the number of FIBs from 1..RT_MAXFIBS(16) dynamically using the tunable without the need to change the kernel config for the maximum anymore. This means that the multi-FIB feature is now fully available with GENERIC kernels. The kernel option ROUTETABLES can still be used to set the default numbers of FIBs in absence of the tunable. Modified: stable/8/sys/net/route.c stable/8/sys/net/route.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/net/route.c ============================================================================== --- stable/8/sys/net/route.c Sun May 6 20:26:22 2012 (r235103) +++ stable/8/sys/net/route.c Sun May 6 20:26:28 2012 (r235104) @@ -68,6 +68,24 @@ #include +/* We use 4 bits in the mbuf flags, thus we are limited to 16 FIBS. */ +#define RT_MAXFIBS 16 + +/* Kernel config default option. */ +#ifdef ROUTETABLES +#if ROUTETABLES <= 0 +#error "ROUTETABLES defined too low" +#endif +#if ROUTETABLES > RT_MAXFIBS +#error "ROUTETABLES defined too big" +#endif +#define RT_NUMFIBS ROUTETABLES +#endif /* ROUTETABLES */ +/* Initialize to default if not otherwise set. */ +#ifndef RT_NUMFIBS +#define RT_NUMFIBS 1 +#endif + u_int rt_numfibs = RT_NUMFIBS; SYSCTL_INT(_net, OID_AUTO, fibs, CTLFLAG_RD, &rt_numfibs, 0, ""); /* Modified: stable/8/sys/net/route.h ============================================================================== --- stable/8/sys/net/route.h Sun May 6 20:26:22 2012 (r235103) +++ stable/8/sys/net/route.h Sun May 6 20:26:28 2012 (r235104) @@ -86,27 +86,6 @@ struct rt_metrics { #define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */ #define RTTTOPRHZ(r) ((r) / (RTM_RTTUNIT / PR_SLOWHZ)) -/* MRT compile-time constants */ -#ifdef _KERNEL - #ifndef ROUTETABLES - #define RT_NUMFIBS 1 - #define RT_MAXFIBS 1 - #else - /* while we use 4 bits in the mbuf flags, we are limited to 16 */ - #define RT_MAXFIBS 16 - #if ROUTETABLES > RT_MAXFIBS - #define RT_NUMFIBS RT_MAXFIBS - #error "ROUTETABLES defined too big" - #else - #if ROUTETABLES == 0 - #define RT_NUMFIBS 1 - #else - #define RT_NUMFIBS ROUTETABLES - #endif - #endif - #endif -#endif - #define RT_DEFAULT_FIB 0 /* Explicitly mark fib=0 restricted cases */ extern u_int rt_numfibs; /* number fo usable routing tables */ /* From owner-svn-src-stable-8@FreeBSD.ORG Mon May 7 07:04:42 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA337106566C; Mon, 7 May 2012 07:04:42 +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 995158FC15; Mon, 7 May 2012 07:04:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4774gUo051367; Mon, 7 May 2012 07:04:42 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4774ghF051352; Mon, 7 May 2012 07:04:42 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201205070704.q4774ghF051352@svn.freebsd.org> From: Marius Strobl Date: Mon, 7 May 2012 07:04: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: r235121 - in stable/8/sys: arm/at91 conf ddb dev/cfe dev/dcons dev/ofw dev/sio dev/syscons dev/uart i386/conf kern modules/dcons modules/sio pc98/cbus sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 May 2012 07:04:42 -0000 Author: marius Date: Mon May 7 07:04:41 2012 New Revision: 235121 URL: http://svn.freebsd.org/changeset/base/235121 Log: MFC: r225203 (partial) Attempt to make break-to-debugger and alternative break-to-debugger more accessible: (1) Always compile in support for breaking into the debugger if options KDB is present in the kernel. (2) Disable both by default, but allow them to be enabled via tunables and sysctls debug.kdb.break_to_debugger and debug.kdb.alt_break_to_debugger. (3) options BREAK_TO_DEBUGGER and options ALT_BREAK_TO_DEBUGGER continue to behave as before -- only now instead of compiling in break-to-debugger support, they change the default values of the above sysctls to enable those features by default. Current kernel configurations should, therefore, continue to behave as expected. (4) Migrate alternative break-to-debugger state machine logic out of individual device drivers into centralised KDB code. This has a number of upsides, but also one downside: it's now tricky to release sio spin locks when entering the debugger, so we don't. However, similar logic does not exist in other device drivers, including uart. (5) dcons requires some special handling; unlike other console types, it allows overriding KDB's own debugger selection, so we need a new interface to KDB to allow that to work. GENERIC kernels will now support break-to-debugger as long as appropriate boot/run-time options are set, which should improve the debuggability of kernels significantly. MFC: r225214 (partial) Follow up to r225203 refining break-to-debugger run-time configuration improvements: (1) Implement new model in previously missed at91 UART driver (2) Move BREAK_TO_DEBUGGER and ALT_BREAK_TO_DEBUGGER from opt_comconsole.h to opt_kdb.h (spotted by np) (3) Garbage collect now-unused opt_comconsole.h Modified: stable/8/sys/arm/at91/uart_dev_at91usart.c stable/8/sys/conf/options stable/8/sys/ddb/db_break.c stable/8/sys/dev/cfe/cfe_console.c stable/8/sys/dev/dcons/dcons_os.c stable/8/sys/dev/ofw/ofw_console.c stable/8/sys/dev/sio/sio.c stable/8/sys/dev/syscons/syscons.c stable/8/sys/dev/uart/uart_core.c stable/8/sys/kern/subr_kdb.c stable/8/sys/modules/dcons/Makefile stable/8/sys/modules/sio/Makefile stable/8/sys/pc98/cbus/sio.c stable/8/sys/sys/kdb.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (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/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/arm/at91/uart_dev_at91usart.c ============================================================================== --- stable/8/sys/arm/at91/uart_dev_at91usart.c Mon May 7 05:28:49 2012 (r235120) +++ stable/8/sys/arm/at91/uart_dev_at91usart.c Mon May 7 07:04:41 2012 (r235121) @@ -29,8 +29,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_comconsole.h" - #include #include #include @@ -508,25 +506,10 @@ at91_usart_bus_param(struct uart_softc * static __inline void at91_rx_put(struct uart_softc *sc, int key) { -#if defined(KDB) && defined(ALT_BREAK_TO_DEBUGGER) - int kdb_brk; - if (sc->sc_sysdev != NULL && sc->sc_sysdev->type == UART_DEV_CONSOLE) { - if ((kdb_brk = kdb_alt_break(key, &sc->sc_altbrk)) != 0) { - switch (kdb_brk) { - case KDB_REQ_DEBUGGER: - kdb_enter(KDB_WHY_BREAK, - "Break sequence on console"); - break; - case KDB_REQ_PANIC: - kdb_panic("Panic sequence on console"); - break; - case KDB_REQ_REBOOT: - kdb_reboot(); - break; - } - } - } +#if defined(KDB) + if (sc->sc_sysdev != NULL && sc->sc_sysdev->type == UART_DEV_CONSOLE) + kdb_alt_break(key, &sc->sc_altbrk); #endif uart_rx_put(sc, key); } Modified: stable/8/sys/conf/options ============================================================================== --- stable/8/sys/conf/options Mon May 7 05:28:49 2012 (r235120) +++ stable/8/sys/conf/options Mon May 7 07:04:41 2012 (r235121) @@ -47,6 +47,8 @@ TWA_DEBUG opt_twa.h TWA_FLASH_FIRMWARE opt_twa.h # Debugging options. +ALT_BREAK_TO_DEBUGGER opt_kdb.h +BREAK_TO_DEBUGGER opt_kdb.h DDB DDB_BUFR_SIZE opt_ddb.h DDB_CAPTURE_DEFAULTBUFSIZE opt_ddb.h @@ -631,9 +633,6 @@ BKTR_SIS_VIA_MODE opt_bktr.h BKTR_USE_FREEBSD_SMBUS opt_bktr.h BKTR_NEW_MSP34XX_DRIVER opt_bktr.h -BREAK_TO_DEBUGGER opt_comconsole.h -ALT_BREAK_TO_DEBUGGER opt_comconsole.h - # Options to support PPS UART_PPS_ON_CTS opt_uart.h Modified: stable/8/sys/ddb/db_break.c ============================================================================== --- stable/8/sys/ddb/db_break.c Mon May 7 05:28:49 2012 (r235120) +++ stable/8/sys/ddb/db_break.c Mon May 7 07:04:41 2012 (r235121) @@ -35,8 +35,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_comconsole.h" - #include #include Modified: stable/8/sys/dev/cfe/cfe_console.c ============================================================================== --- stable/8/sys/dev/cfe/cfe_console.c Mon May 7 05:28:49 2012 (r235120) +++ stable/8/sys/dev/cfe/cfe_console.c Mon May 7 07:04:41 2012 (r235121) @@ -27,8 +27,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_comconsole.h" - #include #include #include @@ -67,7 +65,7 @@ static int polltime; static struct callout_handle cfe_timeouthandle = CALLOUT_HANDLE_INITIALIZER(&cfe_timeouthandle); -#if defined(KDB) && defined(ALT_BREAK_TO_DEBUGGER) +#if defined(KDB) static int alt_break_state; #endif @@ -191,24 +189,8 @@ cfe_cngetc(struct consdev *cp) unsigned char ch; if (cfe_read(conhandle, &ch, 1) == 1) { -#if defined(KDB) && defined(ALT_BREAK_TO_DEBUGGER) - int kdb_brk; - - if ((kdb_brk = kdb_alt_break(ch, &alt_break_state)) != 0) { - switch (kdb_brk) { - case KDB_REQ_DEBUGGER: - kdb_enter(KDB_WHY_BREAK, - "Break sequence on console"); - break; - case KDB_REQ_PANIC: - kdb_panic("Panic sequence on console"); - break; - case KDB_REQ_REBOOT: - kdb_reboot(); - break; - - } - } +#if defined(KDB) + kdb_alt_break(ch, &alt_break_state); #endif return (ch); } Modified: stable/8/sys/dev/dcons/dcons_os.c ============================================================================== --- stable/8/sys/dev/dcons/dcons_os.c Mon May 7 05:28:49 2012 (r235120) +++ stable/8/sys/dev/dcons/dcons_os.c Mon May 7 07:04:41 2012 (r235121) @@ -64,7 +64,6 @@ #include #include -#include "opt_comconsole.h" #include "opt_dcons.h" #include "opt_kdb.h" #include "opt_gdb.h" @@ -133,38 +132,21 @@ static struct ttydevsw dcons_ttydevsw = .tsw_outwakeup = dcons_outwakeup, }; -#if (defined(GDB) || defined(DDB)) && defined(ALT_BREAK_TO_DEBUGGER) +#if (defined(GDB) || defined(DDB)) static int dcons_check_break(struct dcons_softc *dc, int c) { - int kdb_brk; if (c < 0) return (c); - if ((kdb_brk = kdb_alt_break(c, &dc->brk_state)) != 0) { - switch (kdb_brk) { - case KDB_REQ_DEBUGGER: - if ((dc->flags & DC_GDB) != 0) { #ifdef GDB - if (gdb_cur == &dcons_gdb_dbgport) { - kdb_dbbe_select("gdb"); - kdb_enter(KDB_WHY_BREAK, - "Break sequence on dcons gdb port"); - } -#endif - } else - kdb_enter(KDB_WHY_BREAK, - "Break sequence on dcons console port"); - break; - case KDB_REQ_PANIC: - kdb_panic("Panic sequence on dcons console port"); - break; - case KDB_REQ_REBOOT: - kdb_reboot(); - break; - } - } + if ((dc->flags & DC_GDB) != 0 && gdb_cur == &dcons_gdb_dbgport) + kdb_alt_break_gdb(c, &dc->brk_state); + else +#endif + kdb_alt_break(c, &dc->brk_state); + return (c); } #else Modified: stable/8/sys/dev/ofw/ofw_console.c ============================================================================== --- stable/8/sys/dev/ofw/ofw_console.c Mon May 7 05:28:49 2012 (r235120) +++ stable/8/sys/dev/ofw/ofw_console.c Mon May 7 07:04:41 2012 (r235121) @@ -26,7 +26,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_comconsole.h" #include "opt_ofw.h" #include @@ -64,7 +63,7 @@ static int polltime; static struct callout_handle ofw_timeouthandle = CALLOUT_HANDLE_INITIALIZER(&ofw_timeouthandle); -#if defined(KDB) && defined(ALT_BREAK_TO_DEBUGGER) +#if defined(KDB) static int alt_break_state; #endif @@ -199,24 +198,8 @@ ofw_cngetc(struct consdev *cp) unsigned char ch; if (OF_read(stdin, &ch, 1) > 0) { -#if defined(KDB) && defined(ALT_BREAK_TO_DEBUGGER) - int kdb_brk; - - if ((kdb_brk = kdb_alt_break(ch, &alt_break_state)) != 0) { - switch (kdb_brk) { - case KDB_REQ_DEBUGGER: - kdb_enter(KDB_WHY_BREAK, - "Break sequence on console"); - break; - case KDB_REQ_PANIC: - kdb_panic("Panic sequence on console"); - break; - case KDB_REQ_REBOOT: - kdb_reboot(); - break; - - } - } +#if defined(KDB) + kdb_alt_break(ch, &alt_break_state); #endif return (ch); } Modified: stable/8/sys/dev/sio/sio.c ============================================================================== --- stable/8/sys/dev/sio/sio.c Mon May 7 05:28:49 2012 (r235120) +++ stable/8/sys/dev/sio/sio.c Mon May 7 07:04:41 2012 (r235121) @@ -33,7 +33,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_comconsole.h" #include "opt_compat.h" #include "opt_gdb.h" #include "opt_kdb.h" @@ -228,7 +227,7 @@ struct com_s { struct pps_state pps; int pps_bit; -#ifdef ALT_BREAK_TO_DEBUGGER +#ifdef KDB int alt_brk_state; #endif @@ -1102,8 +1101,7 @@ determined_type: ; } if (ret) device_printf(dev, "could not activate interrupt\n"); -#if defined(KDB) && (defined(BREAK_TO_DEBUGGER) || \ - defined(ALT_BREAK_TO_DEBUGGER)) +#if defined(KDB) /* * Enable interrupts for early break-to-debugger support * on the console. @@ -1196,8 +1194,7 @@ comclose(tp) com->poll_output = FALSE; sio_setreg(com, com_cfcr, com->cfcr_image &= ~CFCR_SBREAK); -#if defined(KDB) && (defined(BREAK_TO_DEBUGGER) || \ - defined(ALT_BREAK_TO_DEBUGGER)) +#if defined(KDB) /* * Leave interrupts enabled and don't clear DTR if this is the * console. This allows us to detect break-to-debugger events @@ -1484,9 +1481,8 @@ siointr1(com) u_char modem_status; u_char *ioptr; u_char recv_data; -#if defined(KDB) && defined(ALT_BREAK_TO_DEBUGGER) - int kdb_brk; +#ifdef KDB again: #endif @@ -1519,27 +1515,9 @@ again: else recv_data = inb(com->data_port); #ifdef KDB -#ifdef ALT_BREAK_TO_DEBUGGER if (com->unit == comconsole && - (kdb_brk = kdb_alt_break(recv_data, - &com->alt_brk_state)) != 0) { - mtx_unlock_spin(&sio_lock); - switch (kdb_brk) { - case KDB_REQ_DEBUGGER: - kdb_enter(KDB_WHY_BREAK, - "Break sequence on console"); - break; - case KDB_REQ_PANIC: - kdb_panic("panic on console"); - break; - case KDB_REQ_REBOOT: - kdb_reboot(); - break; - } - mtx_lock_spin(&sio_lock); + kdb_alt_break(recv_data, &com->alt_brk_state) != 0) goto again; - } -#endif /* ALT_BREAK_TO_DEBUGGER */ #endif /* KDB */ if (line_status & (LSR_BI | LSR_FE | LSR_PE)) { /* @@ -1555,10 +1533,9 @@ again: * Note: BI together with FE/PE means just BI. */ if (line_status & LSR_BI) { -#if defined(KDB) && defined(BREAK_TO_DEBUGGER) +#if defined(KDB) if (com->unit == comconsole) { - kdb_enter(KDB_WHY_BREAK, - "Line break on console"); + kdb_break(); goto cont; } #endif Modified: stable/8/sys/dev/syscons/syscons.c ============================================================================== --- stable/8/sys/dev/syscons/syscons.c Mon May 7 05:28:49 2012 (r235120) +++ stable/8/sys/dev/syscons/syscons.c Mon May 7 07:04:41 2012 (r235121) @@ -3426,7 +3426,7 @@ next_code: case DBG: #ifndef SC_DISABLE_KDBKEY if (enable_kdbkey) - kdb_enter(KDB_WHY_BREAK, "manual escape to debugger"); + kdb_break(); #endif break; Modified: stable/8/sys/dev/uart/uart_core.c ============================================================================== --- stable/8/sys/dev/uart/uart_core.c Mon May 7 05:28:49 2012 (r235120) +++ stable/8/sys/dev/uart/uart_core.c Mon May 7 07:04:41 2012 (r235121) @@ -27,10 +27,6 @@ #include __FBSDID("$FreeBSD$"); -#ifndef KLD_MODULE -#include "opt_comconsole.h" -#endif - #include #include #include @@ -119,10 +115,10 @@ uart_intr_break(void *arg) { struct uart_softc *sc = arg; -#if defined(KDB) && defined(BREAK_TO_DEBUGGER) +#if defined(KDB) if (sc->sc_sysdev != NULL && sc->sc_sysdev->type == UART_DEV_CONSOLE) { - kdb_enter(KDB_WHY_BREAK, "Line break on console"); - return (0); + if (kdb_break()) + return (0); } #endif if (sc->sc_opened) @@ -171,26 +167,10 @@ uart_intr_rxready(void *arg) rxp = sc->sc_rxput; UART_RECEIVE(sc); -#if defined(KDB) && defined(ALT_BREAK_TO_DEBUGGER) +#if defined(KDB) if (sc->sc_sysdev != NULL && sc->sc_sysdev->type == UART_DEV_CONSOLE) { while (rxp != sc->sc_rxput) { - int kdb_brk; - - if ((kdb_brk = kdb_alt_break(sc->sc_rxbuf[rxp++], - &sc->sc_altbrk)) != 0) { - switch (kdb_brk) { - case KDB_REQ_DEBUGGER: - kdb_enter(KDB_WHY_BREAK, - "Break sequence on console"); - break; - case KDB_REQ_PANIC: - kdb_panic("Panic sequence on console"); - break; - case KDB_REQ_REBOOT: - kdb_reboot(); - break; - } - } + kdb_alt_break(sc->sc_rxbuf[rxp++], &sc->sc_altbrk); if (rxp == sc->sc_rxbufsz) rxp = 0; } Modified: stable/8/sys/kern/subr_kdb.c ============================================================================== --- stable/8/sys/kern/subr_kdb.c Mon May 7 05:28:49 2012 (r235120) +++ stable/8/sys/kern/subr_kdb.c Mon May 7 07:04:41 2012 (r235121) @@ -56,6 +56,21 @@ struct pcb *kdb_thrctx = NULL; struct thread *kdb_thread = NULL; struct trapframe *kdb_frame = NULL; +#ifdef BREAK_TO_DEBUGGER +#define KDB_BREAK_TO_DEBUGGER 1 +#else +#define KDB_BREAK_TO_DEBUGGER 0 +#endif + +#ifdef ALT_BREAK_TO_DEBUGGER +#define KDB_ALT_BREAK_TO_DEBUGGER 1 +#else +#define KDB_ALT_BREAK_TO_DEBUGGER 0 +#endif + +static int kdb_break_to_debugger = KDB_BREAK_TO_DEBUGGER; +static int kdb_alt_break_to_debugger = KDB_ALT_BREAK_TO_DEBUGGER; + KDB_BACKEND(null, NULL, NULL, NULL); SET_DECLARE(kdb_dbbe_set, struct kdb_dbbe); @@ -86,6 +101,15 @@ SYSCTL_PROC(_debug_kdb, OID_AUTO, trap, SYSCTL_PROC(_debug_kdb, OID_AUTO, trap_code, CTLTYPE_INT | CTLFLAG_RW, NULL, 0, kdb_sysctl_trap_code, "I", "set to cause a page fault via code access"); +SYSCTL_INT(_debug_kdb, OID_AUTO, break_to_debugger, CTLTYPE_INT | CTLFLAG_RW | + CTLFLAG_TUN, &kdb_break_to_debugger, 0, "Enable break to debugger"); +TUNABLE_INT("debug.kdb.break_to_debugger", &kdb_break_to_debugger); + +SYSCTL_INT(_debug_kdb, OID_AUTO, alt_break_to_debugger, CTLTYPE_INT | + CTLFLAG_RW | CTLFLAG_TUN, &kdb_alt_break_to_debugger, 0, + "Enable alternative break to debugger"); +TUNABLE_INT("debug.kdb.alt_break_to_debugger", &kdb_alt_break_to_debugger); + /* * Flag indicating whether or not to IPI the other CPUs to stop them on * entering the debugger. Sometimes, this will result in a deadlock as @@ -260,7 +284,17 @@ kdb_reboot(void) #define KEY_CRTLR 18 /* ^R */ int -kdb_alt_break(int key, int *state) +kdb_break(void) +{ + + if (!kdb_break_to_debugger) + return (0); + kdb_enter(KDB_WHY_BREAK, "Break to debugger"); + return (KDB_REQ_DEBUGGER); +} + +static int +kdb_alt_break_state(int key, int *state) { int brk; @@ -286,6 +320,53 @@ kdb_alt_break(int key, int *state) return (brk); } +static int +kdb_alt_break_internal(int key, int *state, int force_gdb) +{ + int brk; + + if (!kdb_alt_break_to_debugger) + return (0); + brk = kdb_alt_break_state(key, state); + switch (brk) { + case KDB_REQ_DEBUGGER: + if (force_gdb) + kdb_dbbe_select("gdb"); + kdb_enter(KDB_WHY_BREAK, "Break to debugger"); + break; + + case KDB_REQ_PANIC: + if (force_gdb) + kdb_dbbe_select("gdb"); + kdb_panic("Panic sequence on console"); + break; + + case KDB_REQ_REBOOT: + kdb_reboot(); + break; + } + return (0); +} + +int +kdb_alt_break(int key, int *state) +{ + + return (kdb_alt_break_internal(key, state, 0)); +} + +/* + * This variation on kdb_alt_break() is used only by dcons, which has its own + * configuration flag to force GDB use regardless of the global KDB + * configuration. + */ +int +kdb_alt_break_gdb(int key, int *state) +{ + + return (kdb_alt_break_internal(key, state, 1)); +} + /* * Print a backtrace of the calling thread. The backtrace is generated by * the selected debugger, provided it supports backtraces. If no debugger Modified: stable/8/sys/modules/dcons/Makefile ============================================================================== --- stable/8/sys/modules/dcons/Makefile Mon May 7 05:28:49 2012 (r235120) +++ stable/8/sys/modules/dcons/Makefile Mon May 7 07:04:41 2012 (r235121) @@ -5,7 +5,7 @@ KMOD = dcons SRCS = dcons.c dcons.h dcons_os.c dcons_os.h \ - opt_dcons.h opt_kdb.h opt_ddb.h opt_gdb.h opt_comconsole.h + opt_dcons.h opt_kdb.h opt_ddb.h opt_gdb.h .if !defined(KERNBUILDDIR) opt_kdb.h: @@ -13,9 +13,6 @@ opt_kdb.h: opt_ddb.h: echo "#define DDB 1" > $@ - -opt_comconsole.h: - echo "#define ALT_BREAK_TO_DEBUGGER 1" > $@ .endif CFLAGS+= -I${.CURDIR}/../.. Modified: stable/8/sys/modules/sio/Makefile ============================================================================== --- stable/8/sys/modules/sio/Makefile Mon May 7 05:28:49 2012 (r235120) +++ stable/8/sys/modules/sio/Makefile Mon May 7 07:04:41 2012 (r235121) @@ -7,7 +7,7 @@ KMOD= sio SRCS= bus_if.h card_if.h device_if.h isa_if.h pci_if.h serdev_if.h \ - opt_comconsole.h opt_compat.h opt_gdb.h opt_kdb.h opt_sio.h \ + opt_compat.h opt_gdb.h opt_kdb.h opt_sio.h \ sio.c sio_pccard.c sio_pci.c sio_puc.c pccarddevs.h .if ${MACHINE} == "pc98" SRCS+= sio_cbus.c Modified: stable/8/sys/pc98/cbus/sio.c ============================================================================== --- stable/8/sys/pc98/cbus/sio.c Mon May 7 05:28:49 2012 (r235120) +++ stable/8/sys/pc98/cbus/sio.c Mon May 7 07:04:41 2012 (r235121) @@ -31,7 +31,6 @@ * from: i386/isa sio.c,v 1.234 */ -#include "opt_comconsole.h" #include "opt_compat.h" #include "opt_gdb.h" #include "opt_kdb.h" @@ -310,7 +309,7 @@ struct com_s { struct pps_state pps; int pps_bit; -#ifdef ALT_BREAK_TO_DEBUGGER +#ifdef KDB int alt_brk_state; #endif @@ -1752,8 +1751,7 @@ determined_type: ; } if (ret) device_printf(dev, "could not activate interrupt\n"); -#if defined(KDB) && (defined(BREAK_TO_DEBUGGER) || \ - defined(ALT_BREAK_TO_DEBUGGER)) +#if defined(KDB) /* * Enable interrupts for early break-to-debugger support * on the console. @@ -1896,8 +1894,7 @@ comclose(tp) sio_setreg(com, com_cfcr, com->cfcr_image &= ~CFCR_SBREAK); #endif -#if defined(KDB) && (defined(BREAK_TO_DEBUGGER) || \ - defined(ALT_BREAK_TO_DEBUGGER)) +#if defined(KDB) /* * Leave interrupts enabled and don't clear DTR if this is the * console. This allows us to detect break-to-debugger events @@ -2273,7 +2270,7 @@ siointr1(com) u_char rsa_buf_status = 0; int rsa_tx_fifo_size = 0; #endif /* PC98 */ -#if defined(KDB) && defined(ALT_BREAK_TO_DEBUGGER) +#if defined(KDB) int kdb_brk; again: @@ -2370,27 +2367,11 @@ more_intr: else recv_data = inb(com->data_port); #ifdef KDB -#ifdef ALT_BREAK_TO_DEBUGGER if (com->unit == comconsole && (kdb_brk = kdb_alt_break(recv_data, &com->alt_brk_state)) != 0) { - mtx_unlock_spin(&sio_lock); - switch (kdb_brk) { - case KDB_REQ_DEBUGGER: - kdb_enter(KDB_WHY_BREAK, - "Break sequence on console"); - break; - case KDB_REQ_PANIC: - kdb_panic("panic on console"); - break; - case KDB_REQ_REBOOT: - kdb_reboot(); - break; - } - mtx_lock_spin(&sio_lock); goto again; } -#endif /* ALT_BREAK_TO_DEBUGGER */ #endif /* KDB */ if (line_status & (LSR_BI | LSR_FE | LSR_PE)) { /* @@ -2406,7 +2387,7 @@ more_intr: * Note: BI together with FE/PE means just BI. */ if (line_status & LSR_BI) { -#if defined(KDB) && defined(BREAK_TO_DEBUGGER) +#if defined(KDB) if (com->unit == comconsole) { kdb_enter(KDB_WHY_BREAK, "Line break on console"); Modified: stable/8/sys/sys/kdb.h ============================================================================== --- stable/8/sys/sys/kdb.h Mon May 7 05:28:49 2012 (r235120) +++ stable/8/sys/sys/kdb.h Mon May 7 07:04:41 2012 (r235121) @@ -64,6 +64,8 @@ extern struct pcb *kdb_thrctx; /* Curre extern struct thread *kdb_thread; /* Current thread. */ int kdb_alt_break(int, int *); +int kdb_alt_break_gdb(int, int *); +int kdb_break(void); void kdb_backtrace(void); int kdb_dbbe_select(const char *); void kdb_enter(const char *, const char *); From owner-svn-src-stable-8@FreeBSD.ORG Mon May 7 12:20:27 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 771B4106564A; Mon, 7 May 2012 12:20:27 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6107F8FC14; Mon, 7 May 2012 12:20:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q47CKRdh064256; Mon, 7 May 2012 12:20:27 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q47CKR7E064254; Mon, 7 May 2012 12:20:27 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205071220.q47CKR7E064254@svn.freebsd.org> From: Eitan Adler Date: Mon, 7 May 2012 12:20:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235126 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 May 2012 12:20:27 -0000 Author: eadler Date: Mon May 7 12:20:26 2012 New Revision: 235126 URL: http://svn.freebsd.org/changeset/base/235126 Log: MFC r234131: Return EBADF instead of EMFILE from dup2 when the second argument is outside the range of valid file descriptors PR: kern/164970 Approved by: cperciva (implicit) Modified: stable/8/sys/kern/kern_descrip.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/kern/kern_descrip.c ============================================================================== --- stable/8/sys/kern/kern_descrip.c Mon May 7 12:19:49 2012 (r235125) +++ stable/8/sys/kern/kern_descrip.c Mon May 7 12:20:26 2012 (r235126) @@ -772,7 +772,7 @@ do_dup(struct thread *td, int flags, int maxfd = min((int)lim_cur(p, RLIMIT_NOFILE), maxfilesperproc); PROC_UNLOCK(p); if (new >= maxfd) - return (flags & DUP_FCNTL ? EINVAL : EMFILE); + return (flags & DUP_FCNTL ? EINVAL : EBADF); FILEDESC_XLOCK(fdp); if (old >= fdp->fd_nfiles || fdp->fd_ofiles[old] == NULL) { From owner-svn-src-stable-8@FreeBSD.ORG Tue May 8 08:19:08 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DA181065672; Tue, 8 May 2012 08:19:08 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8603F8FC19; Tue, 8 May 2012 08:19:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q488J86K013219; Tue, 8 May 2012 08:19:08 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q488J8Z4013213; Tue, 8 May 2012 08:19:08 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201205080819.q488J8Z4013213@svn.freebsd.org> From: Ulrich Spoerlein Date: Tue, 8 May 2012 08:19:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235137 - in stable/8: contrib/traceroute contrib/traceroute/lbl usr.sbin/traceroute X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 May 2012 08:19:08 -0000 Author: uqs Date: Tue May 8 08:19:07 2012 New Revision: 235137 URL: http://svn.freebsd.org/changeset/base/235137 Log: Sync traceroute(8) with head. Merges r215937,216184 and r211062,215880,220968: - Remove unused traceroute(8) contrib code from head - make WARNS=3 clean - fix an operator precedence bug for TCP tracerouting - Remove unneeded struct timezone passed to gettimeofday(). - Remove clause 3 and 4 from TNF licenses. - Check return code of setuid() in traceroute. Requested by: tuexen Deleted: stable/8/contrib/traceroute/Makefile.in stable/8/contrib/traceroute/aclocal.m4 stable/8/contrib/traceroute/acsite.m4 stable/8/contrib/traceroute/config.guess stable/8/contrib/traceroute/config.sub stable/8/contrib/traceroute/configure stable/8/contrib/traceroute/configure.in stable/8/contrib/traceroute/findsaddr-generic.c stable/8/contrib/traceroute/findsaddr-linux.c stable/8/contrib/traceroute/findsaddr-mib.c stable/8/contrib/traceroute/install-sh stable/8/contrib/traceroute/lbl/gnuc.h stable/8/contrib/traceroute/lbl/os-solaris2.h stable/8/contrib/traceroute/lbl/os-sunos4.h stable/8/contrib/traceroute/mkdep stable/8/contrib/traceroute/strerror.c stable/8/contrib/traceroute/usleep.c Modified: stable/8/contrib/traceroute/as.c stable/8/contrib/traceroute/as.h stable/8/contrib/traceroute/ifaddrlist.c stable/8/contrib/traceroute/traceroute.c stable/8/usr.sbin/traceroute/Makefile Directory Properties: stable/8/contrib/traceroute/ (props changed) stable/8/usr.sbin/traceroute/ (props changed) Modified: stable/8/contrib/traceroute/as.c ============================================================================== --- stable/8/contrib/traceroute/as.c Tue May 8 03:39:44 2012 (r235136) +++ stable/8/contrib/traceroute/as.c Tue May 8 08:19:07 2012 (r235137) @@ -16,13 +16,6 @@ * 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -63,13 +56,14 @@ struct aslookup { }; void * -as_setup(char *server) +as_setup(const char *server) { struct aslookup *asn; struct addrinfo hints, *res0, *res; FILE *f; int s, error; + s = -1; if (server == NULL) server = getenv("RA_SERVER"); if (server == NULL) Modified: stable/8/contrib/traceroute/as.h ============================================================================== --- stable/8/contrib/traceroute/as.h Tue May 8 03:39:44 2012 (r235136) +++ stable/8/contrib/traceroute/as.h Tue May 8 08:19:07 2012 (r235137) @@ -16,13 +16,6 @@ * 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. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -37,6 +30,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -void *as_setup(char *); +void *as_setup(const char *); unsigned int as_lookup(void *, char *, sa_family_t); void as_shutdown(void *); Modified: stable/8/contrib/traceroute/ifaddrlist.c ============================================================================== --- stable/8/contrib/traceroute/ifaddrlist.c Tue May 8 03:39:44 2012 (r235136) +++ stable/8/contrib/traceroute/ifaddrlist.c Tue May 8 08:19:07 2012 (r235137) @@ -61,11 +61,6 @@ struct rtentry; #include #include -#include "gnuc.h" -#ifdef HAVE_OS_PROTO_H -#include "os-proto.h" -#endif - #include "ifaddrlist.h" /* @@ -76,14 +71,14 @@ ifaddrlist(register struct ifaddrlist ** { register int fd, nipaddr; #ifdef HAVE_SOCKADDR_SA_LEN - register int n; + size_t n; #endif register struct ifreq *ifrp, *ifend, *ifnext, *mp; register struct sockaddr_in *sin; register struct ifaddrlist *al; struct ifconf ifc; struct ifreq ibuf[(32 * 1024) / sizeof(struct ifreq)], ifr; -#define MAX_IPADDR (sizeof(ibuf) / sizeof(ibuf[0])) +#define MAX_IPADDR ((int)(sizeof(ibuf) / sizeof(ibuf[0]))) static struct ifaddrlist ifaddrlist[MAX_IPADDR]; char device[sizeof(ifr.ifr_name) + 1]; @@ -96,10 +91,10 @@ ifaddrlist(register struct ifaddrlist ** ifc.ifc_buf = (caddr_t)ibuf; if (ioctl(fd, SIOCGIFCONF, (char *)&ifc) < 0 || - ifc.ifc_len < sizeof(struct ifreq)) { + ifc.ifc_len < (int)sizeof(struct ifreq)) { if (errno == EINVAL) (void)sprintf(errbuf, - "SIOCGIFCONF: ifreq struct too small (%d bytes)", + "SIOCGIFCONF: ifreq struct too small (%zu bytes)", sizeof(ibuf)); else (void)sprintf(errbuf, "SIOCGIFCONF: %s", Modified: stable/8/contrib/traceroute/traceroute.c ============================================================================== --- stable/8/contrib/traceroute/traceroute.c Tue May 8 03:39:44 2012 (r235136) +++ stable/8/contrib/traceroute/traceroute.c Tue May 8 08:19:07 2012 (r235137) @@ -220,7 +220,6 @@ static const char rcsid[] = #include #include #include -#include #include #include @@ -245,11 +244,6 @@ static const char rcsid[] = #include #include -#include "gnuc.h" -#ifdef HAVE_OS_PROTO_H -#include "os-proto.h" -#endif - /* rfc1716 */ #ifndef ICMP_UNREACH_FILTER_PROHIB #define ICMP_UNREACH_FILTER_PROHIB 13 /* admin prohibited filter */ @@ -515,7 +509,10 @@ main(int argc, char **argv) sockerrno = errno; } - setuid(getuid()); + if (setuid(getuid()) != 0) { + perror("setuid()"); + exit(1); + } #ifdef IPCTL_DEFTTL { @@ -962,7 +959,6 @@ main(int argc, char **argv) for (probe = 0, loss = 0; probe < nprobes; ++probe) { register int cc; struct timeval t1, t2; - struct timezone tz; register struct ip *ip; struct outdata outdata; @@ -973,7 +969,7 @@ main(int argc, char **argv) outdata.ttl = ttl; /* Avoid alignment problems by copying bytewise: */ - (void)gettimeofday(&t1, &tz); + (void)gettimeofday(&t1, NULL); memcpy(&outdata.tv, &t1, sizeof(outdata.tv)); /* Finalize and send packet */ @@ -986,7 +982,7 @@ main(int argc, char **argv) double T; int precis; - (void)gettimeofday(&t2, &tz); + (void)gettimeofday(&t2, NULL); i = packet_ok(packet, cc, from, seq); /* Skip short packet */ if (i == 0) @@ -1152,7 +1148,6 @@ wait_for_reply(register int sock, regist fd_set *fdsp; size_t nfds; struct timeval now, wait; - struct timezone tz; register int cc = 0; register int error; int fromlen = sizeof(*fromp); @@ -1165,7 +1160,7 @@ wait_for_reply(register int sock, regist wait.tv_sec = tp->tv_sec + waittime; wait.tv_usec = tp->tv_usec; - (void)gettimeofday(&now, &tz); + (void)gettimeofday(&now, NULL); tvsub(&wait, &now); if (wait.tv_sec < 0) { wait.tv_sec = 0; @@ -1431,7 +1426,7 @@ tcp_check(const u_char *data, int seq) return (ntohs(tcp->th_sport) == ident && ntohs(tcp->th_dport) == port + (fixedPort ? 0 : seq)) - && tcp->th_seq == (ident << 16) | (port + seq); + && tcp->th_seq == (((tcp_seq)ident << 16) | (port + seq)); } void @@ -1504,19 +1499,17 @@ u_short p_cksum(struct ip *ip, u_short *data, int len) { static struct ipovly ipo; - u_short sumh, sumd; - u_long sumt; + u_short sum[2]; ipo.ih_pr = ip->ip_p; ipo.ih_len = htons(len); ipo.ih_src = ip->ip_src; ipo.ih_dst = ip->ip_dst; - sumh = in_cksum((u_short*)&ipo, sizeof(ipo)); /* pseudo ip hdr cksum */ - sumd = in_cksum((u_short*)data, len); /* payload data cksum */ - sumt = (sumh << 16) | (sumd); + sum[1] = in_cksum((u_short*)&ipo, sizeof(ipo)); /* pseudo ip hdr cksum */ + sum[0] = in_cksum(data, len); /* payload data cksum */ - return ~in_cksum((u_short*)&sumt, sizeof(sumt)); + return ~in_cksum(sum, sizeof(sum)); } /* Modified: stable/8/usr.sbin/traceroute/Makefile ============================================================================== --- stable/8/usr.sbin/traceroute/Makefile Tue May 8 03:39:44 2012 (r235136) +++ stable/8/usr.sbin/traceroute/Makefile Tue May 8 08:19:07 2012 (r235137) @@ -29,7 +29,9 @@ DPADD= ${LIBIPSEC} LDADD= -lipsec .endif -CFLAGS+= -I${TRACEROUTE_DISTDIR}/lbl -I${TRACEROUTE_DISTDIR} +CFLAGS+= -I${TRACEROUTE_DISTDIR} + +WARNS?= 3 version.c: ${TRACEROUTE_DISTDIR}/VERSION @rm -f ${.TARGET} From owner-svn-src-stable-8@FreeBSD.ORG Tue May 8 19:33:32 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04075106567E; Tue, 8 May 2012 19:33:32 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E2F1C8FC1C; Tue, 8 May 2012 19:33:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q48JXVeU049067; Tue, 8 May 2012 19:33:31 GMT (envelope-from jlh@svn.freebsd.org) Received: (from jlh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q48JXVHD049061; Tue, 8 May 2012 19:33:31 GMT (envelope-from jlh@svn.freebsd.org) Message-Id: <201205081933.q48JXVHD049061@svn.freebsd.org> From: Jeremie Le Hen Date: Tue, 8 May 2012 19:33:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235141 - in stable/8: lib lib/libc/stdio lib/libstdbuf usr.bin usr.bin/stdbuf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 May 2012 19:33:32 -0000 Author: jlh Date: Tue May 8 19:33:31 2012 New Revision: 235141 URL: http://svn.freebsd.org/changeset/base/235141 Log: MFC r234772: Import stdbuf(1) and the shared library it relies on. This tool changes the default buffering behaviour of standard stdio streams. It only works on dynamic binaries. To make it work for static ones it would require cluttering stdio because there no single entry point. PR: 166660 Reviewed by: current@, jhb Approved by: kib (mentor) MFC after: 1 week MFC r234773: Fix small documentation mistakes. Submitted by: brueffer Approved by: kib (mentor) MFC r234779: Use standard getopt(3) error message. Submitted by: jilles Approved by: kib (mentor) Added: - copied from r234772, head/lib/libstdbuf/ - copied from r234772, head/usr.bin/stdbuf/ Directory Properties: stable/8/lib/libstdbuf/ (props changed) stable/8/usr.bin/stdbuf/ (props changed) Modified: stable/8/lib/Makefile (contents, props changed) stable/8/lib/libc/stdio/setbuf.3 stable/8/lib/libstdbuf/libstdbuf.3 stable/8/usr.bin/Makefile stable/8/usr.bin/stdbuf/stdbuf.c Directory Properties: stable/8/lib/ (props changed) stable/8/lib/libc/ (props changed) stable/8/usr.bin/ (props changed) Modified: stable/8/lib/Makefile ============================================================================== --- stable/8/lib/Makefile Tue May 8 18:56:21 2012 (r235140) +++ stable/8/lib/Makefile Tue May 8 19:33:31 2012 (r235141) @@ -95,6 +95,7 @@ SUBDIR= ${SUBDIR_ORDERED} \ ${_libsmdb} \ ${_libsmutil} \ libstand \ + libstdbuf \ ${_libtelnet} \ ${_libthr} \ libthread_db \ Modified: stable/8/lib/libc/stdio/setbuf.3 ============================================================================== --- stable/8/lib/libc/stdio/setbuf.3 Tue May 8 18:56:21 2012 (r235140) +++ stable/8/lib/libc/stdio/setbuf.3 Tue May 8 19:33:31 2012 (r235141) @@ -83,6 +83,9 @@ normally does) it is line buffered. The standard error stream .Dv stderr is always unbuffered. +Note that these defaults may be altered using the +.Xr stdbuf 1 +utility. .Pp The .Fn setvbuf @@ -177,6 +180,7 @@ function returns what the equivalent .Fn setvbuf would have returned. .Sh SEE ALSO +.Xr stdbuf 1 , .Xr fclose 3 , .Xr fopen 3 , .Xr fread 3 , Modified: stable/8/lib/libstdbuf/libstdbuf.3 ============================================================================== --- head/lib/libstdbuf/libstdbuf.3 Sat Apr 28 20:52:20 2012 (r234772) +++ stable/8/lib/libstdbuf/libstdbuf.3 Tue May 8 19:33:31 2012 (r235141) @@ -43,7 +43,7 @@ an utility, .Xr stdbuf 1 , can be used to run a command with the appropriate environment variables. .Sh ENVIRONMENT -Each stream can be configured indepentently through the following +Each stream can be configured independently through the following environment variables (values are defined below): .Bl -tag -width size -offset indent .It Ev _STDBUF_I Modified: stable/8/usr.bin/Makefile ============================================================================== --- stable/8/usr.bin/Makefile Tue May 8 18:56:21 2012 (r235140) +++ stable/8/usr.bin/Makefile Tue May 8 19:33:31 2012 (r235141) @@ -177,6 +177,7 @@ SUBDIR= alias \ sockstat \ split \ stat \ + stdbuf \ su \ systat \ tabs \ Modified: stable/8/usr.bin/stdbuf/stdbuf.c ============================================================================== --- head/usr.bin/stdbuf/stdbuf.c Sat Apr 28 20:52:20 2012 (r234772) +++ stable/8/usr.bin/stdbuf/stdbuf.c Tue May 8 19:33:31 2012 (r235141) @@ -52,7 +52,7 @@ main(int argc, char *argv[]) int i; ibuf = obuf = ebuf = NULL; - while ((i = getopt(argc, argv, ":e:i:o:")) != -1) { + while ((i = getopt(argc, argv, "e:i:o:")) != -1) { switch (i) { case 'e': ebuf = optarg; @@ -63,13 +63,8 @@ main(int argc, char *argv[]) case 'o': obuf = optarg; break; - case ':': - warnx("Missing argument for option -%c", optopt); - usage(1); - break; case '?': default: - warnx("Unknown option: %c", optopt); usage(1); break; } From owner-svn-src-stable-8@FreeBSD.ORG Wed May 9 00:56:27 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63B7B10658E5; Wed, 9 May 2012 00:56:27 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 44AE58FC14; Wed, 9 May 2012 00:56:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q490uRv8058995; Wed, 9 May 2012 00:56:27 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q490uRei058993; Wed, 9 May 2012 00:56:27 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205090056.q490uRei058993@svn.freebsd.org> From: Eitan Adler Date: Wed, 9 May 2012 00:56:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235148 - stable/8/share/man/man7 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 00:56:27 -0000 Author: eadler Date: Wed May 9 00:56:26 2012 New Revision: 235148 URL: http://svn.freebsd.org/changeset/base/235148 Log: Partial MFC r234935: Prefer the use of csup to cvsup when talking about the binary. PR: docs/167459 Approved by: cperciva (implicit) Modified: stable/8/share/man/man7/development.7 Directory Properties: stable/8/share/man/man7/ (props changed) Modified: stable/8/share/man/man7/development.7 ============================================================================== --- stable/8/share/man/man7/development.7 Wed May 9 00:56:11 2012 (r235147) +++ stable/8/share/man/man7/development.7 Wed May 9 00:56:26 2012 (r235148) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 21, 2002 +.Dd May 02, 2012 .Dt DEVELOPMENT 7 .Os .Sh NAME @@ -89,7 +89,7 @@ I recommend a partition of at least 5GB. .Pp On the master server, use -.Xr cvsup 1 Pq Pa ports/net/cvsup +.Xr csup 1 to automatically pull down and maintain the .Fx @@ -108,23 +108,23 @@ The job should look something like this (please randomize the time of day!). Note that you can use the -.Xr cvsup 1 +.Xr csup 1 configuration file example directly from .Pa /usr/share/examples without modification by supplying appropriate arguments to -.Xr cvsup 1 . +.Xr csup 1 . .Bd -literal -offset 4n -33 6 * * * /usr/local/bin/cvsup -g -r 20 -L 2 -h cvsup.freebsd.org /usr/share/examples/cvsup/cvs-supfile +33 6 * * * /usr/bin/csup -r 20 -L 2 -h cvsup.freebsd.org /usr/share/examples/cvsup/cvs-supfile .Ed .Pp Run the -.Xr cvsup 1 +.Xr csup 1 manually the first time to pull down the archive. It could take all day depending on how fast your connection is! You will run all -.Xr cvsup 1 +.Xr csup 1 and .Xr cvs 1 operations as @@ -555,7 +555,7 @@ Since the main tree is based on CVS, the former is convenient. .Pp First, you need to modify your -.Xr cvsup 1 +.Xr csup 1 environment to avoid it modifying the local changes you have committed to the repository. It is important to remove the @@ -568,7 +568,7 @@ subdirectory to your .Pa refuse file. For more information, see -.Xr cvsup 1 . +.Xr csup 1 . .Pp The .Fx @@ -598,13 +598,13 @@ For more information on using CVS, see .Pp .Sy WARNING! The -.Xr cvsup 1 +.Xr csup 1 utility may blow away changes made on a local branch in some situations. This has been reported to occur when the master CVS repository is directly manipulated or an RCS file is changed. At this point, -.Xr cvsup 1 +.Xr csup 1 notices that the client and server have entirely different RCS files, so it does a full replace instead of trying to send just deltas. @@ -619,7 +619,7 @@ Bottom line is, if you value your local should back it up before every update. .Sh UPDATING VIA CVS The advantage of using -.Xr cvsup 1 +.Xr csup 1 to maintain an updated copy of the CVS repository instead of using it to maintain source trees directly is that you can then pick and choose when you bring your source tree (or pieces of your From owner-svn-src-stable-8@FreeBSD.ORG Wed May 9 10:05:03 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 17A36106566C; Wed, 9 May 2012 10:05:03 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F18818FC12; Wed, 9 May 2012 10:05:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49A52Vf076725; Wed, 9 May 2012 10:05:02 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49A52Ps076723; Wed, 9 May 2012 10:05:02 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201205091005.q49A52Ps076723@svn.freebsd.org> From: Peter Holm Date: Wed, 9 May 2012 10:05: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: r235160 - stable/8/sys/dev/sound/pcm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 10:05:03 -0000 Author: pho Date: Wed May 9 10:05:02 2012 New Revision: 235160 URL: http://svn.freebsd.org/changeset/base/235160 Log: MFC: r234932 Added D_TRACKCLOSE to sndstat_cdevsw to fix the situation when another process is in open() or stat() for the device node, then close() from the owning process does not result in cdevsw close method call. This fixes the pemanent "Device busy" seen. Changed the sndstat_lock from mutex to sx. This allows to extend the region covered by the lock, to include the uiomove() call in sndstat_read() and bufptr increment. This fixes the "panic: sbuf_put_byte called with finished or corrupt sbuf" seen. Modified: stable/8/sys/dev/sound/pcm/sndstat.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/sound/pcm/sndstat.c ============================================================================== --- stable/8/sys/dev/sound/pcm/sndstat.c Wed May 9 08:46:43 2012 (r235159) +++ stable/8/sys/dev/sound/pcm/sndstat.c Wed May 9 10:05:02 2012 (r235160) @@ -53,6 +53,7 @@ static struct cdevsw sndstat_cdevsw = { .d_close = sndstat_close, .d_read = sndstat_read, .d_name = "sndstat", + .d_flags = D_TRACKCLOSE, }; struct sndstat_entry { @@ -63,7 +64,7 @@ struct sndstat_entry { int type, unit; }; -static struct mtx sndstat_lock; +static struct sx sndstat_lock; static struct sbuf sndstat_sbuf; static struct cdev *sndstat_dev = NULL; static int sndstat_bufptr = -1; @@ -93,16 +94,14 @@ sysctl_hw_snd_sndstat_pid(SYSCTL_HANDLER if (sndstat_dev == NULL) return (EINVAL); - mtx_lock(&sndstat_lock); + sx_xlock(&sndstat_lock); val = (int)SNDSTAT_PID(sndstat_dev); - mtx_unlock(&sndstat_lock); err = sysctl_handle_int(oidp, &val, 0, req); if (err == 0 && req->newptr != NULL && val == 0) { - mtx_lock(&sndstat_lock); SNDSTAT_FLUSH(); SNDSTAT_PID_SET(sndstat_dev, 0); - mtx_unlock(&sndstat_lock); } + sx_unlock(&sndstat_lock); return (err); } SYSCTL_PROC(_hw_snd, OID_AUTO, sndstat_pid, CTLTYPE_INT | CTLFLAG_RW, @@ -119,12 +118,10 @@ sysctl_hw_sndverbose(SYSCTL_HANDLER_ARGS verbose = snd_verbose; error = sysctl_handle_int(oidp, &verbose, 0, req); if (error == 0 && req->newptr != NULL) { - mtx_lock(&sndstat_lock); if (verbose < 0 || verbose > 4) error = EINVAL; else snd_verbose = verbose; - mtx_unlock(&sndstat_lock); } return error; } @@ -137,20 +134,19 @@ sndstat_open(struct cdev *i_dev, int fla if (sndstat_dev == NULL || i_dev != sndstat_dev) return EBADF; - mtx_lock(&sndstat_lock); + sx_xlock(&sndstat_lock); if (SNDSTAT_PID(i_dev) != 0) { - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return EBUSY; } SNDSTAT_PID_SET(i_dev, td->td_proc->p_pid); - mtx_unlock(&sndstat_lock); if (sbuf_new(&sndstat_sbuf, NULL, 4096, SBUF_AUTOEXTEND) == NULL) { - mtx_lock(&sndstat_lock); SNDSTAT_PID_SET(i_dev, 0); - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return ENXIO; } sndstat_bufptr = 0; + sx_unlock(&sndstat_lock); return 0; } @@ -160,16 +156,16 @@ sndstat_close(struct cdev *i_dev, int fl if (sndstat_dev == NULL || i_dev != sndstat_dev) return EBADF; - mtx_lock(&sndstat_lock); + sx_xlock(&sndstat_lock); if (SNDSTAT_PID(i_dev) == 0) { - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return EBADF; } SNDSTAT_FLUSH(); SNDSTAT_PID_SET(i_dev, 0); - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return 0; } @@ -182,20 +178,18 @@ sndstat_read(struct cdev *i_dev, struct if (sndstat_dev == NULL || i_dev != sndstat_dev) return EBADF; - mtx_lock(&sndstat_lock); + sx_xlock(&sndstat_lock); if (SNDSTAT_PID(i_dev) != buf->uio_td->td_proc->p_pid || sndstat_bufptr == -1) { - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return EBADF; } - mtx_unlock(&sndstat_lock); if (sndstat_bufptr == 0) { err = (sndstat_prepare(&sndstat_sbuf) > 0) ? 0 : ENOMEM; if (err) { - mtx_lock(&sndstat_lock); SNDSTAT_FLUSH(); - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return err; } } @@ -203,6 +197,7 @@ sndstat_read(struct cdev *i_dev, struct l = min(buf->uio_resid, sbuf_len(&sndstat_sbuf) - sndstat_bufptr); err = (l > 0)? uiomove(sbuf_data(&sndstat_sbuf) + sndstat_bufptr, l, buf) : 0; sndstat_bufptr += l; + sx_unlock(&sndstat_lock); return err; } @@ -228,13 +223,13 @@ sndstat_acquire(struct thread *td) if (sndstat_dev == NULL) return EBADF; - mtx_lock(&sndstat_lock); + sx_xlock(&sndstat_lock); if (SNDSTAT_PID(sndstat_dev) != 0) { - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return EBUSY; } SNDSTAT_PID_SET(sndstat_dev, td->td_proc->p_pid); - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return 0; } @@ -244,13 +239,13 @@ sndstat_release(struct thread *td) if (sndstat_dev == NULL) return EBADF; - mtx_lock(&sndstat_lock); + sx_xlock(&sndstat_lock); if (SNDSTAT_PID(sndstat_dev) != td->td_proc->p_pid) { - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return EBADF; } SNDSTAT_PID_SET(sndstat_dev, 0); - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return 0; } @@ -284,12 +279,12 @@ sndstat_register(device_t dev, char *str ent->unit = unit; ent->handler = handler; - mtx_lock(&sndstat_lock); + sx_xlock(&sndstat_lock); SLIST_INSERT_HEAD(&sndstat_devlist, ent, link); if (type == SS_TYPE_MODULE) sndstat_files++; sndstat_maxunit = (unit > sndstat_maxunit)? unit : sndstat_maxunit; - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return 0; } @@ -305,17 +300,17 @@ sndstat_unregister(device_t dev) { struct sndstat_entry *ent; - mtx_lock(&sndstat_lock); + sx_xlock(&sndstat_lock); SLIST_FOREACH(ent, &sndstat_devlist, link) { if (ent->dev == dev) { SLIST_REMOVE(&sndstat_devlist, ent, sndstat_entry, link); - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); free(ent, M_DEVBUF); return 0; } } - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return ENXIO; } @@ -325,18 +320,18 @@ sndstat_unregisterfile(char *str) { struct sndstat_entry *ent; - mtx_lock(&sndstat_lock); + sx_xlock(&sndstat_lock); SLIST_FOREACH(ent, &sndstat_devlist, link) { if (ent->dev == NULL && ent->str == str) { SLIST_REMOVE(&sndstat_devlist, ent, sndstat_entry, link); sndstat_files--; - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); free(ent, M_DEVBUF); return 0; } } - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return ENXIO; } @@ -399,7 +394,7 @@ sndstat_init(void) { if (sndstat_dev != NULL) return EINVAL; - mtx_init(&sndstat_lock, "sndstat", "sndstat lock", MTX_DEF); + sx_init(&sndstat_lock, "sndstat lock"); sndstat_dev = make_dev(&sndstat_cdevsw, SND_DEV_STATUS, UID_ROOT, GID_WHEEL, 0444, "sndstat"); return 0; @@ -411,20 +406,20 @@ sndstat_uninit(void) if (sndstat_dev == NULL) return EINVAL; - mtx_lock(&sndstat_lock); + sx_xlock(&sndstat_lock); if (SNDSTAT_PID(sndstat_dev) != curthread->td_proc->p_pid) { - mtx_unlock(&sndstat_lock); + sx_unlock(&sndstat_lock); return EBUSY; } - SNDSTAT_FLUSH(); - - mtx_unlock(&sndstat_lock); - + /* XXXPHO: use destroy_dev_sched() */ destroy_dev(sndstat_dev); sndstat_dev = NULL; - mtx_destroy(&sndstat_lock); + SNDSTAT_FLUSH(); + + sx_unlock(&sndstat_lock); + sx_destroy(&sndstat_lock); return 0; } From owner-svn-src-stable-8@FreeBSD.ORG Wed May 9 13:08:26 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 947C6106564A; Wed, 9 May 2012 13:08:26 +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 7EDDA8FC1A; Wed, 9 May 2012 13:08:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49D8QaD084229; Wed, 9 May 2012 13:08:26 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49D8Qml084227; Wed, 9 May 2012 13:08:26 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091308.q49D8Qml084227@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 13:08: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: r235163 - stable/8/contrib/traceroute X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 13:08:26 -0000 Author: tuexen Date: Wed May 9 13:08:26 2012 New Revision: 235163 URL: http://svn.freebsd.org/changeset/base/235163 Log: MFC r234701: Fix a bug in the TCP tracerouting which resulted in not accepting any incoming packets. So all packets seemed to be lost. Modified: stable/8/contrib/traceroute/traceroute.c Directory Properties: stable/8/contrib/traceroute/ (props changed) Modified: stable/8/contrib/traceroute/traceroute.c ============================================================================== --- stable/8/contrib/traceroute/traceroute.c Wed May 9 11:01:39 2012 (r235162) +++ stable/8/contrib/traceroute/traceroute.c Wed May 9 13:08:26 2012 (r235163) @@ -1406,8 +1406,7 @@ tcp_prep(struct outdata *outdata) tcp->th_sport = htons(ident); tcp->th_dport = htons(port + (fixedPort ? 0 : outdata->seq)); - tcp->th_seq = (tcp->th_sport << 16) | (tcp->th_dport + - (fixedPort ? outdata->seq : 0)); + tcp->th_seq = (tcp->th_sport << 16) | tcp->th_dport; tcp->th_ack = 0; tcp->th_off = 5; tcp->th_flags = TH_SYN; @@ -1425,8 +1424,8 @@ tcp_check(const u_char *data, int seq) struct tcphdr *const tcp = (struct tcphdr *) data; return (ntohs(tcp->th_sport) == ident - && ntohs(tcp->th_dport) == port + (fixedPort ? 0 : seq)) - && tcp->th_seq == (((tcp_seq)ident << 16) | (port + seq)); + && ntohs(tcp->th_dport) == port + (fixedPort ? 0 : seq) + && tcp->th_seq == (tcp_seq)((tcp->th_sport << 16) | tcp->th_dport)); } void From owner-svn-src-stable-8@FreeBSD.ORG Wed May 9 14:44:37 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64716106564A; Wed, 9 May 2012 14:44:37 +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 3527C8FC12; Wed, 9 May 2012 14:44:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49Eib4S088151; Wed, 9 May 2012 14:44:37 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49Eia7T088148; Wed, 9 May 2012 14:44:36 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091444.q49Eia7T088148@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 14:44:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235179 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 14:44:37 -0000 Author: tuexen Date: Wed May 9 14:44:36 2012 New Revision: 235179 URL: http://svn.freebsd.org/changeset/base/235179 Log: MFC r234832: Add support for missing gauth_number_of_chunks field. This Bug was found by Irene Ruengeler. Modified: stable/8/sys/netinet/sctp_uio.h stable/8/sys/netinet/sctp_usrreq.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/sctp_uio.h ============================================================================== --- stable/8/sys/netinet/sctp_uio.h Wed May 9 14:35:19 2012 (r235178) +++ stable/8/sys/netinet/sctp_uio.h Wed May 9 14:44:36 2012 (r235179) @@ -660,6 +660,7 @@ struct sctp_authkeyid { /* SCTP_PEER_AUTH_CHUNKS / SCTP_LOCAL_AUTH_CHUNKS */ struct sctp_authchunks { sctp_assoc_t gauth_assoc_id; + uint32_t gauth_number_of_chunks; uint8_t gauth_chunks[]; }; Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Wed May 9 14:35:19 2012 (r235178) +++ stable/8/sys/netinet/sctp_usrreq.c Wed May 9 14:44:36 2012 (r235179) @@ -2868,6 +2868,7 @@ flags_out: } else { /* copy in the chunks */ (void)sctp_serialize_auth_chunks(chklist, sac->gauth_chunks); + sac->gauth_number_of_chunks = (uint32_t) size; *optsize = sizeof(struct sctp_authchunks) + size; } SCTP_TCB_UNLOCK(stcb); @@ -2886,6 +2887,7 @@ flags_out: } else { /* copy in the chunks */ (void)sctp_serialize_auth_chunks(chklist, sac->gauth_chunks); + sac->gauth_number_of_chunks = (uint32_t) size; *optsize = sizeof(struct sctp_authchunks) + size; } SCTP_INP_RUNLOCK(inp); @@ -2916,6 +2918,7 @@ flags_out: } else { /* copy in the chunks */ (void)sctp_serialize_auth_chunks(chklist, sac->gauth_chunks); + sac->gauth_number_of_chunks = (uint32_t) size; *optsize = sizeof(struct sctp_authchunks) + size; } SCTP_TCB_UNLOCK(stcb); From owner-svn-src-stable-8@FreeBSD.ORG Wed May 9 14:45:40 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A2F0F1065670; Wed, 9 May 2012 14:45:40 +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 8D5898FC1F; Wed, 9 May 2012 14:45:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49EjeCT088241; Wed, 9 May 2012 14:45:40 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49EjeoA088239; Wed, 9 May 2012 14:45:40 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201205091445.q49EjeoA088239@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 9 May 2012 14:45:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235180 - stable/8/sys/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 14:45:40 -0000 Author: kib Date: Wed May 9 14:45:40 2012 New Revision: 235180 URL: http://svn.freebsd.org/changeset/base/235180 Log: MFC r235099: Add definition for the -z nodefaultlib flag. Modified: stable/8/sys/sys/elf_common.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/sys/elf_common.h ============================================================================== --- stable/8/sys/sys/elf_common.h Wed May 9 14:44:36 2012 (r235179) +++ stable/8/sys/sys/elf_common.h Wed May 9 14:45:40 2012 (r235180) @@ -476,6 +476,7 @@ typedef struct { #define DF_1_LOADFLTR 0x00000010 /* Immediate loading of filtees */ #define DF_1_NOOPEN 0x00000040 /* Do not allow loading on dlopen() */ #define DF_1_ORIGIN 0x00000080 /* Process $ORIGIN */ +#define DF_1_NODEFLIB 0x00000800 /* Do not search default paths */ /* Values for n_type. Used in core files. */ #define NT_PRSTATUS 1 /* Process status. */ From owner-svn-src-stable-8@FreeBSD.ORG Wed May 9 14:51:08 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43540106566C; Wed, 9 May 2012 14:51:08 +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 2E0B58FC12; Wed, 9 May 2012 14:51:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49Ep8Df088467; Wed, 9 May 2012 14:51:08 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49Ep797088464; Wed, 9 May 2012 14:51:07 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091451.q49Ep797088464@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 14:51:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235181 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 14:51:08 -0000 Author: tuexen Date: Wed May 9 14:51:07 2012 New Revision: 235181 URL: http://svn.freebsd.org/changeset/base/235181 Log: MFC r234951: Fix another RFC 6458 issue. Spotted by Irene Ruengeler. Modified: stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_uio.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Wed May 9 14:45:40 2012 (r235180) +++ stable/8/sys/netinet/sctp_output.c Wed May 9 14:51:07 2012 (r235181) @@ -3430,7 +3430,7 @@ sctp_find_cmsg(int c_type, void *data, s } m_copydata(control, at + CMSG_ALIGN(sizeof(struct cmsghdr)), sizeof(struct sctp_authinfo), (caddr_t)&authinfo); sndrcvinfo->sinfo_keynumber_valid = 1; - sndrcvinfo->sinfo_keynumber = authinfo.auth_keyid; + sndrcvinfo->sinfo_keynumber = authinfo.auth_keynumber; break; default: return (found); Modified: stable/8/sys/netinet/sctp_uio.h ============================================================================== --- stable/8/sys/netinet/sctp_uio.h Wed May 9 14:45:40 2012 (r235180) +++ stable/8/sys/netinet/sctp_uio.h Wed May 9 14:51:07 2012 (r235181) @@ -169,7 +169,7 @@ struct sctp_default_prinfo { }; struct sctp_authinfo { - uint16_t auth_keyid; + uint16_t auth_keynumber; }; struct sctp_rcvinfo { From owner-svn-src-stable-8@FreeBSD.ORG Wed May 9 14:55:18 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31A5F106564A; Wed, 9 May 2012 14:55:18 +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 1A54D8FC15; Wed, 9 May 2012 14:55:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49EtIT5088724; Wed, 9 May 2012 14:55:18 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49EtHGC088713; Wed, 9 May 2012 14:55:17 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091455.q49EtHGC088713@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 14:55:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235183 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 14:55:18 -0000 Author: tuexen Date: Wed May 9 14:55:17 2012 New Revision: 235183 URL: http://svn.freebsd.org/changeset/base/235183 Log: MFC r234995: Use SCTP_PRINTF() instead of printf() in all SCTP sources. Modified: stable/8/sys/netinet/sctp_auth.c stable/8/sys/netinet/sctp_bsd_addr.c stable/8/sys/netinet/sctp_cc_functions.c stable/8/sys/netinet/sctp_crc32.c stable/8/sys/netinet/sctp_indata.c stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_os_bsd.h stable/8/sys/netinet/sctp_output.c stable/8/sys/netinet/sctp_pcb.c stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/sctp_auth.c ============================================================================== --- stable/8/sys/netinet/sctp_auth.c Wed May 9 14:52:03 2012 (r235182) +++ stable/8/sys/netinet/sctp_auth.c Wed May 9 14:55:17 2012 (r235183) @@ -284,16 +284,16 @@ sctp_print_key(sctp_key_t * key, const c uint32_t i; if (key == NULL) { - printf("%s: [Null key]\n", str); + SCTP_PRINTF("%s: [Null key]\n", str); return; } - printf("%s: len %u, ", str, key->keylen); + SCTP_PRINTF("%s: len %u, ", str, key->keylen); if (key->keylen) { for (i = 0; i < key->keylen; i++) - printf("%02x", key->key[i]); - printf("\n"); + SCTP_PRINTF("%02x", key->key[i]); + SCTP_PRINTF("\n"); } else { - printf("[Null key]\n"); + SCTP_PRINTF("[Null key]\n"); } } @@ -303,16 +303,16 @@ sctp_show_key(sctp_key_t * key, const ch uint32_t i; if (key == NULL) { - printf("%s: [Null key]\n", str); + SCTP_PRINTF("%s: [Null key]\n", str); return; } - printf("%s: len %u, ", str, key->keylen); + SCTP_PRINTF("%s: len %u, ", str, key->keylen); if (key->keylen) { for (i = 0; i < key->keylen; i++) - printf("%02x", key->key[i]); - printf("\n"); + SCTP_PRINTF("%02x", key->key[i]); + SCTP_PRINTF("\n"); } else { - printf("[Null key]\n"); + SCTP_PRINTF("[Null key]\n"); } } Modified: stable/8/sys/netinet/sctp_bsd_addr.c ============================================================================== --- stable/8/sys/netinet/sctp_bsd_addr.c Wed May 9 14:52:03 2012 (r235182) +++ stable/8/sys/netinet/sctp_bsd_addr.c Wed May 9 14:55:17 2012 (r235183) @@ -483,7 +483,7 @@ again_locked: } /* Sanity check */ if (thisend >= SCTP_PACKET_LOG_SIZE) { - printf("Insanity stops a log thisbegin:%d thisend:%d writers:%d lock:%d end:%d\n", + SCTP_PRINTF("Insanity stops a log thisbegin:%d thisend:%d writers:%d lock:%d end:%d\n", thisbegin, thisend, SCTP_BASE_VAR(packet_log_writers), Modified: stable/8/sys/netinet/sctp_cc_functions.c ============================================================================== --- stable/8/sys/netinet/sctp_cc_functions.c Wed May 9 14:52:03 2012 (r235182) +++ stable/8/sys/netinet/sctp_cc_functions.c Wed May 9 14:55:17 2012 (r235183) @@ -1594,9 +1594,7 @@ sctp_hs_cwnd_increase(struct sctp_tcb *s cur_val = net->cwnd >> 10; indx = SCTP_HS_TABLE_SIZE - 1; -#ifdef SCTP_DEBUG - printf("HS CC CAlled.\n"); -#endif + if (cur_val < sctp_cwnd_adjust[0].cwnd) { /* normal mode */ if (net->net_ack > net->mtu) { Modified: stable/8/sys/netinet/sctp_crc32.c ============================================================================== --- stable/8/sys/netinet/sctp_crc32.c Wed May 9 14:52:03 2012 (r235182) +++ stable/8/sys/netinet/sctp_crc32.c Wed May 9 14:55:17 2012 (r235183) @@ -134,7 +134,7 @@ sctp_delayed_cksum(struct mbuf *m, uint3 offset += offsetof(struct sctphdr, checksum); if (offset + sizeof(uint32_t) > (uint32_t) (m->m_len)) { - printf("sctp_delayed_cksum(): m->len: %d, off: %d.\n", + SCTP_PRINTF("sctp_delayed_cksum(): m->len: %d, off: %d.\n", (uint32_t) m->m_len, offset); /* * XXX this shouldn't happen, but if it does, the correct Modified: stable/8/sys/netinet/sctp_indata.c ============================================================================== --- stable/8/sys/netinet/sctp_indata.c Wed May 9 14:52:03 2012 (r235182) +++ stable/8/sys/netinet/sctp_indata.c Wed May 9 14:55:17 2012 (r235183) @@ -328,7 +328,7 @@ sctp_mark_non_revokable(struct sctp_asso } SCTP_CALC_TSN_TO_GAP(gap, tsn, asoc->mapping_array_base_tsn); if (!SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap)) { - printf("gap:%x tsn:%x\n", gap, tsn); + SCTP_PRINTF("gap:%x tsn:%x\n", gap, tsn); sctp_print_mapping_array(asoc); #ifdef INVARIANTS panic("Things are really messed up now!!"); @@ -2308,7 +2308,7 @@ sctp_slide_mapping_arrays(struct sctp_tc #ifdef INVARIANTS for (i = 0; i < asoc->mapping_array_size; i++) { if ((asoc->mapping_array[i]) || (asoc->nr_mapping_array[i])) { - printf("Error Mapping array's not clean at clear\n"); + SCTP_PRINTF("Error Mapping array's not clean at clear\n"); sctp_print_mapping_array(asoc); } } @@ -2330,7 +2330,7 @@ sctp_slide_mapping_arrays(struct sctp_tc #ifdef INVARIANTS panic("impossible slide"); #else - printf("impossible slide lgap:%x slide_end:%x slide_from:%x? at:%d\n", + SCTP_PRINTF("impossible slide lgap:%x slide_end:%x slide_from:%x? at:%d\n", lgap, slide_end, slide_from, at); return; #endif @@ -2339,7 +2339,7 @@ sctp_slide_mapping_arrays(struct sctp_tc #ifdef INVARIANTS panic("would overrun buffer"); #else - printf("Gak, would have overrun map end:%d slide_end:%d\n", + SCTP_PRINTF("Gak, would have overrun map end:%d slide_end:%d\n", asoc->mapping_array_size, slide_end); slide_end = asoc->mapping_array_size; #endif @@ -3489,7 +3489,10 @@ sctp_strike_gap_ack_chunks(struct sctp_t continue; } } - /* printf("OK, we are now ready to FR this guy\n"); */ + /* + * SCTP_PRINTF("OK, we are now ready to FR this + * guy\n"); + */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_FR_LOGGING_ENABLE) { sctp_log_fr(tp1->rec.data.TSN_seq, tp1->snd_count, 0, SCTP_FR_MARKED); @@ -3557,7 +3560,7 @@ sctp_strike_gap_ack_chunks(struct sctp_t tot_retrans++; /* mark the sending seq for possible subsequent FR's */ /* - * printf("Marking TSN for FR new value %x\n", + * SCTP_PRINTF("Marking TSN for FR new value %x\n", * (uint32_t)tpi->rec.data.TSN_seq); */ if (TAILQ_EMPTY(&asoc->send_queue)) { @@ -3709,11 +3712,10 @@ sctp_fs_audit(struct sctp_association *a TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) { if (chk->sent < SCTP_DATAGRAM_RESEND) { - printf("Chk TSN:%u size:%d inflight cnt:%d\n", + SCTP_PRINTF("Chk TSN:%u size:%d inflight cnt:%d\n", chk->rec.data.TSN_seq, chk->send_size, - chk->snd_count - ); + chk->snd_count); inflight++; } else if (chk->sent == SCTP_DATAGRAM_RESEND) { resend++; @@ -3730,7 +3732,7 @@ sctp_fs_audit(struct sctp_association *a #ifdef INVARIANTS panic("Flight size-express incorrect? \n"); #else - printf("asoc->total_flight:%d cnt:%d\n", + SCTP_PRINTF("asoc->total_flight:%d cnt:%d\n", entry_flight, entry_cnt); SCTP_PRINTF("Flight size-express incorrect F:%d I:%d R:%d Ab:%d ACK:%d\n", @@ -3895,7 +3897,7 @@ sctp_express_handle_sack(struct sctp_tcb TAILQ_FOREACH_SAFE(tp1, &asoc->sent_queue, sctp_next, tp2) { if (SCTP_TSN_GE(cumack, tp1->rec.data.TSN_seq)) { if (tp1->sent == SCTP_DATAGRAM_UNSENT) { - printf("Warning, an unsent is now acked?\n"); + SCTP_PRINTF("Warning, an unsent is now acked?\n"); } if (tp1->sent < SCTP_DATAGRAM_ACKED) { /* @@ -4437,10 +4439,10 @@ sctp_handle_sack(struct mbuf *m, int off * no way, we have not even sent this TSN out yet. * Peer is hopelessly messed up with us. */ - printf("NEW cum_ack:%x send_s:%x is smaller or equal\n", + SCTP_PRINTF("NEW cum_ack:%x send_s:%x is smaller or equal\n", cum_ack, send_s); if (tp1) { - printf("Got send_s from tsn:%x + 1 of tp1:%p\n", + SCTP_PRINTF("Got send_s from tsn:%x + 1 of tp1:%p\n", tp1->rec.data.TSN_seq, tp1); } hopeless_peer: @@ -4681,10 +4683,8 @@ sctp_handle_sack(struct mbuf *m, int off * peer is either confused or we are under * attack. We must abort. */ - printf("Hopeless peer! biggest_tsn_acked:%x largest seq:%x\n", - biggest_tsn_acked, - send_s); - + SCTP_PRINTF("Hopeless peer! biggest_tsn_acked:%x largest seq:%x\n", + biggest_tsn_acked, send_s); goto hopeless_peer; } } @@ -4719,7 +4719,7 @@ sctp_handle_sack(struct mbuf *m, int off } if (tp1->sent == SCTP_DATAGRAM_UNSENT) { /* no more sent on list */ - printf("Warning, tp1->sent == %d and its now acked?\n", + SCTP_PRINTF("Warning, tp1->sent == %d and its now acked?\n", tp1->sent); } TAILQ_REMOVE(&asoc->sent_queue, tp1, sctp_next); Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Wed May 9 14:52:03 2012 (r235182) +++ stable/8/sys/netinet/sctp_input.c Wed May 9 14:55:17 2012 (r235183) @@ -786,12 +786,12 @@ sctp_handle_abort(struct sctp_abort_chun sctp_abort_notification(stcb, 0, SCTP_SO_NOT_LOCKED); /* free the tcb */ #if defined(SCTP_PANIC_ON_ABORT) - printf("stcb:%p state:%d rport:%d net:%p\n", + SCTP_PRINTF("stcb:%p state:%d rport:%d net:%p\n", stcb, stcb->asoc.state, stcb->rport, net); if (!(stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) { panic("Received an ABORT"); } else { - printf("No panic its in state %x closed\n", stcb->asoc.state); + SCTP_PRINTF("No panic its in state %x closed\n", stcb->asoc.state); } #endif SCTP_STAT_INCR_COUNTER32(sctps_aborted); @@ -5792,9 +5792,9 @@ static void sctp_print_mbuf_chain(struct mbuf *m) { for (; m; m = SCTP_BUF_NEXT(m)) { - printf("%p: m_len = %ld\n", m, SCTP_BUF_LEN(m)); + SCTP_PRINTF("%p: m_len = %ld\n", m, SCTP_BUF_LEN(m)); if (SCTP_BUF_IS_EXTENDED(m)) - printf("%p: extend_size = %d\n", m, SCTP_BUF_EXTEND_SIZE(m)); + SCTP_PRINTF("%p: extend_size = %d\n", m, SCTP_BUF_EXTEND_SIZE(m)); } } Modified: stable/8/sys/netinet/sctp_os_bsd.h ============================================================================== --- stable/8/sys/netinet/sctp_os_bsd.h Wed May 9 14:52:03 2012 (r235182) +++ stable/8/sys/netinet/sctp_os_bsd.h Wed May 9 14:55:17 2012 (r235183) @@ -157,12 +157,13 @@ MALLOC_DECLARE(SCTP_M_MCORE); */ #define USER_ADDR_NULL (NULL) /* FIX ME: temp */ +#define SCTP_PRINTF(params...) printf(params) #if defined(SCTP_DEBUG) #define SCTPDBG(level, params...) \ { \ do { \ if (SCTP_BASE_SYSCTL(sctp_debug_on) & level ) { \ - printf(params); \ + SCTP_PRINTF(params); \ } \ } while (0); \ } @@ -187,7 +188,6 @@ MALLOC_DECLARE(SCTP_M_MCORE); #define SCTPDBG_ADDR(level, addr) #define SCTPDBG_PKT(level, iph, sh) #endif -#define SCTP_PRINTF(params...) printf(params) #ifdef SCTP_LTRACE_CHUNKS #define SCTP_LTRACE_CHK(a, b, c, d) if(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LTRACE_CHUNK_ENABLE) SCTP_CTR6(KTR_SUBSYS, "SCTP:%d[%d]:%x-%x-%x-%x", SCTP_LOG_CHUNK_PROC, 0, a, b, c, d) @@ -196,12 +196,14 @@ MALLOC_DECLARE(SCTP_M_MCORE); #endif #ifdef SCTP_LTRACE_ERRORS -#define SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, file, err) if(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LTRACE_ERROR_ENABLE) \ - printf("mbuf:%p inp:%p stcb:%p net:%p file:%x line:%d error:%d\n", \ - m, inp, stcb, net, file, __LINE__, err); -#define SCTP_LTRACE_ERR_RET(inp, stcb, net, file, err) if(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LTRACE_ERROR_ENABLE) \ - printf("inp:%p stcb:%p net:%p file:%x line:%d error:%d\n", \ - inp, stcb, net, file, __LINE__, err); +#define SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, file, err) \ + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LTRACE_ERROR_ENABLE) \ + SCTP_PRINTF("mbuf:%p inp:%p stcb:%p net:%p file:%x line:%d error:%d\n", \ + m, inp, stcb, net, file, __LINE__, err); +#define SCTP_LTRACE_ERR_RET(inp, stcb, net, file, err) \ + if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LTRACE_ERROR_ENABLE) \ + SCTP_PRINTF("inp:%p stcb:%p net:%p file:%x line:%d error:%d\n", \ + inp, stcb, net, file, __LINE__, err); #else #define SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, file, err) #define SCTP_LTRACE_ERR_RET(inp, stcb, net, file, err) Modified: stable/8/sys/netinet/sctp_output.c ============================================================================== --- stable/8/sys/netinet/sctp_output.c Wed May 9 14:52:03 2012 (r235182) +++ stable/8/sys/netinet/sctp_output.c Wed May 9 14:55:17 2012 (r235183) @@ -3062,7 +3062,7 @@ again_with_private_addresses_allowed: continue; } } else { - printf("Stcb is null - no print\n"); + SCTP_PRINTF("Stcb is null - no print\n"); } atomic_add_int(&sifa->refcount, 1); goto out; @@ -9493,7 +9493,7 @@ sctp_chunk_retransmission(struct sctp_in continue; } if (chk->data == NULL) { - printf("TSN:%x chk->snd_count:%d chk->sent:%d can't retran - no data\n", + SCTP_PRINTF("TSN:%x chk->snd_count:%d chk->sent:%d can't retran - no data\n", chk->rec.data.TSN_seq, chk->snd_count, chk->sent); continue; } @@ -13840,7 +13840,7 @@ out_unlocked: if (inp) { sctp_validate_no_locks(inp); } else { - printf("Warning - inp is NULL so cant validate locks\n"); + SCTP_PRINTF("Warning - inp is NULL so cant validate locks\n"); } #endif if (top) { Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Wed May 9 14:52:03 2012 (r235182) +++ stable/8/sys/netinet/sctp_pcb.c Wed May 9 14:55:17 2012 (r235183) @@ -2426,8 +2426,8 @@ sctp_findassociation_ep_asconf(struct mb stcb = sctp_findassoc_by_vtag(NULL, to, ntohl(sh->v_tag), inp_p, netp, sh->src_port, sh->dest_port, 1, vrf_id, 0); /* - * printf("findassociation_ep_asconf: zero lookup address - * finds stcb 0x%x\n", (uint32_t)stcb); + * SCTP_PRINTF("findassociation_ep_asconf: zero lookup + * address finds stcb 0x%x\n", (uint32_t)stcb); */ } else { stcb = sctp_findassociation_ep_addr(inp_p, @@ -5745,7 +5745,7 @@ skip_sleep: if (v6 == 0) { sctp_input_with_port(m, off, 0); } else { - printf("V6 not yet supported\n"); + SCTP_PRINTF("V6 not yet supported\n"); sctp_m_freem(m); } CURVNET_RESTORE(); @@ -6276,8 +6276,8 @@ sctp_load_addresses_from_init(struct sct ptype = ntohs(phdr->param_type); plen = ntohs(phdr->param_length); /* - * printf("ptype => %0x, plen => %d\n", (uint32_t)ptype, - * (int)plen); + * SCTP_PRINTF("ptype => %0x, plen => %d\n", + * (uint32_t)ptype, (int)plen); */ if (offset + plen > limit) { break; Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Wed May 9 14:52:03 2012 (r235182) +++ stable/8/sys/netinet/sctputil.c Wed May 9 14:55:17 2012 (r235183) @@ -1127,7 +1127,7 @@ sctp_print_mapping_array(struct sctp_ass { unsigned int i, limit; - printf("Mapping array size: %d, baseTSN: %8.8x, cumAck: %8.8x, highestTSN: (%8.8x, %8.8x).\n", + SCTP_PRINTF("Mapping array size: %d, baseTSN: %8.8x, cumAck: %8.8x, highestTSN: (%8.8x, %8.8x).\n", asoc->mapping_array_size, asoc->mapping_array_base_tsn, asoc->cumulative_tsn, @@ -1138,23 +1138,23 @@ sctp_print_mapping_array(struct sctp_ass break; } } - printf("Renegable mapping array (last %d entries are zero):\n", asoc->mapping_array_size - limit); + SCTP_PRINTF("Renegable mapping array (last %d entries are zero):\n", asoc->mapping_array_size - limit); for (i = 0; i < limit; i++) { - printf("%2.2x%c", asoc->mapping_array[i], ((i + 1) % 16) ? ' ' : '\n'); + SCTP_PRINTF("%2.2x%c", asoc->mapping_array[i], ((i + 1) % 16) ? ' ' : '\n'); } if (limit % 16) - printf("\n"); + SCTP_PRINTF("\n"); for (limit = asoc->mapping_array_size; limit > 1; limit--) { if (asoc->nr_mapping_array[limit - 1]) { break; } } - printf("Non renegable mapping array (last %d entries are zero):\n", asoc->mapping_array_size - limit); + SCTP_PRINTF("Non renegable mapping array (last %d entries are zero):\n", asoc->mapping_array_size - limit); for (i = 0; i < limit; i++) { - printf("%2.2x%c", asoc->nr_mapping_array[i], ((i + 1) % 16) ? ' ' : '\n'); + SCTP_PRINTF("%2.2x%c", asoc->nr_mapping_array[i], ((i + 1) % 16) ? ' ' : '\n'); } if (limit % 16) - printf("\n"); + SCTP_PRINTF("\n"); } int @@ -1292,7 +1292,7 @@ select_a_new_ep: goto no_stcb; } /* If we reach here huh? */ - printf("Unknown it ctl flag %x\n", + SCTP_PRINTF("Unknown it ctl flag %x\n", sctp_it_ctl.iterator_flags); sctp_it_ctl.iterator_flags = 0; } @@ -5392,7 +5392,7 @@ found_one: #ifdef INVARIANTS panic("refcnt already incremented"); #else - printf("refcnt already incremented?\n"); + SCTP_PRINTF("refcnt already incremented?\n"); #endif } else { atomic_add_int(&stcb->asoc.refcnt, 1); From owner-svn-src-stable-8@FreeBSD.ORG Wed May 9 14:58:20 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 373D6106564A; Wed, 9 May 2012 14:58:20 +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 21CB08FC12; Wed, 9 May 2012 14:58:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49EwJ8N088864; Wed, 9 May 2012 14:58:19 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49EwJvg088862; Wed, 9 May 2012 14:58:19 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091458.q49EwJvg088862@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 14:58:19 +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: r235184 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 14:58:20 -0000 Author: tuexen Date: Wed May 9 14:58:19 2012 New Revision: 235184 URL: http://svn.freebsd.org/changeset/base/235184 Log: MFC r234996: Call panic() only under INVARIANTS. Modified: stable/8/sys/netinet/sctp_crc32.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/sctp_crc32.c ============================================================================== --- stable/8/sys/netinet/sctp_crc32.c Wed May 9 14:55:17 2012 (r235183) +++ stable/8/sys/netinet/sctp_crc32.c Wed May 9 14:58:19 2012 (r235184) @@ -124,7 +124,9 @@ void sctp_delayed_cksum(struct mbuf *m, uint32_t offset) { #if defined(SCTP_WITH_NO_CSUM) +#ifdef INVARIANTS panic("sctp_delayed_cksum() called when using no SCTP CRC."); +#endif #else uint32_t checksum; From owner-svn-src-stable-8@FreeBSD.ORG Wed May 9 15:00:33 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC1011065754; Wed, 9 May 2012 15:00:33 +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 B17628FC16; Wed, 9 May 2012 15:00:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49F0XIk089003; Wed, 9 May 2012 15:00:33 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49F0Xiq089001; Wed, 9 May 2012 15:00:33 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091500.q49F0Xiq089001@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 15:00:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235185 - stable/8/lib/libc/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 15:00:34 -0000 Author: tuexen Date: Wed May 9 15:00:33 2012 New Revision: 235185 URL: http://svn.freebsd.org/changeset/base/235185 Log: MFC r234997: Remove debug output. Modified: stable/8/lib/libc/net/sctp_sys_calls.c Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/net/sctp_sys_calls.c ============================================================================== --- stable/8/lib/libc/net/sctp_sys_calls.c Wed May 9 14:58:19 2012 (r235184) +++ stable/8/lib/libc/net/sctp_sys_calls.c Wed May 9 15:00:33 2012 (r235185) @@ -797,7 +797,6 @@ continue_send: } sinfo->sinfo_assoc_id = sctp_getassocid(sd, addrs); if (sinfo->sinfo_assoc_id == 0) { - printf("Huh, can't get associd? TSNH!\n"); (void)setsockopt(sd, IPPROTO_SCTP, SCTP_CONNECT_X_COMPLETE, (void *)addrs, (socklen_t) addrs->sa_len); errno = ENOENT; From owner-svn-src-stable-8@FreeBSD.ORG Wed May 9 15:03:16 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D56CA106566C; Wed, 9 May 2012 15:03:16 +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 C010A8FC08; Wed, 9 May 2012 15:03:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49F3GEj089148; Wed, 9 May 2012 15:03:16 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49F3Gt1089144; Wed, 9 May 2012 15:03:16 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091503.q49F3Gt1089144@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 15:03:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235186 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 15:03:16 -0000 Author: tuexen Date: Wed May 9 15:03:16 2012 New Revision: 235186 URL: http://svn.freebsd.org/changeset/base/235186 Log: MFC r235009: Add support for SCTP_STREAM_CHANGE_EVENT, SCTP_ASSOC_RESET_EVENT as required by RFC 6525. This also fixes SCTP_STREAM_RESET_EVENT. Modified: stable/8/sys/netinet/sctp.h stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/sctp.h ============================================================================== --- stable/8/sys/netinet/sctp.h Wed May 9 15:00:33 2012 (r235185) +++ stable/8/sys/netinet/sctp.h Wed May 9 15:03:16 2012 (r235186) @@ -511,35 +511,37 @@ struct sctp_error_unrecognized_chunk { /* * PCB Features (in sctp_features bitmask) */ -#define SCTP_PCB_FLAGS_DO_NOT_PMTUD 0x00000001 -#define SCTP_PCB_FLAGS_EXT_RCVINFO 0x00000002 /* deprecated */ -#define SCTP_PCB_FLAGS_DONOT_HEARTBEAT 0x00000004 -#define SCTP_PCB_FLAGS_FRAG_INTERLEAVE 0x00000008 -#define SCTP_PCB_FLAGS_INTERLEAVE_STRMS 0x00000010 -#define SCTP_PCB_FLAGS_DO_ASCONF 0x00000020 -#define SCTP_PCB_FLAGS_AUTO_ASCONF 0x00000040 -#define SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE 0x00000080 +#define SCTP_PCB_FLAGS_DO_NOT_PMTUD 0x00000001 +#define SCTP_PCB_FLAGS_EXT_RCVINFO 0x00000002 /* deprecated */ +#define SCTP_PCB_FLAGS_DONOT_HEARTBEAT 0x00000004 +#define SCTP_PCB_FLAGS_FRAG_INTERLEAVE 0x00000008 +#define SCTP_PCB_FLAGS_INTERLEAVE_STRMS 0x00000010 +#define SCTP_PCB_FLAGS_DO_ASCONF 0x00000020 +#define SCTP_PCB_FLAGS_AUTO_ASCONF 0x00000040 +#define SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE 0x00000080 /* socket options */ -#define SCTP_PCB_FLAGS_NODELAY 0x00000100 -#define SCTP_PCB_FLAGS_AUTOCLOSE 0x00000200 -#define SCTP_PCB_FLAGS_RECVDATAIOEVNT 0x00000400 /* deprecated */ -#define SCTP_PCB_FLAGS_RECVASSOCEVNT 0x00000800 -#define SCTP_PCB_FLAGS_RECVPADDREVNT 0x00001000 -#define SCTP_PCB_FLAGS_RECVPEERERR 0x00002000 -#define SCTP_PCB_FLAGS_RECVSENDFAILEVNT 0x00004000 -#define SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT 0x00008000 -#define SCTP_PCB_FLAGS_ADAPTATIONEVNT 0x00010000 -#define SCTP_PCB_FLAGS_PDAPIEVNT 0x00020000 -#define SCTP_PCB_FLAGS_AUTHEVNT 0x00040000 -#define SCTP_PCB_FLAGS_STREAM_RESETEVNT 0x00080000 -#define SCTP_PCB_FLAGS_NO_FRAGMENT 0x00100000 -#define SCTP_PCB_FLAGS_EXPLICIT_EOR 0x00400000 -#define SCTP_PCB_FLAGS_NEEDS_MAPPED_V4 0x00800000 -#define SCTP_PCB_FLAGS_MULTIPLE_ASCONFS 0x01000000 -#define SCTP_PCB_FLAGS_PORTREUSE 0x02000000 -#define SCTP_PCB_FLAGS_DRYEVNT 0x04000000 -#define SCTP_PCB_FLAGS_RECVRCVINFO 0x08000000 -#define SCTP_PCB_FLAGS_RECVNXTINFO 0x10000000 +#define SCTP_PCB_FLAGS_NODELAY 0x00000100 +#define SCTP_PCB_FLAGS_AUTOCLOSE 0x00000200 +#define SCTP_PCB_FLAGS_RECVDATAIOEVNT 0x00000400 /* deprecated */ +#define SCTP_PCB_FLAGS_RECVASSOCEVNT 0x00000800 +#define SCTP_PCB_FLAGS_RECVPADDREVNT 0x00001000 +#define SCTP_PCB_FLAGS_RECVPEERERR 0x00002000 +#define SCTP_PCB_FLAGS_RECVSENDFAILEVNT 0x00004000 +#define SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT 0x00008000 +#define SCTP_PCB_FLAGS_ADAPTATIONEVNT 0x00010000 +#define SCTP_PCB_FLAGS_PDAPIEVNT 0x00020000 +#define SCTP_PCB_FLAGS_AUTHEVNT 0x00040000 +#define SCTP_PCB_FLAGS_STREAM_RESETEVNT 0x00080000 +#define SCTP_PCB_FLAGS_NO_FRAGMENT 0x00100000 +#define SCTP_PCB_FLAGS_EXPLICIT_EOR 0x00400000 +#define SCTP_PCB_FLAGS_NEEDS_MAPPED_V4 0x00800000 +#define SCTP_PCB_FLAGS_MULTIPLE_ASCONFS 0x01000000 +#define SCTP_PCB_FLAGS_PORTREUSE 0x02000000 +#define SCTP_PCB_FLAGS_DRYEVNT 0x04000000 +#define SCTP_PCB_FLAGS_RECVRCVINFO 0x08000000 +#define SCTP_PCB_FLAGS_RECVNXTINFO 0x10000000 +#define SCTP_PCB_FLAGS_ASSOC_RESETEVNT 0x20000000 +#define SCTP_PCB_FLAGS_STREAM_CHANGEEVNT 0x40000000 /*- * mobility_features parameters (by micchie).Note @@ -547,9 +549,9 @@ struct sctp_error_unrecognized_chunk { * sctp_mobility_features flags.. not the sctp_features * flags. */ -#define SCTP_MOBILITY_BASE 0x00000001 -#define SCTP_MOBILITY_FASTHANDOFF 0x00000002 -#define SCTP_MOBILITY_PRIM_DELETED 0x00000004 +#define SCTP_MOBILITY_BASE 0x00000001 +#define SCTP_MOBILITY_FASTHANDOFF 0x00000002 +#define SCTP_MOBILITY_PRIM_DELETED 0x00000004 #define SCTP_SMALLEST_PMTU 512 /* smallest pmtu allowed when disabling PMTU Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Wed May 9 15:00:33 2012 (r235185) +++ stable/8/sys/netinet/sctp_usrreq.c Wed May 9 15:03:16 2012 (r235186) @@ -2972,6 +2972,12 @@ flags_out: SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOTSUP); error = ENOTSUP; break; + case SCTP_ASSOC_RESET_EVENT: + event_type = SCTP_PCB_FLAGS_ASSOC_RESETEVNT; + break; + case SCTP_STREAM_CHANGE_EVENT: + event_type = SCTP_PCB_FLAGS_STREAM_CHANGEEVNT; + break; default: event_type = 0; SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); @@ -5347,6 +5353,12 @@ sctp_setopt(struct socket *so, int optna SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOTSUP); error = ENOTSUP; break; + case SCTP_ASSOC_RESET_EVENT: + event_type = SCTP_PCB_FLAGS_ASSOC_RESETEVNT; + break; + case SCTP_STREAM_CHANGE_EVENT: + event_type = SCTP_PCB_FLAGS_STREAM_CHANGEEVNT; + break; default: event_type = 0; SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Wed May 9 15:00:33 2012 (r235185) +++ stable/8/sys/netinet/sctputil.c Wed May 9 15:03:16 2012 (r235186) @@ -3214,7 +3214,7 @@ sctp_notify_stream_reset_add(struct sctp struct sctp_stream_change_event *stradd; int len; - if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_STREAM_RESETEVNT)) { + if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_STREAM_CHANGEEVNT)) { /* event not enabled */ return; } @@ -3275,7 +3275,7 @@ sctp_notify_stream_reset_tsn(struct sctp struct sctp_assoc_reset_event *strasoc; int len; - if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_STREAM_RESETEVNT)) { + if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_ASSOC_RESETEVNT)) { /* event not enabled */ return; } From owner-svn-src-stable-8@FreeBSD.ORG Wed May 9 15:06:08 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64F64106566B; Wed, 9 May 2012 15:06:08 +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 450948FC0A; Wed, 9 May 2012 15:06:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49F68xF089297; Wed, 9 May 2012 15:06:08 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49F68Ll089295; Wed, 9 May 2012 15:06:08 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091506.q49F68Ll089295@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 15:06:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235187 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 15:06:08 -0000 Author: tuexen Date: Wed May 9 15:06:07 2012 New Revision: 235187 URL: http://svn.freebsd.org/changeset/base/235187 Log: MFC r235021: Add support for the SCTP_ENABLE_STREAM_RESET socket option to getsockopt(). This improves the support of RFC 6525. Modified: stable/8/sys/netinet/sctp_usrreq.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Wed May 9 15:03:16 2012 (r235186) +++ stable/8/sys/netinet/sctp_usrreq.c Wed May 9 15:06:07 2012 (r235187) @@ -3285,6 +3285,33 @@ flags_out: } break; } + case SCTP_ENABLE_STREAM_RESET: + { + struct sctp_assoc_value *av; + + SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, *optsize); + SCTP_FIND_STCB(inp, stcb, av->assoc_id); + + if (stcb) { + av->assoc_value = (uint32_t) stcb->asoc.local_strreset_support; + SCTP_TCB_UNLOCK(stcb); + } else { + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) || + (av->assoc_id == SCTP_FUTURE_ASSOC)) { + SCTP_INP_RLOCK(inp); + av->assoc_value = (uint32_t) inp->local_strreset_support; + SCTP_INP_RUNLOCK(inp); + } else { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + error = EINVAL; + } + } + if (error == 0) { + *optsize = sizeof(struct sctp_assoc_value); + } + break; + } default: SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOPROTOOPT); error = ENOPROTOOPT; @@ -4085,7 +4112,6 @@ sctp_setopt(struct socket *so, int optna case SCTP_ENABLE_STREAM_RESET: { struct sctp_assoc_value *av; - uint8_t set_value = 0; SCTP_CHECK_AND_CAST(av, optval, struct sctp_assoc_value, optsize); if (av->assoc_value & (~SCTP_ENABLE_VALUE_MASK)) { @@ -4093,10 +4119,9 @@ sctp_setopt(struct socket *so, int optna error = EINVAL; break; } - set_value = av->assoc_value & SCTP_ENABLE_VALUE_MASK; SCTP_FIND_STCB(inp, stcb, av->assoc_id); if (stcb) { - stcb->asoc.local_strreset_support = set_value; + stcb->asoc.local_strreset_support = (uint8_t) av->assoc_value; SCTP_TCB_UNLOCK(stcb); } else { if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || @@ -4104,7 +4129,7 @@ sctp_setopt(struct socket *so, int optna (av->assoc_id == SCTP_FUTURE_ASSOC) || (av->assoc_id == SCTP_ALL_ASSOC)) { SCTP_INP_WLOCK(inp); - inp->local_strreset_support = set_value; + inp->local_strreset_support = (uint8_t) av->assoc_value; SCTP_INP_WUNLOCK(inp); } if ((av->assoc_id == SCTP_CURRENT_ASSOC) || @@ -4112,7 +4137,7 @@ sctp_setopt(struct socket *so, int optna SCTP_INP_RLOCK(inp); LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { SCTP_TCB_LOCK(stcb); - stcb->asoc.local_strreset_support = set_value; + stcb->asoc.local_strreset_support = (uint8_t) av->assoc_value; SCTP_TCB_UNLOCK(stcb); } SCTP_INP_RUNLOCK(inp); From owner-svn-src-stable-8@FreeBSD.ORG Wed May 9 15:09:13 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E8E9B1065674; Wed, 9 May 2012 15:09:13 +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 B9CF88FC16; Wed, 9 May 2012 15:09:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49F9DbS089478; Wed, 9 May 2012 15:09:13 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49F9Df6089476; Wed, 9 May 2012 15:09:13 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091509.q49F9Df6089476@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 15:09: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: r235188 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 15:09:14 -0000 Author: tuexen Date: Wed May 9 15:09:13 2012 New Revision: 235188 URL: http://svn.freebsd.org/changeset/base/235188 Log: MFC r235057: Do error checking for the SCTP_RESET_STREAMS, SCTP_RESET_ASSOC, and SCTP_ADD_STREAMS socket options as specified by RFC 6525. Modified: stable/8/sys/netinet/sctp_usrreq.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Wed May 9 15:06:07 2012 (r235187) +++ stable/8/sys/netinet/sctp_usrreq.c Wed May 9 15:09:13 2012 (r235188) @@ -4153,7 +4153,6 @@ sctp_setopt(struct socket *so, int optna SCTP_CHECK_AND_CAST(strrst, optval, struct sctp_reset_streams, optsize); SCTP_FIND_STCB(inp, stcb, strrst->srs_assoc_id); - if (stcb == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT); error = ENOENT; @@ -4168,15 +4167,6 @@ sctp_setopt(struct socket *so, int optna SCTP_TCB_UNLOCK(stcb); break; } - if (!(stcb->asoc.local_strreset_support & SCTP_ENABLE_RESET_STREAM_REQ)) { - /* - * User did not enable the operation. - */ - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EPERM); - error = EPERM; - SCTP_TCB_UNLOCK(stcb); - break; - } if (stcb->asoc.stream_reset_outstanding) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY); error = EALREADY; @@ -4235,6 +4225,21 @@ sctp_setopt(struct socket *so, int optna error = ENOENT; break; } + if (stcb->asoc.peer_supports_strreset == 0) { + /* + * Peer does not support the chunk type. + */ + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EOPNOTSUPP); + error = EOPNOTSUPP; + SCTP_TCB_UNLOCK(stcb); + break; + } + if (stcb->asoc.stream_reset_outstanding) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY); + error = EALREADY; + SCTP_TCB_UNLOCK(stcb); + break; + } if ((stradd->sas_outstrms == 0) && (stradd->sas_instrms == 0)) { error = EINVAL; @@ -4298,15 +4303,6 @@ sctp_setopt(struct socket *so, int optna SCTP_TCB_UNLOCK(stcb); break; } - if (!(stcb->asoc.local_strreset_support & SCTP_ENABLE_RESET_ASSOC_REQ)) { - /* - * User did not enable the operation. - */ - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EPERM); - error = EPERM; - SCTP_TCB_UNLOCK(stcb); - break; - } if (stcb->asoc.stream_reset_outstanding) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY); error = EALREADY; From owner-svn-src-stable-8@FreeBSD.ORG Wed May 9 15:11:48 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 117331065670; Wed, 9 May 2012 15:11:48 +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 EDE348FC1B; Wed, 9 May 2012 15:11:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49FBl4s089623; Wed, 9 May 2012 15:11:47 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49FBloF089620; Wed, 9 May 2012 15:11:47 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091511.q49FBloF089620@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 15:11:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235189 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 15:11:48 -0000 Author: tuexen Date: Wed May 9 15:11:47 2012 New Revision: 235189 URL: http://svn.freebsd.org/changeset/base/235189 Log: MFC r235064: Honor SCTP_ENABLE_STREAM_RESET socket option when processing incoming requests. Fix also the provided result in the response and use names as specified in RFC 6525. Modified: stable/8/sys/netinet/sctp_header.h stable/8/sys/netinet/sctp_input.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/sctp_header.h ============================================================================== --- stable/8/sys/netinet/sctp_header.h Wed May 9 15:09:13 2012 (r235188) +++ stable/8/sys/netinet/sctp_header.h Wed May 9 15:11:47 2012 (r235189) @@ -499,12 +499,13 @@ struct sctp_stream_reset_add_strm { uint16_t reserved; } SCTP_PACKED; -#define SCTP_STREAM_RESET_NOTHING 0x00000000 /* Nothing for me to do */ -#define SCTP_STREAM_RESET_PERFORMED 0x00000001 /* Did it */ -#define SCTP_STREAM_RESET_REJECT 0x00000002 /* refused to do it */ -#define SCTP_STREAM_RESET_ERROR_STR 0x00000003 /* bad Stream no */ -#define SCTP_STREAM_RESET_TRY_LATER 0x00000004 /* collision, try again */ -#define SCTP_STREAM_RESET_BAD_SEQNO 0x00000005 /* bad str-reset seq no */ +#define SCTP_STREAM_RESET_RESULT_NOTHING_TO_DO 0x00000000 /* XXX: unused */ +#define SCTP_STREAM_RESET_RESULT_PERFORMED 0x00000001 +#define SCTP_STREAM_RESET_RESULT_DENIED 0x00000002 +#define SCTP_STREAM_RESET_RESULT_ERR__WRONG_SSN 0x00000003 /* XXX: unused */ +#define SCTP_STREAM_RESET_RESULT_ERR_IN_PROGRESS 0x00000004 +#define SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO 0x00000005 +#define SCTP_STREAM_RESET_RESULT_IN_PROGRESS 0x00000006 /* XXX: unused */ /* * convience structures, note that if you are making a request for specific Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Wed May 9 15:09:13 2012 (r235188) +++ stable/8/sys/netinet/sctp_input.c Wed May 9 15:11:47 2012 (r235189) @@ -3599,7 +3599,7 @@ sctp_handle_stream_reset_response(struct asoc->stream_reset_out_is_outstanding = 0; if (asoc->stream_reset_outstanding) asoc->stream_reset_outstanding--; - if (action == SCTP_STREAM_RESET_PERFORMED) { + if (action == SCTP_STREAM_RESET_RESULT_PERFORMED) { /* do it */ sctp_reset_out_streams(stcb, number_entries, srparam->list_of_streams); } else { @@ -3610,7 +3610,7 @@ sctp_handle_stream_reset_response(struct number_entries = (lparm_len - sizeof(struct sctp_stream_reset_in_request)) / sizeof(uint16_t); if (asoc->stream_reset_outstanding) asoc->stream_reset_outstanding--; - if (action != SCTP_STREAM_RESET_PERFORMED) { + if (action != SCTP_STREAM_RESET_RESULT_PERFORMED) { sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_IN, stcb, number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); } @@ -3626,7 +3626,7 @@ sctp_handle_stream_reset_response(struct stcb->asoc.strm_pending_add_size = 0; if (asoc->stream_reset_outstanding) asoc->stream_reset_outstanding--; - if (action == SCTP_STREAM_RESET_PERFORMED) { + if (action == SCTP_STREAM_RESET_RESULT_PERFORMED) { /* Put the new streams into effect */ stcb->asoc.streamoutcnt += num_stream; sctp_notify_stream_reset_add(stcb, stcb->asoc.streamincnt, stcb->asoc.streamoutcnt, 0); @@ -3637,7 +3637,7 @@ sctp_handle_stream_reset_response(struct } else if (type == SCTP_STR_RESET_ADD_IN_STREAMS) { if (asoc->stream_reset_outstanding) asoc->stream_reset_outstanding--; - if (action != SCTP_STREAM_RESET_PERFORMED) { + if (action != SCTP_STREAM_RESET_RESULT_PERFORMED) { sctp_notify_stream_reset_add(stcb, stcb->asoc.streamincnt, stcb->asoc.streamoutcnt, SCTP_STREAM_CHANGED_DENIED); } @@ -3655,7 +3655,7 @@ sctp_handle_stream_reset_response(struct /* huh ? */ return (0); } - if (action == SCTP_STREAM_RESET_PERFORMED) { + if (action == SCTP_STREAM_RESET_RESULT_PERFORMED) { resp = (struct sctp_stream_reset_response_tsn *)respin; asoc->stream_reset_outstanding--; fwdtsn.ch.chunk_length = htons(sizeof(struct sctp_forward_tsn_chunk)); @@ -3714,10 +3714,12 @@ sctp_handle_str_reset_request_in(struct seq = ntohl(req->request_seq); if (asoc->str_reset_seq_in == seq) { - if (trunc) { + asoc->last_reset_action[1] = asoc->last_reset_action[0]; + if (!(asoc->local_strreset_support & SCTP_ENABLE_RESET_STREAM_REQ)) { + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; + } else if (trunc) { /* Can't do it, since they exceeded our buffer size */ - asoc->last_reset_action[1] = asoc->last_reset_action[0]; - asoc->last_reset_action[0] = SCTP_STREAM_RESET_REJECT; + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; } else if (stcb->asoc.stream_reset_out_is_outstanding == 0) { len = ntohs(req->ph.param_length); number_entries = ((len - sizeof(struct sctp_stream_reset_in_request)) / sizeof(uint16_t)); @@ -3725,9 +3727,7 @@ sctp_handle_str_reset_request_in(struct temp = ntohs(req->list_of_streams[i]); req->list_of_streams[i] = temp; } - /* move the reset action back one */ - asoc->last_reset_action[1] = asoc->last_reset_action[0]; - asoc->last_reset_action[0] = SCTP_STREAM_RESET_PERFORMED; + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED; sctp_add_stream_reset_out(chk, number_entries, req->list_of_streams, asoc->str_reset_seq_out, seq, (asoc->sending_seq - 1)); @@ -3737,8 +3737,7 @@ sctp_handle_str_reset_request_in(struct stcb->asoc.stream_reset_outstanding++; } else { /* Can't do it, since we have sent one out */ - asoc->last_reset_action[1] = asoc->last_reset_action[0]; - asoc->last_reset_action[0] = SCTP_STREAM_RESET_TRY_LATER; + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_ERR_IN_PROGRESS; } sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[0]); asoc->str_reset_seq_in++; @@ -3747,7 +3746,7 @@ sctp_handle_str_reset_request_in(struct } else if (asoc->str_reset_seq_in - 2 == seq) { sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[1]); } else { - sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_BAD_SEQNO); + sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO); } } @@ -3769,7 +3768,13 @@ sctp_handle_str_reset_request_tsn(struct seq = ntohl(req->request_seq); if (asoc->str_reset_seq_in == seq) { - fwdtsn.ch.chunk_length = htons(sizeof(struct sctp_forward_tsn_chunk)); + if (!(asoc->local_strreset_support & SCTP_ENABLE_CHANGE_ASSOC_REQ)) { + stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; + stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED; + + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; + } else + fwdtsn.ch.chunk_length = htons(sizeof(struct sctp_forward_tsn_chunk)); fwdtsn.ch.chunk_type = SCTP_FORWARD_CUM_TSN; fwdtsn.ch.chunk_flags = 0; fwdtsn.new_cumulative_tsn = htonl(stcb->asoc.highest_tsn_inside_map + 1); @@ -3777,45 +3782,41 @@ sctp_handle_str_reset_request_tsn(struct if (abort_flag) { return (1); } - stcb->asoc.highest_tsn_inside_map += SCTP_STREAM_RESET_TSN_DELTA; + asoc->highest_tsn_inside_map += SCTP_STREAM_RESET_TSN_DELTA; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) { sctp_log_map(0, 10, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT); } - stcb->asoc.tsn_last_delivered = stcb->asoc.cumulative_tsn = stcb->asoc.highest_tsn_inside_map; - stcb->asoc.mapping_array_base_tsn = stcb->asoc.highest_tsn_inside_map + 1; - memset(stcb->asoc.mapping_array, 0, stcb->asoc.mapping_array_size); - stcb->asoc.highest_tsn_inside_nr_map = stcb->asoc.highest_tsn_inside_map; - memset(stcb->asoc.nr_mapping_array, 0, stcb->asoc.mapping_array_size); - atomic_add_int(&stcb->asoc.sending_seq, 1); + asoc->tsn_last_delivered = asoc->cumulative_tsn = asoc->highest_tsn_inside_map; + asoc->mapping_array_base_tsn = asoc->highest_tsn_inside_map + 1; + memset(asoc->mapping_array, 0, asoc->mapping_array_size); + asoc->highest_tsn_inside_nr_map = asoc->highest_tsn_inside_map; + memset(asoc->nr_mapping_array, 0, asoc->mapping_array_size); + atomic_add_int(&asoc->sending_seq, 1); /* save off historical data for retrans */ - stcb->asoc.last_sending_seq[1] = stcb->asoc.last_sending_seq[0]; - stcb->asoc.last_sending_seq[0] = stcb->asoc.sending_seq; - stcb->asoc.last_base_tsnsent[1] = stcb->asoc.last_base_tsnsent[0]; - stcb->asoc.last_base_tsnsent[0] = stcb->asoc.mapping_array_base_tsn; + asoc->last_sending_seq[1] = asoc->last_sending_seq[0]; + asoc->last_sending_seq[0] = asoc->sending_seq; + asoc->last_base_tsnsent[1] = asoc->last_base_tsnsent[0]; + asoc->last_base_tsnsent[0] = asoc->mapping_array_base_tsn; sctp_add_stream_reset_result_tsn(chk, ntohl(req->request_seq), - SCTP_STREAM_RESET_PERFORMED, - stcb->asoc.sending_seq, - stcb->asoc.mapping_array_base_tsn); + SCTP_STREAM_RESET_RESULT_PERFORMED, + asoc->sending_seq, + asoc->mapping_array_base_tsn); sctp_reset_out_streams(stcb, 0, (uint16_t *) NULL); sctp_reset_in_stream(stcb, 0, (uint16_t *) NULL); - stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; - stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_PERFORMED; - sctp_notify_stream_reset_tsn(stcb, stcb->asoc.sending_seq, (stcb->asoc.mapping_array_base_tsn + 1), 0); + asoc->last_reset_action[1] = asoc->last_reset_action[0]; + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED; + sctp_notify_stream_reset_tsn(stcb, asoc->sending_seq, (asoc->mapping_array_base_tsn + 1), 0); asoc->str_reset_seq_in++; } else if (asoc->str_reset_seq_in - 1 == seq) { sctp_add_stream_reset_result_tsn(chk, seq, asoc->last_reset_action[0], - stcb->asoc.last_sending_seq[0], - stcb->asoc.last_base_tsnsent[0] - ); + asoc->last_sending_seq[0], asoc->last_base_tsnsent[0]); } else if (asoc->str_reset_seq_in - 2 == seq) { sctp_add_stream_reset_result_tsn(chk, seq, asoc->last_reset_action[1], - stcb->asoc.last_sending_seq[1], - stcb->asoc.last_base_tsnsent[1] - ); + asoc->last_sending_seq[1], asoc->last_base_tsnsent[1]); } else { - sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_BAD_SEQNO); + sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO); } return (0); } @@ -3846,12 +3847,14 @@ sctp_handle_str_reset_request_out(struct /* move the reset action back one */ asoc->last_reset_action[1] = asoc->last_reset_action[0]; - if (trunc) { - asoc->last_reset_action[0] = SCTP_STREAM_RESET_REJECT; + if (!(asoc->local_strreset_support & SCTP_ENABLE_RESET_STREAM_REQ)) { + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; + } else if (trunc) { + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; } else if (SCTP_TSN_GE(asoc->cumulative_tsn, tsn)) { /* we can do it now */ sctp_reset_in_stream(stcb, number_entries, req->list_of_streams); - asoc->last_reset_action[0] = SCTP_STREAM_RESET_PERFORMED; + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED; } else { /* * we must queue it up and thus wait for the TSN's @@ -3865,8 +3868,8 @@ sctp_handle_str_reset_request_out(struct siz, SCTP_M_STRESET); if (liste == NULL) { /* gak out of memory */ - sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_REJECT); - asoc->last_reset_action[0] = SCTP_STREAM_RESET_REJECT; + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; + sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[0]); return; } liste->tsn = tsn; @@ -3874,7 +3877,7 @@ sctp_handle_str_reset_request_out(struct memcpy(&liste->req, req, (sizeof(struct sctp_stream_reset_out_request) + (number_entries * sizeof(uint16_t)))); TAILQ_INSERT_TAIL(&asoc->resetHead, liste, next_resp); - asoc->last_reset_action[0] = SCTP_STREAM_RESET_PERFORMED; + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED; } sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[0]); asoc->str_reset_seq_in++; @@ -3891,7 +3894,7 @@ sctp_handle_str_reset_request_out(struct */ sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[1]); } else { - sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_BAD_SEQNO); + sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO); } } @@ -3914,12 +3917,14 @@ sctp_handle_str_reset_add_strm(struct sc /* Now what would be the new total? */ if (asoc->str_reset_seq_in == seq) { num_stream += stcb->asoc.streamincnt; - if ((num_stream > stcb->asoc.max_inbound_streams) || + stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; + if (!(asoc->local_strreset_support & SCTP_ENABLE_CHANGE_ASSOC_REQ)) { + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; + } else if ((num_stream > stcb->asoc.max_inbound_streams) || (num_stream > 0xffff)) { /* We must reject it they ask for to many */ denied: - stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; - stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_REJECT; + stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; } else { /* Ok, we can do that :-) */ struct sctp_stream_in *oldstrm; @@ -3955,8 +3960,7 @@ sctp_handle_str_reset_add_strm(struct sc SCTP_FREE(oldstrm, SCTP_M_STRMI); /* update the size */ stcb->asoc.streamincnt = num_stream; - stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; - stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_PERFORMED; + stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED; sctp_notify_stream_reset_add(stcb, stcb->asoc.streamincnt, stcb->asoc.streamoutcnt, 0); } sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[0]); @@ -3974,7 +3978,7 @@ sctp_handle_str_reset_add_strm(struct sc */ sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[1]); } else { - sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_BAD_SEQNO); + sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO); } } @@ -3996,10 +4000,12 @@ sctp_handle_str_reset_add_out_strm(struc num_stream = ntohs(str_add->number_of_streams); /* Now what would be the new total? */ if (asoc->str_reset_seq_in == seq) { - if (stcb->asoc.stream_reset_outstanding) { + stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; + if (!(asoc->local_strreset_support & SCTP_ENABLE_CHANGE_ASSOC_REQ)) { + asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; + } else if (stcb->asoc.stream_reset_outstanding) { /* We must reject it we have something pending */ - stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; - stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_REJECT; + stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_RESULT_ERR_IN_PROGRESS; } else { /* Ok, we can do that :-) */ int mychk; @@ -4007,14 +4013,12 @@ sctp_handle_str_reset_add_out_strm(struc mychk = stcb->asoc.streamoutcnt; mychk += num_stream; if (mychk < 0x10000) { - stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; - stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_PERFORMED; + stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED; if (sctp_send_str_reset_req(stcb, 0, NULL, 0, 0, 0, 1, num_stream, 0, 1)) { - stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_REJECT; + stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; } } else { - stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; - stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_REJECT; + stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; } } sctp_add_stream_reset_result(chk, seq, stcb->asoc.last_reset_action[0]); @@ -4032,7 +4036,7 @@ sctp_handle_str_reset_add_out_strm(struc */ sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[1]); } else { - sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_BAD_SEQNO); + sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO); } } @@ -4046,7 +4050,6 @@ __attribute__((noinline)) int chk_length, param_len, ptype; struct sctp_paramhdr pstore; uint8_t cstore[SCTP_CHUNK_BUFFER_SIZE]; - uint32_t seq = 0; int num_req = 0; int trunc = 0; @@ -4124,7 +4127,7 @@ strres_nochunk: seq = ntohl(req_out->response_seq); if (seq == stcb->asoc.str_reset_seq_out) { /* implicit ack */ - (void)sctp_handle_stream_reset_response(stcb, seq, SCTP_STREAM_RESET_PERFORMED, NULL); + (void)sctp_handle_stream_reset_response(stcb, seq, SCTP_STREAM_RESET_RESULT_PERFORMED, NULL); } } sctp_handle_str_reset_request_out(stcb, chk, req_out, trunc); From owner-svn-src-stable-8@FreeBSD.ORG Wed May 9 15:15:14 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3CB80106564A; Wed, 9 May 2012 15:15:14 +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 2671C8FC18; Wed, 9 May 2012 15:15:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49FFEGm089782; Wed, 9 May 2012 15:15:14 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49FFDxn089777; Wed, 9 May 2012 15:15:13 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091515.q49FFDxn089777@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 15:15: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: r235190 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 15:15:14 -0000 Author: tuexen Date: Wed May 9 15:15:13 2012 New Revision: 235190 URL: http://svn.freebsd.org/changeset/base/235190 Log: MFC r235066: Provide the flags in the SCTP stream reconfig related notification as specified in RFC 6525. Modified: stable/8/sys/netinet/sctp_constants.h stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_uio.h stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/sctp_constants.h ============================================================================== --- stable/8/sys/netinet/sctp_constants.h Wed May 9 15:11:47 2012 (r235189) +++ stable/8/sys/netinet/sctp_constants.h Wed May 9 15:15:13 2012 (r235190) @@ -779,10 +779,9 @@ __FBSDID("$FreeBSD$"); #define SCTP_NOTIFY_SPECIAL_SP_FAIL 27 #define SCTP_NOTIFY_NO_PEER_AUTH 28 #define SCTP_NOTIFY_SENDER_DRY 29 -#define SCTP_NOTIFY_STR_RESET_ADD_OK 30 -#define SCTP_NOTIFY_STR_RESET_ADD_FAIL 31 -#define SCTP_NOTIFY_STR_RESET_INSTREAM_ADD_OK 32 -#define SCTP_NOTIFY_MAX 32 +#define SCTP_NOTIFY_STR_RESET_DENIED_OUT 30 +#define SCTP_NOTIFY_STR_RESET_DENIED_IN 31 +#define SCTP_NOTIFY_MAX 31 /* This is the value for messages that are NOT completely Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Wed May 9 15:11:47 2012 (r235189) +++ stable/8/sys/netinet/sctp_input.c Wed May 9 15:15:13 2012 (r235190) @@ -3602,6 +3602,8 @@ sctp_handle_stream_reset_response(struct if (action == SCTP_STREAM_RESET_RESULT_PERFORMED) { /* do it */ sctp_reset_out_streams(stcb, number_entries, srparam->list_of_streams); + } else if (action == SCTP_STREAM_RESET_RESULT_DENIED) { + sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_DENIED_OUT, stcb, number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); } else { sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_OUT, stcb, number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); } @@ -3610,7 +3612,10 @@ sctp_handle_stream_reset_response(struct number_entries = (lparm_len - sizeof(struct sctp_stream_reset_in_request)) / sizeof(uint16_t); if (asoc->stream_reset_outstanding) asoc->stream_reset_outstanding--; - if (action != SCTP_STREAM_RESET_RESULT_PERFORMED) { + if (action == SCTP_STREAM_RESET_RESULT_DENIED) { + sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_DENIED_IN, stcb, + number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); + } else if (action != SCTP_STREAM_RESET_RESULT_PERFORMED) { sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_IN, stcb, number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); } @@ -3630,16 +3635,22 @@ sctp_handle_stream_reset_response(struct /* Put the new streams into effect */ stcb->asoc.streamoutcnt += num_stream; sctp_notify_stream_reset_add(stcb, stcb->asoc.streamincnt, stcb->asoc.streamoutcnt, 0); + } else if (action == SCTP_STREAM_RESET_RESULT_DENIED) { + sctp_notify_stream_reset_add(stcb, stcb->asoc.streamincnt, stcb->asoc.streamoutcnt, + SCTP_STREAM_CHANGE_DENIED); } else { sctp_notify_stream_reset_add(stcb, stcb->asoc.streamincnt, stcb->asoc.streamoutcnt, - SCTP_STREAM_CHANGED_DENIED); + SCTP_STREAM_CHANGE_FAILED); } } else if (type == SCTP_STR_RESET_ADD_IN_STREAMS) { if (asoc->stream_reset_outstanding) asoc->stream_reset_outstanding--; - if (action != SCTP_STREAM_RESET_RESULT_PERFORMED) { + if (action == SCTP_STREAM_RESET_RESULT_DENIED) { sctp_notify_stream_reset_add(stcb, stcb->asoc.streamincnt, stcb->asoc.streamoutcnt, - SCTP_STREAM_CHANGED_DENIED); + SCTP_STREAM_CHANGE_DENIED); + } else if (action != SCTP_STREAM_RESET_RESULT_PERFORMED) { + sctp_notify_stream_reset_add(stcb, stcb->asoc.streamincnt, stcb->asoc.streamoutcnt, + SCTP_STREAM_CHANGE_FAILED); } } else if (type == SCTP_STR_RESET_TSN_REQUEST) { /** @@ -3682,9 +3693,12 @@ sctp_handle_stream_reset_response(struct sctp_reset_out_streams(stcb, 0, (uint16_t *) NULL); sctp_reset_in_stream(stcb, 0, (uint16_t *) NULL); sctp_notify_stream_reset_tsn(stcb, stcb->asoc.sending_seq, (stcb->asoc.mapping_array_base_tsn + 1), 0); + } else if (action == SCTP_STREAM_RESET_RESULT_DENIED) { + sctp_notify_stream_reset_tsn(stcb, stcb->asoc.sending_seq, (stcb->asoc.mapping_array_base_tsn + 1), + SCTP_ASSOC_RESET_DENIED); } else { sctp_notify_stream_reset_tsn(stcb, stcb->asoc.sending_seq, (stcb->asoc.mapping_array_base_tsn + 1), - SCTP_STREAM_RESET_FAILED); + SCTP_ASSOC_RESET_FAILED); } } /* get rid of the request and get the request flags */ Modified: stable/8/sys/netinet/sctp_uio.h ============================================================================== --- stable/8/sys/netinet/sctp_uio.h Wed May 9 15:11:47 2012 (r235189) +++ stable/8/sys/netinet/sctp_uio.h Wed May 9 15:15:13 2012 (r235190) @@ -454,7 +454,6 @@ struct sctp_stream_reset_event { #define SCTP_STREAM_RESET_OUTGOING_SSN 0x0002 #define SCTP_STREAM_RESET_DENIED 0x0004 #define SCTP_STREAM_RESET_FAILED 0x0008 -#define SCTP_STREAM_CHANGED_DENIED 0x0010 /* * Assoc reset event - subscribe to SCTP_ASSOC_RESET_EVENT Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Wed May 9 15:11:47 2012 (r235189) +++ stable/8/sys/netinet/sctputil.c Wed May 9 15:15:13 2012 (r235190) @@ -3507,10 +3507,18 @@ sctp_ulp_notify(uint32_t notification, s sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), (SCTP_STREAM_RESET_OUTGOING_SSN | SCTP_STREAM_RESET_FAILED)); break; + case SCTP_NOTIFY_STR_RESET_DENIED_OUT: + sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), + (SCTP_STREAM_RESET_OUTGOING_SSN | SCTP_STREAM_RESET_DENIED)); + break; case SCTP_NOTIFY_STR_RESET_FAILED_IN: sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), (SCTP_STREAM_RESET_INCOMING | SCTP_STREAM_RESET_FAILED)); break; + case SCTP_NOTIFY_STR_RESET_DENIED_IN: + sctp_notify_stream_reset(stcb, error, ((uint16_t *) data), + (SCTP_STREAM_RESET_INCOMING | SCTP_STREAM_RESET_DENIED)); + break; case SCTP_NOTIFY_ASCONF_ADD_IP: sctp_notify_peer_addr_change(stcb, SCTP_ADDR_ADDED, data, error); From owner-svn-src-stable-8@FreeBSD.ORG Wed May 9 15:16:39 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8605F106566B; Wed, 9 May 2012 15:16:39 +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 65D978FC14; Wed, 9 May 2012 15:16:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49FGdK0089895; Wed, 9 May 2012 15:16:39 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49FGdaL089889; Wed, 9 May 2012 15:16:39 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201205091516.q49FGdaL089889@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 9 May 2012 15:16: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: r235191 - in stable/8: lib/libc/gen libexec/rtld-elf sys/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 15:16:39 -0000 Author: kib Date: Wed May 9 15:16:38 2012 New Revision: 235191 URL: http://svn.freebsd.org/changeset/base/235191 Log: MFC r211705: Introduce implementation-private rtld interface _rtld_addr_phdr, which fills struct dl_phdr_info for the shared object that contains the specified address, if any. Requested and tested by: Peter Jeremy Modified: stable/8/lib/libc/gen/Symbol.map stable/8/lib/libc/gen/dlfcn.c stable/8/libexec/rtld-elf/Symbol.map stable/8/libexec/rtld-elf/rtld.c stable/8/sys/sys/link_elf.h Directory Properties: stable/8/lib/libc/ (props changed) stable/8/libexec/rtld-elf/ (props changed) stable/8/sys/ (props changed) Modified: stable/8/lib/libc/gen/Symbol.map ============================================================================== --- stable/8/lib/libc/gen/Symbol.map Wed May 9 15:15:13 2012 (r235190) +++ stable/8/lib/libc/gen/Symbol.map Wed May 9 15:16:38 2012 (r235191) @@ -440,6 +440,7 @@ FBSDprivate_1.0 { _spinlock; _spinlock_debug; _spinunlock; + _rtld_addr_phdr; _rtld_atfork_pre; _rtld_atfork_post; _rtld_error; /* for private use */ Modified: stable/8/lib/libc/gen/dlfcn.c ============================================================================== --- stable/8/lib/libc/gen/dlfcn.c Wed May 9 15:15:13 2012 (r235190) +++ stable/8/lib/libc/gen/dlfcn.c Wed May 9 15:16:38 2012 (r235191) @@ -157,3 +157,11 @@ void _rtld_atfork_post(int *locks) { } + +#pragma weak _rtld_addr_phdr +int +_rtld_addr_phdr(const void *addr, struct dl_phdr_info *phdr_info) +{ + + return (0); +} Modified: stable/8/libexec/rtld-elf/Symbol.map ============================================================================== --- stable/8/libexec/rtld-elf/Symbol.map Wed May 9 15:15:13 2012 (r235190) +++ stable/8/libexec/rtld-elf/Symbol.map Wed May 9 15:16:38 2012 (r235191) @@ -24,4 +24,5 @@ FBSDprivate_1.0 { _rtld_free_tls; _rtld_atfork_pre; _rtld_atfork_post; + _rtld_addr_phdr; }; Modified: stable/8/libexec/rtld-elf/rtld.c ============================================================================== --- stable/8/libexec/rtld-elf/rtld.c Wed May 9 15:15:13 2012 (r235190) +++ stable/8/libexec/rtld-elf/rtld.c Wed May 9 15:16:38 2012 (r235191) @@ -143,6 +143,8 @@ static int rtld_verify_object_versions( static void object_add_name(Obj_Entry *, const char *); static int object_match_name(const Obj_Entry *, const char *); static void ld_utrace_log(int, void *, void *, size_t, int, const char *); +static void rtld_fill_dl_phdr_info(const Obj_Entry *obj, + struct dl_phdr_info *phdr_info); void r_debug_state(struct r_debug *, struct link_map *); @@ -214,6 +216,7 @@ static func_ptr_type exports[] = { (func_ptr_type) &dl_iterate_phdr, (func_ptr_type) &_rtld_atfork_pre, (func_ptr_type) &_rtld_atfork_post, + (func_ptr_type) &_rtld_addr_phdr, NULL }; @@ -2266,6 +2269,24 @@ dlvsym(void *handle, const char *name, c } int +_rtld_addr_phdr(const void *addr, struct dl_phdr_info *phdr_info) +{ + const Obj_Entry *obj; + int lockstate; + + lockstate = rlock_acquire(rtld_bind_lock); + obj = obj_from_addr(addr); + if (obj == NULL) { + _rtld_error("No shared object contains address"); + rlock_release(rtld_bind_lock, lockstate); + return (0); + } + rtld_fill_dl_phdr_info(obj, phdr_info); + rlock_release(rtld_bind_lock, lockstate); + return (1); +} + +int dladdr(const void *addr, Dl_info *info) { const Obj_Entry *obj; @@ -2367,6 +2388,21 @@ dlinfo(void *handle, int request, void * return (error); } +static void +rtld_fill_dl_phdr_info(const Obj_Entry *obj, struct dl_phdr_info *phdr_info) +{ + + phdr_info->dlpi_addr = (Elf_Addr)obj->relocbase; + phdr_info->dlpi_name = STAILQ_FIRST(&obj->names) ? + STAILQ_FIRST(&obj->names)->name : obj->path; + phdr_info->dlpi_phdr = obj->phdr; + phdr_info->dlpi_phnum = obj->phsize / sizeof(obj->phdr[0]); + phdr_info->dlpi_tls_modid = obj->tlsindex; + phdr_info->dlpi_tls_data = obj->tlsinit; + phdr_info->dlpi_adds = obj_loads; + phdr_info->dlpi_subs = obj_loads - obj_count; +} + int dl_iterate_phdr(__dl_iterate_hdr_callback callback, void *param) { @@ -2380,16 +2416,7 @@ dl_iterate_phdr(__dl_iterate_hdr_callbac error = 0; for (obj = obj_list; obj != NULL; obj = obj->next) { - phdr_info.dlpi_addr = (Elf_Addr)obj->relocbase; - phdr_info.dlpi_name = STAILQ_FIRST(&obj->names) ? - STAILQ_FIRST(&obj->names)->name : obj->path; - phdr_info.dlpi_phdr = obj->phdr; - phdr_info.dlpi_phnum = obj->phsize / sizeof(obj->phdr[0]); - phdr_info.dlpi_tls_modid = obj->tlsindex; - phdr_info.dlpi_tls_data = obj->tlsinit; - phdr_info.dlpi_adds = obj_loads; - phdr_info.dlpi_subs = obj_loads - obj_count; - + rtld_fill_dl_phdr_info(obj, &phdr_info); if ((error = callback(&phdr_info, sizeof phdr_info, param)) != 0) break; Modified: stable/8/sys/sys/link_elf.h ============================================================================== --- stable/8/sys/sys/link_elf.h Wed May 9 15:15:13 2012 (r235190) +++ stable/8/sys/sys/link_elf.h Wed May 9 15:16:38 2012 (r235191) @@ -92,6 +92,7 @@ __BEGIN_DECLS typedef int (*__dl_iterate_hdr_callback)(struct dl_phdr_info *, size_t, void *); extern int dl_iterate_phdr(__dl_iterate_hdr_callback, void *); +int _rtld_addr_phdr(const void *, struct dl_phdr_info *); __END_DECLS From owner-svn-src-stable-8@FreeBSD.ORG Wed May 9 15:18:55 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91727106564A; Wed, 9 May 2012 15:18:55 +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 724A58FC0A; Wed, 9 May 2012 15:18:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49FIt7P090033; Wed, 9 May 2012 15:18:55 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49FItJX090028; Wed, 9 May 2012 15:18:55 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091518.q49FItJX090028@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 15:18:55 +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: r235192 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 15:18:55 -0000 Author: tuexen Date: Wed May 9 15:18:54 2012 New Revision: 235192 URL: http://svn.freebsd.org/changeset/base/235192 Log: MFC r235075: Add support for SCTP_SEND_FAILED_EVENT as required by RFC 6458. Modified: stable/8/sys/netinet/sctp.h stable/8/sys/netinet/sctp_uio.h stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/sctp.h ============================================================================== --- stable/8/sys/netinet/sctp.h Wed May 9 15:16:38 2012 (r235191) +++ stable/8/sys/netinet/sctp.h Wed May 9 15:18:54 2012 (r235192) @@ -526,7 +526,7 @@ struct sctp_error_unrecognized_chunk { #define SCTP_PCB_FLAGS_RECVASSOCEVNT 0x00000800 #define SCTP_PCB_FLAGS_RECVPADDREVNT 0x00001000 #define SCTP_PCB_FLAGS_RECVPEERERR 0x00002000 -#define SCTP_PCB_FLAGS_RECVSENDFAILEVNT 0x00004000 +#define SCTP_PCB_FLAGS_RECVSENDFAILEVNT 0x00004000 /* deprecated */ #define SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT 0x00008000 #define SCTP_PCB_FLAGS_ADAPTATIONEVNT 0x00010000 #define SCTP_PCB_FLAGS_PDAPIEVNT 0x00020000 @@ -542,6 +542,7 @@ struct sctp_error_unrecognized_chunk { #define SCTP_PCB_FLAGS_RECVNXTINFO 0x10000000 #define SCTP_PCB_FLAGS_ASSOC_RESETEVNT 0x20000000 #define SCTP_PCB_FLAGS_STREAM_CHANGEEVNT 0x40000000 +#define SCTP_PCB_FLAGS_RECVNSENDFAILEVNT 0x80000000 /*- * mobility_features parameters (by micchie).Note Modified: stable/8/sys/netinet/sctp_uio.h ============================================================================== --- stable/8/sys/netinet/sctp_uio.h Wed May 9 15:16:38 2012 (r235191) +++ stable/8/sys/netinet/sctp_uio.h Wed May 9 15:18:54 2012 (r235192) @@ -343,7 +343,7 @@ struct sctp_remote_error { uint8_t sre_data[4]; }; -/* data send failure event */ +/* data send failure event (deprecated) */ struct sctp_send_failed { uint16_t ssf_type; uint16_t ssf_flags; @@ -354,6 +354,17 @@ struct sctp_send_failed { uint8_t ssf_data[]; }; +/* data send failure event (not deprecated) */ +struct sctp_send_failed_event { + uint16_t ssfe_type; + uint16_t ssfe_flags; + uint32_t ssfe_length; + uint32_t ssfe_error; + struct sctp_sndinfo ssfe_info; + sctp_assoc_t ssfe_assoc_id; + uint8_t ssfe_data[]; +}; + /* flag that indicates state of data */ #define SCTP_DATA_UNSENT 0x0001 /* inqueue never on wire */ #define SCTP_DATA_SENT 0x0002 /* on wire at failure */ @@ -513,22 +524,22 @@ union sctp_notification { }; /* notification types */ -#define SCTP_ASSOC_CHANGE 0x0001 -#define SCTP_PEER_ADDR_CHANGE 0x0002 -#define SCTP_REMOTE_ERROR 0x0003 -#define SCTP_SEND_FAILED 0x0004 -#define SCTP_SHUTDOWN_EVENT 0x0005 -#define SCTP_ADAPTATION_INDICATION 0x0006 +#define SCTP_ASSOC_CHANGE 0x0001 +#define SCTP_PEER_ADDR_CHANGE 0x0002 +#define SCTP_REMOTE_ERROR 0x0003 +#define SCTP_SEND_FAILED 0x0004 +#define SCTP_SHUTDOWN_EVENT 0x0005 +#define SCTP_ADAPTATION_INDICATION 0x0006 /* same as above */ -#define SCTP_ADAPTION_INDICATION 0x0006 -#define SCTP_PARTIAL_DELIVERY_EVENT 0x0007 -#define SCTP_AUTHENTICATION_EVENT 0x0008 -#define SCTP_STREAM_RESET_EVENT 0x0009 -#define SCTP_SENDER_DRY_EVENT 0x000a -#define SCTP_NOTIFICATIONS_STOPPED_EVENT 0x000b /* we don't send this */ -#define SCTP_ASSOC_RESET_EVENT 0x000c -#define SCTP_STREAM_CHANGE_EVENT 0x000d - +#define SCTP_ADAPTION_INDICATION 0x0006 +#define SCTP_PARTIAL_DELIVERY_EVENT 0x0007 +#define SCTP_AUTHENTICATION_EVENT 0x0008 +#define SCTP_STREAM_RESET_EVENT 0x0009 +#define SCTP_SENDER_DRY_EVENT 0x000a +#define SCTP_NOTIFICATIONS_STOPPED_EVENT 0x000b /* we don't send this */ +#define SCTP_ASSOC_RESET_EVENT 0x000c +#define SCTP_STREAM_CHANGE_EVENT 0x000d +#define SCTP_SEND_FAILED_EVENT 0x000e /* * socket option structs */ Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Wed May 9 15:16:38 2012 (r235191) +++ stable/8/sys/netinet/sctp_usrreq.c Wed May 9 15:18:54 2012 (r235192) @@ -2978,6 +2978,9 @@ flags_out: case SCTP_STREAM_CHANGE_EVENT: event_type = SCTP_PCB_FLAGS_STREAM_CHANGEEVNT; break; + case SCTP_SEND_FAILED_EVENT: + event_type = SCTP_PCB_FLAGS_RECVNSENDFAILEVNT; + break; default: event_type = 0; SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); @@ -5380,6 +5383,9 @@ sctp_setopt(struct socket *so, int optna case SCTP_STREAM_CHANGE_EVENT: event_type = SCTP_PCB_FLAGS_STREAM_CHANGEEVNT; break; + case SCTP_SEND_FAILED_EVENT: + event_type = SCTP_PCB_FLAGS_RECVNSENDFAILEVNT; + break; default: event_type = 0; SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Wed May 9 15:16:38 2012 (r235191) +++ stable/8/sys/netinet/sctputil.c Wed May 9 15:18:54 2012 (r235192) @@ -2798,39 +2798,66 @@ sctp_notify_send_failed(struct sctp_tcb { struct mbuf *m_notify; struct sctp_send_failed *ssf; + struct sctp_send_failed_event *ssfe; struct sctp_queued_to_read *control; int length; if ((stcb == NULL) || - sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVSENDFAILEVNT)) { + (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVSENDFAILEVNT) && + sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT))) { /* event not enabled */ return; } - m_notify = sctp_get_mbuf_for_msg(sizeof(struct sctp_send_failed), 0, M_DONTWAIT, 1, MT_DATA); + if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT)) { + length = sizeof(struct sctp_send_failed_event); + } else { + length = sizeof(struct sctp_send_failed); + } + m_notify = sctp_get_mbuf_for_msg(length, 0, M_DONTWAIT, 1, MT_DATA); if (m_notify == NULL) /* no space left */ return; - length = sizeof(struct sctp_send_failed) + chk->send_size; + length += chk->send_size; length -= sizeof(struct sctp_data_chunk); SCTP_BUF_LEN(m_notify) = 0; - ssf = mtod(m_notify, struct sctp_send_failed *); - ssf->ssf_type = SCTP_SEND_FAILED; - if (error == SCTP_NOTIFY_DATAGRAM_UNSENT) - ssf->ssf_flags = SCTP_DATA_UNSENT; - else - ssf->ssf_flags = SCTP_DATA_SENT; - ssf->ssf_length = length; - ssf->ssf_error = error; - /* not exactly what the user sent in, but should be close :) */ - bzero(&ssf->ssf_info, sizeof(ssf->ssf_info)); - ssf->ssf_info.sinfo_stream = chk->rec.data.stream_number; - ssf->ssf_info.sinfo_ssn = chk->rec.data.stream_seq; - ssf->ssf_info.sinfo_flags = chk->rec.data.rcv_flags; - ssf->ssf_info.sinfo_ppid = chk->rec.data.payloadtype; - ssf->ssf_info.sinfo_context = chk->rec.data.context; - ssf->ssf_info.sinfo_assoc_id = sctp_get_associd(stcb); - ssf->ssf_assoc_id = sctp_get_associd(stcb); - + if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT)) { + ssfe = mtod(m_notify, struct sctp_send_failed_event *); + ssfe->ssfe_type = SCTP_SEND_FAILED_EVENT; + if (error == SCTP_NOTIFY_DATAGRAM_UNSENT) + ssfe->ssfe_flags = SCTP_DATA_UNSENT; + else + ssfe->ssfe_flags = SCTP_DATA_SENT; + ssfe->ssfe_length = length; + ssfe->ssfe_error = error; + /* not exactly what the user sent in, but should be close :) */ + bzero(&ssfe->ssfe_info, sizeof(ssfe->ssfe_info)); + ssfe->ssfe_info.snd_sid = chk->rec.data.stream_number; + ssfe->ssfe_info.snd_flags = chk->rec.data.rcv_flags; + ssfe->ssfe_info.snd_ppid = chk->rec.data.payloadtype; + ssfe->ssfe_info.snd_context = chk->rec.data.context; + ssfe->ssfe_info.snd_assoc_id = sctp_get_associd(stcb); + ssfe->ssfe_assoc_id = sctp_get_associd(stcb); + SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed_event); + } else { + ssf = mtod(m_notify, struct sctp_send_failed *); + ssf->ssf_type = SCTP_SEND_FAILED; + if (error == SCTP_NOTIFY_DATAGRAM_UNSENT) + ssf->ssf_flags = SCTP_DATA_UNSENT; + else + ssf->ssf_flags = SCTP_DATA_SENT; + ssf->ssf_length = length; + ssf->ssf_error = error; + /* not exactly what the user sent in, but should be close :) */ + bzero(&ssf->ssf_info, sizeof(ssf->ssf_info)); + ssf->ssf_info.sinfo_stream = chk->rec.data.stream_number; + ssf->ssf_info.sinfo_ssn = chk->rec.data.stream_seq; + ssf->ssf_info.sinfo_flags = chk->rec.data.rcv_flags; + ssf->ssf_info.sinfo_ppid = chk->rec.data.payloadtype; + ssf->ssf_info.sinfo_context = chk->rec.data.context; + ssf->ssf_info.sinfo_assoc_id = sctp_get_associd(stcb); + ssf->ssf_assoc_id = sctp_get_associd(stcb); + SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed); + } if (chk->data) { /* * trim off the sctp chunk header(it should be there) @@ -2842,7 +2869,6 @@ sctp_notify_send_failed(struct sctp_tcb } } SCTP_BUF_NEXT(m_notify) = chk->data; - SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed); /* Steal off the mbuf */ chk->data = NULL; /* @@ -2882,43 +2908,75 @@ sctp_notify_send_failed2(struct sctp_tcb { struct mbuf *m_notify; struct sctp_send_failed *ssf; + struct sctp_send_failed_event *ssfe; struct sctp_queued_to_read *control; int length; if ((stcb == NULL) || - sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVSENDFAILEVNT)) { + (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVSENDFAILEVNT) && + sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT))) { /* event not enabled */ return; } - length = sizeof(struct sctp_send_failed) + sp->length; - m_notify = sctp_get_mbuf_for_msg(sizeof(struct sctp_send_failed), 0, M_DONTWAIT, 1, MT_DATA); - if (m_notify == NULL) + if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT)) { + length = sizeof(struct sctp_send_failed_event); + } else { + length = sizeof(struct sctp_send_failed); + } + m_notify = sctp_get_mbuf_for_msg(length, 0, M_DONTWAIT, 1, MT_DATA); + if (m_notify == NULL) { /* no space left */ return; + } + length += sp->length; SCTP_BUF_LEN(m_notify) = 0; - ssf = mtod(m_notify, struct sctp_send_failed *); - ssf->ssf_type = SCTP_SEND_FAILED; - if (error == SCTP_NOTIFY_DATAGRAM_UNSENT) - ssf->ssf_flags = SCTP_DATA_UNSENT; - else - ssf->ssf_flags = SCTP_DATA_SENT; - ssf->ssf_length = length; - ssf->ssf_error = error; - /* not exactly what the user sent in, but should be close :) */ - bzero(&ssf->ssf_info, sizeof(ssf->ssf_info)); - ssf->ssf_info.sinfo_stream = sp->stream; - ssf->ssf_info.sinfo_ssn = sp->strseq; - if (sp->some_taken) { - ssf->ssf_info.sinfo_flags = SCTP_DATA_LAST_FRAG; + if (sctp_stcb_is_feature_on(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_RECVNSENDFAILEVNT)) { + ssfe = mtod(m_notify, struct sctp_send_failed_event *); + ssfe->ssfe_type = SCTP_SEND_FAILED; + if (error == SCTP_NOTIFY_DATAGRAM_UNSENT) + ssfe->ssfe_flags = SCTP_DATA_UNSENT; + else + ssfe->ssfe_flags = SCTP_DATA_SENT; + ssfe->ssfe_length = length; + ssfe->ssfe_error = error; + /* not exactly what the user sent in, but should be close :) */ + bzero(&ssfe->ssfe_info, sizeof(ssfe->ssfe_info)); + ssfe->ssfe_info.snd_sid = sp->stream; + if (sp->some_taken) { + ssfe->ssfe_info.snd_flags = SCTP_DATA_LAST_FRAG; + } else { + ssfe->ssfe_info.snd_flags = SCTP_DATA_NOT_FRAG; + } + ssfe->ssfe_info.snd_ppid = sp->ppid; + ssfe->ssfe_info.snd_context = sp->context; + ssfe->ssfe_info.snd_assoc_id = sctp_get_associd(stcb); + ssfe->ssfe_assoc_id = sctp_get_associd(stcb); + SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed_event); } else { - ssf->ssf_info.sinfo_flags = SCTP_DATA_NOT_FRAG; + ssf = mtod(m_notify, struct sctp_send_failed *); + ssf->ssf_type = SCTP_SEND_FAILED; + if (error == SCTP_NOTIFY_DATAGRAM_UNSENT) + ssf->ssf_flags = SCTP_DATA_UNSENT; + else + ssf->ssf_flags = SCTP_DATA_SENT; + ssf->ssf_length = length; + ssf->ssf_error = error; + /* not exactly what the user sent in, but should be close :) */ + bzero(&ssf->ssf_info, sizeof(ssf->ssf_info)); + ssf->ssf_info.sinfo_stream = sp->stream; + ssf->ssf_info.sinfo_ssn = sp->strseq; + if (sp->some_taken) { + ssf->ssf_info.sinfo_flags = SCTP_DATA_LAST_FRAG; + } else { + ssf->ssf_info.sinfo_flags = SCTP_DATA_NOT_FRAG; + } + ssf->ssf_info.sinfo_ppid = sp->ppid; + ssf->ssf_info.sinfo_context = sp->context; + ssf->ssf_info.sinfo_assoc_id = sctp_get_associd(stcb); + ssf->ssf_assoc_id = sctp_get_associd(stcb); + SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed); } - ssf->ssf_info.sinfo_ppid = sp->ppid; - ssf->ssf_info.sinfo_context = sp->context; - ssf->ssf_info.sinfo_assoc_id = sctp_get_associd(stcb); - ssf->ssf_assoc_id = sctp_get_associd(stcb); SCTP_BUF_NEXT(m_notify) = sp->data; - SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_send_failed); /* Steal off the mbuf */ sp->data = NULL; From owner-svn-src-stable-8@FreeBSD.ORG Wed May 9 15:21:19 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCFEE106564A; Wed, 9 May 2012 15:21:19 +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 BE4BE8FC16; Wed, 9 May 2012 15:21:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49FLJ2K090172; Wed, 9 May 2012 15:21:19 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49FLJTb090167; Wed, 9 May 2012 15:21:19 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091521.q49FLJTb090167@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 15:21:19 +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: r235193 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 15:21:20 -0000 Author: tuexen Date: Wed May 9 15:21:19 2012 New Revision: 235193 URL: http://svn.freebsd.org/changeset/base/235193 Log: MFC r235077: Remove debug code. Modified: stable/8/sys/netinet/sctp_input.c stable/8/sys/netinet/sctp_pcb.c stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/sctp_input.c ============================================================================== --- stable/8/sys/netinet/sctp_input.c Wed May 9 15:18:54 2012 (r235192) +++ stable/8/sys/netinet/sctp_input.c Wed May 9 15:21:19 2012 (r235193) @@ -785,15 +785,6 @@ sctp_handle_abort(struct sctp_abort_chun /* notify user of the abort and clean up... */ sctp_abort_notification(stcb, 0, SCTP_SO_NOT_LOCKED); /* free the tcb */ -#if defined(SCTP_PANIC_ON_ABORT) - SCTP_PRINTF("stcb:%p state:%d rport:%d net:%p\n", - stcb, stcb->asoc.state, stcb->rport, net); - if (!(stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) { - panic("Received an ABORT"); - } else { - SCTP_PRINTF("No panic its in state %x closed\n", stcb->asoc.state); - } -#endif SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) || (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) { Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Wed May 9 15:18:54 2012 (r235192) +++ stable/8/sys/netinet/sctp_pcb.c Wed May 9 15:21:19 2012 (r235193) @@ -3426,9 +3426,6 @@ sctp_inpcb_free(struct sctp_inpcb *inp, *ippp = htonl(SCTP_FROM_SCTP_PCB + SCTP_LOC_3); } asoc->sctp_ep->last_abort_code = SCTP_FROM_SCTP_PCB + SCTP_LOC_3; -#if defined(SCTP_PANIC_ON_ABORT) - panic("inpcb_free does an abort"); -#endif sctp_send_abort_tcb(asoc, op_err, SCTP_SO_LOCKED); SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_OPEN) || @@ -3520,10 +3517,6 @@ sctp_inpcb_free(struct sctp_inpcb *inp, *ippp = htonl(SCTP_FROM_SCTP_PCB + SCTP_LOC_5); } asoc->sctp_ep->last_abort_code = SCTP_FROM_SCTP_PCB + SCTP_LOC_5; -#if defined(SCTP_PANIC_ON_ABORT) - panic("inpcb_free does an abort"); -#endif - sctp_send_abort_tcb(asoc, op_err, SCTP_SO_LOCKED); SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_OPEN) || @@ -3604,9 +3597,6 @@ sctp_inpcb_free(struct sctp_inpcb *inp, } asoc->sctp_ep->last_abort_code = SCTP_FROM_SCTP_PCB + SCTP_LOC_7; -#if defined(SCTP_PANIC_ON_ABORT) - panic("inpcb_free does an abort"); -#endif sctp_send_abort_tcb(asoc, op_err, SCTP_SO_LOCKED); SCTP_STAT_INCR_COUNTER32(sctps_aborted); } else if (asoc->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) { Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Wed May 9 15:18:54 2012 (r235192) +++ stable/8/sys/netinet/sctp_usrreq.c Wed May 9 15:21:19 2012 (r235193) @@ -780,9 +780,6 @@ sctp_disconnect(struct socket *so) ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT); ph->param_length = htons(SCTP_BUF_LEN(err)); } -#if defined(SCTP_PANIC_ON_ABORT) - panic("disconnect does an abort"); -#endif sctp_send_abort_tcb(stcb, err, SCTP_SO_LOCKED); SCTP_STAT_INCR_COUNTER32(sctps_aborted); } @@ -888,10 +885,6 @@ sctp_disconnect(struct socket *so) ippp = (uint32_t *) (ph + 1); *ippp = htonl(SCTP_FROM_SCTP_USRREQ + SCTP_LOC_4); } -#if defined(SCTP_PANIC_ON_ABORT) - panic("disconnect does an abort"); -#endif - stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_4; sctp_send_abort_tcb(stcb, op_err, SCTP_SO_LOCKED); SCTP_STAT_INCR_COUNTER32(sctps_aborted); @@ -1103,9 +1096,6 @@ sctp_shutdown(struct socket *so) ippp = (uint32_t *) (ph + 1); *ippp = htonl(SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6); } -#if defined(SCTP_PANIC_ON_ABORT) - panic("shutdown does an abort"); -#endif stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6; sctp_abort_an_association(stcb->sctp_ep, stcb, SCTP_RESPONSE_TO_USER_REQ, Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Wed May 9 15:18:54 2012 (r235192) +++ stable/8/sys/netinet/sctputil.c Wed May 9 15:21:19 2012 (r235193) @@ -3881,9 +3881,6 @@ sctp_abort_an_association(struct sctp_in if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) sctp_abort_notification(stcb, error, so_locked); /* notify the peer */ -#if defined(SCTP_PANIC_ON_ABORT) - panic("aborting an association"); -#endif sctp_send_abort_tcb(stcb, op_err, so_locked); SCTP_STAT_INCR_COUNTER32(sctps_aborted); if ((SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) || From owner-svn-src-stable-8@FreeBSD.ORG Wed May 9 15:23:34 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0CFF71065687; Wed, 9 May 2012 15:23:34 +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 D2E408FC14; Wed, 9 May 2012 15:23:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49FNXUP090353; Wed, 9 May 2012 15:23:33 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49FNX2b090350; Wed, 9 May 2012 15:23:33 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091523.q49FNX2b090350@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 15:23:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235195 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 15:23:34 -0000 Author: tuexen Date: Wed May 9 15:23:33 2012 New Revision: 235195 URL: http://svn.freebsd.org/changeset/base/235195 Log: MFC r235081: Add support for the sac_info field in struct sctp_assoc_change as required by RFC 6458. Modified: stable/8/sys/netinet/sctp_uio.h stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/sctp_uio.h ============================================================================== --- stable/8/sys/netinet/sctp_uio.h Wed May 9 15:22:39 2012 (r235194) +++ stable/8/sys/netinet/sctp_uio.h Wed May 9 15:23:33 2012 (r235195) @@ -296,16 +296,23 @@ struct sctp_assoc_change { uint16_t sac_outbound_streams; uint16_t sac_inbound_streams; sctp_assoc_t sac_assoc_id; + uint8_t sac_info[]; }; /* sac_state values */ -#define SCTP_COMM_UP 0x0001 -#define SCTP_COMM_LOST 0x0002 -#define SCTP_RESTART 0x0003 -#define SCTP_SHUTDOWN_COMP 0x0004 -#define SCTP_CANT_STR_ASSOC 0x0005 - - +#define SCTP_COMM_UP 0x0001 +#define SCTP_COMM_LOST 0x0002 +#define SCTP_RESTART 0x0003 +#define SCTP_SHUTDOWN_COMP 0x0004 +#define SCTP_CANT_STR_ASSOC 0x0005 + +/* sac_info values */ +#define SCTP_ASSOC_SUPPORTS_PR 0x01 +#define SCTP_ASSOC_SUPPORTS_AUTH 0x02 +#define SCTP_ASSOC_SUPPORTS_ASCONF 0x03 +#define SCTP_ASSOC_SUPPORTS_MULTIBUF 0x04 +#define SCTP_ASSOC_SUPPORTS_RE_CONFIG 0x05 +#define SCTP_ASSOC_SUPPORTS_MAX 0x05 /* * Address event */ Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Wed May 9 15:22:39 2012 (r235194) +++ stable/8/sys/netinet/sctputil.c Wed May 9 15:23:33 2012 (r235195) @@ -2602,6 +2602,7 @@ sctp_notify_assoc_change(uint32_t event, struct mbuf *m_notify; struct sctp_assoc_change *sac; struct sctp_queued_to_read *control; + unsigned int i; #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; @@ -2666,7 +2667,22 @@ sctp_notify_assoc_change(uint32_t event, sac->sac_outbound_streams = stcb->asoc.streamoutcnt; sac->sac_inbound_streams = stcb->asoc.streamincnt; sac->sac_assoc_id = sctp_get_associd(stcb); - SCTP_BUF_LEN(m_notify) = sizeof(struct sctp_assoc_change); + i = 0; + if (stcb->asoc.peer_supports_prsctp) { + sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_PR; + } + if (stcb->asoc.peer_supports_auth) { + sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_AUTH; + } + if (stcb->asoc.peer_supports_asconf) { + sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_ASCONF; + } + sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_MULTIBUF; + if (stcb->asoc.peer_supports_strreset) { + sac->sac_info[i++] = SCTP_ASSOC_SUPPORTS_RE_CONFIG; + } + sac->sac_length += i; + SCTP_BUF_LEN(m_notify) = sac->sac_length; SCTP_BUF_NEXT(m_notify) = NULL; control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination, 0, 0, stcb->asoc.context, 0, 0, 0, From owner-svn-src-stable-8@FreeBSD.ORG Wed May 9 15:25:59 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7F5CD1065675; Wed, 9 May 2012 15:25:59 +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 504F58FC14; Wed, 9 May 2012 15:25:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49FPxOi090497; Wed, 9 May 2012 15:25:59 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49FPxkk090494; Wed, 9 May 2012 15:25:59 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201205091525.q49FPxkk090494@svn.freebsd.org> From: Michael Tuexen Date: Wed, 9 May 2012 15:25:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235196 - stable/8/sys/netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 15:25:59 -0000 Author: tuexen Date: Wed May 9 15:25:58 2012 New Revision: 235196 URL: http://svn.freebsd.org/changeset/base/235196 Log: MFC r235091: Address clang warnings. Modified: stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet/sctputil.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Wed May 9 15:23:33 2012 (r235195) +++ stable/8/sys/netinet/sctp_usrreq.c Wed May 9 15:25:58 2012 (r235196) @@ -5806,7 +5806,6 @@ sctp_ctloutput(struct socket *so, struct { void *optval = NULL; size_t optsize = 0; - struct sctp_inpcb *inp; void *p; int error = 0; @@ -5824,12 +5823,11 @@ sctp_ctloutput(struct socket *so, struct #endif return (error); } - inp = (struct sctp_inpcb *)so->so_pcb; optsize = sopt->sopt_valsize; if (optsize) { SCTP_MALLOC(optval, void *, optsize, SCTP_M_SOCKOPT); if (optval == NULL) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOBUFS); + SCTP_LTRACE_ERR_RET(so->so_pcb, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOBUFS); return (ENOBUFS); } error = sooptcopyin(sopt, optval, optsize, optsize); @@ -5844,7 +5842,7 @@ sctp_ctloutput(struct socket *so, struct } else if (sopt->sopt_dir == SOPT_GET) { error = sctp_getopt(so, sopt->sopt_name, optval, &optsize, p); } else { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + SCTP_LTRACE_ERR_RET(so->so_pcb, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); error = EINVAL; } if ((error == 0) && (optval != NULL)) { Modified: stable/8/sys/netinet/sctputil.c ============================================================================== --- stable/8/sys/netinet/sctputil.c Wed May 9 15:23:33 2012 (r235195) +++ stable/8/sys/netinet/sctputil.c Wed May 9 15:25:58 2012 (r235196) @@ -3288,7 +3288,8 @@ sctp_notify_stream_reset_add(struct sctp struct sctp_stream_change_event *stradd; int len; - if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_STREAM_CHANGEEVNT)) { + if ((stcb == NULL) || + (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_STREAM_CHANGEEVNT))) { /* event not enabled */ return; } @@ -3349,7 +3350,8 @@ sctp_notify_stream_reset_tsn(struct sctp struct sctp_assoc_reset_event *strasoc; int len; - if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_ASSOC_RESETEVNT)) { + if ((stcb == NULL) || + (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_ASSOC_RESETEVNT))) { /* event not enabled */ return; } @@ -3407,7 +3409,8 @@ sctp_notify_stream_reset(struct sctp_tcb struct sctp_stream_reset_event *strreset; int len; - if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_STREAM_RESETEVNT)) { + if ((stcb == NULL) || + (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_STREAM_RESETEVNT))) { /* event not enabled */ return; } From owner-svn-src-stable-8@FreeBSD.ORG Wed May 9 15:58:00 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14558106566C; Wed, 9 May 2012 15:58:00 +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 F03D88FC14; Wed, 9 May 2012 15:57:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q49FvxOX091852; Wed, 9 May 2012 15:57:59 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q49FvxLL091842; Wed, 9 May 2012 15:57:59 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201205091557.q49FvxLL091842@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 9 May 2012 15:57:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235198 - in stable/8: lib/libc/gen lib/libc/include lib/libc/stdlib lib/libthr lib/libthr/thread libexec/rtld-elf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2012 15:58:00 -0000 Author: kib Date: Wed May 9 15:57:59 2012 New Revision: 235198 URL: http://svn.freebsd.org/changeset/base/235198 Log: MFC r211706: On shared object unload, in __cxa_finalize, call and clear all installed atexit and __cxa_atexit handlers that are either installed by unloaded dso, or points to the functions provided by the dso. Use _rtld_addr_phdr to locate segment information from the address of private variable belonging to the dso, supplied by crtstuff.c. Provide utility function __elf_phdr_match_addr to do the match of address against dso executable segment. Call back into libthr from __cxa_finalize using weak __pthread_cxa_finalize symbol to remove any atfork handler which function points into unloaded object. The rtld needs private __pthread_cxa_finalize symbol to not require resolution of the weak undefined symbol at initialization time. This cannot work, since rtld is relocated before sym_zero is set up. MFC r211894: Do not call __pthread_cxa_finalize with invalid struct dl_phdr_info. Requested and tested by: Peter Jeremy Added: stable/8/lib/libc/gen/elf_utils.c - copied unchanged from r211706, head/lib/libc/gen/elf_utils.c Modified: stable/8/lib/libc/gen/Makefile.inc stable/8/lib/libc/gen/Symbol.map stable/8/lib/libc/include/libc_private.h stable/8/lib/libc/stdlib/atexit.c stable/8/lib/libthr/pthread.map stable/8/lib/libthr/thread/thr_fork.c stable/8/lib/libthr/thread/thr_private.h stable/8/libexec/rtld-elf/rtld.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libthr/ (props changed) stable/8/libexec/rtld-elf/ (props changed) Modified: stable/8/lib/libc/gen/Makefile.inc ============================================================================== --- stable/8/lib/libc/gen/Makefile.inc Wed May 9 15:36:37 2012 (r235197) +++ stable/8/lib/libc/gen/Makefile.inc Wed May 9 15:57:59 2012 (r235198) @@ -10,7 +10,7 @@ SRCS+= __getosreldate.c __xuname.c \ alarm.c arc4random.c assert.c basename.c check_utility_compat.c \ clock.c closedir.c confstr.c \ crypt.c ctermid.c daemon.c devname.c dirname.c disklabel.c \ - dlfcn.c drand48.c erand48.c err.c errlst.c errno.c \ + dlfcn.c drand48.c elf_utils.c erand48.c err.c errlst.c errno.c \ exec.c fdevname.c feature_present.c fmtcheck.c fmtmsg.c fnmatch.c \ fpclassify.c frexp.c fstab.c ftok.c fts.c fts-compat.c ftw.c \ getbootfile.c getbsize.c \ Modified: stable/8/lib/libc/gen/Symbol.map ============================================================================== --- stable/8/lib/libc/gen/Symbol.map Wed May 9 15:36:37 2012 (r235197) +++ stable/8/lib/libc/gen/Symbol.map Wed May 9 15:57:59 2012 (r235198) @@ -445,6 +445,7 @@ FBSDprivate_1.0 { _rtld_atfork_post; _rtld_error; /* for private use */ _rtld_thread_init; /* for private use */ + __elf_phdr_match_addr; _err; _warn; __fmtcheck; Copied: stable/8/lib/libc/gen/elf_utils.c (from r211706, head/lib/libc/gen/elf_utils.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/lib/libc/gen/elf_utils.c Wed May 9 15:57:59 2012 (r235198, copy of r211706, head/lib/libc/gen/elf_utils.c) @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2010 Konstantin Belousov + * 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. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include + +int +__elf_phdr_match_addr(struct dl_phdr_info *phdr_info, void *addr) +{ + const Elf_Phdr *ph; + int i; + + for (i = 0; i < phdr_info->dlpi_phnum; i++) { + ph = &phdr_info->dlpi_phdr[i]; + if (ph->p_type != PT_LOAD || (ph->p_flags & PF_X) == 0) + continue; + if (phdr_info->dlpi_addr + ph->p_vaddr <= (uintptr_t)addr && + (uintptr_t)addr + sizeof(addr) < phdr_info->dlpi_addr + + ph->p_vaddr + ph->p_memsz) + break; + } + return (i != phdr_info->dlpi_phnum); +} Modified: stable/8/lib/libc/include/libc_private.h ============================================================================== --- stable/8/lib/libc/include/libc_private.h Wed May 9 15:36:37 2012 (r235197) +++ stable/8/lib/libc/include/libc_private.h Wed May 9 15:57:59 2012 (r235198) @@ -235,4 +235,7 @@ extern int __sys_fcntl(int, int, ...); /* execve() with PATH processing to implement posix_spawnp() */ int _execvpe(const char *, char * const *, char * const *); +struct dl_phdr_info; +int __elf_phdr_match_addr(struct dl_phdr_info *, void *); + #endif /* _LIBC_PRIVATE_H_ */ Modified: stable/8/lib/libc/stdlib/atexit.c ============================================================================== --- stable/8/lib/libc/stdlib/atexit.c Wed May 9 15:36:37 2012 (r235197) +++ stable/8/lib/libc/stdlib/atexit.c Wed May 9 15:57:59 2012 (r235198) @@ -37,6 +37,7 @@ static char sccsid[] = "@(#)atexit.c 8.2 __FBSDID("$FreeBSD$"); #include "namespace.h" +#include #include #include #include @@ -146,6 +147,9 @@ __cxa_atexit(void (*func)(void *), void return (error); } +#pragma weak __pthread_cxa_finalize +void __pthread_cxa_finalize(const struct dl_phdr_info *); + /* * Call all handlers registered with __cxa_atexit for the shared * object owning 'dso'. Note: if 'dso' is NULL, then all remaining @@ -154,18 +158,28 @@ __cxa_atexit(void (*func)(void *), void void __cxa_finalize(void *dso) { + struct dl_phdr_info phdr_info; struct atexit *p; struct atexit_fn fn; - int n; + int n, has_phdr; + + if (dso != NULL) + has_phdr = _rtld_addr_phdr(dso, &phdr_info); + else + has_phdr = 0; _MUTEX_LOCK(&atexit_mutex); for (p = __atexit; p; p = p->next) { for (n = p->ind; --n >= 0;) { if (p->fns[n].fn_type == ATEXIT_FN_EMPTY) continue; /* already been called */ - if (dso != NULL && dso != p->fns[n].fn_dso) - continue; /* wrong DSO */ fn = p->fns[n]; + if (dso != NULL && dso != fn.fn_dso) { + /* wrong DSO ? */ + if (!has_phdr || !__elf_phdr_match_addr( + &phdr_info, fn.fn_ptr.cxa_func)) + continue; + } /* Mark entry to indicate that this particular handler has already been called. @@ -182,4 +196,7 @@ __cxa_finalize(void *dso) } } _MUTEX_UNLOCK(&atexit_mutex); + + if (has_phdr && &__pthread_cxa_finalize != NULL) + __pthread_cxa_finalize(&phdr_info); } Modified: stable/8/lib/libthr/pthread.map ============================================================================== --- stable/8/lib/libthr/pthread.map Wed May 9 15:36:37 2012 (r235197) +++ stable/8/lib/libthr/pthread.map Wed May 9 15:57:59 2012 (r235198) @@ -198,6 +198,7 @@ FBSDprivate_1.0 { __poll; __pthread_cond_timedwait; __pthread_cond_wait; + __pthread_cxa_finalize; __pthread_mutex_init; __pthread_mutex_lock; __pthread_mutex_timedlock; Modified: stable/8/lib/libthr/thread/thr_fork.c ============================================================================== --- stable/8/lib/libthr/thread/thr_fork.c Wed May 9 15:36:37 2012 (r235197) +++ stable/8/lib/libthr/thread/thr_fork.c Wed May 9 15:57:59 2012 (r235198) @@ -59,6 +59,7 @@ #include "namespace.h" #include +#include #include #include #include @@ -94,6 +95,27 @@ _pthread_atfork(void (*prepare)(void), v return (0); } +void +__pthread_cxa_finalize(struct dl_phdr_info *phdr_info) +{ + struct pthread *curthread; + struct pthread_atfork *af, *af1; + + _thr_check_init(); + + curthread = _get_curthread(); + THR_UMUTEX_LOCK(curthread, &_thr_atfork_lock); + TAILQ_FOREACH_SAFE(af, &_thr_atfork_list, qe, af1) { + if (__elf_phdr_match_addr(phdr_info, af->prepare) || + __elf_phdr_match_addr(phdr_info, af->parent) || + __elf_phdr_match_addr(phdr_info, af->child)) { + TAILQ_REMOVE(&_thr_atfork_list, af, qe); + free(af); + } + } + THR_UMUTEX_UNLOCK(curthread, &_thr_atfork_lock); +} + __weak_reference(_fork, fork); pid_t _fork(void); Modified: stable/8/lib/libthr/thread/thr_private.h ============================================================================== --- stable/8/lib/libthr/thread/thr_private.h Wed May 9 15:36:37 2012 (r235197) +++ stable/8/lib/libthr/thread/thr_private.h Wed May 9 15:57:59 2012 (r235198) @@ -725,6 +725,9 @@ _thr_check_init(void) _libpthread_init(NULL); } +struct dl_phdr_info; +void __pthread_cxa_finalize(struct dl_phdr_info *phdr_info); + __END_DECLS #endif /* !_THR_PRIVATE_H */ Modified: stable/8/libexec/rtld-elf/rtld.c ============================================================================== --- stable/8/libexec/rtld-elf/rtld.c Wed May 9 15:36:37 2012 (r235197) +++ stable/8/libexec/rtld-elf/rtld.c Wed May 9 15:57:59 2012 (r235198) @@ -3719,3 +3719,11 @@ fetch_ventry(const Obj_Entry *obj, unsig } return NULL; } + +/* + * No unresolved symbols for rtld. + */ +void +__pthread_cxa_finalize(struct dl_phdr_info *a) +{ +} From owner-svn-src-stable-8@FreeBSD.ORG Thu May 10 10:56:47 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A93EF106564A; Thu, 10 May 2012 10:56:47 +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 899248FC08; Thu, 10 May 2012 10:56:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4AAulZY032664; Thu, 10 May 2012 10:56:47 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4AAulGt032661; Thu, 10 May 2012 10:56:47 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201205101056.q4AAulGt032661@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 10 May 2012 10:56:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235223 - in stable/8/sys: kern sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 May 2012 10:56:47 -0000 Author: kib Date: Thu May 10 10:56:46 2012 New Revision: 235223 URL: http://svn.freebsd.org/changeset/base/235223 Log: MFC r234952: Mark the migrating callouts with CALLOUT_DFRMIGRATION flag. The flag is cleared by callout_stop_safe() when the function detects a migration, besides returning the success. The softclock() rechecks the flag for migrating callout and cancels its execution if the flag was cleared meantime. PR: misc/166340 Modified: stable/8/sys/kern/kern_timeout.c stable/8/sys/sys/callout.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/kern/kern_timeout.c ============================================================================== --- stable/8/sys/kern/kern_timeout.c Thu May 10 10:39:45 2012 (r235222) +++ stable/8/sys/kern/kern_timeout.c Thu May 10 10:56:46 2012 (r235223) @@ -613,6 +613,32 @@ softclock(void *arg) cc_cme_cleanup(cc); /* + * Handle deferred callout stops + */ + if ((c->c_flags & CALLOUT_DFRMIGRATION) + == 0) { + CTR3(KTR_CALLOUT, + "deferred cancelled %p func %p arg %p", + c, new_func, new_arg); + if (cc->cc_next == c) { + cc->cc_next = + TAILQ_NEXT(c, + c_links.tqe); + } + if (c->c_flags & + CALLOUT_LOCAL_ALLOC) { + c->c_func = NULL; + SLIST_INSERT_HEAD( + &cc->cc_callfree, c, + c_links.sle); + } + goto nextc; + } else { + c->c_flags &= ~ + CALLOUT_DFRMIGRATION; + } + + /* * It should be assert here that the * callout is not destroyed but that * is not easy. @@ -627,6 +653,9 @@ softclock(void *arg) panic("migration should not happen"); #endif } +#ifdef SMP +nextc: +#endif steps = 0; c = cc->cc_next; } @@ -782,6 +811,7 @@ callout_reset_on(struct callout *c, int cc->cc_migration_ticks = to_ticks; cc->cc_migration_func = ftn; cc->cc_migration_arg = arg; + c->c_flags |= CALLOUT_DFRMIGRATION; CTR5(KTR_CALLOUT, "migration of %p func %p arg %p in %d to %u deferred", c, c->c_func, c->c_arg, to_ticks, cpu); @@ -952,6 +982,12 @@ again: CC_UNLOCK(cc); KASSERT(!sq_locked, ("sleepqueue chain locked")); return (1); + } else if ((c->c_flags & CALLOUT_DFRMIGRATION) != 0) { + c->c_flags &= ~CALLOUT_DFRMIGRATION; + CTR3(KTR_CALLOUT, "postponing stop %p func %p arg %p", + c, c->c_func, c->c_arg); + CC_UNLOCK(cc); + return (1); } CTR3(KTR_CALLOUT, "failed to stop %p func %p arg %p", c, c->c_func, c->c_arg); Modified: stable/8/sys/sys/callout.h ============================================================================== --- stable/8/sys/sys/callout.h Thu May 10 10:39:45 2012 (r235222) +++ stable/8/sys/sys/callout.h Thu May 10 10:56:46 2012 (r235223) @@ -64,6 +64,7 @@ struct callout { #define CALLOUT_MPSAFE 0x0008 /* callout handler is mp safe */ #define CALLOUT_RETURNUNLOCKED 0x0010 /* handler returns with mtx unlocked */ #define CALLOUT_SHAREDLOCK 0x0020 /* callout lock held in shared mode */ +#define CALLOUT_DFRMIGRATION 0x0040 /* callout in deferred migration mode */ struct callout_handle { struct callout *callout; From owner-svn-src-stable-8@FreeBSD.ORG Thu May 10 11:08:09 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E2FED1065672; Thu, 10 May 2012 11:08: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 CC3798FC16; Thu, 10 May 2012 11:08:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4AB89RP033100; Thu, 10 May 2012 11:08:09 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4AB89ec033098; Thu, 10 May 2012 11:08:09 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201205101108.q4AB89ec033098@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 10 May 2012 11:08:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235225 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 May 2012 11:08:10 -0000 Author: kib Date: Thu May 10 11:08:09 2012 New Revision: 235225 URL: http://svn.freebsd.org/changeset/base/235225 Log: MFC r234981: Move the code to call the callout callback into the helper function softclock_call_cc(). While there, move some common code to callout_cc_del(). Modified: stable/8/sys/kern/kern_timeout.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/kern/kern_timeout.c ============================================================================== --- stable/8/sys/kern/kern_timeout.c Thu May 10 11:06:19 2012 (r235224) +++ stable/8/sys/kern/kern_timeout.c Thu May 10 11:08:09 2012 (r235225) @@ -405,6 +405,181 @@ callout_cc_add(struct callout *c, struct c, c_links.tqe); } +static void +callout_cc_del(struct callout *c, struct callout_cpu *cc) +{ + + if (cc->cc_next == c) + cc->cc_next = TAILQ_NEXT(c, c_links.tqe); + if (c->c_flags & CALLOUT_LOCAL_ALLOC) { + c->c_func = NULL; + SLIST_INSERT_HEAD(&cc->cc_callfree, c, c_links.sle); + } +} + +static struct callout * +softclock_call_cc(struct callout *c, struct callout_cpu *cc, int *mpcalls, + int *lockcalls, int *gcalls) +{ + void (*c_func)(void *); + void *c_arg; + struct lock_class *class; + struct lock_object *c_lock; + int c_flags, sharedlock; +#ifdef SMP + struct callout_cpu *new_cc; + void (*new_func)(void *); + void *new_arg; + int new_cpu, new_ticks; +#endif +#ifdef DIAGNOSTIC + struct bintime bt1, bt2; + struct timespec ts2; + static uint64_t maxdt = 36893488147419102LL; /* 2 msec */ + static timeout_t *lastfunc; +#endif + + cc->cc_next = TAILQ_NEXT(c, c_links.tqe); + class = (c->c_lock != NULL) ? LOCK_CLASS(c->c_lock) : NULL; + sharedlock = (c->c_flags & CALLOUT_SHAREDLOCK) ? 0 : 1; + c_lock = c->c_lock; + c_func = c->c_func; + c_arg = c->c_arg; + c_flags = c->c_flags; + if (c->c_flags & CALLOUT_LOCAL_ALLOC) + c->c_flags = CALLOUT_LOCAL_ALLOC; + else + c->c_flags &= ~CALLOUT_PENDING; + cc->cc_curr = c; + cc->cc_cancel = 0; + CC_UNLOCK(cc); + if (c_lock != NULL) { + class->lc_lock(c_lock, sharedlock); + /* + * The callout may have been cancelled + * while we switched locks. + */ + if (cc->cc_cancel) { + class->lc_unlock(c_lock); + goto skip; + } + /* The callout cannot be stopped now. */ + cc->cc_cancel = 1; + + if (c_lock == &Giant.lock_object) { + (*gcalls)++; + CTR3(KTR_CALLOUT, "callout %p func %p arg %p", + c, c_func, c_arg); + } else { + (*lockcalls)++; + CTR3(KTR_CALLOUT, "callout lock %p func %p arg %p", + c, c_func, c_arg); + } + } else { + (*mpcalls)++; + CTR3(KTR_CALLOUT, "callout mpsafe %p func %p arg %p", + c, c_func, c_arg); + } +#ifdef DIAGNOSTIC + binuptime(&bt1); +#endif + THREAD_NO_SLEEPING(); + SDT_PROBE(callout_execute, kernel, , callout_start, c, 0, 0, 0, 0); + c_func(c_arg); + SDT_PROBE(callout_execute, kernel, , callout_end, c, 0, 0, 0, 0); + THREAD_SLEEPING_OK(); +#ifdef DIAGNOSTIC + binuptime(&bt2); + bintime_sub(&bt2, &bt1); + if (bt2.frac > maxdt) { + if (lastfunc != c_func || bt2.frac > maxdt * 2) { + bintime2timespec(&bt2, &ts2); + printf( + "Expensive timeout(9) function: %p(%p) %jd.%09ld s\n", + c_func, c_arg, (intmax_t)ts2.tv_sec, ts2.tv_nsec); + } + maxdt = bt2.frac; + lastfunc = c_func; + } +#endif + CTR1(KTR_CALLOUT, "callout %p finished", c); + if ((c_flags & CALLOUT_RETURNUNLOCKED) == 0) + class->lc_unlock(c_lock); +skip: + CC_LOCK(cc); + /* + * If the current callout is locally allocated (from + * timeout(9)) then put it on the freelist. + * + * Note: we need to check the cached copy of c_flags because + * if it was not local, then it's not safe to deref the + * callout pointer. + */ + if (c_flags & CALLOUT_LOCAL_ALLOC) { + KASSERT(c->c_flags == CALLOUT_LOCAL_ALLOC, + ("corrupted callout")); + c->c_func = NULL; + SLIST_INSERT_HEAD(&cc->cc_callfree, c, c_links.sle); + } + cc->cc_curr = NULL; + if (cc->cc_waiting) { + /* + * There is someone waiting for the + * callout to complete. + * If the callout was scheduled for + * migration just cancel it. + */ + if (cc_cme_migrating(cc)) + cc_cme_cleanup(cc); + cc->cc_waiting = 0; + CC_UNLOCK(cc); + wakeup(&cc->cc_waiting); + CC_LOCK(cc); + } else if (cc_cme_migrating(cc)) { +#ifdef SMP + /* + * If the callout was scheduled for + * migration just perform it now. + */ + new_cpu = cc->cc_migration_cpu; + new_ticks = cc->cc_migration_ticks; + new_func = cc->cc_migration_func; + new_arg = cc->cc_migration_arg; + cc_cme_cleanup(cc); + + /* + * Handle deferred callout stops + */ + if ((c->c_flags & CALLOUT_DFRMIGRATION) == 0) { + CTR3(KTR_CALLOUT, + "deferred cancelled %p func %p arg %p", + c, new_func, new_arg); + callout_cc_del(c, cc); + goto nextc; + } + + c->c_flags &= ~CALLOUT_DFRMIGRATION; + + /* + * It should be assert here that the + * callout is not destroyed but that + * is not easy. + */ + new_cc = callout_cpu_switch(c, cc, new_cpu); + callout_cc_add(c, new_cc, new_ticks, new_func, new_arg, + new_cpu); + CC_UNLOCK(new_cc); + CC_LOCK(cc); +#else + panic("migration should not happen"); +#endif + } +#ifdef SMP +nextc: +#endif + return (cc->cc_next); +} + /* * The callout mechanism is based on the work of Adam M. Costello and * George Varghese, published in a technical report entitled "Redesigning @@ -433,12 +608,6 @@ softclock(void *arg) int mpcalls; int lockcalls; int gcalls; -#ifdef DIAGNOSTIC - struct bintime bt1, bt2; - struct timespec ts2; - static uint64_t maxdt = 36893488147419102LL; /* 2 msec */ - static timeout_t *lastfunc; -#endif #ifndef MAX_SOFTCLOCK_STEPS #define MAX_SOFTCLOCK_STEPS 100 /* Maximum allowed value of steps. */ @@ -460,7 +629,7 @@ softclock(void *arg) cc->cc_softticks++; bucket = &cc->cc_callwheel[curticks & callwheelmask]; c = TAILQ_FIRST(bucket); - while (c) { + while (c != NULL) { depth++; if (c->c_time != curticks) { c = TAILQ_NEXT(c, c_links.tqe); @@ -475,189 +644,10 @@ softclock(void *arg) steps = 0; } } else { - void (*c_func)(void *); - void *c_arg; - struct lock_class *class; - struct lock_object *c_lock; - int c_flags, sharedlock; - - cc->cc_next = TAILQ_NEXT(c, c_links.tqe); TAILQ_REMOVE(bucket, c, c_links.tqe); - class = (c->c_lock != NULL) ? - LOCK_CLASS(c->c_lock) : NULL; - sharedlock = (c->c_flags & CALLOUT_SHAREDLOCK) ? - 0 : 1; - c_lock = c->c_lock; - c_func = c->c_func; - c_arg = c->c_arg; - c_flags = c->c_flags; - if (c->c_flags & CALLOUT_LOCAL_ALLOC) { - c->c_flags = CALLOUT_LOCAL_ALLOC; - } else { - c->c_flags = - (c->c_flags & ~CALLOUT_PENDING); - } - cc->cc_curr = c; - cc->cc_cancel = 0; - CC_UNLOCK(cc); - if (c_lock != NULL) { - class->lc_lock(c_lock, sharedlock); - /* - * The callout may have been cancelled - * while we switched locks. - */ - if (cc->cc_cancel) { - class->lc_unlock(c_lock); - goto skip; - } - /* The callout cannot be stopped now. */ - cc->cc_cancel = 1; - - if (c_lock == &Giant.lock_object) { - gcalls++; - CTR3(KTR_CALLOUT, - "callout %p func %p arg %p", - c, c_func, c_arg); - } else { - lockcalls++; - CTR3(KTR_CALLOUT, "callout lock" - " %p func %p arg %p", - c, c_func, c_arg); - } - } else { - mpcalls++; - CTR3(KTR_CALLOUT, - "callout mpsafe %p func %p arg %p", - c, c_func, c_arg); - } -#ifdef DIAGNOSTIC - binuptime(&bt1); -#endif - THREAD_NO_SLEEPING(); - SDT_PROBE(callout_execute, kernel, , - callout_start, c, 0, 0, 0, 0); - c_func(c_arg); - SDT_PROBE(callout_execute, kernel, , - callout_end, c, 0, 0, 0, 0); - THREAD_SLEEPING_OK(); -#ifdef DIAGNOSTIC - binuptime(&bt2); - bintime_sub(&bt2, &bt1); - if (bt2.frac > maxdt) { - if (lastfunc != c_func || - bt2.frac > maxdt * 2) { - bintime2timespec(&bt2, &ts2); - printf( - "Expensive timeout(9) function: %p(%p) %jd.%09ld s\n", - c_func, c_arg, - (intmax_t)ts2.tv_sec, - ts2.tv_nsec); - } - maxdt = bt2.frac; - lastfunc = c_func; - } -#endif - CTR1(KTR_CALLOUT, "callout %p finished", c); - if ((c_flags & CALLOUT_RETURNUNLOCKED) == 0) - class->lc_unlock(c_lock); - skip: - CC_LOCK(cc); - /* - * If the current callout is locally - * allocated (from timeout(9)) - * then put it on the freelist. - * - * Note: we need to check the cached - * copy of c_flags because if it was not - * local, then it's not safe to deref the - * callout pointer. - */ - if (c_flags & CALLOUT_LOCAL_ALLOC) { - KASSERT(c->c_flags == - CALLOUT_LOCAL_ALLOC, - ("corrupted callout")); - c->c_func = NULL; - SLIST_INSERT_HEAD(&cc->cc_callfree, c, - c_links.sle); - } - cc->cc_curr = NULL; - if (cc->cc_waiting) { - - /* - * There is someone waiting for the - * callout to complete. - * If the callout was scheduled for - * migration just cancel it. - */ - if (cc_cme_migrating(cc)) - cc_cme_cleanup(cc); - cc->cc_waiting = 0; - CC_UNLOCK(cc); - wakeup(&cc->cc_waiting); - CC_LOCK(cc); - } else if (cc_cme_migrating(cc)) { -#ifdef SMP - struct callout_cpu *new_cc; - void (*new_func)(void *); - void *new_arg; - int new_cpu, new_ticks; - - /* - * If the callout was scheduled for - * migration just perform it now. - */ - new_cpu = cc->cc_migration_cpu; - new_ticks = cc->cc_migration_ticks; - new_func = cc->cc_migration_func; - new_arg = cc->cc_migration_arg; - cc_cme_cleanup(cc); - - /* - * Handle deferred callout stops - */ - if ((c->c_flags & CALLOUT_DFRMIGRATION) - == 0) { - CTR3(KTR_CALLOUT, - "deferred cancelled %p func %p arg %p", - c, new_func, new_arg); - if (cc->cc_next == c) { - cc->cc_next = - TAILQ_NEXT(c, - c_links.tqe); - } - if (c->c_flags & - CALLOUT_LOCAL_ALLOC) { - c->c_func = NULL; - SLIST_INSERT_HEAD( - &cc->cc_callfree, c, - c_links.sle); - } - goto nextc; - } else { - c->c_flags &= ~ - CALLOUT_DFRMIGRATION; - } - - /* - * It should be assert here that the - * callout is not destroyed but that - * is not easy. - */ - new_cc = callout_cpu_switch(c, cc, - new_cpu); - callout_cc_add(c, new_cc, new_ticks, - new_func, new_arg, new_cpu); - CC_UNLOCK(new_cc); - CC_LOCK(cc); -#else - panic("migration should not happen"); -#endif - } -#ifdef SMP -nextc: -#endif + c = softclock_call_cc(c, cc, &mpcalls, + &lockcalls, &gcalls); steps = 0; - c = cc->cc_next; } } } @@ -1000,19 +990,12 @@ again: c->c_flags &= ~(CALLOUT_ACTIVE | CALLOUT_PENDING); - if (cc->cc_next == c) { - cc->cc_next = TAILQ_NEXT(c, c_links.tqe); - } - TAILQ_REMOVE(&cc->cc_callwheel[c->c_time & callwheelmask], c, - c_links.tqe); - CTR3(KTR_CALLOUT, "cancelled %p func %p arg %p", c, c->c_func, c->c_arg); + TAILQ_REMOVE(&cc->cc_callwheel[c->c_time & callwheelmask], c, + c_links.tqe); + callout_cc_del(c, cc); - if (c->c_flags & CALLOUT_LOCAL_ALLOC) { - c->c_func = NULL; - SLIST_INSERT_HEAD(&cc->cc_callfree, c, c_links.sle); - } CC_UNLOCK(cc); return (1); } From owner-svn-src-stable-8@FreeBSD.ORG Thu May 10 20:37:57 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 551F9106574C; Thu, 10 May 2012 20:37:57 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D92E8FC12; Thu, 10 May 2012 20:37:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4AKbvLE050915; Thu, 10 May 2012 20:37:57 GMT (envelope-from daichi@svn.freebsd.org) Received: (from daichi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4AKbvU5050911; Thu, 10 May 2012 20:37:57 GMT (envelope-from daichi@svn.freebsd.org) Message-Id: <201205102037.q4AKbvU5050911@svn.freebsd.org> From: Daichi GOTO Date: Thu, 10 May 2012 20:37:57 +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: r235244 - stable/8/sys/fs/unionfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 May 2012 20:37:57 -0000 Author: daichi Date: Thu May 10 20:37:56 2012 New Revision: 235244 URL: http://svn.freebsd.org/changeset/base/235244 Log: MFC: 234867 and 234944 - fixed a vnode lock hang-up issue. - fixed an incorrect lock status issue. - fixed an incorrect lock issue of unionfs root vnode removed. (pointed out by keith) - fixed an infinity loop issue. (pointed out by dumbbell) - changed to do LK_RELEASE expressly when unlocked. - fixed a unionfs_readdir math issue Submitted by: ozawa@ongs.co.jp, Matthew Fleming Modified: stable/8/sys/fs/unionfs/union_subr.c stable/8/sys/fs/unionfs/union_vfsops.c stable/8/sys/fs/unionfs/union_vnops.c Modified: stable/8/sys/fs/unionfs/union_subr.c ============================================================================== --- stable/8/sys/fs/unionfs/union_subr.c Thu May 10 20:35:50 2012 (r235243) +++ stable/8/sys/fs/unionfs/union_subr.c Thu May 10 20:37:56 2012 (r235244) @@ -2,8 +2,8 @@ * Copyright (c) 1994 Jan-Simon Pendry * Copyright (c) 1994 * The Regents of the University of California. All rights reserved. - * Copyright (c) 2005, 2006 Masanori Ozawa , ONGS Inc. - * Copyright (c) 2006 Daichi Goto + * Copyright (c) 2005, 2006, 2012 Masanori Ozawa , ONGS Inc. + * Copyright (c) 2006, 2012 Daichi Goto * * This code is derived from software contributed to Berkeley by * Jan-Simon Pendry. @@ -350,19 +350,22 @@ unionfs_noderem(struct vnode *vp, struct uvp = unp->un_uppervp; dvp = unp->un_dvp; unp->un_lowervp = unp->un_uppervp = NULLVP; - vp->v_vnlock = &(vp->v_lock); vp->v_data = NULL; - lockmgr(vp->v_vnlock, LK_EXCLUSIVE | LK_INTERLOCK, VI_MTX(vp)); + vp->v_object = NULL; + VI_UNLOCK(vp); + if (lvp != NULLVP) - VOP_UNLOCK(lvp, 0); + VOP_UNLOCK(lvp, LK_RELEASE); if (uvp != NULLVP) - VOP_UNLOCK(uvp, 0); - vp->v_object = NULL; + VOP_UNLOCK(uvp, LK_RELEASE); if (dvp != NULLVP && unp->un_hash.le_prev != NULL) unionfs_rem_cached_vnode(unp, dvp); + if (lockmgr(vp->v_vnlock, LK_EXCLUSIVE, VI_MTX(vp)) != 0) + panic("the lock for deletion is unacquirable."); + if (lvp != NULLVP) { vfslocked = VFS_LOCK_GIANT(lvp->v_mount); vrele(lvp); @@ -550,7 +553,7 @@ unionfs_relookup(struct vnode *dvp, stru cn->cn_flags |= (cnp->cn_flags & SAVESTART); vref(dvp); - VOP_UNLOCK(dvp, 0); + VOP_UNLOCK(dvp, LK_RELEASE); if ((error = relookup(dvp, vpp, cn))) { uma_zfree(namei_zone, cn->cn_pnbuf); @@ -951,7 +954,7 @@ unionfs_vn_create_on_upper(struct vnode *vpp = vp; unionfs_vn_create_on_upper_free_out1: - VOP_UNLOCK(udvp, 0); + VOP_UNLOCK(udvp, LK_RELEASE); unionfs_vn_create_on_upper_free_out2: if (cn.cn_flags & HASBUF) { Modified: stable/8/sys/fs/unionfs/union_vfsops.c ============================================================================== --- stable/8/sys/fs/unionfs/union_vfsops.c Thu May 10 20:35:50 2012 (r235243) +++ stable/8/sys/fs/unionfs/union_vfsops.c Thu May 10 20:37:56 2012 (r235244) @@ -1,8 +1,8 @@ /*- * Copyright (c) 1994, 1995 The Regents of the University of California. * Copyright (c) 1994, 1995 Jan-Simon Pendry. - * Copyright (c) 2005, 2006 Masanori Ozawa , ONGS Inc. - * Copyright (c) 2006 Daichi Goto + * Copyright (c) 2005, 2006, 2012 Masanori Ozawa , ONGS Inc. + * Copyright (c) 2006, 2012 Daichi Goto * All rights reserved. * * This code is derived from software donated to Berkeley by @@ -166,7 +166,7 @@ unionfs_domount(struct mount *mp) uid = va.va_uid; gid = va.va_gid; } - VOP_UNLOCK(mp->mnt_vnodecovered, 0); + VOP_UNLOCK(mp->mnt_vnodecovered, LK_RELEASE); if (error) return (error); @@ -251,7 +251,7 @@ unionfs_domount(struct mount *mp) * Save reference */ if (below) { - VOP_UNLOCK(upperrootvp, 0); + VOP_UNLOCK(upperrootvp, LK_RELEASE); vn_lock(lowerrootvp, LK_EXCLUSIVE | LK_RETRY); ump->um_lowervp = upperrootvp; ump->um_uppervp = lowerrootvp; @@ -302,7 +302,7 @@ unionfs_domount(struct mount *mp) /* * Unlock the node */ - VOP_UNLOCK(ump->um_uppervp, 0); + VOP_UNLOCK(ump->um_uppervp, LK_RELEASE); /* * Get the unionfs root vnode. Modified: stable/8/sys/fs/unionfs/union_vnops.c ============================================================================== --- stable/8/sys/fs/unionfs/union_vnops.c Thu May 10 20:35:50 2012 (r235243) +++ stable/8/sys/fs/unionfs/union_vnops.c Thu May 10 20:37:56 2012 (r235244) @@ -2,8 +2,8 @@ * Copyright (c) 1992, 1993, 1994, 1995 Jan-Simon Pendry. * Copyright (c) 1992, 1993, 1994, 1995 * The Regents of the University of California. - * Copyright (c) 2005, 2006 Masanori Ozawa , ONGS Inc. - * Copyright (c) 2006 Daichi Goto + * Copyright (c) 2005, 2006, 2012 Masanori Ozawa , ONGS Inc. + * Copyright (c) 2006, 2012 Daichi Goto * All rights reserved. * * This code is derived from software contributed to Berkeley by @@ -75,21 +75,6 @@ KASSERT(((vp)->v_op == &unionfs_vnodeops), \ ("unionfs: it is not unionfs-vnode")) -/* lockmgr lock <-> reverse table */ -struct lk_lr_table { - int lock; - int revlock; -}; - -static struct lk_lr_table un_llt[] = { - {LK_SHARED, LK_RELEASE}, - {LK_EXCLUSIVE, LK_RELEASE}, - {LK_UPGRADE, LK_DOWNGRADE}, - {LK_DOWNGRADE, LK_UPGRADE}, - {0, 0} -}; - - static int unionfs_lookup(struct vop_cachedlookup_args *ap) { @@ -141,7 +126,7 @@ unionfs_lookup(struct vop_cachedlookup_a if (udvp != NULLVP) { dtmpvp = udvp; if (ldvp != NULLVP) - VOP_UNLOCK(ldvp, 0); + VOP_UNLOCK(ldvp, LK_RELEASE); } else dtmpvp = ldvp; @@ -149,7 +134,7 @@ unionfs_lookup(struct vop_cachedlookup_a error = VOP_LOOKUP(dtmpvp, &vp, cnp); if (dtmpvp == udvp && ldvp != NULLVP) { - VOP_UNLOCK(udvp, 0); + VOP_UNLOCK(udvp, LK_RELEASE); vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); } @@ -161,10 +146,10 @@ unionfs_lookup(struct vop_cachedlookup_a */ if (nameiop == DELETE || nameiop == RENAME || (cnp->cn_lkflags & LK_TYPE_MASK)) - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp, LK_RELEASE); vrele(vp); - VOP_UNLOCK(dvp, 0); + VOP_UNLOCK(dvp, LK_RELEASE); *(ap->a_vpp) = dunp->un_dvp; vref(dunp->un_dvp); @@ -202,7 +187,7 @@ unionfs_lookup(struct vop_cachedlookup_a } if (nameiop == DELETE || nameiop == RENAME || (cnp->cn_lkflags & LK_TYPE_MASK)) - VOP_UNLOCK(uvp, 0); + VOP_UNLOCK(uvp, LK_RELEASE); } /* check whiteout */ @@ -246,7 +231,7 @@ unionfs_lookup(struct vop_cachedlookup_a return (lerror); } if (cnp->cn_lkflags & LK_TYPE_MASK) - VOP_UNLOCK(lvp, 0); + VOP_UNLOCK(lvp, LK_RELEASE); } } @@ -281,7 +266,7 @@ unionfs_lookup(struct vop_cachedlookup_a goto unionfs_lookup_out; if (LK_SHARED == (cnp->cn_lkflags & LK_TYPE_MASK)) - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp, LK_RELEASE); if (LK_EXCLUSIVE != VOP_ISLOCKED(vp)) { vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); lockflag = 1; @@ -289,7 +274,7 @@ unionfs_lookup(struct vop_cachedlookup_a error = unionfs_mkshadowdir(MOUNTTOUNIONFSMOUNT(dvp->v_mount), udvp, VTOUNIONFS(vp), cnp, td); if (lockflag != 0) - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp, LK_RELEASE); if (error != 0) { UNIONFSDEBUG("unionfs_lookup: Unable to create shadow dir."); if ((cnp->cn_lkflags & LK_TYPE_MASK) == LK_EXCLUSIVE) @@ -386,7 +371,7 @@ unionfs_create(struct vop_create_args *a if (vp->v_type == VSOCK) *(ap->a_vpp) = vp; else { - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp, LK_RELEASE); error = unionfs_nodeget(ap->a_dvp->v_mount, vp, NULLVP, ap->a_dvp, ap->a_vpp, cnp, curthread); vrele(vp); @@ -460,7 +445,7 @@ unionfs_mknod(struct vop_mknod_args *ap) if (vp->v_type == VSOCK) *(ap->a_vpp) = vp; else { - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp, LK_RELEASE); error = unionfs_nodeget(ap->a_dvp->v_mount, vp, NULLVP, ap->a_dvp, ap->a_vpp, cnp, curthread); vrele(vp); @@ -564,6 +549,7 @@ unionfs_close(struct vop_close_args *ap) struct unionfs_node_status *unsp; struct ucred *cred; struct thread *td; + struct vnode *vp; struct vnode *ovp; UNIONFS_INTERNAL_DEBUG("unionfs_close: enter\n"); @@ -571,12 +557,14 @@ unionfs_close(struct vop_close_args *ap) KASSERT_UNIONFS_VNODE(ap->a_vp); locked = 0; - unp = VTOUNIONFS(ap->a_vp); + vp = ap->a_vp; + unp = VTOUNIONFS(vp); cred = ap->a_cred; td = ap->a_td; - if (VOP_ISLOCKED(ap->a_vp) != LK_EXCLUSIVE) { - vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY); + if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) { + if (vn_lock(vp, LK_UPGRADE) != 0) + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); locked = 1; } unionfs_get_node_status(unp, td, &unsp); @@ -599,7 +587,7 @@ unionfs_close(struct vop_close_args *ap) if (error != 0) goto unionfs_close_abort; - ap->a_vp->v_object = ovp->v_object; + vp->v_object = ovp->v_object; if (ovp == unp->un_uppervp) { unsp->uns_upper_opencnt--; @@ -610,7 +598,7 @@ unionfs_close(struct vop_close_args *ap) unsp->uns_lower_opencnt--; } if (unsp->uns_lower_opencnt > 0) - ap->a_vp->v_object = unp->un_lowervp->v_object; + vp->v_object = unp->un_lowervp->v_object; } } else unsp->uns_lower_opencnt--; @@ -619,7 +607,7 @@ unionfs_close_abort: unionfs_tryrem_node_status(unp, unsp); if (locked != 0) - VOP_UNLOCK(ap->a_vp, 0); + vn_lock(vp, LK_DOWNGRADE | LK_RETRY); UNIONFS_INTERNAL_DEBUG("unionfs_close: leave (%d)\n", error); @@ -914,7 +902,7 @@ unionfs_ioctl(struct vop_ioctl_args *ap) unionfs_get_node_status(unp, ap->a_td, &unsp); ovp = (unsp->uns_upper_opencnt ? unp->un_uppervp : unp->un_lowervp); unionfs_tryrem_node_status(unp, unsp); - VOP_UNLOCK(ap->a_vp, 0); + VOP_UNLOCK(ap->a_vp, LK_RELEASE); if (ovp == NULLVP) return (EBADF); @@ -941,7 +929,7 @@ unionfs_poll(struct vop_poll_args *ap) unionfs_get_node_status(unp, ap->a_td, &unsp); ovp = (unsp->uns_upper_opencnt ? unp->un_uppervp : unp->un_lowervp); unionfs_tryrem_node_status(unp, unsp); - VOP_UNLOCK(ap->a_vp, 0); + VOP_UNLOCK(ap->a_vp, LK_RELEASE); if (ovp == NULLVP) return (EBADF); @@ -1001,7 +989,7 @@ unionfs_remove(struct vop_remove_args *a ump = NULL; vp = uvp = lvp = NULLVP; /* search vnode */ - VOP_UNLOCK(ap->a_vp, 0); + VOP_UNLOCK(ap->a_vp, LK_RELEASE); error = unionfs_relookup(udvp, &vp, cnp, &cn, td, cnp->cn_nameptr, strlen(cnp->cn_nameptr), DELETE); if (error != 0 && error != ENOENT) { @@ -1204,7 +1192,7 @@ unionfs_rename(struct vop_rename_args *a if ((error = vn_lock(fvp, LK_EXCLUSIVE)) != 0) goto unionfs_rename_abort; error = unionfs_copyfile(unp, 1, fcnp->cn_cred, td); - VOP_UNLOCK(fvp, 0); + VOP_UNLOCK(fvp, LK_RELEASE); if (error != 0) goto unionfs_rename_abort; break; @@ -1212,7 +1200,7 @@ unionfs_rename(struct vop_rename_args *a if ((error = vn_lock(fvp, LK_EXCLUSIVE)) != 0) goto unionfs_rename_abort; error = unionfs_mkshadowdir(ump, rfdvp, unp, fcnp, td); - VOP_UNLOCK(fvp, 0); + VOP_UNLOCK(fvp, LK_RELEASE); if (error != 0) goto unionfs_rename_abort; break; @@ -1269,13 +1257,13 @@ unionfs_rename(struct vop_rename_args *a if ((error = vn_lock(fdvp, LK_EXCLUSIVE)) != 0) goto unionfs_rename_abort; error = unionfs_relookup_for_delete(fdvp, fcnp, td); - VOP_UNLOCK(fdvp, 0); + VOP_UNLOCK(fdvp, LK_RELEASE); if (error != 0) goto unionfs_rename_abort; /* Locke of tvp is canceled in order to avoid recursive lock. */ if (tvp != NULLVP && tvp != tdvp) - VOP_UNLOCK(tvp, 0); + VOP_UNLOCK(tvp, LK_RELEASE); error = unionfs_relookup_for_rename(tdvp, tcnp, td); if (tvp != NULLVP && tvp != tdvp) vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY); @@ -1293,11 +1281,11 @@ unionfs_rename(struct vop_rename_args *a } if (ltdvp != NULLVP) - VOP_UNLOCK(ltdvp, 0); + VOP_UNLOCK(ltdvp, LK_RELEASE); if (tdvp != rtdvp) vrele(tdvp); if (ltvp != NULLVP) - VOP_UNLOCK(ltvp, 0); + VOP_UNLOCK(ltvp, LK_RELEASE); if (tvp != rtvp && tvp != NULLVP) { if (rtvp == NULLVP) vput(tvp); @@ -1371,7 +1359,7 @@ unionfs_mkdir(struct vop_mkdir_args *ap) } if ((error = VOP_MKDIR(udvp, &uvp, cnp, ap->a_vap)) == 0) { - VOP_UNLOCK(uvp, 0); + VOP_UNLOCK(uvp, LK_RELEASE); cnp->cn_lkflags = LK_EXCLUSIVE; error = unionfs_nodeget(ap->a_dvp->v_mount, uvp, NULLVP, ap->a_dvp, ap->a_vpp, cnp, td); @@ -1427,7 +1415,9 @@ unionfs_rmdir(struct vop_rmdir_args *ap) ump = MOUNTTOUNIONFSMOUNT(ap->a_vp->v_mount); if (ump->um_whitemode == UNIONFS_WHITE_ALWAYS || lvp != NULLVP) cnp->cn_flags |= DOWHITEOUT; - error = VOP_RMDIR(udvp, uvp, cnp); + error = unionfs_relookup_for_delete(ap->a_dvp, cnp, td); + if (!error) + error = VOP_RMDIR(udvp, uvp, cnp); } else if (lvp != NULLVP) error = unionfs_mkwhiteout(udvp, cnp, td, unp->un_path); @@ -1467,7 +1457,7 @@ unionfs_symlink(struct vop_symlink_args if (udvp != NULLVP) { error = VOP_SYMLINK(udvp, &uvp, cnp, ap->a_vap, ap->a_target); if (error == 0) { - VOP_UNLOCK(uvp, 0); + VOP_UNLOCK(uvp, LK_RELEASE); cnp->cn_lkflags = LK_EXCLUSIVE; error = unionfs_nodeget(ap->a_dvp->v_mount, uvp, NULLVP, ap->a_dvp, ap->a_vpp, cnp, td); @@ -1487,9 +1477,11 @@ unionfs_readdir(struct vop_readdir_args int error; int eofflag; int locked; + int uio_offset_bk; struct unionfs_node *unp; struct unionfs_node_status *unsp; struct uio *uio; + struct vnode *vp; struct vnode *uvp; struct vnode *lvp; struct thread *td; @@ -1505,41 +1497,50 @@ unionfs_readdir(struct vop_readdir_args error = 0; eofflag = 0; locked = 0; - unp = VTOUNIONFS(ap->a_vp); + uio_offset_bk = 0; uio = ap->a_uio; - uvp = unp->un_uppervp; - lvp = unp->un_lowervp; + uvp = NULLVP; + lvp = NULLVP; td = uio->uio_td; ncookies_bk = 0; cookies_bk = NULL; - if (ap->a_vp->v_type != VDIR) + vp = ap->a_vp; + if (vp->v_type != VDIR) return (ENOTDIR); - /* check opaque */ - if (uvp != NULLVP && lvp != NULLVP) { - if ((error = VOP_GETATTR(uvp, &va, ap->a_cred)) != 0) - goto unionfs_readdir_exit; - if (va.va_flags & OPAQUE) - lvp = NULLVP; - } - /* check the open count. unionfs needs to open before readdir. */ - if (VOP_ISLOCKED(ap->a_vp) != LK_EXCLUSIVE) { - vn_lock(ap->a_vp, LK_UPGRADE | LK_RETRY); + if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) { + if (vn_lock(vp, LK_UPGRADE) != 0) + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); locked = 1; } - unionfs_get_node_status(unp, td, &unsp); - if ((uvp != NULLVP && unsp->uns_upper_opencnt <= 0) || - (lvp != NULLVP && unsp->uns_lower_opencnt <= 0)) { - unionfs_tryrem_node_status(unp, unsp); + unp = VTOUNIONFS(vp); + if (unp == NULL) error = EBADF; + else { + uvp = unp->un_uppervp; + lvp = unp->un_lowervp; + unionfs_get_node_status(unp, td, &unsp); + if ((uvp != NULLVP && unsp->uns_upper_opencnt <= 0) || + (lvp != NULLVP && unsp->uns_lower_opencnt <= 0)) { + unionfs_tryrem_node_status(unp, unsp); + error = EBADF; + } } - if (locked == 1) - vn_lock(ap->a_vp, LK_DOWNGRADE | LK_RETRY); + if (locked) + vn_lock(vp, LK_DOWNGRADE | LK_RETRY); if (error != 0) goto unionfs_readdir_exit; + /* check opaque */ + if (uvp != NULLVP && lvp != NULLVP) { + if ((error = VOP_GETATTR(uvp, &va, ap->a_cred)) != 0) + goto unionfs_readdir_exit; + if (va.va_flags & OPAQUE) + lvp = NULLVP; + } + /* upper only */ if (uvp != NULLVP && lvp == NULLVP) { error = VOP_READDIR(uvp, uio, ap->a_cred, ap->a_eofflag, @@ -1576,7 +1577,7 @@ unionfs_readdir(struct vop_readdir_args unsp->uns_readdir_status = 1; /* - * ufs(and other fs) needs size of uio_resid larger than + * UFS(and other FS) needs size of uio_resid larger than * DIRBLKSIZ. * size of DIRBLKSIZ equals DEV_BSIZE. * (see: ufs/ufs/ufs_vnops.c ufs_readdir func , ufs/ufs/dir.h) @@ -1585,7 +1586,7 @@ unionfs_readdir(struct vop_readdir_args goto unionfs_readdir_exit; /* - * backup cookies + * Backup cookies. * It prepares to readdir in lower. */ if (ap->a_ncookies != NULL) { @@ -1601,6 +1602,11 @@ unionfs_readdir(struct vop_readdir_args /* initialize for readdir in lower */ if (unsp->uns_readdir_status == 1) { unsp->uns_readdir_status = 2; + /* + * Backup uio_offset. See the comment after the + * VOP_READDIR call on the lower layer. + */ + uio_offset_bk = uio->uio_offset; uio->uio_offset = 0; } @@ -1612,6 +1618,19 @@ unionfs_readdir(struct vop_readdir_args error = VOP_READDIR(lvp, uio, ap->a_cred, ap->a_eofflag, ap->a_ncookies, ap->a_cookies); + /* + * We can't return an uio_offset of 0: this would trigger an + * infinite loop, because the next call to unionfs_readdir would + * always restart with the upper layer (uio_offset == 0) and + * always return some data. + * + * This happens when the lower layer root directory is removed. + * (A root directory deleting of unionfs should not be permitted. + * But current VFS can not do it.) + */ + if (uio->uio_offset == 0) + uio->uio_offset = uio_offset_bk; + if (cookies_bk != NULL) { /* merge cookies */ int size; @@ -1623,7 +1642,7 @@ unionfs_readdir(struct vop_readdir_args pos = newcookies; memcpy(pos, cookies_bk, ncookies_bk * sizeof(u_long)); - pos += ncookies_bk * sizeof(u_long); + pos += ncookies_bk; memcpy(pos, *(ap->a_cookies), *(ap->a_ncookies) * sizeof(u_long)); free(cookies_bk, M_TEMP); free(*(ap->a_cookies), M_TEMP); @@ -1743,18 +1762,66 @@ unionfs_print(struct vop_print_args *ap) } static int -unionfs_get_llt_revlock(int flags) +unionfs_islocked(struct vop_islocked_args *ap) { - int count; + struct unionfs_node *unp; - flags &= LK_TYPE_MASK; - for (count = 0; un_llt[count].lock != 0; count++) { - if (flags == un_llt[count].lock) { - return un_llt[count].revlock; - } + KASSERT_UNIONFS_VNODE(ap->a_vp); + + unp = VTOUNIONFS(ap->a_vp); + if (unp == NULL) + return (vop_stdislocked(ap)); + + if (unp->un_uppervp != NULLVP) + return (VOP_ISLOCKED(unp->un_uppervp)); + if (unp->un_lowervp != NULLVP) + return (VOP_ISLOCKED(unp->un_lowervp)); + return (vop_stdislocked(ap)); +} + +static int +unionfs_get_llt_revlock(struct vnode *vp, int flags) +{ + int revlock; + + revlock = 0; + + switch (flags & LK_TYPE_MASK) { + case LK_SHARED: + if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) + revlock = LK_UPGRADE; + else + revlock = LK_RELEASE; + break; + case LK_EXCLUSIVE: + case LK_UPGRADE: + revlock = LK_RELEASE; + break; + case LK_DOWNGRADE: + revlock = LK_UPGRADE; + break; + default: + break; } - return 0; + return (revlock); +} + +/* + * The state of an acquired lock is adjusted similarly to + * the time of error generating. + * flags: LK_RELEASE or LK_UPGRADE + */ +static void +unionfs_revlock(struct vnode *vp, int flags) +{ + if (flags & LK_RELEASE) + VOP_UNLOCK(vp, flags); + else { + /* UPGRADE */ + if (vn_lock(vp, flags) != 0) + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + } } static int @@ -1763,6 +1830,7 @@ unionfs_lock(struct vop_lock1_args *ap) int error; int flags; int revlock; + int interlock; int uhold; struct mount *mp; struct unionfs_mount *ump; @@ -1774,15 +1842,13 @@ unionfs_lock(struct vop_lock1_args *ap) KASSERT_UNIONFS_VNODE(ap->a_vp); error = 0; + interlock = 1; uhold = 0; flags = ap->a_flags; vp = ap->a_vp; if (LK_RELEASE == (flags & LK_TYPE_MASK) || !(flags & LK_TYPE_MASK)) - return (VOP_UNLOCK(vp, flags)); - - if ((revlock = unionfs_get_llt_revlock(flags)) == 0) - panic("unknown lock type: 0x%x", flags & LK_TYPE_MASK); + return (VOP_UNLOCK(vp, flags | LK_RELEASE)); if ((flags & LK_INTERLOCK) == 0) VI_LOCK(vp); @@ -1798,6 +1864,9 @@ unionfs_lock(struct vop_lock1_args *ap) lvp = unp->un_lowervp; uvp = unp->un_uppervp; + if ((revlock = unionfs_get_llt_revlock(vp, flags)) == 0) + panic("unknown lock type: 0x%x", flags & LK_TYPE_MASK); + if ((mp->mnt_kern_flag & MNTK_MPSAFE) != 0 && (vp->v_iflag & VI_OWEINACT) != 0) flags |= LK_NOWAIT; @@ -1811,6 +1880,23 @@ unionfs_lock(struct vop_lock1_args *ap) flags |= LK_CANRECURSE; if (lvp != NULLVP) { + if (uvp != NULLVP && flags & LK_UPGRADE) { + /* Share Lock is once released and a deadlock is avoided. */ + VI_LOCK_FLAGS(uvp, MTX_DUPOK); + vholdl(uvp); + uhold = 1; + VI_UNLOCK(vp); + VOP_UNLOCK(uvp, LK_RELEASE | LK_INTERLOCK); + VI_LOCK(vp); + unp = VTOUNIONFS(vp); + if (unp == NULL) { + /* vnode is released. */ + VI_UNLOCK(vp); + VOP_UNLOCK(lvp, LK_RELEASE); + vdrop(uvp); + return (EBUSY); + } + } VI_LOCK_FLAGS(lvp, MTX_DUPOK); flags |= LK_INTERLOCK; vholdl(lvp); @@ -1823,19 +1909,28 @@ unionfs_lock(struct vop_lock1_args *ap) VI_LOCK(vp); unp = VTOUNIONFS(vp); if (unp == NULL) { + /* vnode is released. */ VI_UNLOCK(vp); if (error == 0) - VOP_UNLOCK(lvp, 0); + VOP_UNLOCK(lvp, LK_RELEASE); vdrop(lvp); + if (uhold != 0) + vdrop(uvp); return (vop_stdlock(ap)); } } if (error == 0 && uvp != NULLVP) { + if (uhold && flags & LK_UPGRADE) { + flags &= ~LK_TYPE_MASK; + flags |= LK_EXCLUSIVE; + } VI_LOCK_FLAGS(uvp, MTX_DUPOK); flags |= LK_INTERLOCK; - vholdl(uvp); - uhold = 1; + if (uhold == 0) { + vholdl(uvp); + uhold = 1; + } VI_UNLOCK(vp); ap->a_flags &= ~LK_INTERLOCK; @@ -1845,30 +1940,27 @@ unionfs_lock(struct vop_lock1_args *ap) VI_LOCK(vp); unp = VTOUNIONFS(vp); if (unp == NULL) { + /* vnode is released. */ VI_UNLOCK(vp); - if (error == 0) { - VOP_UNLOCK(uvp, 0); - if (lvp != NULLVP) - VOP_UNLOCK(lvp, 0); - } - if (lvp != NULLVP) - vdrop(lvp); + if (error == 0) + VOP_UNLOCK(uvp, LK_RELEASE); vdrop(uvp); + if (lvp != NULLVP) { + VOP_UNLOCK(lvp, LK_RELEASE); + vdrop(lvp); + } return (vop_stdlock(ap)); } - if (error != 0 && lvp != NULLVP) { + /* rollback */ VI_UNLOCK(vp); - if ((revlock & LK_TYPE_MASK) == LK_RELEASE) - VOP_UNLOCK(lvp, revlock); - else - vn_lock(lvp, revlock | LK_RETRY); - goto unionfs_lock_abort; + unionfs_revlock(lvp, revlock); + interlock = 0; } } - VI_UNLOCK(vp); -unionfs_lock_abort: + if (interlock) + VI_UNLOCK(vp); if (lvp != NULLVP) vdrop(lvp); if (uhold != 0) @@ -2013,7 +2105,7 @@ unionfs_advlock(struct vop_advlock_args unionfs_tryrem_node_status(unp, unsp); } - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp, LK_RELEASE); error = VOP_ADVLOCK(uvp, ap->a_id, ap->a_op, ap->a_fl, ap->a_flags); @@ -2022,7 +2114,7 @@ unionfs_advlock(struct vop_advlock_args return error; unionfs_advlock_abort: - VOP_UNLOCK(vp, 0); + VOP_UNLOCK(vp, LK_RELEASE); UNIONFS_INTERNAL_DEBUG("unionfs_advlock: leave (%d)\n", error); @@ -2150,7 +2242,8 @@ unionfs_openextattr(struct vop_openextat error = VOP_OPENEXTATTR(tvp, ap->a_cred, ap->a_td); if (error == 0) { - vn_lock(vp, LK_UPGRADE | LK_RETRY); + if (vn_lock(vp, LK_UPGRADE) != 0) + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (tvp == unp->un_uppervp) unp->un_flag |= UNIONFS_OPENEXTU; else @@ -2186,7 +2279,8 @@ unionfs_closeextattr(struct vop_closeext error = VOP_CLOSEEXTATTR(tvp, ap->a_commit, ap->a_cred, ap->a_td); if (error == 0) { - vn_lock(vp, LK_UPGRADE | LK_RETRY); + if (vn_lock(vp, LK_UPGRADE) != 0) + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (tvp == unp->un_uppervp) unp->un_flag &= ~UNIONFS_OPENEXTU; else @@ -2435,6 +2529,7 @@ struct vop_vector unionfs_vnodeops = { .vop_getextattr = unionfs_getextattr, .vop_getwritemount = unionfs_getwritemount, .vop_inactive = unionfs_inactive, + .vop_islocked = unionfs_islocked, .vop_ioctl = unionfs_ioctl, .vop_link = unionfs_link, .vop_listextattr = unionfs_listextattr, From owner-svn-src-stable-8@FreeBSD.ORG Thu May 10 22:38:15 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A85E7106566B; Thu, 10 May 2012 22:38:15 +0000 (UTC) (envelope-from daichi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7A3158FC14; Thu, 10 May 2012 22:38:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4AMcFIg054861; Thu, 10 May 2012 22:38:15 GMT (envelope-from daichi@svn.freebsd.org) Received: (from daichi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4AMcF3E054860; Thu, 10 May 2012 22:38:15 GMT (envelope-from daichi@svn.freebsd.org) Message-Id: <201205102238.q4AMcF3E054860@svn.freebsd.org> From: Daichi GOTO Date: Thu, 10 May 2012 22:38:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235250 - stable/8/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 May 2012 22:38:15 -0000 Author: daichi Date: Thu May 10 22:38:15 2012 New Revision: 235250 URL: http://svn.freebsd.org/changeset/base/235250 Log: Added forgotten r234867,234944 mergeinfo Modified: Directory Properties: stable/8/sys/ (props changed) From owner-svn-src-stable-8@FreeBSD.ORG Fri May 11 01:28:26 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 543FD106566C; Fri, 11 May 2012 01:28:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 214C98FC16; Fri, 11 May 2012 01:28:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4B1SPpe060134; Fri, 11 May 2012 01:28:25 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4B1SPlO060133; Fri, 11 May 2012 01:28:25 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201205110128.q4B1SPlO060133@svn.freebsd.org> From: Ed Maste Date: Fri, 11 May 2012 01:28: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: r235254 - stable/8/lib/libfetch X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 May 2012 01:28:26 -0000 Author: emaste Date: Fri May 11 01:28:25 2012 New Revision: 235254 URL: http://svn.freebsd.org/changeset/base/235254 Log: MFC r234138: Support percent-encoded user and password RFC 1738 specifies that any ":", "@", or "/" within a user name or password in a URL is percent-encoded, to avoid ambiguity with the use of those characters as URL component separators. Modified: stable/8/lib/libfetch/fetch.c Directory Properties: stable/8/lib/libfetch/ (props changed) Modified: stable/8/lib/libfetch/fetch.c ============================================================================== --- stable/8/lib/libfetch/fetch.c Fri May 11 01:24:16 2012 (r235253) +++ stable/8/lib/libfetch/fetch.c Fri May 11 01:28:25 2012 (r235254) @@ -289,6 +289,49 @@ fetchMakeURL(const char *scheme, const c } /* + * Return value of the given hex digit. + */ +static int +fetch_hexval(char ch) +{ + + if (ch >= '0' && ch <= '9') + return (ch - '0'); + else if (ch >= 'a' && ch <= 'f') + return (ch - 'a' + 10); + else if (ch >= 'A' && ch <= 'F') + return (ch - 'A' + 10); + return (-1); +} + +/* + * Decode percent-encoded URL component from src into dst, stopping at end + * of string, or at @ or : separators. Returns a pointer to the unhandled + * part of the input string (null terminator, @, or :). No terminator is + * written to dst (it is the caller's responsibility). + */ +static const char * +fetch_pctdecode(char *dst, const char *src, size_t dlen) +{ + int d1, d2; + char c; + const char *s; + + for (s = src; *s != '\0' && *s != '@' && *s != ':'; s++) { + if (s[0] == '%' && (d1 = fetch_hexval(s[1])) >= 0 && + (d2 = fetch_hexval(s[2])) >= 0 && (d1 > 0 || d2 > 0)) { + c = d1 << 4 | d2; + s += 2; + } else { + c = *s; + } + if (dlen-- > 0) + *dst++ = c; + } + return (s); +} + +/* * Split an URL into components. URL syntax is: * [method:/][/[user[:pwd]@]host[:port]/][document] * This almost, but not quite, RFC1738 URL syntax. @@ -329,15 +372,11 @@ fetchParseURL(const char *URL) p = strpbrk(URL, "/@"); if (p && *p == '@') { /* username */ - for (q = URL, i = 0; (*q != ':') && (*q != '@'); q++) - if (i < URL_USERLEN) - u->user[i++] = *q; + q = fetch_pctdecode(u->user, URL, URL_USERLEN); /* password */ if (*q == ':') - for (q++, i = 0; (*q != ':') && (*q != '@'); q++) - if (i < URL_PWDLEN) - u->pwd[i++] = *q; + q = fetch_pctdecode(u->pwd, ++q, URL_PWDLEN); p++; } else { From owner-svn-src-stable-8@FreeBSD.ORG Fri May 11 04:02:38 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7A01A10657E1; Fri, 11 May 2012 04:02:38 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 648ED8FC08; Fri, 11 May 2012 04:02:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4B42cUS065385; Fri, 11 May 2012 04:02:38 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4B42c5H065383; Fri, 11 May 2012 04:02:38 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201205110402.q4B42c5H065383@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 11 May 2012 04:02: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: r235259 - stable/8/sbin/geom/class/part X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 May 2012 04:02:38 -0000 Author: ae Date: Fri May 11 04:02:37 2012 New Revision: 235259 URL: http://svn.freebsd.org/changeset/base/235259 Log: MFC r235033: Don't ignore start offset value when user specifies it together with alignment. PR: bin/167567 Tested by: Warren Block Modified: stable/8/sbin/geom/class/part/geom_part.c Directory Properties: stable/8/sbin/geom/class/part/ (props changed) Modified: stable/8/sbin/geom/class/part/geom_part.c ============================================================================== --- stable/8/sbin/geom/class/part/geom_part.c Fri May 11 04:02:17 2012 (r235258) +++ stable/8/sbin/geom/class/part/geom_part.c Fri May 11 04:02:37 2012 (r235259) @@ -524,6 +524,8 @@ gpart_autofill(struct gctl_req *req) grade = ~0ULL; a_first = ALIGNUP(first + offset, alignment); last = ALIGNDOWN(last + offset, alignment); + if (a_first < start) + a_first = start; while ((pp = find_provider(gp, first)) != NULL) { s = find_provcfg(pp, "start"); if (s == NULL) { @@ -563,7 +565,8 @@ gpart_autofill(struct gctl_req *req) (off_t)strtoimax(s, NULL, 0) / pp->lg_sectorsize; } else first = (off_t)strtoimax(s, NULL, 0) + 1; - a_first = ALIGNUP(first + offset, alignment); + if (first > a_first) + a_first = ALIGNUP(first + offset, alignment); } if (a_first <= last) { /* Free space [first-last] */ From owner-svn-src-stable-8@FreeBSD.ORG Sat May 12 00:43:35 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 80734106564A; Sat, 12 May 2012 00:43:35 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B8968FC08; Sat, 12 May 2012 00:43:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4C0hZxq007761; Sat, 12 May 2012 00:43:35 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4C0hZjP007759; Sat, 12 May 2012 00:43:35 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205120043.q4C0hZjP007759@svn.freebsd.org> From: Eitan Adler Date: Sat, 12 May 2012 00:43:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235305 - stable/8/etc/mtree X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 May 2012 00:43:35 -0000 Author: eadler Date: Sat May 12 00:43:34 2012 New Revision: 235305 URL: http://svn.freebsd.org/changeset/base/235305 Log: MFC r235203: fix spacing in mtree file Approved by: cperciva (implicit) Modified: stable/8/etc/mtree/BSD.usr.dist Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/mtree/BSD.usr.dist ============================================================================== --- stable/8/etc/mtree/BSD.usr.dist Sat May 12 00:43:14 2012 (r235304) +++ stable/8/etc/mtree/BSD.usr.dist Sat May 12 00:43:34 2012 (r235305) @@ -193,8 +193,8 @@ .. bootforth .. - csh - .. + csh + .. cvs contrib .. From owner-svn-src-stable-8@FreeBSD.ORG Sat May 12 00:46:59 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DD94F106564A; Sat, 12 May 2012 00:46:59 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C85478FC0C; Sat, 12 May 2012 00:46:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4C0kxOR007984; Sat, 12 May 2012 00:46:59 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4C0kxgJ007982; Sat, 12 May 2012 00:46:59 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205120046.q4C0kxgJ007982@svn.freebsd.org> From: Eitan Adler Date: Sat, 12 May 2012 00:46:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235308 - stable/8/sbin/md5 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 May 2012 00:47:00 -0000 Author: eadler Date: Sat May 12 00:46:59 2012 New Revision: 235308 URL: http://svn.freebsd.org/changeset/base/235308 Log: MFC r235205: Document the -c option in --help output Approved by: cperciva (implicit) Modified: stable/8/sbin/md5/md5.c Directory Properties: stable/8/sbin/md5/ (props changed) Modified: stable/8/sbin/md5/md5.c ============================================================================== --- stable/8/sbin/md5/md5.c Sat May 12 00:46:39 2012 (r235307) +++ stable/8/sbin/md5/md5.c Sat May 12 00:46:59 2012 (r235308) @@ -372,6 +372,6 @@ static void usage(Algorithm_t *alg) { - fprintf(stderr, "usage: %s [-pqrtx] [-s string] [files ...]\n", alg->progname); + fprintf(stderr, "usage: %s [-pqrtx] [-c string] [-s string] [files ...]\n", alg->progname); exit(1); } From owner-svn-src-stable-8@FreeBSD.ORG Sat May 12 00:49:38 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE4911065696; Sat, 12 May 2012 00:49:38 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B99FA8FC0C; Sat, 12 May 2012 00:49:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4C0nca9008232; Sat, 12 May 2012 00:49:38 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4C0ncq0008230; Sat, 12 May 2012 00:49:38 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205120049.q4C0ncq0008230@svn.freebsd.org> From: Eitan Adler Date: Sat, 12 May 2012 00:49: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: r235311 - stable/8/usr.sbin/portsnap/portsnap X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 May 2012 00:49:38 -0000 Author: eadler Date: Sat May 12 00:49:38 2012 New Revision: 235311 URL: http://svn.freebsd.org/changeset/base/235311 Log: MFC r235208: make it easier for users used to a VCS that allows up to be a shortcut for update. Approved by: cperciva (implicit) Modified: stable/8/usr.sbin/portsnap/portsnap/portsnap.sh Directory Properties: stable/8/usr.sbin/portsnap/ (props changed) Modified: stable/8/usr.sbin/portsnap/portsnap/portsnap.sh ============================================================================== --- stable/8/usr.sbin/portsnap/portsnap/portsnap.sh Sat May 12 00:49:14 2012 (r235310) +++ stable/8/usr.sbin/portsnap/portsnap/portsnap.sh Sat May 12 00:49:38 2012 (r235311) @@ -143,6 +143,9 @@ parse_cmdline() { cron | extract | fetch | update | alfred) COMMANDS="${COMMANDS} $1" ;; + up) + COMMANDS="${COMMANDS} update" + ;; *) if [ $# -gt 1 ]; then usage; fi if echo ${COMMANDS} | grep -vq extract; then From owner-svn-src-stable-8@FreeBSD.ORG Sat May 12 00:55:30 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54CE11065740; Sat, 12 May 2012 00:55:30 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E21F8FC0A; Sat, 12 May 2012 00:55:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4C0tUwr008522; Sat, 12 May 2012 00:55:30 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4C0tUnb008520; Sat, 12 May 2012 00:55:30 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205120055.q4C0tUnb008520@svn.freebsd.org> From: Eitan Adler Date: Sat, 12 May 2012 00:55:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235314 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 May 2012 00:55:30 -0000 Author: eadler Date: Sat May 12 00:55:29 2012 New Revision: 235314 URL: http://svn.freebsd.org/changeset/base/235314 Log: MFC r232496: Fix a variety of grammar nits and errors Approved by: cperciva (implicit) Modified: stable/8/share/man/man4/jme.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/jme.4 ============================================================================== --- stable/8/share/man/man4/jme.4 Sat May 12 00:55:02 2012 (r235313) +++ stable/8/share/man/man4/jme.4 Sat May 12 00:55:29 2012 (r235314) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 29, 2011 +.Dd March 4, 2012 .Dt JME 4 .Os .Sh NAME @@ -130,23 +130,26 @@ variables and tunables: .Bl -tag -width "xxxxxx" .It Va dev.jme.%d.tx_coal_to -Maximum amount of time to delay for Tx completion interrupt in -units of 1us. -The accepted range is 1 to 65535, the default is 100 (100us). +This variable sets the maximum amount of time to delay +before sending a Tx completion interrupt, in microseconds. +The accepted range is 1 to 65535; the default is 100 (100us). .It Va dev.jme.%d.tx_coal_pkt -Maximum number of packets to fire Tx completion interrupt. -The accepted range is 1 to 255, the default is 8. +This variable sets the maximum number of outgoing packets which may be +coalesced together into a single Tx completion interrupt. +The accepted range is 1 to 255; the default is 8. .It Va dev.jme.%d.rx_coal_to -Maximum amount of time to delay for Rx completion interrupt in -units of 1us. -The accepted range is 1 to 65535, the default is 100 (100us). +This variable sets the maximum amount of time to wait for +additional packets to arrive (for possible packet coalescing) +before firing an Rx completion interrupt, in microseconds. +The accepted range is 1 to 65535; the default is 100 (100us). .It Va dev.jme.%d.rx_coal_pkt -Maximum number of packets to fire Rx completion interrupt. -The accepted range is 1 to 255, the default is 2. +This variable sets the maximum number of incoming packets which may be +coalesced into a single Rx completion interrupt. +The accepted range is 1 to 255; the default is 2. .It Va dev.jme.%d.process_limit -Maximum amount of Rx events to be processed in the event loop before -rescheduling a taskqueue. -The accepted range is 10 to 255, the default value is 128 events. +This variable sets the maximum number of events that will be processed +in a single batch before the handler is requeued into a taskqueue. +The accepted range is 10 to 255; the default value is 128 events. The interface does not need to be brought down and up again before a change takes effect. .El @@ -173,22 +176,22 @@ driver tries to avoid unnecessary statio controllers that use eFuse to store station address. The number of times that eFuse can be safely reprogrammed is 16 at most. -In addition, there is no way to restore factory default station -address once station address is reprogrammed via eFuse. -It is highly recommended not to reprogram station address and -it is responsibility of administrator to store original station -address into a safe place when station address should be changed. +In addition, there is no way to restore the factory default station +address once the station address has been reprogrammed via eFuse. +It is highly recommended not to reprogram the station address and +it is the responsibility of the administrator to store the original station +address in a safe place when station address is changed. .Pp There are two known 1000baseT link establishment issues with JMC25x. If the full mask revision number of JMC25x controller is less than -or equal to 4 and link partner enabled IEEE 802.3az Energy Efficient -Ethernet feature, the controller would not be able to establish a +or equal to 4 and the link partner enabled the IEEE 802.3az Energy Efficient +Ethernet feature, the controller will not be able to establish a 1000baseT link. -Also if the length of cable is longer than 120 meters, controller +Also, if the length of the cable is longer than 120 meters, the controller can not establish a 1000baseT link. -The known workaround for the issue is to force manual link +The known workaround for these issues is to force manual link configuration with 100baseTX instead of relying on auto-negotiation. -The full mask revision number of controller could be checked with +The full mask revision number of controller can be checked with the verbose kernel boot option. -Use lower nibble of chip revision number to get full mask revision of -the controller. +Use the lower nibble of the chip revision number to get the +full mask revision of the controller.