[9fans] process group, processes running in the background - Plan9

This is a discussion on [9fans] process group, processes running in the background - Plan9 ; 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...

+ Reply to Thread
Results 1 to 7 of 7

Thread: [9fans] process group, processes running in the background

  1. [9fans] process group, processes running in the background

    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


  2. Re: [9fans] process group, processes running in the background

    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 :

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



  3. Re: [9fans] process group, processes running in the background

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



  4. Re: [9fans] process group, processes running in the background

    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



  5. Re: [9fans] process group, processes running in the background

    > 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


  6. Re: [9fans] process group, processes running in the background

    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! !'
    }
    }



  7. Re: [9fans] process group, processes running in the background

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



+ Reply to Thread