Skip to contentSkip to conversation

chrt: inconsistency in --help

DISCUSSION Applied Martin Steigerwald 3 participants 4 messages Jun 9, 2015 – Jun 15, 2015 Util-Linux package

lore
Share & tools
lore
#0 lore raw

Hi!

In wheezy I have (util-linux 2.20.1-5.3):

somehost:~$ chrt --help

chrt - manipulate real-time attributes of a process

Set policy:
chrt [options] <policy> <priority> {<pid> | <command> [<arg> ...]}

Get policy:
chrt [options] {<pid> | <command> [<arg> ...]}

And this works for a PID if I place "-p" with the options. Like this:

chrt -p -i 0 $$
chrt -pi 0 $$
chrt -i -p 0 $$
chrt -ip 0 $$

In Jessie I have(util-linux 2.25.2-6):

somehost:~$ chrt --help

chrt - manipulate real-time attributes of a process

Set policy:
chrt [options] [<policy>] <priority> [-p <pid> | <command> [<arg>...]]

Get policy:
chrt [options] -p <pid>

And this doesn´t work:

chrt -i 0 -p $$
chrt: failed to execute -p: No such file or directory

Suggestion:

1) Either make chrt command parsing more flexible (preffered)

2) or or even and change set policy to

Set policy:
chrt [options] [-p] [<policy>] <priority> [<pid> | <command> [<arg>...]]

But well second option separates -p from pid. So maybe option 1 is the way to go.

What do you think?

Ciao,

Signature · 15 lines
Martin Steigerwald  | Consultant / Trainer

teamix GmbH
Südwestpark 43
90449 Nürnberg

Tel.:  +49 911 30999 55 | Fax: +49 911 30999 99
mail: [email protected] | web:  http://www.teamix.de | blog: http://blog.teamix.de

Amtsgericht Nürnberg, HRB 18320 | Geschäftsführer: Oliver Kügow, Richard Müller

***Nicht verpassen: NSX Roadshow "Optimierte Sicherheit für das moderne Rechenzentrum - Sicherheit im Wandel" mit teamix, TrendMicro und VMware***
Nürnberg 18.06. | München 02.07. | Frankfurt 16.07. | Stuttgart 23.07.

Jetzt anmelden: www.teamix.de/nsx-roadshow
maintainer
#1 lore raw
Quoted 3 lines · Martin Steigerwald

Suggestion:

1) Either make chrt command parsing more flexible (preffered)

Unfortunately we have to care about backward compatibility...

Quoted 4 lines

2) or or even and change set policy to

Set policy:
chrt [options] [-p] [<policy>] <priority> [<pid> | <command> [<arg>...]]

Yes, I have modified --help output to this

Quoted 2 lines

But well second option separates -p from pid. So maybe option 1 is the way to go.

It's not elegant, but unfortunately used for years and I don't think we want to make it more complex by any improvement.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#2 lore raw
Quoted 5 lines · Karel Zak
Quoted 2 lines · Martin Steigerwald

Set policy:
chrt [options] [-p] [<policy>] <priority> [<pid> | <command> [<arg>...]]

Yes, I have modified --help output to this

Well, -p is just one of the possible options, so it could be simply subsumed under [options]. Also, the brackets around "<pid> | <command> [<arg>..." seem to say that both <pid> and <command> are optional, but they are not when the <priority> is given. Furthermore, <policy> seems to suggest it is something like "WORD" or "name" or "12345", but in fact it is a certain type of option, starting with a dash. So I think the current synopsis is rather confusing.

The man page summarizes the command as follows:
chrt [options] priority command [argument...]
chrt [options] -p [priority] pid

The first line shows how to run a command with certain attributes, the second how to query or modify the attributes of an existing process. Quite clear.

So, to make usage synopsis clearer and correct I would suggest rewriting it as:

Set policy:
chrt [options] <priority> <command> [<arg>...] chrt [options] -p <priority> <pid>

The first of the upcoming two patches makes this change.

Benno

Signature · 2 lines
http://www.fastmail.com - Accessible with your email software
                          or over the web
maintainer Applied
#3 lore raw
Quoted 6 lines · Benno Schulenberg

So, to make usage synopsis clearer and correct I would suggest rewriting it as:

Set policy:
chrt [options] <priority> <command> [<arg>...] chrt [options] -p <priority> <pid>

OK, it looks better.

Quoted 1 line

The first of the upcoming two patches makes this change.

Applied, thanks!

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com