Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Nov 2011 22:31:33 +0200
From:      Mikolaj Golub <trociny@freebsd.org>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        freebsd-hackers@freebsd.org, Robert Watson <rwatson@freebsd.org>
Subject:   Re: "ps -e" without procfs(5)
Message-ID:  <864ny6zbru.fsf@kopusha.home.net>
In-Reply-To: <20111109125329.GX50300@deviant.kiev.zoral.com.ua> (Kostik Belousov's message of "Wed, 9 Nov 2011 14:53:29 %2B0200")
References:  <86vcr21agm.fsf@kopusha.home.net> <20111105135801.GT50300@deviant.kiev.zoral.com.ua> <86ehxmpogp.fsf@kopusha.home.net> <20111105154443.GB50300@deviant.kiev.zoral.com.ua> <86ehxmjsza.fsf@kopusha.home.net> <20111105194553.GK50300@deviant.kiev.zoral.com.ua> <8662iyjof9.fsf@kopusha.home.net> <20111106181041.GH50300@deviant.kiev.zoral.com.ua> <86r51iqoad.fsf@kopusha.home.net> <20111109124455.GW50300@deviant.kiev.zoral.com.ua> <20111109125329.GX50300@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

On Wed, 9 Nov 2011 14:53:29 +0200 Kostik Belousov 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.
 >> And now you return success and nothing gets copied out for the process
 >> in P_INEXEC state. Either you should return an error like EAGAIN, or
 >> consider the P_INEXEC state as transitional and wait till process
 >> leaves it. Or, ignore the state as it was before, and return whatever
 >> error proc_rwmem generated (my preference).

 KB> Forgot to say that the check does not change much because you drop
 KB> process lock immediately after the check, so the process may enter
 KB> the INEXEC state right after the check. I believe you already tried
 KB> to do this with P_WEXIT.

Ok, eventually I decided not to check for P_INEXEC (as the simplest :-).

The updated patch:

http://people.freebsd.org/~trociny/env.sys.5.patch

-- 
Mikolaj Golub



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?864ny6zbru.fsf>