![]() ![]() In fact, the process of setting up the kernel consists mainly of selecting which files to upload to the kernel will be merged. Thus, by simply accessing various fields of struct task_struct, we could get information of the process relative to this function. Linux Loadable Kernel Module A Akash7 Read Discuss If you want to add code to a Linux kit, the basic way to do that is to add source files to the kernel source tree and assemble the kernel. When a particular function executes on behalf of a process(say init()), the kernel associates the current macro with that process's task_struct. I recommend you to go through the data structure once. ![]() This data structure contains all the information corresponding to a process, like, state, name, MM info, etc. It is to be noted that inside Linux, each process's task control block(or PCB), is represented by struct task_struct. This can be simply achieved using the current macro. Now, the question is to find the relative process for that particular function. hello-world.c / include / Needed by all modules / include .![]() Same is the situation with exit() and rmmod. So, we can say that the function init() is executing on behalf of the insmod process. That is, when you insert the module using insmod, the init() function gets executed, and when you remove the module using rmmod, the exit() function gets executed. Modular design ensures that you do not have to make a monolithic kernel that contains all code necessary for hardware and situations. To answer your question in a very basic way : Some of the kernel's functions, including init() and exit(), execute "on behalf of" user space processes. A kernel module is a code that can be loaded into the kernel image at will, without requiring users to rebuild the kernel or reboot their computer. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |