emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: proced: ppid of process ID 0 can be 0


From: Stefan Monnier
Subject: Re: proced: ppid of process ID 0 can be 0
Date: Mon, 22 Dec 2008 07:23:05 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

>> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]