On 08/02/17 12:13, Andriy Gapon wrote:
As far as I understand a module initialization routine is executed via the
sysinit mechanism. Specifically, module_register_init is set up as the sysinit
function for every module and it calls MOD_EVENT(mod, MOD_LOAD) to invoke the
module event handler.
In linker_load_file() I see the following code:
I think that this means that any statically declared sysctl-s in the module
would be registered before the module receives the MOD_LOAD event.
It's possible that some of the sysctl-s could have procedures as handlers and
they might access data that is supposed to be initialized by the module event
So, for example, running sysctl -a at just the right moment during the loading
of a module might end up in an expected behavior (including a crash).
Is my interpretation of how the code works correct?
Can the order of linker_file_sysinit and linker_file_register_sysctls be changed
without a great risk?
The same applies to:
Not sure if this answers your question.
If a SYSCTL() is TUNABLE, it's procedure can be called when the sysctl
is created. Else the SYSCTL() procedure callback might be called right
after it's registered. I think there is an own subsystem in sys/kernel.h
which takes care of the actual SYSCTL() creation/destruction - after the
linker is involved.
firstname.lastname@example.org mailing list
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"