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

Derek Fawcus dfawcus+lists-tuhs at employees.org
Fri Mar 27 20:51:12 AEST 2020


On Wed, Mar 25, 2020 at 07:47:48PM -0400, Richard Salz wrote:
> > One point being that one could fork/exec a program with those fd's
> > attached to stdin/stdout and it could operate as a normal filter, w/
> 
> Hasn't that pretty much worked ever since BSD wrote inetd?

The socket fd is dup'ed and then applied to stdin & stdout for the child
process.  So if say the child closes stdout, stdin still has the underlying
'file' open in both read and write mode, hence the reader at the far end
will not receive any form of 'close' notification (e.g. EOF on read).

If a socket fd could be split (or partially dup'ed) in to new read-only
and write-only fds, and the original fd then closed, that 'issue' would
go away.  Obviously it hasn't been much of an issue...

DF


More information about the TUHS mailing list