Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Mar 2017 20:32:12 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r316057 - head/share/man/man9
Message-ID:  <201703272032.v2RKWCuR074083@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Mon Mar 27 20:32:12 2017
New Revision: 316057
URL: https://svnweb.freebsd.org/changeset/base/316057

Log:
  Document EVENTHANDLER_DEFINE(9).
  
  MFC after:	2 weeks
  Sponsored by:	DARPA, AFRL

Modified:
  head/share/man/man9/EVENTHANDLER.9
  head/share/man/man9/Makefile

Modified: head/share/man/man9/EVENTHANDLER.9
==============================================================================
--- head/share/man/man9/EVENTHANDLER.9	Mon Mar 27 20:28:56 2017	(r316056)
+++ head/share/man/man9/EVENTHANDLER.9	Mon Mar 27 20:32:12 2017	(r316057)
@@ -23,7 +23,7 @@
 .\" SUCH DAMAGE.
 .\" $FreeBSD$
 .\"
-.Dd April 19, 2014
+.Dd March 27, 2017
 .Dt EVENTHANDLER 9
 .Os
 .Sh NAME
@@ -32,6 +32,7 @@
 .Sh SYNOPSIS
 .In sys/eventhandler.h
 .Fn EVENTHANDLER_DECLARE name type
+.Fn EVENTHANDLER_DEFINE name func arg priority
 .Fn EVENTHANDLER_INVOKE name ...
 .Ft eventhandler_tag
 .Fn EVENTHANDLER_REGISTER name func arg priority
@@ -60,6 +61,20 @@ mechanism provides a way for kernel subs
 kernel events and have their callback functions invoked when these
 events occur.
 .Pp
+Callback functions are invoked in order of priority.
+The relative priority of each callback among other callbacks
+associated with an event is given by argument
+.Fa priority ,
+which is an integer ranging from
+.Dv EVENTHANDLER_PRI_FIRST
+(highest priority), to
+.Dv EVENTHANDLER_PRI_LAST
+(lowest priority).
+The symbol
+.Dv EVENTHANDLER_PRI_ANY
+may be used if the handler does not have a specific priority
+associated with it.
+.Pp
 The normal way to use this subsystem is via the macro interface.
 The macros that can be used for working with event handlers and callback
 function lists are:
@@ -69,6 +84,21 @@ This macro declares an event handler nam
 .Fa name
 with callback functions of type
 .Fa type .
+.It Fn EVENTHANDLER_DEFINE
+This macro uses
+.Xr SYSINIT 9
+to register a callback function
+.Fa func
+with event handler
+.Fa name .
+When invoked, function
+.Fa func
+will be invoked with argument
+.Fa arg
+as its first parameter along with any additional parameters passed in
+via macro
+.Fn EVENTHANDLER_INVOKE
+(see below).
 .It Fn EVENTHANDLER_REGISTER
 This macro registers a callback function
 .Fa func
@@ -82,19 +112,6 @@ as its first parameter along with any ad
 via macro
 .Fn EVENTHANDLER_INVOKE
 (see below).
-Callback functions are invoked in order of priority.
-The relative priority of each callback among other callbacks
-associated with an event is given by argument
-.Fa priority ,
-which is an integer ranging from
-.Dv EVENTHANDLER_PRI_FIRST
-(highest priority), to
-.Dv EVENTHANDLER_PRI_LAST
-(lowest priority).
-The symbol
-.Dv EVENTHANDLER_PRI_ANY
-may be used if the handler does not have a specific priority
-associated with it.
 If registration is successful,
 .Fn EVENTHANDLER_REGISTER
 returns a cookie of type

Modified: head/share/man/man9/Makefile
==============================================================================
--- head/share/man/man9/Makefile	Mon Mar 27 20:28:56 2017	(r316056)
+++ head/share/man/man9/Makefile	Mon Mar 27 20:32:12 2017	(r316057)
@@ -797,6 +797,7 @@ MLINKS+=DRIVER_MODULE.9 DRIVER_MODULE_OR
 	DRIVER_MODULE.9 EARLY_DRIVER_MODULE.9 \
 	DRIVER_MODULE.9 EARLY_DRIVER_MODULE_ORDERED.9
 MLINKS+=EVENTHANDLER.9 EVENTHANDLER_DECLARE.9 \
+	EVENTHANDLER.9 EVENTHANDLER_DEFINE.9 \
 	EVENTHANDLER.9 EVENTHANDLER_DEREGISTER.9 \
 	EVENTHANDLER.9 eventhandler_deregister.9 \
 	EVENTHANDLER.9 eventhandler_find_list.9 \



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