[TUHS] sockets (was Re: First appearance of named pipes)

Derek Fawcus dfawcus+lists-tuhs at employees.org
Mon Mar 9 01:13:32 AEST 2020

On Sun, Mar 08, 2020 at 01:36:14PM +1100, Rob Pike wrote:
> Always bemused me that to get a named local I/O connection one ended
> up with "Unix domain (what does that even mean?) sockets" rather than
> named pipes,

Yeah - I always found that a bit weird, having to use socketpair()
to get a bidirectional "pipe".

> I've been told, but haven't confirmed, that
> early sockets didn't even support read and write. They still don't
> support open and close, and never will.

Err - granted on the open; but if my memory serves, close() has been
supported on them ever since I started using them ('87).  Otherwise
the normal fork/dup/close/exec pattern for child processes would not

Now what would have been useful is a way to have distinct fd's for
the local read and write end of (e.g.) a TCP socket - such that one
direction could be closed w/o closing the other.  Or maybe some
fcntl() to dup the bidirectional fd in to a pair of unidirectional
fds.  That way one could dispense with shutdown for closing one
direction, making children and fd passed programs socket agnostic.


More information about the TUHS mailing list