Re: accessing kernel symbols

From: Matthew Jacob (mjacob@feral.com)
Date: Thu Jul 27 2000 - 20:31:10 EST


Uh- sure- but that's not what I meant. gshekar didn't say *why* he wanted it.
I myself would use a cat of /proc/ksyms to find out whether an SMP kernel is
running or not to decide which driver to load (e.g.). I wouldn't use the
output of ksyms except as a hint for something useful (like which flavor down
or __down is to be used this week)

On Fri, 28 Jul 2000, Keith Owens wrote:

> 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/



This archive was generated by hypermail 2b29 : Mon Jul 31 2000 - 21:00:25 EST