2) What if module B requires module A *optionally*, based on reaching some point in the code? How can B obtain a pointer to a function in A after loading it?That's where you'd need to use ddi_modopen(9F). It's sort of like dlopen(3C) in the kernel.
Just FTR, I have found an interesting file: ml/modstubs.s This file defines function stubs that load the required implementation on demand. This seems to be a mechanism that loads modules based *only* on a function call, without the need to initiate module loading explicitly. (Well, at least if I am not mistaken...) I was curious how taskq_create_sysdc() can be sure that the SDC module is loaded when spawning threads that explicitly call sysdc_thread_enter(). The only scheduling class that gets loaded on initialization from main() is TS. So there are two obvious questions: How can SDC task queues work? How can ZFS (which depends on them) work? :-D I was looking for '_depends_on[] = "sched/SDC"' or '-dy -Nsched/sysdc' -- but there is nothing of that kind. Then I found ml/mldstubs.s! So this is it: #ifndef SDC_MODULE MODULE(SDC,sched); NO_UNLOAD_STUB(SDC, sysdc_thread_enter, nomod_zero); END_MODULE(SDC); #endif This piece information could once be (hopefully) useful to someone who wants to use SDC and doesn't know how (and where) to load it. If I'm not wrong, you simply don't load it. sysdc_thread_enter() does the trick for you. This has (of course) the disadvantage that all the automatically loaded modules have to be known in advance, they can't be built and distributed separately, and changes to their interfaces must be reflected in modstubs.s. Andrej
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ on-discuss mailing list on-discuss@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/on-discuss