Re: [PATCH] chrt: when more than one argument, interpret first argument as priority
Benno Schulenberg <[email protected]>
| Newsgroups | org.kernel.vger.util-linux |
|---|---|
| Message-ID | <[email protected]> |
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
OpenPGP_signature.asc
(application/pgp-signature, 840 B)
-----BEGIN PGP SIGNATURE----- wsF5BAABCAAjFiEEFo5vQpe/16ea/USWUUu+Lrjhlh8FAmhegVAFAwAAAAAACgkQUUu+Lrjhlh+q 3Q//YXuBWVC32gffoK24cpc6EsoqVRUL9jOMjom/pE7etPHIQH5ICHnEVou2/dBjVyk/YV8jOoXr f20MuPBBGMdxNWSBzyGLoKhipoo4oqsNqamoCwSs6D9gysd1XL5xvp1YLhdnlzhDup7Xym/vNGHY DyWIRPTJIsAYU1aCFY17In8Go9OU4j5PB2dqw6QtKkTYbwTw9QNNMzXNvtqybTJMA0Nw3xGUhXj0 0Bl6kvZABcHJRV+YVh2PR8+UYPbHGJ5nE+HxR+OQ+EQv5O5u/eB3neMc/4WbI+Q6ZwmQFGAuso2y 7iPN0N5SKtKe/lmCbzmSl54f48B5enABT0a7I2rOdUjM70Ay+MsTIH8QdbW+lV+LP00ViH3FQ9fZ 81TYxmWpZfw0/zNqP3QJzbl5Bs1wxGR5MXL7Ra6s2nttpuev/XRny08PfooJXI1NzJPohjnZr+BT gO9sNEMxYU1mExiXbzanVUOATpHDe1pT9F/301s1bc8bIUaF0ZyYmvxIRpqmRR4T9Zj7pqDhfDz2 ZUNk5wdsM546qhSpmzF5yCJBdRToY8kDXql5T1Wa+iy+QQin9JkaDKzumdl2jBayJayDJ7weFUP1 SPo+LKjo5+SKg/nrg1JtElTHbvxcDejeAmTqwVoPMaOijG1THucxFFn/aGHtsNVUV7a/Ude6TWuU 1xw= =WzIB -----END PGP SIGNATURE-----