From 59ffc21419017070c6da0ba06729ebe258dea285 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Sun, 7 Aug 2022 18:45:29 +0000 Subject: [PATCH] module(9): Call callbacks in topological order on load. They are called in reverse topological order on unload. dtrace_sdt will rely on this soon to ensure provider definitions are processed before their uses. --- sys/kern/kern_module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_module.c b/sys/kern/kern_module.c index d2457df91969..7ad2b5bffc83 100644 --- a/sys/kern/kern_module.c +++ b/sys/kern/kern_module.c @@ -1889,7 +1889,7 @@ module_register_callbacks(void (*load)(struct module *), kernconfig_lock(); TAILQ_INSERT_TAIL(&modcblist, modcb, modcb_list); - TAILQ_FOREACH(mod, &module_list, mod_chain) + TAILQ_FOREACH_REVERSE(mod, &module_list, modlist, mod_chain) load(mod); kernconfig_unlock();