From owner-svn-src-head@freebsd.org Mon Mar 27 20:32:13 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81505D20CC6; Mon, 27 Mar 2017 20:32:13 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5976EE82; Mon, 27 Mar 2017 20:32:13 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2RKWCWl074086; Mon, 27 Mar 2017 20:32:12 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2RKWCuR074083; Mon, 27 Mar 2017 20:32:12 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201703272032.v2RKWCuR074083@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 27 Mar 2017 20:32:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316057 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Mar 2017 20:32:13 -0000 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 \