home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.xenix.sco
- Path: sparky!uunet!decwrl!pa.dec.com!nntpd2.cxo.dec.com!nntpd.lkg.dec.com!tkou02.enet.dec.com!wpowz!zambotti
- From: zambotti@wpowz.enet.dec.com (Walter Zambotti DEC)
- Subject: Idle ttys hang applications???
- Message-ID: <1992Sep15.040134.19779@news.jit.dec.com>
- Sender: usenet@news.jit.dec.com (USENET News System)
- Reply-To: zambotti@wpowz.enet.dec.com (Walter Zambotti DEC)
- Organization: Digital Equipment Corporation
- Date: Tue, 15 Sep 1992 04:01:34 GMT
- Lines: 63
-
- Hello
-
- I am having a strange problem using ttys from within a C application.
-
- The environment is :
-
- 386 4 meg of mem
- Xenix 2.3.4
- Dev 2.3.1
- Stallion 16 port/tty I/O board
-
- The problem appears as the tty going dead if the tty is not read from
- continuously. If the tty is accessed every couple of seconds then it
- works indefinitely (day after day). If the operator leaves the
- application for two or three minutes and then returns he find the tty
- locked up.
-
- close(2)ing the tty and re-open(2)ing the tty seems to have no effect
- but restarting the application does clear the problem.
-
- At first, because of the above, I suspected the application was
- corrupting file related memory structures. But this didn't make sense
- because the problem only occurs after the state of the application
- becomes IDLE and the application isn't even been executed. If the
- application is continuely used then there is no problem (for days on
- end).
-
- About the C program :
-
- The applcation first open(2)s the "tty??" device and then sets up the
- the baud/etc with ioctl(2) and then sits in a small select(2) loop
- waiting for the "tty??" or STDIN to become read ready i.e. :
-
- device = open("/dev/tty010", O_READONLY)
- ioctl(device, TCGETA, devicesettings)
- devicesettings.c_lflag |= ICANON
- ioctl(device, TCSETA, devicesettings)
-
- loop
- FD_SET(device, &readfds)
- FD_SET(STDIN, &readfds)
-
- select(maxfiles, &readfds, null, null, null)
-
- if(FD_ISSET(device, &readfds)) ProcessDevice()
- if(FD_ISSET(STDIN, &readfds)) ProcessSTDIN()
- endloop
-
- The application is also curses based so I'm not to sure what ioctl
- settings have been chosen for STDIN.
-
- I am currently getting an rs-232 line analyser so I can see if the
- device is behaving. But if it were the device (temperature measuring
- device) then why does it only reset itself after I restart the
- application. There shouldn't be anyway for the device to know that I
- have restarted the application I hope!
-
- If anyone has seen something similar or can help direct me to find the
- cause of this problem can you post a reply please.
-
- regards,
-
- Walter Zambotti
-