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: w and ps don't agree
- Message-ID: <1992Aug19.094326.6013@ircam.fr>
- Date: 19 Aug 92 09:43:26 GMT
- References: <1992Aug17.081549.12346@trl.oz.au> <Bt6Lty.Cv7@ef2007.efhd.ford.com> <1992Aug19.071445.4360@ircam.fr>
- Organization: IRCAM, Paris (France)
- Lines: 23
-
- As a solution to the problem of phantom users... If no process is attached
- to a specific pty and it still shows (with w) a user, e.g.:
-
- User tty from login@ idle JCPU PCPU what
- jjk p5 vistaxx 5Aug92 212days -
-
- as gheeong@rhea.trl.OZ.AU (Ghee Ong) mentioned, it is not only necessary
- to clean the utmp entry, but the INUSE bit, such as with the following
- piece of code:
-
- int fd= open("/dev/ttyp5", O_RDWR|O_NDELAY);
-
- if (fd < 0) {
- perror("open");
- exit(-1);
- }
- if (ioctl (fd, TIOCCINUSE, 0) < 0) {
- perror("ioctl TIOCCINUSE");
- exit(-1);
- }
- close (fd);
-
- This really freed that pty. Now why was the INUSE bit still there, I wonder.
-