Re: [PATCH] chrt: when more than one argument, interpret first argument as priority

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Op 27-06-2025 om 10:38 schreef Madadi Vineeth Reddy:
On 26/06/25 16:57, Benno Schulenberg wrote:
The first argument is a priority not only for `chrt --pid <prio> <pid>`
but also for `chrt <prio> <command> [<argument>...]`.

Good catch. SCHED_RR is indeed taken by default when no policy is given.

We could address this by initializing `need_prio` to `true` by default,
and then setting it to `false` in the corresponding switch cases for
policies that don't require a priority.

Well, that change is redundant with my proposed change.

Also, setting 'need_prio' to true by default gives a somewhat wrong
impression, because no priority is needed when only option --pid is
given.

What your proposed change accomplishes is that the error message
for the mistaken `./chrt somecommand` changes from:

  chrt: unsupported priority value for the policy: 0: see --max for valid range

to:

  chrt: bad usage
  Try 'chrt --help' for more information.

I think both error messages are equally poor -- the first is puzzling,
the second too unspecific.  It would be better to combine your change
with more specific feedback, depending on whether --pid was given.  I'll
send a better patch next week.


Benno

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux