I am trying to cross task_struct children in the linux kernel and receive information from children. I am having problems with all the information, so let me just keep it while getting the pid for simplicity.
This is the supporting part of my code.
struct list_head * p; struct task_struct ts, *tsk; pid_t tmp_pid; INIT_LIST_HEAD(&ts.children); current = tsk; list_for_each(p, &(tsk->children)){ ts = *list_entry(p, struct task_struct, children); tmp_pid = ts.pid; printk("the pid is %d\n", tmp_pid); }
I think the problem is with list_entry, but I donβt know how to fix it, all the examples that I can find seem to call it the same way.
This should print all the child PIDs, instead I always get the same number -17 .... it is on the order of 10 ^ 9 or 10 ^ 11.
Can someone help me here? compilation takes about 30 minutes, so trying to log different things is not really an option.
devin source share