Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Dec 2005 19:15:31 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 87900 for review
Message-ID:  <200512081915.jB8JFV0N007977@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=87900

Change 87900 by jhb@jhb_slimer on 2005/12/08 19:15:03

	- Indicate the mutex name via a DEF or SPIN flag to more closely
	  match mtx_init() syntax and trim a line.
	- Simplify logic for flag printing as a result since we now always
	  print at least one flag.
	- Make 'show mtx' an alias for 'show mutex' since I mistyped it on
	  my first test.

Affected files ...

.. //depot/projects/smpng/sys/kern/kern_mutex.c#109 edit

Differences ...

==== //depot/projects/smpng/sys/kern/kern_mutex.c#109 (text+ko) ====

@@ -946,35 +946,28 @@
 {
 	struct thread *td;
 	struct mtx *m;
-	int comma;
 
 	if (!have_addr)
 		return;
 	m = (struct mtx *)addr;
 
-	if (m->mtx_object.lo_class == &lock_class_mtx_sleep)
-		db_printf("default mutex:\n");
-	else if (m->mtx_object.lo_class == &lock_class_mtx_spin)
-		db_printf("spin mutex:\n");
-	else
+	if (m->mtx_object.lo_class != &lock_class_mtx_sleep &&
+	    m->mtx_object.lo_class != &lock_class_mtx_spin)
 		return;
 	db_printf(" name: %s\n", m->mtx_object.lo_name);
-	if (m->mtx_object.lo_type)
+	if (m->mtx_object.lo_type &&
+	    m->mtx_object.lo_type != m->mtx_object.lo_name)
 		db_printf(" type: %s\n", m->mtx_object.lo_type);
-	if (m->mtx_object.lo_flags & (LO_RECURSABLE | LO_DUPOK)) {
-		db_printf(" flags: {");
-		comma = 0;
-		if (m->mtx_object.lo_flags & LO_RECURSABLE) {
-			db_printf("RECURSE");
-			comma++;
-		}
-		if (m->mtx_object.lo_flags & LO_DUPOK) {
-			if (comma)
-				db_printf(", ");
-			db_printf("DUPOK");
-		}
-		db_printf("}\n");
-	}
+	db_printf(" flags: {");
+	if (m->mtx_object.lo_class == &lock_class_mtx_spin)
+		db_printf("SPIN");
+	else
+		db_printf("DEF");
+	if (m->mtx_object.lo_flags & LO_RECURSABLE)
+		db_printf(", RECURSE");
+	if (m->mtx_object.lo_flags & LO_DUPOK)
+		db_printf(", DUPOK");
+	db_printf("}\n");
 	db_printf(" owner: ");
 	if (mtx_unowned(m))
 		db_printf("UNOWNED\n");
@@ -986,4 +979,13 @@
 			db_printf(" recursed: %d\n", m->mtx_recurse);
 	}
 }
+
+/* Make 'show mtx' an alias for 'show mutex'.  Ugly. */
+static const struct command db_show_mutex_mtx = {
+	"mtx",
+	db_show_mutex,
+	0,
+	NULL
+};
+TEXT_SET(db_show_cmd_set, db_show_mutex_mtx);
 #endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200512081915.jB8JFV0N007977>