From 6c3db754793fc446e8de69e438e384eff739859a Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Thu, 28 Feb 2013 12:02:28 +0100 Subject: [PATCH] pid_namespaces.7: readlink(2) on /proc/self gives the caller's PID in the pidns of /proc Signed-off-by: Michael Kerrisk --- man7/pid_namespaces.7 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/man7/pid_namespaces.7 b/man7/pid_namespaces.7 index 5e49633cc..b1a40f1f9 100644 --- a/man7/pid_namespaces.7 +++ b/man7/pid_namespaces.7 @@ -234,6 +234,13 @@ then it isn't necessary to change the root directory: a new procfs instance can be mounted directly over .IR /proc .) +Calling +.BR readlink (2) +on the path +.I /proc/self +yields the process ID of the caller in the PID namespace of the procfs mount +(i.e., the PID namespace of the process that mounted the procfs). + When a process ID is passed over a UNIX domain socket to a process in a different PID namespace (see the description of .B SCM_CREDENTIALS -- 2.11.4.GIT