What happened to my /proc/curproc/file?

Sam Varshavchik mrsam at courier-mta.com
Tue Sep 4 11:10:46 UTC 2012


Konstantin Belousov writes:

> The procfs links, as well as any other user of vn_fullpath(9) function,
> can only translate a vnode to path if namecache contains useful data.
> As such, the facilities are not guaranteed to success all the time.
>
> In case of rmdir(2), UFS explicitely purges the cache for directory which
> contained direntry of the removed directory. I suspect that you have
> your test program binary located in the same directory which was the parent
> of the removed one.

Correct. Looks like the same thing applies if I try to use sysctl to get  
KERN_PROC_PATHNAME.

I need some reliable way to get a process's executable file's name, as long  
as it's meaningful (the executable file hasn't been removed).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20120904/8ad73fcd/attachment.pgp


More information about the freebsd-hackers mailing list