Re: New option in ps for thread output management

Eric Paire (e.paire@opengroup.org)
Wed, 16 Sep 1998 07:48:07 +0200


> Eric PAIRE <e.paire@opengroup.org> writes:
> > I intent to modify "procps-1.2.8" in order to add a new option to select
> > display of cloned processes. In BSD systems, the '-m' ps option adds
> > threads to the list of processes listed. Since there are only forked and
> > cloned processes in Linux, I want to add an option which selects the
> > output of cloned processes, and have no explicit reference to threads.
>
> So how do you tell "cloned" processes from "non-cloned" processes? The
> only way I see to do it from the information currently in /proc is by
> examining the VM stuff. This should allow processes created with
> CLONE_VM to be identified, which would be good enough.
>
In the pre-patch-2.1.122, Linus has accepted to add to the /proc/<pid>/stat
string the exit_signal of the process. As you know, the exit_signal is an
argument of the clone() system call, and usually SIGCHLD for forked process,
and another signal number for cloned process (which is coherent with the way
the __WCLONE flag of the "wait()" system call family argument works).

Therefore, it is very easy to separate cloned from forked process from a
kernel point of view.

Eric
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ Eric PAIRE
Email : e.paire@gr.opengroup.org | The Open Group - Grenoble Research Institute
Phone : +33 (0) 476 63 48 71 | 2, avenue de Vignate
Fax : +33 (0) 476 51 05 32 | F-38610 Gieres FRANCE

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/