Retrieving the Processes information through modules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm a Kernel newbie. Inspired by Open Source, I'm into this.
This is my first mail.

I'm using Linux 2.4 kernel(RH 9).

I'm trying to retrieve all the processes information(name, pid ,state,
parent) with the following code:

 struct task_struct *task = current;
 for_each_process(task){
       printk("Process name : %s, pid = %d, State : %d, Parent : %s",
task -> comm,
                                                   task -> pid,  task
-> state, task -> parent -> comm);
 }


I've tried this code by placing in the "init_module()" of a module.
When the module gets inserted the information gets printed in the
Kernel buffer. Everything is fine.

Now I would like to know  whether  there is any other (better) way of
acheiving this task?!
" Are Kernel modules the only way to get these types of tasks done?"

Thanks & Regards
Jp ;)

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux