home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / ultrix / 6321 < prev    next >
Encoding:
Internet Message Format  |  1992-08-19  |  1.1 KB

  1. Path: sparky!uunet!mcsun!corton!ircam!fingerhu
  2. From: fingerhu@ircam.fr (Michel Fingerhut)
  3. Newsgroups: comp.unix.ultrix
  4. Subject: Re: w and ps don't agree
  5. Message-ID: <1992Aug19.094326.6013@ircam.fr>
  6. Date: 19 Aug 92 09:43:26 GMT
  7. References: <1992Aug17.081549.12346@trl.oz.au> <Bt6Lty.Cv7@ef2007.efhd.ford.com> <1992Aug19.071445.4360@ircam.fr>
  8. Organization: IRCAM, Paris (France)
  9. Lines: 23
  10.  
  11. As a solution to the problem of phantom users...  If no process is attached
  12. to a specific pty and it still shows (with w) a user, e.g.:
  13.  
  14.     User  tty  from          login@  idle  JCPU  PCPU  what
  15.     jjk   p5   vistaxx       5Aug92 212days             -
  16.  
  17. as gheeong@rhea.trl.OZ.AU (Ghee Ong) mentioned, it is not only necessary
  18. to clean the utmp entry, but the INUSE bit, such as with the following
  19. piece of code:
  20.  
  21.     int fd= open("/dev/ttyp5", O_RDWR|O_NDELAY);
  22.  
  23.     if (fd < 0) {
  24.     perror("open");
  25.     exit(-1);
  26.     }
  27.     if (ioctl (fd, TIOCCINUSE, 0) < 0) {
  28.     perror("ioctl TIOCCINUSE");
  29.     exit(-1);
  30.     }
  31.     close (fd);
  32.  
  33. This really freed that pty.  Now why was the INUSE bit still there, I wonder.
  34.