Question: (C Language) Write a Linux loadable kernel module which lists all the processes currently running in your OS. Specifications below: 1. Upon loading, the kernel

(C Language)

Write a Linux loadable kernel module which lists all the processes currently running in your OS. Specifications below:

(C Language) Write a Linux loadable kernel module which lists all the

1. Upon loading, the kernel module prints your name. 2. The kernel module then prints the init process first. The global variable init_task" represents the init process and is readily usable in your code. Include . 3. Then the kernel module prints all other processes one by one. Recall that all processes form a linked list in the Linux kernel. To traverse the list, use the list_for_each_entry macro defined in as suggested in the book. Study the book description as well as the header file for the definition of the macro. You can choose process attributes for printing from those listed in the definition of task_struct given in . 4. Once all processes are printed, the kernel module prints the current process. Another global variable current" represents the current process and is also readily usable. Exercise 6: Process List - Specification (cont'd) 48 5. When a process is printed, some of the process attributes must be printed on the same line. Attributes to print: name, PID, parent name, parent PID, priority, and two more attributes of your choice. You can choose process attributes for printing from those listed in the definition of task_struct given in . 6. The module prints the number of processes found at the end. 7. Upon exiting, the kernel module prints your name. 8. Issue the following command to show the process count in another way: $ ps -e / WC -1 The two numbers must be the same. 1. Upon loading, the kernel module prints your name. 2. The kernel module then prints the init process first. The global variable init_task" represents the init process and is readily usable in your code. Include . 3. Then the kernel module prints all other processes one by one. Recall that all processes form a linked list in the Linux kernel. To traverse the list, use the list_for_each_entry macro defined in as suggested in the book. Study the book description as well as the header file for the definition of the macro. You can choose process attributes for printing from those listed in the definition of task_struct given in . 4. Once all processes are printed, the kernel module prints the current process. Another global variable current" represents the current process and is also readily usable. Exercise 6: Process List - Specification (cont'd) 48 5. When a process is printed, some of the process attributes must be printed on the same line. Attributes to print: name, PID, parent name, parent PID, priority, and two more attributes of your choice. You can choose process attributes for printing from those listed in the definition of task_struct given in . 6. The module prints the number of processes found at the end. 7. Upon exiting, the kernel module prints your name. 8. Issue the following command to show the process count in another way: $ ps -e / WC -1 The two numbers must be the same

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!