Subject: Re: /proc/${pid}/exe not working
To: Alan Barrett <apb@cequrux.com>
From: Antti Kantee <pooka@cs.hut.fi>
List: current-users
Date: 02/24/2007 17:49:36
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.

> This causes a problem with perl:
> 
> $ /usr/pkg/bin/perl5.8.8 -e 'print $^X, "\n"'
> /
> $ /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.

-- 
Antti Kantee <pooka@iki.fi>                     Of course he runs NetBSD
http://www.iki.fi/pooka/                          http://www.NetBSD.org/
    "la qualité la plus indispensable du cuisinier est l'exactitude"