Subject: dt blocks at read from pty
To: None <macbsd-development@NetBSD.ORG>
From: Ken Nakata <email@example.com>
Date: 02/28/1995 13:17:44
Dt blocks at read from pty when the pty is in non-raw mode and stopc
is sent. I have been experiencing this for quite a while, but never
seen anybody complaining about it... Has anyone seen this?
You should be able to reproduce it by cat'ing some file (preferably a
long one) and type ^S while cat is running. Then dt gets stuck, and
you can't switch the VT or kill dt process unless you can login from
another terminal. It does not happen in an Emacs session.
I spent a couple of hours tracking the problem, and I think now I have
the explanation. When pty is not in raw mode and stopc (^S) is sent
to the pty, then output from the pty is stopped. Then, select tells
dt that this pty has some input to be processed even though the output
stream has been stopped. So, naturally, dt tries to read from the pty
and gets stuck.
Possible solutions would include using non-blocking I/O, handling
stopc on dt's own (as some serial terminals do), and treating stopc as
a special case.
The first plan would void the whole point of select(), and the second
plan would be as brain dead as a VT-100. So, I'm working on the third
plan in which dt would check if pty is in raw mode, and if not, it
tries to handle stopc on its own, each time ^S is pressed.