Summary: | procstat -e fails to report changes to environment. | ||
---|---|---|---|
Product: | Base System | Reporter: | mrT <mrT1188123> |
Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> |
Status: | Closed Works As Intended | ||
Severity: | Affects Many People | CC: | amd64, kib |
Priority: | --- | ||
Version: | 10.3-RELEASE | ||
Hardware: | amd64 | ||
OS: | Any |
Description
mrT
2017-02-16 15:37:18 UTC
I was using shell: ksh93 version sh (AT&T Research) 93u+ 2012-08-01 and also tested using '/bin/sh' and got the same results. 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. |