"ps -e" without procfs(5)

Mikolaj Golub trociny at freebsd.org
Wed Nov 9 13:06:58 UTC 2011


On Wed, 9 Nov 2011 14:44:55 +0200 Kostik Belousov wrote:

 KB> On Tue, Nov 08, 2011 at 11:47:54PM +0200, Mikolaj Golub wrote:
 >> 
 >> http://people.freebsd.org/~trociny/env.sys.4.patch
 >> 
 >> Investigating cases when EFAULT was returned and if the fallback was
 >> successful I noticed that most of the cases were when p->p_comm changed during
 >> the read, so the process was in exec in that time. In order to avoid this
 >> error I added a check for P_INEXEC flag.

 KB> And now you return success and nothing gets copied out for the process
 KB> in P_INEXEC state.

This looked ok for me: new arguments have not been created for the process
yet, so return nothing :-)

 KB> Either you should return an error like EAGAIN, or consider the P_INEXEC
 KB> state as transitional and wait till process leaves it. Or, ignore the
 KB> state as it was before, and return whatever error proc_rwmem generated
 KB> (my preference).

I prefer EAGAIN :-). Reading in the process space that is being currrently
updated does not look good for me. And EAGAIN gives a hint that if I try it
again I will probably get the result, while EFAULT looks mysterious.

-- 
Mikolaj Golub


More information about the freebsd-hackers mailing list