From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 14 20:31:42 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16B7B106566C; Mon, 14 Nov 2011 20:31:42 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 6A12B8FC17; Mon, 14 Nov 2011 20:31:41 +0000 (UTC) Received: by bkbzs8 with SMTP id zs8so8737883bkb.13 for ; Mon, 14 Nov 2011 12:31:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:x-comment-to:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=k0q6FO4rMR55mJH9zpssXt1fNUGSiFOCxNRtcOHhrIE=; b=k2kJa9H0T40ah9QCRKKgUCXdiDc5crN8M+vP+1U2NmKddGhNCWjGkgPZiMdkxLUw/Z o9i2dX3Dis57jWfu5dC40qxHJQ0TNebl79rmPI2gk6rxlFqMk96WdpOyJDVyEYhuXJJl fpWFZUaxXeyiQJEmF8qUr6h1c+2O913ZHKHI0= Received: by 10.204.41.66 with SMTP id n2mr20903520bke.77.1321302699857; Mon, 14 Nov 2011 12:31:39 -0800 (PST) Received: from localhost ([95.69.173.122]) by mx.google.com with ESMTPS id z7sm34643541bka.1.2011.11.14.12.31.35 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 14 Nov 2011 12:31:36 -0800 (PST) From: Mikolaj Golub To: Kostik Belousov 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> X-Comment-To: Kostik Belousov Sender: Mikolaj Golub Date: Mon, 14 Nov 2011 22:31:33 +0200 In-Reply-To: <20111109125329.GX50300@deviant.kiev.zoral.com.ua> (Kostik Belousov's message of "Wed, 9 Nov 2011 14:53:29 +0200") Message-ID: <864ny6zbru.fsf@kopusha.home.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: freebsd-hackers@freebsd.org, Robert Watson Subject: Re: "ps -e" without procfs(5) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Nov 2011 20:31:42 -0000 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