在 Linux 中,为什么所有进程都有一个全局/dev/stdin 文件? [英] In Linux, why is there a global /dev/stdin file for all processes?
本文介绍了在 Linux 中,为什么所有进程都有一个全局/dev/stdin 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
不同进程的标准输入不应该是唯一的吗?如果是这样,stdin 文件的路径不应该像 /dev/pid/stdin
而不是全局 /dev/stdin
吗?
Shouldn't the standard input for different process unique? If so, shouldn't the path of the stdin file be like /dev/pid/stdin
instead of a global /dev/stdin
?
有人对此有想法吗?
推荐答案
/dev/stdin
是独一无二的,因为
- 它是一个到
/proc/self/fd/0
的符号链接 /proc/self
是一个符号链接only 你的运行进程可以看到到its process-id
- it is a symbolic link to
/proc/self/fd/0
/proc/self
is a symbolic link only seen by your running process to its process-id
/proc
文件系统是一个虚拟(不是真实)文件系统它能够为每个进程显示不同的视图.
The /proc
filesystem is a virtual (not real) filesystem which has the ability to show a different view to each process.
进一步阅读:
这篇关于在 Linux 中,为什么所有进程都有一个全局/dev/stdin 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文