Sobes.tech
Senior

In which directory are the file descriptors of the running process located?

sobes.tech AI

Answer from AI

In Linux, the file descriptors of a running process are available in the directory /proc/<pid>/fd/, where <pid> is the process ID.

This directory contains symbolic links to all open files, sockets, pipes, and other resources held open by the process.

Example:

ls -l /proc/1234/fd/

will show all file descriptors of the process with PID 1234.

In Go, you can obtain the current process's PID using os.Getpid() and then work with this directory to analyze open descriptors.