Subject: Re: code to store the path of the executable in struct proc...
To: Christos Zoulas <email@example.com>
From: Andrew Doran <firstname.lastname@example.org>
Date: 09/21/2007 01:14:00
On Thu, Sep 20, 2007 at 05:01:03PM -0400, Christos Zoulas wrote:
> In order to properly implement ld.elf_so $ORIGIN and the procfs
> "exe" symlink we need to know the path to an executable. The
> following code does this, but it is not particularly efficient and
> its use of vnode_to_path() is questionable.
> + if (p->p_path == NULL)
> + p->p_path = PNBUF_GET();
I think kmem_alloc() is better because pnbufs are obviously quite large and
right now there aren't that many of them floating about at any given time.
> + * Try to find a pathname for a vnode. Since there is no mapping
> + * vnode -> parent directory, this needs the NAMECACHE_ENTER_REVERSE
> + * option to work (to make cache_revlookup succeed).
> + */
> +vnode_to_path(char *path, size_t len, struct vnode *vp, struct lwp *curl,
> + struct proc *p)
The reverse mapping makes me uncomfortable. For MP the namecache needs to be
simple because it's one item of shared state that gets hammered on. Is it
possible to get the path at exec time?