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 <kzak@xxxxxxxxxx> http://karelzak.blogspot.com