Re: [PATCH 1/4] chrt: with more than one argument, interpret first argument as priority

Madadi Vineeth Reddy <[email protected]>
Newsgroups org.kernel.vger.util-linux
Message-ID <[email protected]>
Hi Benno,

On 30/06/25 14:10, Benno Schulenberg wrote:
> The first argument is a priority not only for `chrt --pid <prio> <pid>`
> but also for `chrt <prio> <command> [<argument>...]`.
> 
> This fixes an oversight in recent commit e7a2d62434.
> 
> CC: Madadi Vineeth Reddy <[email protected]>
> Signed-off-by: Benno Schulenberg <[email protected]>
> ---
>  schedutils/chrt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/schedutils/chrt.c b/schedutils/chrt.c
> index 0bcdd1a1e..4c45eae80 100644
> --- a/schedutils/chrt.c
> +++ b/schedutils/chrt.c
> @@ -530,7 +530,7 @@ int main(int argc, char **argv)
>  
>  	errno = 0;
>  
> -	if (need_prio || argc - optind == 2)
> +	if (need_prio || argc - optind > 1)
>  		ctl->priority = strtos32_or_err(argv[optind], _("invalid priority argument"));
>  	else
>  		ctl->priority = 0;

LGTM.

Without this patch:
chrt 12 grep boo README
chrt: unsupported priority value for the policy: 0: see --max for valid range

With this patch:
chrt 12 grep boo README
      See: http://vger.kernel.org/majordomo-info.html#taboo

Reviewed-by: Madadi Vineeth Reddy <[email protected]>
Tested-by: Madadi Vineeth Reddy <[email protected]>

Thanks,
Madadi Vineeth Reddy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.