Bug#583960: [v-admins] Bug#583960: reniced: Add option to use `ps H -eo lwp, cmd` instead of `ps H -eo lwp, comm`

2010-06-30 Thread Christian Garbs
On Mon, Jun 07, 2010 at 08:56:43PM +, 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.


signature.asc
Description: Digital signature


Bug#583960: [v-admins] Bug#583960: reniced: Add option to use `ps H -eo lwp, cmd` instead of `ps H -eo lwp, comm`

2010-06-07 Thread Debian bug at v.nix.is
On Sun, Jun 6, 2010 at 11:19, Christian Garbs mi...@cgarbs.de wrote:
 On Mon, May 31, 2010 at 09:00:01PM +, v.nix.is wrote:

 The reniced program is really limited by the hardcoded use of a
 `comm' argument to ps(1). It should optionally allow for using
 `cmd'. Or any other ps option with a command-line argument.

 I've extended the upstream version to include your idea via the -o
 parameter that is directly passed on to ps(1).

 Please have a look at this inofficial package of v1.18 and tell me
 if it works for you:

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.

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.



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