| Create a module that uses the /proc file system to return a list of all pids and ppid Hi,
I m a newbie to linux. Can someone help me on how to Create a module that uses the /proc file system to return a list of all pids and ppids for processes om the system . I googled and found the following:
#include < linux/kernel.h >
#include < linux/sched.h >
#include < linux/module.h >
int init_module(void)
{
struct task_struct *task;
for_each_process(task)
{
printk("%s [%d]\n",task->comm , task->pid);
}
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "Cleaning Up.\n");
}
But I need to read pids, ppids from the /proc file and not from the module 
Can someone help me with this. Thanks in advance. |