mercredi 4 novembre 2015

File Descriptors and File Handles (and C)

Can someone explain to me precisely the difference between a file descriptor and a file handle (separate from Windows' definition for the term; I'm curious about their definition, but that would require a much longer answer)?

From what I have gathered from Wikipedia, a file descriptor is an index in a file descriptor table, which points to a file name in a file table, which in turn points to an inode in an inode table. File handle is a type of data structure that stores a file descriptor.

  • Is a file descriptor simply an index in the file descriptor table (i.e., the index value simply is the file descriptor)?
  • Or does the file descriptor table element, identified by its index, store the file descriptor (making them likely two different numbers, assuming the index is a number)?
  • Is "file handle" simply a term for the FILE data structure in C which stores file descriptors? Or does file handle refer to some other data structure, which stores a file descriptor, separate from the C data structure (FILE)? What else can anyone tell me about the nature of file handle data structures?

Aucun commentaire:

Enregistrer un commentaire