From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: proced: ppid of process ID 0 can be 0 Date: Mon, 22 Dec 2008 07:23:05 -0500 Message-ID: References: <18765.19040.568030.246241@tfkp04.physik.uni-erlangen.de> <18765.29820.997276.703222@tfkp04.physik.uni-erlangen.de> <18765.51840.943986.608296@tfkp04.physik.uni-erlangen.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1229948605 20852 80.91.229.12 (22 Dec 2008 12:23:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 22 Dec 2008 12:23:25 +0000 (UTC) Cc: lekktu@gmail.com, emacs-devel@gnu.org, Roland.Winkler@physik.uni-erlangen.de To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 22 13:24:31 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LEjpl-0006fQ-So for ged-emacs-devel@m.gmane.org; Mon, 22 Dec 2008 13:24:30 +0100 Original-Received: from localhost ([127.0.0.1]:47457 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LEjoW-0005nu-Gj for ged-emacs-devel@m.gmane.org; Mon, 22 Dec 2008 07:23:12 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LEjoS-0005nb-4u for emacs-devel@gnu.org; Mon, 22 Dec 2008 07:23:08 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LEjoR-0005nE-BD for emacs-devel@gnu.org; Mon, 22 Dec 2008 07:23:07 -0500 Original-Received: from [199.232.76.173] (port=51346 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LEjoR-0005nA-78 for emacs-devel@gnu.org; Mon, 22 Dec 2008 07:23:07 -0500 Original-Received: from ironport2-out.pppoe.ca ([206.248.154.182]:52475 helo=ironport2-out.teksavvy.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LEjoP-0004jL-Vn; Mon, 22 Dec 2008 07:23:06 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArcEADkVT0lMCqBi/2dsb2JhbACBbLtwWIRkikaGQ4Fa X-IronPort-AV: E=Sophos;i="4.36,263,1228107600"; d="scan'208";a="31364120" Original-Received: from 76-10-160-98.dsl.teksavvy.com (HELO pastel.home) ([76.10.160.98]) by ironport2-out.teksavvy.com with ESMTP; 22 Dec 2008 07:23:05 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 16F9884A4; Mon, 22 Dec 2008 07:23:05 -0500 (EST) In-Reply-To: (Eli Zaretskii's message of "Mon, 22 Dec 2008 06:08:06 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:107180 Archived-At: >> The primitives should ensure that what they return forms a forest. > You mean a tree. No, I meant a forest. It may consist of a single tree, but I see no reason to impose such a constraint. >> I.e. under POSIX, they should treat a "ppid == 0" as meaning that >> there's no parent (i.e. the data returned to Elisp should never say "the >> parent is process 0" but should instead say "this process doesn't have >> a parent"). > For me, code that calls process-tree-root-p (say) is much more > self-explanatory than a test for a missing parent pid attribute. To me the definition of "root" is "has no parent", so the two are equivalent. I could live with a predicate process-tree-root-p, but I'd expect it to just check for the absence of a parent. > It is also more reliable, since ppid attribute could be missing for > some other reason, like failure to access the attribute. And what would your process-tree-root-p say in that case? > Btw, is the above really mandated by Posix? Any references to that? I don't know, but whatever it is POSIX say, it should be handled in the POSIX implementation of system-process-attributes. On my GNU/Linux system, 0 is not a process, so a ppid of 0 is not a parent but rather the mark of the absence of a parent. Stefan