ps -e without procfs(5).

Garance A Drosihn drosih at rpi.edu
Sun Dec 5 20:16:37 PST 2004


At 4:28 PM -0800 11/30/04, Peter Wemm wrote:
>On Tuesday 30 November 2004 03:12 pm, Pawel Jakub Dawidek wrote:
>>  Hello.
>>
>>  I need some testing for this patch:
>>
>>	http://people.freebsd.org/~pjd/patches/ps-e.patch
>>
>  > It allows to use 'ps -e' without procfs(5) mounted.
>
>ps -e is "live" and reads the environment from the process.  It looks
>like your patch adds a once-only snapshot of the exec-time values..
>
>I've only ever used "ps -e" to figure out what the current live values
>are, I'd be more interested in a ptrace based replacement..

I also always thought that `ps -e' was live, but I went to check
on that, and now I'm not so sure it is.  On both 4.x and 5.x (with
procfs mounted), I tried doing `ps -eww -p $$'.  I got a list of
environment variables, and I tried adding or modifying a variable
and then re-entering the command.  As near as I could tell, the
output did not change.  So, it looks like the procfs implementation
is also just a copy of the variables as they were set when the
process initially started up.

I also tried a quick test of 'ps eww p $$' on a linux box, and it
also seems to show only the environment variables (and values) that
the process started up with.

I think there are a few issues that need to be addressed in Pawel's
work here, but it looks like he is correct in implementing it as a
once-only snapshot.  Maybe we should have something else to show
the "live" environment of a process.

We probably need to do more comparisons of the procfs-based `ps -e'
(on both 4.x and 5.x) with Pawel's work, but once we sort out the
security issues I think it is a reasonable thing to add.  It will
mean there is one less reason that anyone has to mount procfs, and
I believe that is a direction that we (as a project) wanted to go.

-- 
Garance Alistair Drosehn            =   gad at gilead.netel.rpi.edu
Senior Systems Programmer           or  gad at freebsd.org
Rensselaer Polytechnic Institute    or  drosih at rpi.edu


More information about the freebsd-arch mailing list