How we come to know which value is holding which file descriptor
(printing the values of file descriptor using shell)
Você pode listar todos os descritores de arquivos de um processo usando o /proc
filesystem , usando
ls -l /proc/<PID>/fd
Exemplo:
$ ls -l /proc/2218/fd
total 0
lr-x------ 1 setacinq setacinq 64 Mar 14 09:29 0 -> /dev/null
l-wx------ 1 setacinq setacinq 64 Mar 14 09:29 1 -> /dev/null
lr-x------ 1 setacinq setacinq 64 Mar 14 09:29 18 -> pipe:[14524]
l-wx------ 1 setacinq setacinq 64 Mar 14 09:29 19 -> pipe:[14524]
l-wx------ 1 setacinq setacinq 64 Mar 14 09:29 2 -> /home/setacinq/.xsession-errors
lrwx------ 1 setacinq setacinq 64 Mar 14 09:29 22 -> anon_inode:[eventfd]
lrwx------ 1 setacinq setacinq 64 Mar 14 09:29 23 -> anon_inode:[eventfd]
lrwx------ 1 setacinq setacinq 64 Mar 14 09:29 28 -> socket:[14566]
lr-x------ 1 setacinq setacinq 64 Mar 14 09:29 30 -> /usr/share/unity/lenses/commands/commands.lens
lrwx------ 1 setacinq setacinq 64 Mar 14 09:29 32 -> socket:[11753]
lr-x------ 1 setacinq setacinq 64 Mar 14 09:29 35 -> /usr/share/unity/lenses/music/music.lens
lr-x------ 1 setacinq setacinq 64 Mar 14 09:29 36 -> /usr/share/unity/lenses/files/files.lens
lr-x------ 1 setacinq setacinq 64 Mar 14 09:29 37 -> /usr/share/unity/lenses/applications/applications.lens
lr-x------ 1 setacinq setacinq 64 Mar 14 09:29 38 -> /usr/share/unity/lenses/video/video.lens
lr-x------ 1 setacinq setacinq 64 Mar 14 09:29 8 -> anon_inode:inotify
lrwx------ 1 setacinq setacinq 64 Mar 14 09:29 9 -> /home/setacinq/.config/compiz-1/compizconfig/done_upgrades