[Bug 217144] procstat -e fails to report changes to environment.

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Feb 16 23:15:48 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=217144

Konstantin Belousov <kib at FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kib at FreeBSD.org
             Status|New                         |Closed
         Resolution|---                         |Works As Intended

--- Comment #2 from Konstantin Belousov <kib at FreeBSD.org> ---
This is perfectly normal.  Kernel can reliably see the environment for a
process only during execve(2), when old program passes the environment to a new
executed program through the syscall.  New program (address space) gets the
envirnment as a set of strings on top of the main thread stack.  procstat -e
best guess is to access these strings and show them as good enough
approximation.

During the normal operations, the environment changes do not need to be
reflected into the strings and they are not, as you discovered.  Still procstat
-e is useful because typical program only consumes the environment without
changing it.  Shells of course do change env vars, but maintaining env as
externally visible strings set is not needed until something is execed.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list