On Wed, Jun 30, 2010 at 20:15, Christian Garbs <mi...@cgarbs.de> wrote:
> 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.

Ah, that should work then.

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

cgarbs.de's httpd was returning connection refused when this is
written. So I couldn't test your new version. But the above looks
good, and does what I want.

I just wanted to point out that if the ps format was completely
customizable it might be easier for people who like a ps invocation
that doesn't start with "ps H -eo lwp," to use the program,
e.g. someone that wants to write regexes against "ps auxf".

But that's at your discretion, this works for me and solves the bug,
thanks.



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to