Util-Linux package development
 help / color / mirror / Atom feed
From: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
To: Benno Schulenberg <bensberg@telfort.nl>, util-linux@vger.kernel.org
Cc: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
Subject: Re: [PATCH 2/4] chrt: do not try to interpret the --pid option itself as a PID
Date: Tue, 1 Jul 2025 10:35:31 +0530	[thread overview]
Message-ID: <79eaa2c0-65be-4370-b44f-2e8a1730b671@linux.ibm.com> (raw)
In-Reply-To: <20250630084052.11041-2-bensberg@telfort.nl>

On 30/06/25 14:10, Benno Schulenberg wrote:
> When not specifying a PID with --pid, `chrt` would report:
> 
>   chrt: invalid PID argument: '--pid'
> 
> That was silly.  After this change, `chrt --pid` will report:
> 
>   chrt: too few arguments

IMO, the current message is already helpful, and I'm not sure
the proposed one is much clearer.

Maybe something like --pid requires an argument would be clearer?

Also, I noticed that currently more than one pid can't be passed
if someone wants to update the custom slice for multiple pids at
once. I can look into adding support for that if it's helpful.

Thanks,
Madadi Vineeth Reddy

> 
> CC: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
> Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
> ---
>  schedutils/chrt.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/schedutils/chrt.c b/schedutils/chrt.c
> index 4c45eae80..8ed4d69f3 100644
> --- a/schedutils/chrt.c
> +++ b/schedutils/chrt.c
> @@ -474,6 +474,8 @@ int main(int argc, char **argv)
>  			policy_given = true;
>  			break;
>  		case 'p':
> +			if (argc - optind == 0)
> +				errx(EXIT_FAILURE, _("too few arguments"));
>  			errno = 0;
>  			/* strtopid_or_err() is not suitable here; 0 can be passed.*/
>  			ctl->pid = strtos32_or_err(argv[argc - 1], _("invalid PID argument"));


  reply	other threads:[~2025-07-01  5:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-30  8:40 [PATCH 1/4] chrt: with more than one argument, interpret first argument as priority Benno Schulenberg
2025-06-30  8:40 ` [PATCH 2/4] chrt: do not try to interpret the --pid option itself as a PID Benno Schulenberg
2025-07-01  5:05   ` Madadi Vineeth Reddy [this message]
2025-07-01 13:34     ` Benno Schulenberg
2025-07-02  8:30       ` Karel Zak
2025-06-30  8:40 ` [PATCH 3/4] chrt: simplify the other check for too few arguments Benno Schulenberg
2025-07-01  5:16   ` Madadi Vineeth Reddy
2025-07-01 13:39     ` Benno Schulenberg
2025-07-02  9:01       ` Karel Zak
2025-07-02 13:39         ` Benno Schulenberg
2025-07-02 14:52           ` Karel Zak
2025-06-30  8:40 ` [PATCH 4/4] chrt: do not try to interpret any other option as a PID either Benno Schulenberg
2025-07-01  5:21   ` Madadi Vineeth Reddy
2025-07-01 13:52     ` Benno Schulenberg
2025-07-01  4:57 ` [PATCH 1/4] chrt: with more than one argument, interpret first argument as priority Madadi Vineeth Reddy

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=79eaa2c0-65be-4370-b44f-2e8a1730b671@linux.ibm.com \
    --to=vineethr@linux.ibm.com \
    --cc=bensberg@telfort.nl \
    --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