Subject: /proc/${pid}/exe not working
To: None <>
From: Alan Barrett <>
List: current-users
Date: 02/24/2007 12:04:36
I have procfs mounted on /proc, without "-o linux".  According to the
mount_procfs man page, there should not be any "exe" symlinks if the
'linux" option is not used, but in reality there are "exe" symlinks.  A
few of the "exe" symlinks are correct, but most just point to "/".

This causes a problem with perl:

$ /usr/pkg/bin/perl5.8.8 -e 'print $^X, "\n"'
$ /usr/pkg/bin/perl5.8.8 -e 'system "ls", "-l", "/proc/$$/exe"'
lr-xr-xr-x  1 root  wheel  1 Feb 24 11:53 /proc/26280/exe -> /

If procfs is not pounted, perl uses some other method of figuring out
its own name, and it works.

I suppose I could patch perl to treat the case of "/proc/$$/exe is a
symlink to /" as if the information was missing, but I am really interested
in having accurate information in the procfs symlinks.

The only pattern I see is that procfs "exe" symlinks to programs in /bin
and /sbin seem to work, while symlinks to programs in /usr/* all fail.
/usr is a nullfs mount, in case that helps diagnose the problem, but
before leaping to the conclusion that procfs symlinks cant handle nullfs
mounts, note that procfs "cwd" symlinks to /usr/* all seem to work.

--apb (Alan Barrett)