home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / xenix / sco / 2932 < prev    next >
Encoding:
Text File  |  1992-09-14  |  2.5 KB  |  75 lines

  1. Newsgroups: comp.unix.xenix.sco
  2. Path: sparky!uunet!decwrl!pa.dec.com!nntpd2.cxo.dec.com!nntpd.lkg.dec.com!tkou02.enet.dec.com!wpowz!zambotti
  3. From: zambotti@wpowz.enet.dec.com (Walter Zambotti DEC)
  4. Subject: Idle ttys hang applications???
  5. Message-ID: <1992Sep15.040134.19779@news.jit.dec.com>
  6. Sender: usenet@news.jit.dec.com (USENET News System)
  7. Reply-To: zambotti@wpowz.enet.dec.com (Walter Zambotti DEC)
  8. Organization: Digital Equipment Corporation
  9. Date: Tue, 15 Sep 1992 04:01:34 GMT
  10. Lines: 63
  11.  
  12. Hello
  13.  
  14. I am having a strange problem using ttys from within a C application.
  15.  
  16. The environment is :
  17.  
  18.     386 4 meg of mem
  19.     Xenix 2.3.4
  20.     Dev 2.3.1
  21.     Stallion 16 port/tty I/O board
  22.  
  23. The problem appears as the tty going dead if the tty is not read from
  24. continuously.  If the tty is accessed every couple of seconds then it
  25. works indefinitely (day after day).  If the operator leaves the
  26. application for two or three minutes and then returns he find the tty
  27. locked up.
  28.  
  29. close(2)ing the tty and re-open(2)ing the tty seems to have no effect
  30. but restarting the application does clear the problem. 
  31.  
  32. At first, because of the above, I suspected the application was
  33. corrupting file related memory structures.  But this didn't make sense
  34. because the problem only occurs after the state of the application
  35. becomes IDLE and the application isn't even been executed.  If the
  36. application is continuely used then there is no problem (for days on
  37. end).
  38.  
  39. About the C program :
  40.  
  41. The applcation first open(2)s the "tty??" device and then sets up the
  42. the baud/etc with ioctl(2) and then sits in a small select(2) loop
  43. waiting for the "tty??" or STDIN to become read ready i.e. :
  44.  
  45.     device = open("/dev/tty010", O_READONLY)
  46.     ioctl(device, TCGETA, devicesettings)
  47.     devicesettings.c_lflag |= ICANON 
  48.     ioctl(device, TCSETA, devicesettings)
  49.  
  50.     loop
  51.         FD_SET(device, &readfds)
  52.         FD_SET(STDIN, &readfds)
  53.  
  54.         select(maxfiles, &readfds, null, null, null)
  55.  
  56.         if(FD_ISSET(device, &readfds)) ProcessDevice()
  57.         if(FD_ISSET(STDIN, &readfds)) ProcessSTDIN()
  58.     endloop
  59.  
  60. The application is also curses based so I'm not to sure what ioctl
  61. settings have been chosen for STDIN.
  62.  
  63. I am currently getting an rs-232 line analyser so I can see if the
  64. device is behaving.  But if it were the device (temperature measuring
  65. device) then why does it only reset itself after I restart the
  66. application.  There shouldn't be anyway for the device to know that I
  67. have restarted the application I hope!
  68.  
  69. If anyone has seen something similar or can help direct me to find the
  70. cause of this problem can you post a reply please.
  71.  
  72. regards,
  73.  
  74. Walter Zambotti
  75.