]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
namespaces.7: Adjust example program to show device major and minor numbers
authorMichael Kerrisk <mtk.manpages@gmail.com>
Mon, 12 Dec 2016 06:11:41 +0000 (07:11 +0100)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Mon, 12 Dec 2016 06:30:16 +0000 (07:30 +0100)
Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
man7/namespaces.7

index c755545755a850a6d4214a9950fe91137a458a0a..f9ba97244678b339f78d5d91cb9d20c28c5edb44 100644 (file)
@@ -442,7 +442,7 @@ and show that new UTS namespace is associated with the new user namespace:
 $ \fBunshare \-Uu sleep 1000 &\fP
 [1] 23235
 $ \fB./ns_introspect /proc/23235/ns/uts\fP
-Inode number of owning user namespace is: 4026532448
+Device/Inode of owning user namespace is: [0,3] / 4026532448
 $ \fBreadlink /proc/23235/ns/user \fP
 user:[4026532448]
 .in
@@ -456,7 +456,7 @@ example is the initial user namespace:
 $ \fBreadlink /proc/self/ns/user\fP
 user:[4026531837]
 $ \fB./ns_introspect /proc/23235/ns/user\fP
-Inode number of owning user namespace is: 4026531837
+Device/Inode of owning user namespace is: [0,3] / 4026531837
 .in
 .fi
 
@@ -480,16 +480,17 @@ The owning user namespace is outside your namespace scope
 .nf
 /* ns_introspect.c
 
-   Licensed under GNU General Public License v2 or later
+   Licensed under the GNU General Public License v2 or later.
 */
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
-#include <sys/stat.h>
 #include <fcntl.h>
-#include <sys/ioctl.h>
 #include <string.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
 #include <errno.h>
+#include <sys/sysmacros.h>
 
 #ifndef NS_GET_USERNS
 #define NSIO    0xb7
@@ -542,7 +543,9 @@ main(int argc, char *argv[])
             perror("fstat\-userns");
             exit(EXIT_FAILURE);
         }
-        printf("Inode number of owning user namespace is: %ld\\n",
+        printf("Device/Inode of owning user namespace is: "
+                "[%lx,%lx] / %ld\\n",
+                (long) major(sb.st_dev), (long) minor(sb.st_dev),
                 (long) sb.st_ino);
 
         close(userns_fd);
@@ -570,7 +573,8 @@ main(int argc, char *argv[])
             perror("fstat\-parentns");
             exit(EXIT_FAILURE);
         }
-        printf("Inode number of parent namespace is: %ld\\n",
+        printf("Device/Inode of parent namespace is: [%lx,%lx] / %ld\\n",
+                (long) major(sb.st_dev), (long) minor(sb.st_dev),
                 (long) sb.st_ino);
 
         close(parent_fd);