File kinds
- -: regular
- d : directory.
- c : character device file.
- b : block device file.
- s : local socket file.
- p : named pipe.
- l : symbolic link.
Namespace
WikiPedia article about Linux namespaces
Namespace kinds
- Mount
- PID
- Network
- Interprocess communication
- UTS
- User ID
- Cgroup (Control group)
操作命名空间的 sytemcalls
- clone
- unshare
- setns
引用命名空间的方式
- 命名空间里的进程
- 命名空间里的文件描述符
- 命名空间里文件的绑定
具体实现
- The kernel assigns each process a symbolic link per namespace kind in
/proc/<pid>/ns/
. The inode number pointed to by this symlink is the same for each process in this namespace. This uniquely identifies each namespace by the inode number pointed to by one of its symlinks.
Inode
ls -i $dir
to display inode numbers.- Detailed Understanding of Linux Inodes with Example: linoxide.com/linux-command/linux-inode/
- The following information is stored in inode:
- File type: regular file, directory, pipe etc.
- Permissions to that file: read, write, execute
- Link count: The number of hard link relative to an inode
- User ID: owner of file
- Group ID: group owner
- Size of file: or major/minor number in case of some special files
- Time stamp: access time, modification time and (inode) change time
- Attributes: immutable’ for example
- Access control list: permissions for special users/groups
- Link to location of file
- Other metadata about the file
- Note that the inode does not store the name of the file but its content only.
- The following information is stored in inode: