Subject: Re: /proc/${pid}/exe not working
To: None <current-users@netbsd.org>
From: Antti Kantee <pooka@cs.hut.fi>
List: current-users
Date: 02/25/2007 15:52:27
On Sun Feb 25 2007 at 15:23:45 +0200, Alan Barrett wrote:
> On Sat, 24 Feb 2007, Antti Kantee wrote:
> > > 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?
> 
> In this special case, we could possibly use proc.p_comm for the basename,
> and do the getcwd_common() walk for the dirname.

The problem is locating the directory to start the getcwd walk from.

-- 
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"