From: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
To: Karel Zak <kzak@redhat.com>
Cc: Benno Schulenberg <bensberg@telfort.nl>,
util-linux@vger.kernel.org,
Madadi Vineeth Reddy <vineethr@linux.ibm.com>
Subject: Re: [PATCH 4/4 V2] chrt: do not try to interpret any other option as a PID either
Date: Tue, 15 Jul 2025 11:03:45 +0530 [thread overview]
Message-ID: <41444f08-31a0-4a04-91ba-31b5c006d92f@linux.ibm.com> (raw)
In-Reply-To: <ceu2o6v4tz6g2hvt7olpg2v2viomyv22xm2jgodv4h4rzr4x3m@pmunyjscofn5>
On 14/07/25 16:58, Karel Zak wrote:
> 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?
>
Yes. That makes sense.
Thanks,
Madadi Vineeth Reddy
> Karel
>
prev parent reply other threads:[~2025-07-15 5:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-03 14:47 [PATCH 1/4 V2] chrt: with more than one argument, interpret first argument as priority Benno Schulenberg
2025-07-03 14:47 ` [PATCH 2/4 V2] chrt: do not try to interpret the --pid option itself as a PID Benno Schulenberg
2025-07-03 14:47 ` [PATCH 3/4 V2] chrt: simplify the other check for too few arguments Benno Schulenberg
2025-07-06 5:58 ` Madadi Vineeth Reddy
2025-07-06 9:10 ` Benno Schulenberg
2025-07-09 7:12 ` chrt from git segfaults Benno Schulenberg
2025-07-09 18:45 ` Madadi Vineeth Reddy
2025-07-10 8:11 ` Benno Schulenberg
2025-07-12 16:29 ` Madadi Vineeth Reddy
2025-07-14 11:32 ` Karel Zak
2025-07-15 5:29 ` Madadi Vineeth Reddy
2025-07-15 9:19 ` Benno Schulenberg
2025-07-16 8:16 ` Karel Zak
2025-07-03 14:47 ` [PATCH 4/4 V2] chrt: do not try to interpret any other option as a PID either Benno Schulenberg
2025-07-06 6:09 ` Madadi Vineeth Reddy
2025-07-14 11:28 ` Karel Zak
2025-07-15 5:33 ` Madadi Vineeth Reddy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41444f08-31a0-4a04-91ba-31b5c006d92f@linux.ibm.com \
--to=vineethr@linux.ibm.com \
--cc=bensberg@telfort.nl \
--cc=kzak@redhat.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).