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