Subject: Re: /proc/${pid}/exe not working
To: None <current-users@netbsd.org>
From: Alan Barrett <apb@cequrux.com>
List: current-users
Date: 02/24/2007 21:24:44
On Sat, 24 Feb 2007, Antti Kantee wrote:
> On Sat Feb 24 2007 at 12:04:36 +0200, Alan Barrett wrote:
> > I have procfs mounted on /proc, without "-o linux".  According to the
> > mount_procfs man page, there should not be any "exe" symlinks if the
> > 'linux" option is not used, but in reality there are "exe" symlinks.  A
> > few of the "exe" symlinks are correct, but most just point to "/".
> 
> This was changed recently.  I fixed the man page.

Thanks.

> > $ /usr/pkg/bin/perl5.8.8 -e 'system "ls", "-l", "/proc/$$/exe"'
> > lr-xr-xr-x  1 root  wheel  1 Feb 24 11:53 /proc/26280/exe -> /
> 
> This is probably because "exe" has never been "really" supported.
> Rather, it's fetched from the name lookup cache.  If the entry for a
> particular vnode gets flushed (or it's never entered - this is file
> system specific behaviour), the exe-link is out of luck.

What confuses me is that /proc/${pid}/cwd does not suffer from the
problem, although the code paths in procfs_vnops.c for PFScwd and PFSexe
are so similar.  Anyway, I raised a PR (number 35830).

--apb (Alan Barrett)