What is anon_inode in the output of "ls -l /proc/[PID]/fd"?
Everything under /proc
is covered in the man proc
. This section covers anon_inode
.
For file descriptors for pipes and sockets, the entries will be symbolic links whose content is the file type with the inode. A readlink(2) call on this file returns a string in the format:
type:[inode]
For example,
socket:[2248868]
will be a socket and its inode is 2248868. For sockets, that inode can be used to find more information in one of the files under/proc/net/
.For file descriptors that have no corresponding inode (e.g., file descriptors produced by
epoll_create(2)
,eventfd(2)
,inotify_init(2)
,signalfd(2)
, andtimerfd(2))
, the entry will be a symbolic link with contents of the formanon_inode:<file-type>
In some cases, the file-type is surrounded by square brackets.
For example, an epoll file descriptor will have a symbolic link whose content is the string
anon_inode:[eventpoll]
.
For more on epoll
I discuss them here - What information can I find out about an eventpoll on a running thread?.
For additional information on anon_inode
's - What is an anonymous inode in Linux?. Basically there is/was data on disk that no longer has a filesystem reference to access it. An anon_inode
shows that there's a file descriptor which has no referencing inode.