I am writing a system call which should store some info for the process that called it,for its oldest children process and for its oldest sibling process.
I know that the information i want is kept in sched.h in the task_struct and i have managed to store info for the process that called the system call from the fields i wanted from the struct task_struct.
My problem with the oldest children and the oldest sibling is that in the struct task_struct there are two lists which have all the children and all the siblings (if i have understood right).I assume that i have to iterate through those lists and find the last element.But if i find the last element on those lists how can i access their task_struct?
Thank you in advance.
I am writing a system call which should store some info for the process
Share
task_struct has pointers to youngest child, younger sibling and older sibling. These pointers points to the respective task_struct s .
*p_cptr, *p_ysptr, *p_osptrin task_struct points to youngest child, younger sibling and older sibling respectively. For examplecurrent->p_cptrsimply points to the youngest child,where current is the pointer to the task_struct of the process currently running.