On Wed, Feb 26, 2003 at 03:47:43PM +0000, Dr William Bland wrote: > Hello all, > I wrote my first module just a few days ago, so I'm very new to > all this. I want to be able to perform a kernel symbol lookup from within > a module, i.e. to have a function of one argument, a char*, returning a > void* (or whatever) where the input is the name of the kernel symbol > (e.g. "printk") and the output is the address that the symbol refers to > (e.g. the address of the printk function). If you're using a late 2.5 version of the kernel, take a look at kernel/kallsyms.c, kallsyms_lookup(). > Someone pointed me towards query_module(NULL, ...), but as far as I can > see this is intended to be called from user space programs and won't work > from within a module. Is this correct? This is correct. However, by looking at the sys_query_module code in the kernel, you can find out how to accomplish what you want to do. Specifically, take a look at kernel/module.c, qm_symbols(), which is what whoever pointed you probably meant. This call is in 2.4, but doesn't exist in 2.5. > Could someone point me towards the right way of doing this please? That I don't know, sorry. -- Muli Ben-Yehuda http://www.mulix.org
Attachment:
pgp00334.pgp
Description: PGP signature