From owner-svn-src-stable@freebsd.org Sun Apr 23 08:39:47 2017 Return-Path: Delivered-To: svn-src-stable@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 750CAD4A821; Sun, 23 Apr 2017 08:39:47 +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 508D61989; Sun, 23 Apr 2017 08:39:47 +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 v3N8dkIM072059; Sun, 23 Apr 2017 08:39:46 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8dkFm072057; Sun, 23 Apr 2017 08:39:46 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201704230839.v3N8dkFm072057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Apr 2017 08:39:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317327 - stable/11/share/man/man9 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:39:47 -0000 Author: trasz Date: Sun Apr 23 08:39:46 2017 New Revision: 317327 URL: https://svnweb.freebsd.org/changeset/base/317327 Log: MFC r316057: Document EVENTHANDLER_DEFINE(9). Sponsored by: DARPA, AFRL Modified: stable/11/share/man/man9/EVENTHANDLER.9 stable/11/share/man/man9/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/EVENTHANDLER.9 ============================================================================== --- stable/11/share/man/man9/EVENTHANDLER.9 Sun Apr 23 08:38:47 2017 (r317326) +++ stable/11/share/man/man9/EVENTHANDLER.9 Sun Apr 23 08:39:46 2017 (r317327) @@ -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: stable/11/share/man/man9/Makefile ============================================================================== --- stable/11/share/man/man9/Makefile Sun Apr 23 08:38:47 2017 (r317326) +++ stable/11/share/man/man9/Makefile Sun Apr 23 08:39:46 2017 (r317327) @@ -744,6 +744,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 \