Subject: Re: /proc/${pid}/exe not working
To: Alan Barrett <>
From: Antti Kantee <>
List: current-users
Date: 02/24/2007 21:47:23
On Sat Feb 24 2007 at 21:24:44 +0200, Alan Barrett wrote:
> > > $ /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).

That's because cwd can do real getcwd if the entry is not found in the
cache - directories always have a unique parent.  Other types of file
system nodes, however, lack this luxury (think hardlinks).

As a hack to fix a hack, maybe we can add layerfs support the name cache?
What do people think?

Antti Kantee <>                     Of course he runs NetBSD                
    "la qualité la plus indispensable du cuisinier est l'exactitude"