| Filehandle |
Website Links For File |
Information AboutFilehandle |
| CATEGORIES ABOUT FILE DESCRIPTOR | |
| unix | |
|
In computer programming, a file descriptor is an abstract key for accessing a file. The term is generally used in POSIX Operating System s. In Microsoft Windows terminology and in the context of the C Standard I/O Library , "file handle" is preferred, though the latter case is technically a different object (see below). In POSIX, a file descriptor is an Integer , specifically of the C type int. There are 3 standard POSIX file descriptors which presumably every process (save perhaps a Daemon ) should expect to have: Generally, 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. In Unix-like systems, file descriptors can refer to files, Directories , Block or Character Device s (also called "special files"), Socket s, FIFO s (also called Named Pipe s), or unnamed Pipe s.
To further complicate terminology, Microsoft Windows also uses the term ''file handle'' to refer to the more low-level construct, akin to POSIX's file descriptors. Microsoft's C libraries also provide compatibility functions which "wrap" these native handles to support the POSIX-like convention of integer file descriptors as detailed above. OPERATIONS ON FILE DESCRIPTORS A modern Unix typically provides the following operations on file descriptors. Creating file descriptors
Deriving file descriptors
Operations on a single file descriptor
Operations on multiple file descriptors
Operations on the file descriptor table
Operations that modify process state
File locking
Sockets
Miscellaneous
UPCOMING OPERATIONS A series of new operations on file descriptors has been added to Solaris and Linux, as well as numerous C libraries, to be standardized in a future version of POSIX . The at suffix signifies that the function takes an additional first argument supplying a file descriptor from which Relative Path s are resolved, the forms lacking the at suffix thus becoming equivalent to passing a file descriptor corresponding to the current Working Directory .
FILE DESCRIPTORS AS CAPABILITIES Unix file descriptors are Capabilities . They can be passed between processes across Unix Domain Socket s using the Sendmsg () system call. A Unix process' file descriptor table is an example of a C-list . REFERENCES |
|
|