[BUG] Getting path to program binary sometimes fails

Mike Gelfand Mike.Gelfand at LogicNow.com
Fri Dec 5 11:56:13 UTC 2014


Hello,

Sorry for late reply.

On Nov 14, 2014, at 1:23 PM, Konstantin Belousov <kostikbel at gmail.com> wrote:

>> error condition, what should I do to get the path reliably? Should I
>> retry (and how many times)? You?re saying cache is being purged; does
>> it mean that when I ask for path then cache is populated again? Does
>> it guarantee then that I?ll be able to get the path on next call?
>> Could you guarantee that I?ll be able to get the path at all if I fail
>> two or more times? Should I rely on ENOENT specifically when retrying?
> After the path resolution failed, it can only succeed later if the cache
> is populated again.  Cache cannot be populated by the vnode->path
> request, just think where to get the data ?  The cache is populated
> when lookup is performed, so if nothing accessed the file by name
> between your two calls, second translation fails as well.

Still no answer to the very first question: how do I get path to current or any other process binary reliably? The fact that this sysctl is not guaranteed to work and there's no way to make it work if all I know is process ID makes it quite useless for programs which need this information. Are you saying that this information cannot at all be reliably retrieved in FreeBSD? Is there a way to at least prolong cache entry lifetime or increase cache size so that eviction happens as rarely as possible (if at all)?

Regards,
Mike


More information about the freebsd-hackers mailing list