kern/85651: [patch] debugging code to show entries in event handler list

Ben Thomas bthomas at virtualiron.com
Fri Sep 2 18:00:40 GMT 2005


>Number:         85651
>Category:       kern
>Synopsis:       [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:
>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 at 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:


More information about the freebsd-bugs mailing list