9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] process group, processes running in the background
@ 2008-06-20 14:03 Rudolf Sykora
  2008-06-20 15:50 ` Rudolf Sykora
  2008-06-20 19:10 ` Pietro Gagliardi
  0 siblings, 2 replies; 7+ messages in thread
From: Rudolf Sykora @ 2008-06-20 14:03 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 221 bytes --]

Hello,

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

Is there any simple way how to change a process' group?

Is there anything like pstree in plan9?

Thanks
Ruda

[-- Attachment #2: Type: text/html, Size: 248 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] process group, processes running in the background
  2008-06-20 14:03 [9fans] process group, processes running in the background Rudolf Sykora
@ 2008-06-20 15:50 ` Rudolf Sykora
  2008-06-20 19:08   ` a
  2008-06-20 19:58   ` Russ Cox
  2008-06-20 19:10 ` Pietro Gagliardi
  1 sibling, 2 replies; 7+ messages in thread
From: Rudolf Sykora @ 2008-06-20 15:50 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 491 bytes --]

And the last question should have been:

Can I say what processes are running in the background (only the last one
run is in $apid) and is it possible to get them back to foreground?

R.

2008/6/20 Rudolf Sykora <rudolf.sykora@gmail.com>:

> Hello,
>
> is there any simple way how to identify processes belonging to one concrete
> process group?
>
> Is there any simple way how to change a process' group?
>
> Is there anything like pstree in plan9?
>
> Thanks
> Ruda
>

[-- Attachment #2: Type: text/html, Size: 745 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] process group, processes running in the background
  2008-06-20 15:50 ` Rudolf Sykora
@ 2008-06-20 19:08   ` a
  2008-06-20 19:17     ` erik quanstrom
  2008-06-20 19:58   ` Russ Cox
  1 sibling, 1 reply; 7+ messages in thread
From: a @ 2008-06-20 19:08 UTC (permalink / raw)
  To: 9fans

// Can I say what processes are running in the background...

I assume you mean in the shell (the rest of your questions were more
general). rc tracks this internally for wait to work (which will allow you
to wait for a given pid or all backgrounded pids) in waitpids in
/sys/src/cmd/rc/plan9.c, but i don't see that the contents of this are
exposed to users anywhere.

If one were sufficently motivated, it looks like it'd be fairly straight-
forward to add an env var, say apidlist, and have the *waitpid fns in
plan9.c manipulate it.

// ...is it possible to get them back to foreground?

Nope.
anthony




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] process group, processes running in the background
  2008-06-20 14:03 [9fans] process group, processes running in the background Rudolf Sykora
  2008-06-20 15:50 ` Rudolf Sykora
@ 2008-06-20 19:10 ` Pietro Gagliardi
  2008-06-21 12:40   ` Rudolf Sykora
  1 sibling, 1 reply; 7+ messages in thread
From: Pietro Gagliardi @ 2008-06-20 19:10 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] process group, processes running in the background
  2008-06-20 19:08   ` a
@ 2008-06-20 19:17     ` erik quanstrom
  0 siblings, 0 replies; 7+ messages in thread
From: erik quanstrom @ 2008-06-20 19:17 UTC (permalink / raw)
  To: a, 9fans

> If one were sufficently motivated, it looks like it'd be fairly straight-
> forward to add an env var, say apidlist, and have the *waitpid fns in
> plan9.c manipulate it.

byron's rc does this.  the variable is called $apids.
i don't recall ever wanting for this feature in rc.

- erik



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] process group, processes running in the background
  2008-06-20 15:50 ` Rudolf Sykora
  2008-06-20 19:08   ` a
@ 2008-06-20 19:58   ` Russ Cox
  1 sibling, 0 replies; 7+ messages in thread
From: Russ Cox @ 2008-06-20 19:58 UTC (permalink / raw)
  To: 9fans

There is no "job control" in Plan 9.
Instead, there is a window system.

Draw two windows, and run one command
in each.  Then it is very easy to bring one or the
other command to the foreground by clicking
with the mouse in the associated window.

Russ


P.S.  Processes by group:

for(i in `{grep . /proc/*/noteid | sed 's!.*:!!' | sort -nu}){
	echo $i
	ps | grep -f <{
		grep -l ' '$i' ' /proc/*/noteid >[2]/dev/null |
		sed 's!/proc/!^[^ ]+ +!; s!/noteid! !'
	}
}



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [9fans] process group, processes running in the background
  2008-06-20 19:10 ` Pietro Gagliardi
@ 2008-06-21 12:40   ` Rudolf Sykora
  0 siblings, 0 replies; 7+ messages in thread
From: Rudolf Sykora @ 2008-06-21 12:40 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 938 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1782 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-06-21 12:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-20 14:03 [9fans] process group, processes running in the background Rudolf Sykora
2008-06-20 15:50 ` Rudolf Sykora
2008-06-20 19:08   ` a
2008-06-20 19:17     ` erik quanstrom
2008-06-20 19:58   ` Russ Cox
2008-06-20 19:10 ` Pietro Gagliardi
2008-06-21 12:40   ` Rudolf Sykora

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).