From bthomas@virtualiron.com  Fri Sep  2 17:57:31 2005
Return-Path: <bthomas@virtualiron.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 2151916A41F
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  2 Sep 2005 17:57:31 +0000 (GMT)
	(envelope-from bthomas@virtualiron.com)
Received: from mail.virtualiron.com (mail.virtualiron.com [209.213.88.114])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B695243D45
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  2 Sep 2005 17:57:30 +0000 (GMT)
	(envelope-from bthomas@virtualiron.com)
Received: from [10.1.2.26] ([10.1.2.26]) by mail.virtualiron.com with Microsoft SMTPSVC(6.0.3790.1830);
	 Fri, 2 Sep 2005 13:58:06 -0400
Message-Id: <43189289.7020602@virtualiron.com>
Date: Fri, 02 Sep 2005 13:57:29 -0400
From: Ben Thomas <bthomas@virtualiron.com>
To: FreeBSD-gnats-submit@freebsd.org
Subject: [patch] debugging code to show entries in event handler list

>Number:         85651
>Category:       kern
>Synopsis:       [kernel] [patch] debugging code to show entries in event handler list
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 02 18:00:35 GMT 2005
>Closed-Date:    
>Last-Modified:  Tue Oct 25 02:30:14 GMT 2005
>Originator:     Ben Thomas
>Release:        FreeBSD 5.4-RELEASE i386
>Organization:
Virtual Iron Software
>Environment:
System: FreeBSD bthomas4.katana-technology.com 5.4-RELEASE FreeBSD 5.4-RELEASE #10: Sun Aug 28 13:48:00 EDT 2005 ben@bthomas4.katana-technology.com:/usr/obj/usr/home/ben/BSD/RELENG_5_4_0_RELEASE/src/sys/BEN i386


>Description:

Add a debugging routine to print the entries in an eventhandler list
This has been very useful, to me, when debugging a number of problems.



This patch is against the 5_4_0_RELEASE code


>How-To-Repeat:
>Fix:

--- eventhandler.h-DIFF begins here ---
--- /usr/src.original/sys/sys/eventhandler.h	Sat Mar 13 21:06:28 2004
+++ /usr/src/sys/sys/eventhandler.h	Thu Aug 11 17:03:41 2005
@@ -130,6 +130,7 @@
 	    eventhandler_tag tag);
 struct eventhandler_list *eventhandler_find_list(char *name);
 void	eventhandler_prune_list(struct eventhandler_list *list);
+void    eventhandler_print_list(char *name);
 
 /*
  * Standard system event queues.
--- eventhandler.h-DIFF ends here ---

--- subr_eventhandler.c-DIFF begins here ---
--- /usr/src.original/sys/kern/subr_eventhandler.c	Tue Jun 10 20:56:57 2003
+++ /usr/src/sys/kern/subr_eventhandler.c	Thu Aug 11 17:05:01 2005
@@ -239,3 +239,30 @@
 	ep = en;
     }
 }
+/*
+ * Routine to print list of routines to be called by an event handler.
+ * This is to assist with debugging.
+ */
+
+void
+eventhandler_print_list(char *name)
+{
+    struct eventhandler_entry_generic *_ep;
+    struct eventhandler_entry *_ee;
+    struct eventhandler_list *list;
+
+    mtx_lock(&eventhandler_mutex);
+    list = _eventhandler_find_list(name);
+    if (list == NULL) {
+        printf("%s: no such event list '%s'\n", __FUNCTION__, name);
+	return;
+    }
+
+    printf("Eventhandler list '%s':\n", name);
+    TAILQ_FOREACH(_ee, &((list)->el_entries), ee_link) {
+      _ep = (struct eventhandler_entry_generic *)_ee;
+      printf("  %d: %p\n", _ep->ee.ee_priority, _ep->func);
+    }
+
+    return;
+}
--- subr_eventhandler.c-DIFF ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
