On Mon, Jun 07, 2010 at 08:56:43PM +0000, Debian bug at v.nix.is wrote:

> I looked at the source code for the 1.18 tarball and it doesn't work
> as expected because you're using the --user option to ps:
> 
>     $ ps H -o lwp,cmd --user 0|wc -l
>     110
>     $ ps H -o lwp,cmd --user 1001|wc -l
>     22
> 
> The command I used omitted that and used the -e option:
> 
>     $ ps H -eo lwp,cmd|wc -l
>     231
> 
> That allows me to filter all processes, including non-root
> processes.

The --user option is only added when you're not root, otherweise -e is
used:

    if ($root) {
        $cmdline .= " H -eo lwp,$psformat";
    } else {
        $cmdline .= " H -o lwp,$psformat --user $>";
    }

I think that's ok because AFAIK non-root users are not allowed to
change the priority of other users' processes.  Only root can change
those.


> It would be better to be able to control the entire ps command, not
> just the $psformat. That'd vven allow for the ability to use a
> non-ps(1) program to get the process list.

I'd like to keep the distinction between root and non-root usage
because that way it works 'out of the box' - as root, you can change
everything and als a normal user only your processes are affected.

Because of this changing the ps(1) command would mean not only one,
but two new configuration variables - one for the root-ps(1) command
and one for the non-root-ps(1) command.  Until anybody really needs a
non-ps(1) command, I'd like to keep reniced as simple and short as
possible.


To sum it up:

 * ps -e should be chosen automatically when you are root
 * changing other users' processes as non-root should throw errors
 * for now I'd like to stick with ps(1)

Could you please confirm the first two?

Regards
Christian
-- 
....Christian.Garbs.....................................http://www.cgarbs.de

Was macht ein Bit am liebsten?
Ist doch klar: Bus fahren.

Attachment: signature.asc
Description: Digital signature

Reply via email to