some basic doubts / confusion regarding linux kernel / OS
Mandeep Sandhu
mandeepsandhu.chd at gmail.com
Fri Oct 4 01:32:46 EDT 2013
On Thu, Oct 3, 2013 at 10:38 PM, ajay saini <ajay_saini1006 at yahoo.co.in>wrote:
> Hi,
>
> I had some confusion/doubts regarding Linux kernel / OS and I want to be
> completely sure that my understanding is right for below, and need your
> inputs (would be really glad for your help):
>
> - There are functions defined in linux kernel. Some of these functions
> have a line "EXPORT_SYMBOL(<function_name>);" after them.
> These are the functions which are exported, so they can be directly
> called from a linux kernel module - right ? (we just need to include header
> files which define
> them in our kernel module)
>
Yes. They are used during dynamic loading of modules. More here:
http://stackoverflow.com/questions/6670589/use-of-export-symbol
>
> - There are some functions defined in linux kernel, which are not static
> and are not exported, like "migrate_pages" in migrate.c and it is
> mentioned in
> include/linux/migrate.h file.
> Is there a way to call these functions, directly from kernel module ??
> (even if I include the header file) ??
> If no, What is the technique used there, which prevents the module
> from calling this function (even though I have included the header file)??
>
The compiler? :)
> - We have kernel header files defined in include/linux/ and there are user
> space header files (the C libraries).
> Can a user space program include kernel header file and call a kernel
> function directly?? No , right ??
> Again, what is there which prevents a user space program from doing
> so?? How this technique is implemented ??
>
Kernel fxn's can't be called directly, you'll have to use either the syscal
interface or one of the many (indirect) userspace-kernel communication
mechanisms.
Again, the "technique" here is that you compiler will barf if you try and
use kernel functions directly as it won't find the definitions of those
functions during linking. CMIIW.
HTH,
-mandeep
> - I understand that, a struct page exists for each physical page in RAM.
> And this linked list of struct pages are stored together at the beginning
> of a zone. After this
> storage, does the real data (content) of pages is stored.
> Now each of these pages must be pointing to the data area/page which
> they define ? Which is this field in the struct page, which points to this
> data area, a physical
> address + length of the page ?
>
> Thanks,
> Ajay
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20131004/095bd8c4/attachment-0001.html
More information about the Kernelnewbies
mailing list