Saturday, February 26, 2022

[SOLVED] Efficient way to find task_struct by pid

Issue

Is there an efficient way of finding the task_struct for a specified PID, without iterating through the task_struct list?

id='dv3'>

Solution

What's wrong with using one of the following?

extern struct task_struct *find_task_by_vpid(pid_t nr);
extern struct task_struct *find_task_by_pid_ns(pid_t nr,
            struct pid_namespace *ns);


Answered By - jørgensen
Answer Checked By - Timothy Miller (WPSolving Admin)