Re: Reading from a pty after slave exited
Re: Reading from a pty after slave exited
- Subject: Re: Reading from a pty after slave exited
- From: Terry Lambert <email@hidden>
- Date: Tue, 27 Apr 2010 02:39:18 -0700
On Apr 24, 2010, at 4:57 AM, Julian Scheid wrote:
On Sat, Apr 24, 2010 at 9:43 PM, Terry Lambert <email@hidden>
wrote:
Your specific problems came from racing the child opening the slave
side
following a fork vs. performing an ioctl which should only be
performed on
the slave side of a pty on the master side instead. Historically
BSD ptys
haven't really enforced the distinction, and telnetd got it wrong;
a lot of
people coming after telnetd cribbed code from it, and got it wrong
too.
Doing these ioctls on the master side of the device may fail with
an ENOTTY
error in a future release. As a transiton stage, we'll probably
still allow
them for a while as long as both ends are open, but I'd like to
discourage
people from relying on that in new code.
Thanks for the clarification, this makes more sense now.
However, I'm still slightly confused: the example code I posted in
this thread neither explicitly opens the slave side nor performs any
ioctl, except maybe implicitly by calling forkpty. As such I'm not
aware of any wrongdoing on my part.
Maybe you are referring to the VMIN/VTIME experiments that I mentioned
a few posts ago? For what it's worth, the reason I applied these to
the master end was because the only useful explanation of VMIN/VTIME I
could find so far --
http://www.unixwiz.net/techtips/termios-vmin-vtime.html -- makes it
sound like it is a setting applicable to reading, not writing, and
since in my example the master is what does the reading, that's where
I applied it.
If that was the wrong thing to do, in my defense it is quite hard to
find good documentation on this -- I wouldn't know where to start
looking really. Any pointers are appreciated.
Yes, sorry it wasn't clear.
The ttread that implements the VMIN/VTIME is only called from l_read
through the linesw line discipline table, which is only called from
ptsd_read() (cloning pty slave side) or ptsread() (non-cloning pty
slave side).
-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden