Subject: Re: /proc/${pid}/exe not working
To: None <current-users@netbsd.org>
From: Alan Barrett <apb@cequrux.com>
List: current-users
Date: 02/25/2007 15:23:45
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.
--apb (Alan Barrett)