namespaces.7: Mention that device ID should also be checked when comparing NS symlinks

When comparing two namespaces symlinks to see if they refer to
the same namespace, both the inode number and the device ID
should be compared. This point was already made clear in
ioctl_ns(2), but was missing from this page.

Reported-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2018-04-27 14:10:32 +02:00
parent 8e13d56651
commit 075f5e6592
1 changed files with 5 additions and 2 deletions

View File

@ -154,11 +154,14 @@ In Linux 3.7 and earlier, these files were visible as hard links.
Since Linux 3.8,
.\" commit bf056bfa80596a5d14b26b17276a56a0dcb080e5
they appear as symbolic links.
If two processes are in the same namespace, then the inode numbers of their
If two processes are in the same namespace,
then the device IDs and inode numbers of their
.IR /proc/[pid]/ns/xxx
symbolic links will be the same; an application can check this using the
.I stat.st_dev
and
.I stat.st_ino
field returned by
fields returned by
.BR stat (2).
The content of this symbolic link is a string containing
the namespace type and inode number as in the following example: