By default, the first three rows of a "file descriptor table" consists of:
FD 0 (standard input, associated with keyboard)
FD 1 (standard output, associated with screen)
FD 2 (standard error, associated with screen)
These file descriptors point to one or more rows in the "open file table". Imagine we only have these three file descriptors. Then how does the "open file table" look like?
Usually all three file descriptors point to the same file, but that doesn't mean they point to the same entry in the "open file table". So how the open file table looks like?
_ | offset | reference count | permissions | flags | pointers
_ | ? | ? | ? | ?
possible more rows
The lsof command shows for example:
lsof 721 root 0u CHR 136,1 0t0 4 /dev/pts/1
lsof 721 root 1u CHR 136,1 0t0 4 /dev/pts/1
lsof 721 root 2u CHR 136,1 0t0 4 /dev/pts/1
The file "/dev/pts/1" is CHR (character special file). They all point to the same file.
I'm also wondering why it's for example "0u" and not "0r"? The file descriptor 0 stands for input, so it only has to read something.
r for read access;
w for write access;
u for read and write access;
I would expect something like: 0r, 1w, 2w instead of 0u, 1u, 2u? And what are the offsets et cetera?