Re: [PATCH 2/4] chrt: do not try to interpret the --pid option itself as a PID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
> Signed-off-by: Benno Schulenberg <bensberg@xxxxxxxxxx>
> ---
>  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"));





[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux