Not sure if I'm posting on the correct forum...

Ok, so when we say that FD is what it claims to be...a file....is it like an ordinary file on some drive or just some kind of a logical structure somewhere in the memory of the running process?

Here is what I did:

Started a process which creates a stream socket, prints PID and FD number and then waits for incoming connections...
Code:
darijo@dakt:~/programming/src/sockets$ ./a.out
PID = 11241
Socket FD# = 3
here how things look in /proc FS:
Code:
darijo@dakt:/proc/11241/fd$ ls -l
total 0
lrwx------ 1 darijo darijo 64 2009-02-09 05:56 0 -> /dev/pts/0
lrwx------ 1 darijo darijo 64 2009-02-09 05:56 1 -> /dev/pts/0
lrwx------ 1 darijo darijo 64 2009-02-09 05:56 2 -> /dev/pts/0
lrwx------ 1 darijo darijo 64 2009-02-09 05:56 3 -> socket:[60726]
So it looks that standard FDs (stdin, stdout, stderr ) are actual files on the disk (correct me if I'm wrong ), the number returned by a socket() call is a link to 'socket number' which is located...who knows where???


Thank you for your time and sorry for bad English.