3 ms·
> file descriptors are... neither files nor descriptors This is a pretty modern and userspace-centric view of file descriptors IMHO. The "description" part is
by nineteen999 3y ago
> file descriptors are... neither files nor descriptors
This is a pretty modern and userspace-centric view of file descriptors IMHO. The "description" part is in the file description table on the kernel side of the userspace/kernel boundary (see struct file[1]) for what are extremely obvious reasons.
Up to V7 UNIX (1973-1979[2,3]), the file description table could literally only reference a file on disk, UNIX domain/TCP/UDP sockets weren't introduced until 4.2BSD.
Your gentle rant makes sense from a modern point of view of course, but we need to keep in mind that the UNIX design is over 50 years old now. You could argue that the 4.2BSD people should have used different tables/names rather than overload the file description table but that ship has sailed and here we are.
[1]https://chenshuo.com/notes/kernel/file-descriptor-table/ https://chenshuo.com/notes/kernel/file-descriptor-table/
[2]https://www.tuhs.org/cgi-bin/utree.pl?file=V4/nsys/file.h https://www.tuhs.org/cgi-bin/utree.pl?file=V4/nsys/file.h
[3]https://www.tuhs.org/cgi-bin/utree.pl?file=V7/usr/include/sys/file.h https://www.tuhs.org/cgi-bin/utree.pl?file=V7/usr/include/sy...
- gpderetta 3y agoPipes were created quite early in the unix development though. I assume they had an entry in the file description table. Same for ttys.
- jetbalsa 3y agoLooking at [2], They did not. Only has FWRITE and FREAD, later on in the linked v7 they added FPIPE, not sure how TTY's are handled back then, but I bet it was a device driver of some kind with the real basic BIOS those systems had.