Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need help with pseudo tty, read(), and timeout

11 views
Skip to first unread message

Andrew Bateman

unread,
Apr 10, 1996, 3:00:00 AM4/10/96
to


I've written a little motif-based utility for our
developers that runs on a Sun SPARC (Solaris 2.4). All it
does is multiplex data between a Sun serial port and two
pseudo tty's. However, I'm having a problem with the
connection to the slave side of the pseudo tty. My utility
opens up a serial port and the master side of two pseudo
tty's. Another program (GNU GDB, for example) then opens up
the slave side of one of the pseudo tty's. It sets
(using tcgetattr and tcsetattr) the timeout attribute
(termios.c_cc[VTIME]) of the slave to be positive, nonzero.
It then uses read() to read the characters off the (slave)
tty. However, if no characters are present, read() goes out
to lunch and never comes back. The read() *never* times out.

If the slave is opened up as non-blocking and I do a read()
with no characters present, instead of going out to lunch I
get a constant "Resource temporarily unavailable" (errno = EAGAIN)
with read() returning a -1. The tcgetattr and tcsetattr are successful
on the slave, in both cases. So what gives? Is the slave pseudo
tty accepting, but not recognizing, the timeout attribute? What am
I doing wrong? What am I missing here (probably a lot, I imagine).
The funny thing is, if I use tip to connect to the
slave, everything works great -- I can communicate just fine and
data is passed through no problem. What is it about
pseudo tty's, read(), and timing out that makes this not work?
Thanks in advance.

Cheers,
Andrew

-------------------------------------------------------------
Andrew J. Bateman
Netrix Corporation e-mail: a...@netrix.com
13595 Dulles Technology Drive phone: (703) 793-1222
Herndon, VA 22071 fax: (703) 742-4049

0 new messages