From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Sat, 21 Jun 2008 14:40:50 +0200 From: "Rudolf Sykora" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@9fans.net> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_5478_27255187.1214052050707" References: Subject: Re: [9fans] process group, processes running in the background Topicbox-Message-UUID: c3f78394-ead3-11e9-9d60-3106f5b1d025 ------=_Part_5478_27255187.1214052050707 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Thanks for everybody's answers... :) R. 2008/6/20 Pietro Gagliardi : > On Jun 20, 2008, at 10:03 AM, Rudolf Sykora wrote: > > Hello, >> >> is there any simple way how to identify processes belonging to one >> concrete process group? >> > > They're called "note groups" and the noteid file of each process has the > number. So if you call 6 lines of rc and 5 lines of awk simple, then yes! > > { > for(i in /proc/*) > if(! ~ $i /proc/trace) > echo `{cat $i/noteid}:`{basename $i} > } | sort -t: -n | awk ' > # based on squash by jon bentley from programming pearls 1st edition > BEGIN { FS = ":" } > $1 != prev { prev = $1; if(NR > 1) printf "\n"; printf "%d: ", $1 } > { printf "%d ", $2 } > END { printf "\n" } > ' > > Is there anything like pstree in plan9? >> > Work with the code I gave you and /sys/src/cmd/ps.c. > > Pietro > > > ------=_Part_5478_27255187.1214052050707 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Thanks for everybody's answers... :)
R.

2008/6/20 Pietro Gagliardi <pietro10@mac.com>:
On Jun 20, 2008, at 10:03 AM, Rudolf Sykora wrote:

Hello,

is there any simple way how to identify processes belonging to one concrete process group?

They're called "note groups" and the noteid file of each process has the number. So if you call 6 lines of rc and 5 lines of awk simple, then yes!

{
       for(i in /proc/*)
               if(! ~ $i /proc/trace)
                       echo `{cat $i/noteid}:`{basename $i}
} | sort -t: -n | awk '
# based on squash by jon bentley from programming pearls 1st edition
BEGIN { FS = ":" }
$1 != prev { prev = $1; if(NR > 1) printf "\n"; printf "%d: ", $1 }
{ printf "%d ", $2 }
END { printf "\n" }

'

Is there anything like pstree in plan9?
Work with the code I gave you and /sys/src/cmd/ps.c.

Pietro



------=_Part_5478_27255187.1214052050707--