In Linux, why is there a global /dev/stdin file fo

2020-02-12 06:14发布

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?

Does anyone have ideas about this?

1条回答
放荡不羁爱自由
2楼-- · 2020-02-12 06:51

/dev/stdin is unique because

  • 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

The /proc filesystem is a virtual (not real) filesystem which has the ability to show a different view to each process.

Further reading:

查看更多
登录 后发表回答