4 ms·
This is nonsense, pipes are the weird case, not the typical. The socket interface looks largely identical to ttys, which were in the first version of Unix over
by murderfs 3y ago
This is nonsense, pipes are the weird case, not the typical. The socket interface looks largely identical to ttys, which were in the first version of Unix over a decade before Berkeley sockets were introduced. Pipes didn't exist until Research Unix v3.
- gpderetta 3y agoWhile historically you are correct, having a single file descriptor for reading and writing to distinct streams is confusing and can break code. Bidirectionally buffered wrappers over file descriptors (FILE, std::fstream for example) share the buffer between the read and write side, so you have to use distinct buffered wrappers with dup'd file descriptor anyway. Also the tty is typically connected to stdin, stdout and stderr, that are separate file descriptor (again, a leaky abstraction when they refer to the same description).
- geertj 3y agoNot a lot of application software interacts directly with ttys. I think the more relevant example here is stdio, which uses separate fds for reading and writing, like the pipe example.