Deleted Added
full compact
subr_eventhandler.c (142324) subr_eventhandler.c (177253)
1/*-
2 * Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/kern/subr_eventhandler.c 142324 2005-02-23 19:32:29Z sam $");
28__FBSDID("$FreeBSD: head/sys/kern/subr_eventhandler.c 177253 2008-03-16 10:58:09Z rwatson $");
29
30#include <sys/param.h>
31#include <sys/kernel.h>
32#include <sys/lock.h>
33#include <sys/malloc.h>
34#include <sys/mutex.h>
35#include <sys/proc.h>
36#include <sys/systm.h>

--- 20 unchanged lines hidden (view full) ---

57static void
58eventhandler_init(void *dummy __unused)
59{
60 TAILQ_INIT(&eventhandler_lists);
61 mtx_init(&eventhandler_mutex, "eventhandler", NULL, MTX_DEF);
62 atomic_store_rel_int(&eventhandler_lists_initted, 1);
63}
64SYSINIT(eventhandlers, SI_SUB_EVENTHANDLER, SI_ORDER_FIRST, eventhandler_init,
29
30#include <sys/param.h>
31#include <sys/kernel.h>
32#include <sys/lock.h>
33#include <sys/malloc.h>
34#include <sys/mutex.h>
35#include <sys/proc.h>
36#include <sys/systm.h>

--- 20 unchanged lines hidden (view full) ---

57static void
58eventhandler_init(void *dummy __unused)
59{
60 TAILQ_INIT(&eventhandler_lists);
61 mtx_init(&eventhandler_mutex, "eventhandler", NULL, MTX_DEF);
62 atomic_store_rel_int(&eventhandler_lists_initted, 1);
63}
64SYSINIT(eventhandlers, SI_SUB_EVENTHANDLER, SI_ORDER_FIRST, eventhandler_init,
65 NULL)
65 NULL);
66
67/*
68 * Insertion is O(n) due to the priority scan, but optimises to O(1)
69 * if all priorities are identical.
70 */
71eventhandler_tag
72eventhandler_register(struct eventhandler_list *list, const char *name,
73 void *func, void *arg, int priority)

--- 167 unchanged lines hidden ---
66
67/*
68 * Insertion is O(n) due to the priority scan, but optimises to O(1)
69 * if all priorities are identical.
70 */
71eventhandler_tag
72eventhandler_register(struct eventhandler_list *list, const char *name,
73 void *func, void *arg, int priority)

--- 167 unchanged lines hidden ---