svn commit: r211027 - projects/sv/sys/net

Attilio Rao attilio at FreeBSD.org
Sat Aug 7 17:19:47 UTC 2010


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;


More information about the svn-src-projects mailing list