Re: [PATCH 4/4 V2] chrt: do not try to interpret any other option as a PID either
Karel Zak <[email protected]> Mon, 14 Jul 2025 13:28:52 +0200
| Newsgroups | org.kernel.vger.util-linux |
|---|---|
| Message-ID | <ceu2o6v4tz6g2hvt7olpg2v2viomyv22xm2jgodv4h4rzr4x3m@pmunyjscofn5> |
On Sun, Jul 06, 2025 at 11:39:44AM +0530, Madadi Vineeth Reddy wrote:
> On 03/07/25 20:17, Benno Schulenberg wrote:
> > When doing, for example, `chrt --pid --max`, it would report:
> >
> > chrt: invalid PID argument: '--max'
> >
> > This mistakenly gave the impression that the PID argument has to follow
> > directly after the --pid option.
> >
> > Avoid this by delaying the parsing of a PID until after all options have
> > been parsed. Temporarily set 'ctl->pid' to zero to indicate that a PID
> > needs to be read.
> >
> > After this change, `chrt --pid --max` will simply report the minimum and
> > maximum valid priorities. And `chrt --pid -v`:
>
> According to help text,
> chrt [options] --pid <priority> <pid>
>
> I’m still not sure about allowing the --max option after --pid.
> I’ll leave it to Karel to decide what’s best here.
My point of view (may be wrong, sched-utils CLI is odd). The core of
the chrt command line can be described as:
chrt <options> [<prio>] <process>
where <process> is
1) new process by exec()
2) already running process
The default is 1), --pid enables the 2) and in this case
<process> is PID.
The --pid is just an option to switch between the cases. There is no
argument for the option; it informs how to interpret the <process>.
The ideal would be to use "--" before <process>.
It means that arbitrary options could be after --pid, including --max.
Does it make sense?
Karel
--
Karel Zak <[email protected]>
http://karelzak.blogspot.com