Linux - File Descriptor
About
A file descriptor is an index for an entry in a kernel-resident data structure containing the details of all open files. In POSIX, this data structure is called a file descriptor table, and each process has its own file descriptor table. The user application passes the abstract key to the kernel through a system call, and the kernel will access the file on behalf of the application, based on the key. The application itself cannot read or write the file descriptor table directly.
You can also see a file descriptor as an object that a process uses to:
- read or write to an open file
- open network sockets
- …
In Unix-like systems, file descriptors can refer to:
- files,
- directories,
- block
- or character devices (also called “special files”),
- sockets,
- FIFOs (also called named pipes),
- or unnamed pipes.
A file descriptor is a low positive integer.
You can set the limit:
- for the system with the file limits.conf
- for the session with the help of ulimit
Articles Related
Limit
There is a limit to the amount of file descriptors per process.
If the file descriptor limit is exceeded for a process, you may see the following errors:
"Too Many Open Files" "Err#24 EMFILE" (in truss output)
To resolve the issue, raise the OS limit on the number of available file descriptors