Messages in this thread | | | From | Keith Owens <> | Subject | Re: accessing kernel symbols | Date | Fri, 28 Jul 2000 08:33:20 +1000 |
| |
On Thu, 27 Jul 2000 09:24:47 -0700 (PDT), Matthew Jacob <mjacob@feral.com> wrote: >Even better (from a module writer's perspective) you can just read /proc/ksyms >to get address/name pairs of the functions it would be reasonably safe for >your module to bind to.
No, please I beg you - NOOOO! Grabbing addresses out of /proc/ksyms and doing direct branches to them
(a) Will not work on architectures where a function pointer is a descriptor instead of just an address (like IA64). (b) Does not put any reference count on the symbol you are using. If the symbol is in a module and there is no refernce count, it can be removed under you - splat! Al Viro just did a huge cleanup on module reference counts, don't introduce a mechanism that destroys that work.
If you want to access a symbol from a module just refer to it by name. Of course the symbol has to be exported. If you need a symbol that is not currently exported you have to ask yourself should it be exported or are you looking for the wrong interface.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |