Kernel Programming Questions

Peter Teoh htmldeveloper at gmail.com
Sun May 25 16:20:57 UTC 2008


On Sat, May 24, 2008 at 4:32 AM, Vadim Klishko <vadim at cirque.com> wrote:
> Hello Everybody,
>
> Could anyone please tell me what functions I could call from a Linux kernel module to:
>
> 1) dynamically load a library,
>
> 2) get the address of an exported function,
>
> 3) unload the library?
>

This 3 function in succession in userland Windows is:

LoadLibrary(), GetProcAddress(), and FreeLibrary().   So my suspicion
is that you are moving from windows + userland environment and
attempting to do likewise things in kernel.   Even in Windows, the
three functions listed above, though common in userland, are highly
uncharacteristics in kernel.   The problem is not that it is NOT
possible, but it is extremely inefficient to do it in kernel.

eg, in userland...read() and fopen() can access the file directly.
In kernel? u either read it via block by block I/O, or go through a
long process of detecting the filesystem, and the API to read the
filename, and then the metadata blocks and data blocks...etc.

not trying to scare you....but this is the nature of
kernel.....everything is at its most efficient level....functions are
minimized and duplication eliminated (eg, read() never
exists)....functionalities are pushed to the userland whenever
possible etc....

> Also, what are the functions that would allow me to read from and write to a binary or text file from within a kernel module?
>
> Any help will be sincerely appreciated.
>
> Vadim
>

bottomline is:   anything u want to do.....first consider userland....

-- 
Regards,
Peter Teoh



More information about the devel mailing list