[Ilugc] File Descriptors

  • From: andyetitmoves@xxxxxxxxx (Ramkumar R. Aiyengar)
  • Date: Thu Jan 10 16:33:41 2008

I opened vi editor in one tty and in other i went to /proc/<pid of vi>/fd
and saw 4 fd those were 0,1,2 and 3.. Iknow about 0,1,2 but I could not make
out the what does 3 stands for?? It was a link to the .swp file.. Is 3
descriptor for the Read file?? Where can I find 'good' info about file
descriptors?/

for each file you open from inside a program, you get an fd.. 0, 1, 2
are the default ones that come when you start the program, even
without you opening any file.. the .swp file is a temp file used by vi
to record unsaved changes (i think, i don't use vi...)

(now that i see shakthi's reply as well...)

why 9? you could surely have more descriptors than that.. it's usually
a system-specific limit (a sysctl entry in linux)...

Ramkumar.

-- 
One of the main causes of the fall of the Roman Empire
was that, lacking zero, they had no way to indicate
successful termination of their C programs.
                             -- Robert Firth

Other related posts: