From owner-svn-src-projects@FreeBSD.ORG  Sat Aug  7 17:19:46 2010
Return-Path: <owner-svn-src-projects@FreeBSD.ORG>
Delivered-To: svn-src-projects@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E43CD106564A;
	Sat,  7 Aug 2010 17:19:46 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B92E38FC13;
	Sat,  7 Aug 2010 17:19:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o77HJkT2004974;
	Sat, 7 Aug 2010 17:19:46 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o77HJkVZ004972;
	Sat, 7 Aug 2010 17:19:46 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <201008071719.o77HJkVZ004972@svn.freebsd.org>
From: Attilio Rao <attilio@FreeBSD.org>
Date: Sat, 7 Aug 2010 17:19:46 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-projects@freebsd.org
X-SVN-Group: projects
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r211027 - projects/sv/sys/net
X-BeenThere: svn-src-projects@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the src &quot; projects&quot;
	tree" <svn-src-projects.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-projects>, 
	<mailto:svn-src-projects-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-projects>
List-Post: <mailto:svn-src-projects@freebsd.org>
List-Help: <mailto:svn-src-projects-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-projects>, 
	<mailto:svn-src-projects-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 07 Aug 2010 17:19:47 -0000

Author: attilio
Date: Sat Aug  7 17:19:46 2010
New Revision: 211027
URL: http://svn.freebsd.org/changeset/base/211027

Log:
  - Fix a bug when newptr == NULL
  - Fix spelling for the exact operations
  - Remove a stale comment and rework another one
  
  Note: Besides the fact that this sysctl may needing an enum for handling
  the operations from the userland in a more polite manner, I'm a bit
  unsure about its purpose and if we might use it.
  
  Is that used for emulating panic and check if netdump really works?
  If yes, probabilly this might be just in debugging mode eventually.

Modified:
  projects/sv/sys/net/netdump_client.c

Modified: projects/sv/sys/net/netdump_client.c
==============================================================================
--- projects/sv/sys/net/netdump_client.c	Sat Aug  7 17:02:36 2010	(r211026)
+++ projects/sv/sys/net/netdump_client.c	Sat Aug  7 17:19:46 2010	(r211027)
@@ -293,19 +293,18 @@ sysctl_nic(SYSCTL_HANDLER_ARGS)
 	return error;
 }
 
-/* From the watchdog code and modified */
 static int
 sysctl_force_crash(SYSCTL_HANDLER_ARGS) 
 {
 	int error;
-	error = sysctl_handle_int(oidp, &nd_force_crash, 
-				  sizeof(nd_force_crash), req);
-	if (error)
-	    return error;
+
+	error = sysctl_handle_int(oidp, &nd_force_crash, nd_force_crash, req);
+	if (error || req->newptr == NULL)
+		return error;
 
 	switch (nd_force_crash) {
 		case 1:
-			printf("\nCrashing system...\n");
+			printf("\nLivelocking system...\n");
 			for (;;);
 			break;
 		case 2:
@@ -313,19 +312,18 @@ sysctl_force_crash(SYSCTL_HANDLER_ARGS) 
 			panic("netdump forced crash");
 			break;
 		case 3:
-			printf("\nDeadlocking system while holding the em lock\n");
-			{
-				nd_nic->if_netdump->test_get_lock(nd_nic);
-				for (;;);
-			}
+			printf("\nLivelocking system while holding the "
+			    "interface lock\n");
+			nd_nic->if_netdump->test_get_lock(nd_nic);
+			for (;;);
 			break;
 		case 5:
 			critical_enter();
-			panic("netdump forced crash in critical section");
+			panic("Forcing spourious critical section");
 			break;
 		case 6:
 			critical_enter();
-			printf("\nNetdump spinning in a critical section\n");
+			printf("\nLivelocking in a critical section\n");
 			for (;;);
 		default:
 			return EINVAL;