Yes. As said by Anish, I generally practice through a dummy hello world module. Suppose, if I want to print all the processes currently running, I do like this. #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> MODULE_LICENSE("Dual BSD/GPL"); static int hello_init(void) { struct task_struct *task; printk("Hello World!\n"); for_each_process(task) { printk("%s %d\n", task->comm, task->pid); } printk("\n\n\n"); for(task = &init_task; ((task=next_task(task)) != &init_task) ; ) printk("%s %d\n", task->comm, task->pid); printk("\n\n\n"); return 0; } static void hello_exit(void) { printk("Good bye!\n"); } module_init(hello_init); module_exit(hello_exit); By the way, you can do as suggested by Valdis, too. I do search for a particular code/strings using find, xargs, grep combination. I hope this helps you. Regards, Srinivas On Tue, Jul 16, 2013 at 12:42 PM, Satya Prakash Prasad < unixkernel497@gmail.com> wrote:
Thanks .. I have another question. I was trying to practice some kernel process management APIs as in http://reiber.org/nxt/pub/Linux/LinuxKernelDevelopment/Linux.Kernel.Development.3rd.Edition.pdf<http://www.linkedin.com/redirect?url=http%3A%2F%2Freiber%2Eorg%2Fnxt%2Fpub%2FLinux%2FLinuxKernelDevelopment%2FLinux%2EKernel%2EDevelopment%2E3rd%2EEdition%2Epdf&urlhash=3MN8&_t=tracking_disc>(Linux Kernel Development by Robert Love, 3rd edition).
I am not sure how to practice the code snippet given in the text book. I can understand the theory but do not find a way to practice. For example: I want to read a process 'struct task_struct' to find it parent's process identifier, how many tasks are in which state, creating kernel threads etc?
Any idea?
On Mon, Jul 15, 2013 at 2:32 PM, Srinivas Ganji < srinivasganji.kernel@gmail.com> wrote:
As per as I know, you can follow two text books.
1. Linux Kernel Development by Robert Love, 3rd edition. 2. Linux Device Drivers by Alessandro Rubini, Jonathan Corbet, Greh Kroah-Hartman. 3rd edition.
At the same time, you can practice the exercises given in the text books - practice makes a man perfect. The other thing is "Make your hands dirty by digging the kernel code whenever you have a doubt".
Regards, Srinivas
On Mon, Jul 15, 2013 at 2:06 PM, Satya Prakash Prasad < unixkernel497@gmail.com> wrote:
Please let me know how to study and get hands on experience on Linux Kernel and Device Drivers?
Regards, Prakash
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies