From: Eric W. Biederman Date: Mon, 2 Oct 2006 09:17:12 +0000 (-0700) Subject: [PATCH] pid: implement pid_nr X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5feb8f5f8403d8874a04aac443692dfe83bd63d2;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [PATCH] pid: implement pid_nr As we stop storing pid_t's and move to storing struct pid *. We need a way to get the pid_t from the struct pid to report to user space what we have stored. Having a clean well defined way to do this is especially important as we move to multiple pid spaces as may need to report a different value to the caller depending on which pid space the caller is in. Signed-off-by: Eric W. Biederman Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/include/linux/pid.h b/include/linux/pid.h index 8cf9b11ed264..dba1b2d677a3 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h @@ -94,6 +94,14 @@ extern struct pid *find_ge_pid(int nr); extern struct pid *alloc_pid(void); extern void FASTCALL(free_pid(struct pid *pid)); +static inline pid_t pid_nr(struct pid *pid) +{ + pid_t nr = 0; + if (pid) + nr = pid->nr; + return nr; +} + #define pid_next(task, type) \ ((task)->pids[(type)].node.next)