Results 1 to 2 of 2
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 ...
- 10-25-2009 #1Just Joined!
- Join Date
- Oct 2009
- Posts
- 1
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.
- 10-31-2009 #2
Hi
This ps works by reading the virtual files in /proc.
from
UNIX man pages : ps ()
You can also refer to your ps man page.
Hope it helped
chris81


Reply With Quote
