/ dev / fd与/ proc / self / fd /有何关系?


17
$ ls -l /dev/stdin /dev/fd/0
lrwx------ 1 tim tim 64 2011-08-07 09:53 /dev/fd/0 -> /dev/pts/2
lrwxrwxrwx 1 root root 15 2011-08-06 08:14 /dev/stdin -> /proc/self/fd/0
$ ls -l /dev/pts/2 /proc/self/fd/0
crw--w---- 1 tim tty  136, 2 2011-08-07 09:54 /dev/pts/2
lrwx------ 1 tim tim     64 2011-08-07 09:54 /proc/self/fd/0 -> /dev/pts/2
  1. / dev / fd /和/ proc / self / fd /之间有什么区别和关系?两者fd的均值both floppy disk,均为file descriptor还是均等于一个?
  2. / proc / self和/ proc通常做什么?

Answers:


18

/dev/fd/proc/self/fd完全相同;/dev/fd是的符号链接/proc/self/fd/proc/self/fd是公开所有进程(/proc/$pid/fd/$number)的文件描述符的较大方案的一部分。/dev/fd在其他unices上存在,并且出于兼容性考虑在Linux下提供。/proc/*/fd特定于Linux。


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.