Assar Westerlund writes: > I think that the goal should be to make KLDs work with all kinds of > kernels.
I've been thinking about this too... Certainly, for each kernel config option FOO we could have a symbol in the kernel that a KLD could examine: static const u_char kernlel_option_FOO = 1; But what to do about KLD's that want to link against kernel symbols that may or may not exist? For example, some KLD's that present interfaces would like to know if BPF is in the kernel, and if so to support it .. but this means linking with bpfattach(), etc.. Would it be possible to permit 'partial' linking of a KLD, so that the following code would work no matter what kernel was used? int xyz_attach() { ... if (kernlel_option_BPF > 0) bpf_attach(..); /* "bpf_attach" only gets resolved if it exists * in the kernel; otherwise, it remains NULL but * that's OK because in that case we don't call it */ ... } Maybe this would require something like this in the KLD.. MODULE_BREAKABLE_LINKS(xyz) { "bpfattach", "bpf_mtap" }; A fair bit of hackery, but probably worth it... -Archie ___________________________________________________________________________ Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com To Unsubscribe: send mail to majord...@freebsd.org with "unsubscribe freebsd-current" in the body of the message