I want to get to the children task (process) list of a process, here is the code:
void myFunc()
{
struct task_struct* current_task;
struct task_struct* child_task;
struct list_head children_list;
current_task = current;
children_list = current_task->children;
child_task = list_entry(&children_list,struct task_struct,tasks);
printk("KERN_INFO I am parent: %d, my child is: %d \n",
current_task->pid,child_task->pid);
}
The current pid is right, but the child pid is not correct.
What am I doing wrong?
Note, the last parameter to the list_entry should be
childrenbtw: if you are not very familiar with list_entry, following article is a good source:
http://isis.poly.edu/kulesh/stuff/src/klist/