home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / ultrix / 6828 < prev    next >
Encoding:
Internet Message Format  |  1992-09-11  |  891 b 

  1. Path: sparky!uunet!mcsun!corton!ircam!fingerhu
  2. From: fingerhu@ircam.fr (Michel Fingerhut)
  3. Newsgroups: comp.unix.ultrix
  4. Subject: Re: tty/ptys getting wasted?
  5. Message-ID: <1992Sep11.093152.24990@ircam.fr>
  6. Date: 11 Sep 92 09:31:52 GMT
  7. References: <1992Sep10.001635.20812@reed.edu>
  8. Organization: IRCAM, Paris (France)
  9. Lines: 16
  10.  
  11. nelson@reed.edu (Nelson Minar) asks about unreusable ptys.
  12. This occurs if the pty was left with the INUSE bit on.
  13. Since it occurs here as well, I wrote a script I run nightly which does
  14. the following:
  15.  
  16. 1.  scan all /dev/pty??, let XX be the number of the one being checked
  17. 2.  if can't open it AND there are no processes holding it (with ps agvxtXX
  18.     as well as ofiles /dev/ttyXX) then:
  19.  
  20.     fd= open ("/dev/ttyXX",  O_RDWR|O_NDELAY);
  21.     ioctl (fd, TIOCCINUSE, 0);
  22.     fchown(fd, 0, 0);
  23.     fchmod(fd, 0666);
  24.     close(fd);
  25.  
  26.     and cleanup /etc/utmp afterwards for this entry.
  27.