]> git.ipfire.org Git - thirdparty/util-linux.git/commit
chrt: Only display current settings when no policy is specified
authorMadadi Vineeth Reddy <vineethr@linux.ibm.com>
Sat, 21 Jun 2025 19:50:47 +0000 (01:20 +0530)
committerKarel Zak <kzak@redhat.com>
Mon, 23 Jun 2025 11:22:25 +0000 (13:22 +0200)
commit13346d4d28cd4873e8aad991866e1d1e22861efc
tree27072d7be368bc30d8cec2fc4f084d8d7d8d0248
parentc069c10bad4eece7d129886f375d20d547ccf144
chrt: Only display current settings when no policy is specified

Previously, running "chrt --pid <pid>" with no policy options
would display the process’s current scheduling attributes, but
specifying a policy without a priority (e.g. chrt --rr --pid <pid>)
would silently fallback to displaying the same info. This was
confusing, since a policy option normally implies an intent to
change something.

This patch changes the behavior so that
chrt --pid <pid> continues to show the current settings:

chrt --pid 10862
pid 10862's current scheduling policy:  SCHED_OTHER
pid 10862's current scheduling priority: 0
pid 10862's current runtime parameter:  2800000

If a policy is specified but no priority follows, chrt now
errors out:

chrt --rr --pid 10862
chrt: policy SCHED_RR requires a priority argument

Verbose output (-v) still prints the current settings when a
valid policy+priority is provided.

Signed-off-by: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
schedutils/chrt.c