Quote:>How do programs like telnet and rlogin (and their daemons) avoid
>deadlock when dealing with stdin/stdout/stderr of a child process?
daemons often do, more or less:
- read from their side of their child's stdout and stderr until they
receive an eof indication, writing the data to the network socket. some
daemons will shutdown the socket when either is closed, some only if stdout
is closed, and others only if both are closed. if writing the network
socket results in an fatal error they tend to close their side of the
child's stdout and stderr, so the child receives an error trying to write
- read from the network socket until an eof indication, writing the data to
their side of the chlid's stdin, closing it on eof. if writing to the
child results in an error they usually shutdown the receive side of the
network socket, so that the peer receives an error trying to send.
typically written using non-blocking i/o, using select or poll to monitor
the fd's for activity.
Quote:>What I'd like to do is write a wrapper program, sort of like a
>bi-directional tee, which I could wrap around any other arbitrary
>process to capture all the stdin/out/err traffic of a child process
>without affecting its operation. Is there a program which already
bringing you boring signatures for 17 years