NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/40813: bad ps/ptyfs interaction



The following reply was made to PR bin/40813; it has been noted by GNATS.

From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/40813: bad ps/ptyfs interaction
Date: Sun, 18 Mar 2012 21:38:33 +0000

 On Sat, Mar 03, 2012 at 01:20:04AM +0000, Julian Djamil Fagir wrote:
  >  Hi,
  >  
  >  > Dunno. Why should ps need to access the pty anyway? To get its device
  >  > number?
  >  yep, see src/bin/ps.c:
  >  305                 if (stat(ttypath, &sb) == -1)
  >  306                     err(1, "%s", ttypath);
  >  307                 if (!S_ISCHR(sb.st_mode))
  >  308                     errx(1, "%s: not a terminal", ttypath);
  >  309                 flag = sb.st_rdev;
  >  
  >  If you wouldn't fail now, you would fail later when you kvm_getproc2(3)
  >  without the device number.
 
 Ok, but it needs to be able to do this without the tty available,
 because there can still be processes lying around even if the ptyfs
 entry has gone away.
 
 -- 
 David A. Holland
 dholland%netbsd.org@localhost
 


Home | Main Index | Thread Index | Old Index