From owner-p4-projects@FreeBSD.ORG Thu Dec 8 19:15:34 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id CEC4D16A435; Thu, 8 Dec 2005 19:15:33 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8148F16A430 for ; Thu, 8 Dec 2005 19:15:33 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1A9CB43D68 for ; Thu, 8 Dec 2005 19:15:32 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id jB8JFVmG007980 for ; Thu, 8 Dec 2005 19:15:32 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id jB8JFV0N007977 for perforce@freebsd.org; Thu, 8 Dec 2005 19:15:31 GMT (envelope-from jhb@freebsd.org) Date: Thu, 8 Dec 2005 19:15:31 GMT Message-Id: <200512081915.jB8JFV0N007977@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 87900 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2005 19:15:34 -0000 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