* Re: [PATCH] rename: change "expression" to "original"
From: Nuno Silva @ 2025-06-22 9:15 UTC (permalink / raw)
To: util-linux; +Cc: Haelwenn (lanodan) Monnier
In-Reply-To: <20250621232642.17613-2-contact@hacktivis.me>
On 2025-06-22, Haelwenn (lanodan) Monnier wrote:
> As rename(1) doesn't uses an expression (like regex or glob) but
> rather a substring.
[...]
> -*rename* [options] _expression replacement file_...
> +*rename* [options] _original replacement file_...
[...]
Oh. I was aware of there being at least two different "rename" utilities
on Linux systems, this one from util-linux and a perl-based one using
regexes, but I hadn't noticed this wording in the online manual and
usage output.
Yes, this change probably helps telling it apart from the perl-based
rename.
(I don't recall what made confusion more prone in the case of this
utility, was it that some distributions installed the perl one as
"rename"?)
--
Nuno Silva
Who hopes the Cc works properly.
^ permalink raw reply
* [PATCH] rename: change "expression" to "original"
From: Haelwenn (lanodan) Monnier @ 2025-06-21 23:26 UTC (permalink / raw)
To: util-linux; +Cc: Haelwenn (lanodan) Monnier
As rename(1) doesn't uses an expression (like regex or glob) but rather a substring.
---
Note: Not on the mailing-list so CC me on replies
misc-utils/rename.1.adoc | 12 ++++++------
misc-utils/rename.c | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/misc-utils/rename.1.adoc b/misc-utils/rename.1.adoc
index b8ea2bfdf..e5ba17e7a 100644
--- a/misc-utils/rename.1.adoc
+++ b/misc-utils/rename.1.adoc
@@ -20,11 +20,11 @@ rename - rename files
== SYNOPSIS
-*rename* [options] _expression replacement file_...
+*rename* [options] _original replacement file_...
== DESCRIPTION
-*rename* will rename the specified files by replacing the first occurrence of _expression_ in their name by _replacement_.
+*rename* will rename the specified files by replacing the first occurrence of the _original_ substring in their name by _replacement_.
== OPTIONS
@@ -38,10 +38,10 @@ Show which files were renamed, if any.
Do not make any changes; add *--verbose* to see what would be made.
*-a*, *--all*::
-Replace all occurrences of _expression_ rather than only the first one.
+Replace all occurrences of _original_ rather than only the first one.
*-l*, *--last*::
-Replace the last occurrence of _expression_ rather than the first one.
+Replace the last occurrence of _original_ rather than the first one.
*-o*, *--no-overwrite*::
Do not overwrite existing files. When *--symlink* is active, do not overwrite symlinks pointing to existing targets.
@@ -57,9 +57,9 @@ The renaming has no safeguards by default or without any one of the options *--n
== EDGE CASES
-If the _expression_ is empty, then by default _replacement_ will be added to the start of the filename. With *--all*, _replacement_ will be inserted in between every two characters of the filename, as well as at the start and end.
+If the _original_ is empty, then by default _replacement_ will be added to the start of the filename. With *--all*, _replacement_ will be inserted in between every two characters of the filename, as well as at the start and end.
-Normally, only the final path component of a filename is updated. (Or with *--symlink*, only the final path component of the link.) But if either _expression_ or _replacement_ contains a _/_, the full path is updated. This can cause a file to be moved between folders. Creating folders, and moving files between filesystems, is not supported.
+Normally, only the final path component of a filename is updated. (Or with *--symlink*, only the final path component of the link.) But if either _original_ or _replacement_ contains a _/_, the full path is updated. This can cause a file to be moved between folders. Creating folders, and moving files between filesystems, is not supported.
== INTERACTIVE MODE
diff --git a/misc-utils/rename.c b/misc-utils/rename.c
index bb2e3103d..5eb8f4429 100644
--- a/misc-utils/rename.c
+++ b/misc-utils/rename.c
@@ -251,7 +251,7 @@ static void __attribute__((__noreturn__)) usage(void)
FILE *out = stdout;
fputs(USAGE_HEADER, out);
fprintf(out,
- _(" %s [options] <expression> <replacement> <file>...\n"),
+ _(" %s [options] <original> <replacement> <file>...\n"),
program_invocation_short_name);
fputs(USAGE_SEPARATOR, out);
base-commit: c8e5b8a818323af30ec656f079c7feadaeeb13c3
--
2.49.0
^ permalink raw reply related
* [PATCH v4 1/3] chrt: Make minor cleanups in chrt
From: Madadi Vineeth Reddy @ 2025-06-21 19:50 UTC (permalink / raw)
To: util-linux, Karel Zak, Benno Schulenberg; +Cc: Madadi Vineeth Reddy
In-Reply-To: <20250621195048.24900-1-vineethr@linux.ibm.com>
Minor changes such as fixing an incorrect comment and aligning
the closing brace of an if condition in main() were made, along
with making the usage of --pid consistent across files instead
of -p, although -p still works, for better readability.
No functional change is intended.
Signed-off-by: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
---
schedutils/chrt.1.adoc | 10 +++++-----
schedutils/chrt.c | 6 +++---
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/schedutils/chrt.1.adoc b/schedutils/chrt.1.adoc
index 77add535d..36cdcc5fe 100644
--- a/schedutils/chrt.1.adoc
+++ b/schedutils/chrt.1.adoc
@@ -40,7 +40,7 @@ chrt - manipulate the real-time attributes of a process
*chrt* [options] _priority command argument_ ...
-*chrt* [options] *-p* [_priority_] _PID_
+*chrt* [options] *--pid* [_priority_] _PID_
== DESCRIPTION
@@ -117,20 +117,20 @@ ____
//TRANSLATORS: Keep {colon} untranslated
You can also retrieve the real-time attributes of an existing task{colon}::
____
-*chrt -p* _PID_
+*chrt --pid* _PID_
____
//TRANSLATORS: Keep {colon} untranslated
Or set them{colon}::
____
-*chrt -r -p* _priority PID_
+*chrt -r --pid* _priority PID_
____
This, for example, sets real-time scheduling to priority _30_ for the process _PID_ with the *SCHED_RR* (round-robin) class{colon}::
____
-*chrt -r -p 30* _PID_
+*chrt -r --pid 30* _PID_
____
Reset priorities to default for a process{colon}::
____
-*chrt -o -p 0* _PID_
+*chrt -o --pid 0* _PID_
____
See *sched*(7) for a detailed discussion of the different scheduler classes and how they interact.
diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index cf99935dc..8fe748f43 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -64,7 +64,7 @@ static void __attribute__((__noreturn__)) usage(void)
" chrt [options] --pid <priority> <pid>\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(_("Get policy:\n"
- " chrt [options] -p <pid>\n"), out);
+ " chrt [options] --pid <pid>\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(_("Policy options:\n"), out);
@@ -341,7 +341,7 @@ static int set_sched_one(struct chrt_ctl *ctl, pid_t pid)
return set_sched_one_by_setscheduler(ctl, pid);
}
-#else /* !HAVE_SCHED_SETATTR */
+#else /* HAVE_SCHED_SETATTR */
static int set_sched_one(struct chrt_ctl *ctl, pid_t pid)
{
struct sched_attr sa = { .size = sizeof(struct sched_attr) };
@@ -499,7 +499,7 @@ int main(int argc, char **argv)
((ctl->pid == -1) && argc - optind < 2)) {
warnx(_("bad usage"));
errtryhelp(EXIT_FAILURE);
-}
+ }
if ((ctl->pid > -1) && (ctl->verbose || argc - optind == 1)) {
show_sched_info(ctl);
--
2.49.0
^ permalink raw reply related
* [PATCH v4 3/3] chrt: Make priority optional for policies that don't use it
From: Madadi Vineeth Reddy @ 2025-06-21 19:50 UTC (permalink / raw)
To: util-linux, Karel Zak, Benno Schulenberg; +Cc: Madadi Vineeth Reddy
In-Reply-To: <20250621195048.24900-1-vineethr@linux.ibm.com>
Currently, chrt requires a priority argument even for scheduling
policies like SCHED_OTHER and SCHED_BATCH, which ignore it.
This change relaxes that requirement. Now, priority is only expected
for SCHED_FIFO and SCHED_RR. For other policies, a default value of 0
is set internally and no argument is required on the command line.
This simplifies usage when modifying runtime parameters like
--sched-runtime for non-realtime tasks.
For example, to change the EEVDF tunable base_slice, one currently
needs to run:
chrt -o -T 1000000 --pid 0 $PID
Passing '0' after --pid is not intutive and not required as priority
is not applicable to SCHED_OTHER tasks. Now with this patch, one can do:
chrt -o -T 1000000 --pid $PID
Passing '0' still works ensuring ABI doesn't break.
Signed-off-by: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
---
schedutils/chrt.1.adoc | 14 +++++++++-----
schedutils/chrt.c | 24 ++++++++++++++++--------
2 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/schedutils/chrt.1.adoc b/schedutils/chrt.1.adoc
index 36cdcc5fe..5b8d7e832 100644
--- a/schedutils/chrt.1.adoc
+++ b/schedutils/chrt.1.adoc
@@ -49,7 +49,7 @@ chrt - manipulate the real-time attributes of a process
== POLICIES
*-o*, *--other*::
-Set scheduling policy to *SCHED_OTHER* (time-sharing scheduling). This is the default Linux scheduling policy.
+Set scheduling policy to *SCHED_OTHER* (time-sharing scheduling). This is the default Linux scheduling policy. Since util-linux v2.42, the priority argument is optional; if specified, it must be set to zero.
*-f*, *--fifo*::
Set scheduling policy to *SCHED_FIFO* (first in-first out).
@@ -58,16 +58,16 @@ Set scheduling policy to *SCHED_FIFO* (first in-first out).
Set scheduling policy to *SCHED_RR* (round-robin scheduling). When no policy is defined, the *SCHED_RR* is used as the default.
*-b*, *--batch*::
-Set scheduling policy to *SCHED_BATCH* (scheduling batch processes). Linux-specific, supported since 2.6.16. The priority argument has to be set to zero.
+Set scheduling policy to *SCHED_BATCH* (scheduling batch processes). Linux-specific, supported since 2.6.16. Since util-linux v2.42, the priority argument is optional; if specified, it must be set to zero.
*-i*, *--idle*::
-Set scheduling policy to *SCHED_IDLE* (scheduling very low priority jobs). Linux-specific, supported since 2.6.23. The priority argument has to be set to zero.
+Set scheduling policy to *SCHED_IDLE* (scheduling very low priority jobs). Linux-specific, supported since 2.6.23. Since util-linux v2.42, the priority argument is optional; if specified, it must be set to zero.
*-d*, *--deadline*::
-Set scheduling policy to *SCHED_DEADLINE* (sporadic task model deadline scheduling). Linux-specific, supported since 3.14. The priority argument has to be set to zero. See also *--sched-runtime*, *--sched-deadline* and *--sched-period*. The relation between the options required by the kernel is runtime <= deadline <= period. *chrt* copies _period_ to _deadline_ if *--sched-deadline* is not specified and _deadline_ to _runtime_ if *--sched-runtime* is not specified. It means that at least *--sched-period* has to be specified. See *sched*(7) for more details.
+Set scheduling policy to *SCHED_DEADLINE* (sporadic task model deadline scheduling). Linux-specific, supported since 3.14. Since util-linux v2.42, the priority argument is optional; if specified, it must be set to zero. See also *--sched-runtime*, *--sched-deadline* and *--sched-period*. The relation between the options required by the kernel is runtime <= deadline <= period. *chrt* copies _period_ to _deadline_ if *--sched-deadline* is not specified and _deadline_ to _runtime_ if *--sched-runtime* is not specified. It means that at least *--sched-period* has to be specified. See *sched*(7) for more details.
*-d*, *--ext*::
-Set scheduling policy to *SCHED_EXT* (BPF program-defined scheduling). Linux-specific, supported since 6.12. The priority argument has to be set to zero.
+Set scheduling policy to *SCHED_EXT* (BPF program-defined scheduling). Linux-specific, supported since 6.12. Since util-linux v2.42, the priority argument is optional; if specified, it must be set to zero.
== SCHEDULING OPTIONS
@@ -132,6 +132,10 @@ Reset priorities to default for a process{colon}::
____
*chrt -o --pid 0* _PID_
____
+Set a custom slice of 1 ms for a SCHED_OTHER task (priority is optional for policies other than SCHED_FIFO and SCHED_RR){colon}::
+____
+*chrt -o -T 1000000 --pid* _PID_
+____
See *sched*(7) for a detailed discussion of the different scheduler classes and how they interact.
== PERMISSIONS
diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index d694845ac..0bcdd1a1e 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -399,7 +399,7 @@ int main(int argc, char **argv)
{
struct chrt_ctl _ctl = { .pid = -1, .policy = SCHED_RR }, *ctl = &_ctl;
int c;
- bool policy_given = false;
+ bool policy_given = false, need_prio = false;
static const struct option longopts[] = {
{ "all-tasks", no_argument, NULL, 'a' },
@@ -455,6 +455,7 @@ int main(int argc, char **argv)
case 'f':
ctl->policy = SCHED_FIFO;
policy_given = true;
+ need_prio = true;
break;
case 'R':
ctl->reset_on_fork = 1;
@@ -480,6 +481,7 @@ int main(int argc, char **argv)
case 'r':
ctl->policy = SCHED_RR;
policy_given = true;
+ need_prio = true;
break;
case 'v':
ctl->verbose = 1;
@@ -503,29 +505,35 @@ int main(int argc, char **argv)
}
}
- if (((ctl->pid > -1) && argc - optind < 1) ||
- ((ctl->pid == -1) && argc - optind < 2)) {
+ if (((ctl->pid > -1) && argc - optind < (need_prio ? 1 : 0)) ||
+ ((ctl->pid == -1) && argc - optind < (need_prio ? 2 : 1))) {
warnx(_("bad usage"));
errtryhelp(EXIT_FAILURE);
}
/* pid exists but priority not given */
if (ctl->pid > -1 && argc - optind == 1) {
- /* Error if a policy was specified but no priority given */
- if (policy_given)
+ /* Error if priority is missing for a policy that requires it */
+ if (policy_given && need_prio)
errx(EXIT_FAILURE, ("policy %s requires a priority argument"),
get_policy_name(ctl->policy));
/* If no policy specified, show current settings */
- show_sched_info(ctl);
- return EXIT_SUCCESS;
+ if (!policy_given) {
+ show_sched_info(ctl);
+ return EXIT_SUCCESS;
+ }
}
if (ctl->verbose)
show_sched_info(ctl);
errno = 0;
- ctl->priority = strtos32_or_err(argv[optind], _("invalid priority argument"));
+
+ if (need_prio || argc - optind == 2)
+ ctl->priority = strtos32_or_err(argv[optind], _("invalid priority argument"));
+ else
+ ctl->priority = 0;
if (ctl->runtime && !supports_runtime_param(ctl->policy))
errx(EXIT_FAILURE, _("--sched-runtime option is supported for %s"),
--
2.49.0
^ permalink raw reply related
* [PATCH v4 2/3] chrt: Only display current settings when no policy is specified
From: Madadi Vineeth Reddy @ 2025-06-21 19:50 UTC (permalink / raw)
To: util-linux, Karel Zak, Benno Schulenberg; +Cc: Madadi Vineeth Reddy
In-Reply-To: <20250621195048.24900-1-vineethr@linux.ibm.com>
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 | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index 8fe748f43..d694845ac 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -64,7 +64,7 @@ static void __attribute__((__noreturn__)) usage(void)
" chrt [options] --pid <priority> <pid>\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(_("Get policy:\n"
- " chrt [options] --pid <pid>\n"), out);
+ " chrt --pid <pid>\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(_("Policy options:\n"), out);
@@ -399,6 +399,7 @@ int main(int argc, char **argv)
{
struct chrt_ctl _ctl = { .pid = -1, .policy = SCHED_RR }, *ctl = &_ctl;
int c;
+ bool policy_given = false;
static const struct option longopts[] = {
{ "all-tasks", no_argument, NULL, 'a' },
@@ -435,21 +436,25 @@ int main(int argc, char **argv)
case 'b':
#ifdef SCHED_BATCH
ctl->policy = SCHED_BATCH;
+ policy_given = true;
#endif
break;
case 'd':
#ifdef SCHED_DEADLINE
ctl->policy = SCHED_DEADLINE;
+ policy_given = true;
#endif
break;
case 'e':
#ifdef SCHED_EXT
ctl->policy = SCHED_EXT;
+ policy_given = true;
#endif
break;
case 'f':
ctl->policy = SCHED_FIFO;
+ policy_given = true;
break;
case 'R':
ctl->reset_on_fork = 1;
@@ -457,6 +462,7 @@ int main(int argc, char **argv)
case 'i':
#ifdef SCHED_IDLE
ctl->policy = SCHED_IDLE;
+ policy_given = true;
#endif
break;
case 'm':
@@ -464,6 +470,7 @@ int main(int argc, char **argv)
return EXIT_SUCCESS;
case 'o':
ctl->policy = SCHED_OTHER;
+ policy_given = true;
break;
case 'p':
errno = 0;
@@ -472,6 +479,7 @@ int main(int argc, char **argv)
break;
case 'r':
ctl->policy = SCHED_RR;
+ policy_given = true;
break;
case 'v':
ctl->verbose = 1;
@@ -501,12 +509,21 @@ int main(int argc, char **argv)
errtryhelp(EXIT_FAILURE);
}
- if ((ctl->pid > -1) && (ctl->verbose || argc - optind == 1)) {
+ /* pid exists but priority not given */
+ if (ctl->pid > -1 && argc - optind == 1) {
+ /* Error if a policy was specified but no priority given */
+ if (policy_given)
+ errx(EXIT_FAILURE, ("policy %s requires a priority argument"),
+ get_policy_name(ctl->policy));
+
+ /* If no policy specified, show current settings */
show_sched_info(ctl);
- if (argc - optind == 1)
- return EXIT_SUCCESS;
+ return EXIT_SUCCESS;
}
+ if (ctl->verbose)
+ show_sched_info(ctl);
+
errno = 0;
ctl->priority = strtos32_or_err(argv[optind], _("invalid priority argument"));
--
2.49.0
^ permalink raw reply related
* [PATCH v4 0/3] chrt: Improve argument handling and allow optional priority
From: Madadi Vineeth Reddy @ 2025-06-21 19:50 UTC (permalink / raw)
To: util-linux, Karel Zak, Benno Schulenberg; +Cc: Madadi Vineeth Reddy
This series improves the usability and correctness of the chrt tool:
- Minor cleanups such as indentation fixes and correcting comment.
- Fixes an issue where specifying a policy without a priority would
misleadingly print current settings
- Makes the priority argument optional for scheduling policies that
ignore it, simplifying usage for tuning parameters like --sched-runtime
Changes in v4:
- Rectified my mistake of not giving proper space in a comment in v3
Changes in v3:
- Made --pid consistent throughout (Karel Zak)
- Change get policy to not have policy options (Karel Zak and Benno Schulenberg)
Changes in v2:
- Updated the man page to reflect the optional priority behavior (Karel Zak)
- Renamed variable to 'need_prio' (Karel Zak)
Madadi Vineeth Reddy (3):
chrt: Make minor cleanups in chrt
chrt: Only display current settings when no policy is specified
chrt: Make priority optional for policies that don't use it
schedutils/chrt.1.adoc | 24 +++++++++++++----------
schedutils/chrt.c | 43 +++++++++++++++++++++++++++++++++---------
2 files changed, 48 insertions(+), 19 deletions(-)
--
2.49.0
^ permalink raw reply
* [PATCH v3 2/3] chrt: Only display current settings when no policy is specified
From: Madadi Vineeth Reddy @ 2025-06-21 19:19 UTC (permalink / raw)
To: util-linux, Karel Zak, Benno Schulenberg; +Cc: Madadi Vineeth Reddy
In-Reply-To: <20250621191956.21142-1-vineethr@linux.ibm.com>
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 | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index 8fe748f43..40a006040 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -64,7 +64,7 @@ static void __attribute__((__noreturn__)) usage(void)
" chrt [options] --pid <priority> <pid>\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(_("Get policy:\n"
- " chrt [options] --pid <pid>\n"), out);
+ " chrt --pid <pid>\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(_("Policy options:\n"), out);
@@ -399,6 +399,7 @@ int main(int argc, char **argv)
{
struct chrt_ctl _ctl = { .pid = -1, .policy = SCHED_RR }, *ctl = &_ctl;
int c;
+ bool policy_given = false;
static const struct option longopts[] = {
{ "all-tasks", no_argument, NULL, 'a' },
@@ -435,21 +436,25 @@ int main(int argc, char **argv)
case 'b':
#ifdef SCHED_BATCH
ctl->policy = SCHED_BATCH;
+ policy_given = true;
#endif
break;
case 'd':
#ifdef SCHED_DEADLINE
ctl->policy = SCHED_DEADLINE;
+ policy_given = true;
#endif
break;
case 'e':
#ifdef SCHED_EXT
ctl->policy = SCHED_EXT;
+ policy_given = true;
#endif
break;
case 'f':
ctl->policy = SCHED_FIFO;
+ policy_given = true;
break;
case 'R':
ctl->reset_on_fork = 1;
@@ -457,6 +462,7 @@ int main(int argc, char **argv)
case 'i':
#ifdef SCHED_IDLE
ctl->policy = SCHED_IDLE;
+ policy_given = true;
#endif
break;
case 'm':
@@ -464,6 +470,7 @@ int main(int argc, char **argv)
return EXIT_SUCCESS;
case 'o':
ctl->policy = SCHED_OTHER;
+ policy_given = true;
break;
case 'p':
errno = 0;
@@ -472,6 +479,7 @@ int main(int argc, char **argv)
break;
case 'r':
ctl->policy = SCHED_RR;
+ policy_given = true;
break;
case 'v':
ctl->verbose = 1;
@@ -501,12 +509,21 @@ int main(int argc, char **argv)
errtryhelp(EXIT_FAILURE);
}
- if ((ctl->pid > -1) && (ctl->verbose || argc - optind == 1)) {
+ /*pid exists but priority not given*/
+ if (ctl->pid > -1 && argc - optind == 1) {
+ /* Error if a policy was specified but no priority given */
+ if (policy_given)
+ errx(EXIT_FAILURE, ("policy %s requires a priority argument"),
+ get_policy_name(ctl->policy));
+
+ /* If no policy specified, show current settings */
show_sched_info(ctl);
- if (argc - optind == 1)
- return EXIT_SUCCESS;
+ return EXIT_SUCCESS;
}
+ if (ctl->verbose)
+ show_sched_info(ctl);
+
errno = 0;
ctl->priority = strtos32_or_err(argv[optind], _("invalid priority argument"));
--
2.49.0
^ permalink raw reply related
* Re: [PATCH v3 2/3] chrt: Only display current settings when no policy is specified
From: Madadi Vineeth Reddy @ 2025-06-21 19:27 UTC (permalink / raw)
To: util-linux, Karel Zak, Benno Schulenberg
In-Reply-To: <20250621191956.21142-3-vineethr@linux.ibm.com>
On 22/06/25 00:49, Madadi Vineeth Reddy wrote:
> 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 | 25 +++++++++++++++++++++----
> 1 file changed, 21 insertions(+), 4 deletions(-)
>
> diff --git a/schedutils/chrt.c b/schedutils/chrt.c
> index 8fe748f43..40a006040 100644
> --- a/schedutils/chrt.c
> +++ b/schedutils/chrt.c
> @@ -64,7 +64,7 @@ static void __attribute__((__noreturn__)) usage(void)
> " chrt [options] --pid <priority> <pid>\n"), out);
> fputs(USAGE_SEPARATOR, out);
> fputs(_("Get policy:\n"
> - " chrt [options] --pid <pid>\n"), out);
> + " chrt --pid <pid>\n"), out);
>
> fputs(USAGE_SEPARATOR, out);
> fputs(_("Policy options:\n"), out);
> @@ -399,6 +399,7 @@ int main(int argc, char **argv)
> {
> struct chrt_ctl _ctl = { .pid = -1, .policy = SCHED_RR }, *ctl = &_ctl;
> int c;
> + bool policy_given = false;
>
> static const struct option longopts[] = {
> { "all-tasks", no_argument, NULL, 'a' },
> @@ -435,21 +436,25 @@ int main(int argc, char **argv)
> case 'b':
> #ifdef SCHED_BATCH
> ctl->policy = SCHED_BATCH;
> + policy_given = true;
> #endif
> break;
>
> case 'd':
> #ifdef SCHED_DEADLINE
> ctl->policy = SCHED_DEADLINE;
> + policy_given = true;
> #endif
> break;
> case 'e':
> #ifdef SCHED_EXT
> ctl->policy = SCHED_EXT;
> + policy_given = true;
> #endif
> break;
> case 'f':
> ctl->policy = SCHED_FIFO;
> + policy_given = true;
> break;
> case 'R':
> ctl->reset_on_fork = 1;
> @@ -457,6 +462,7 @@ int main(int argc, char **argv)
> case 'i':
> #ifdef SCHED_IDLE
> ctl->policy = SCHED_IDLE;
> + policy_given = true;
> #endif
> break;
> case 'm':
> @@ -464,6 +470,7 @@ int main(int argc, char **argv)
> return EXIT_SUCCESS;
> case 'o':
> ctl->policy = SCHED_OTHER;
> + policy_given = true;
> break;
> case 'p':
> errno = 0;
> @@ -472,6 +479,7 @@ int main(int argc, char **argv)
> break;
> case 'r':
> ctl->policy = SCHED_RR;
> + policy_given = true;
> break;
> case 'v':
> ctl->verbose = 1;
> @@ -501,12 +509,21 @@ int main(int argc, char **argv)
> errtryhelp(EXIT_FAILURE);
> }
>
> - if ((ctl->pid > -1) && (ctl->verbose || argc - optind == 1)) {
> + /*pid exists but priority not given*/
Missed spacing in the comment. Ignore this v3. Please refer to v4.
> + if (ctl->pid > -1 && argc - optind == 1) {
> + /* Error if a policy was specified but no priority given */
> + if (policy_given)
> + errx(EXIT_FAILURE, ("policy %s requires a priority argument"),
> + get_policy_name(ctl->policy));
> +
> + /* If no policy specified, show current settings */
> show_sched_info(ctl);
> - if (argc - optind == 1)
> - return EXIT_SUCCESS;
> + return EXIT_SUCCESS;
> }
>
> + if (ctl->verbose)
> + show_sched_info(ctl);
> +
> errno = 0;
> ctl->priority = strtos32_or_err(argv[optind], _("invalid priority argument"));
>
^ permalink raw reply
* [PATCH v3 3/3] chrt: Make priority optional for policies that don't use it
From: Madadi Vineeth Reddy @ 2025-06-21 19:19 UTC (permalink / raw)
To: util-linux, Karel Zak, Benno Schulenberg; +Cc: Madadi Vineeth Reddy
In-Reply-To: <20250621191956.21142-1-vineethr@linux.ibm.com>
Currently, chrt requires a priority argument even for scheduling
policies like SCHED_OTHER and SCHED_BATCH, which ignore it.
This change relaxes that requirement. Now, priority is only expected
for SCHED_FIFO and SCHED_RR. For other policies, a default value of 0
is set internally and no argument is required on the command line.
This simplifies usage when modifying runtime parameters like
--sched-runtime for non-realtime tasks.
For example, to change the EEVDF tunable base_slice, one currently
needs to run:
chrt -o -T 1000000 --pid 0 $PID
Passing '0' after --pid is not intutive and not required as priority
is not applicable to SCHED_OTHER tasks. Now with this patch, one can do:
chrt -o -T 1000000 --pid $PID
Passing '0' still works ensuring ABI doesn't break.
Signed-off-by: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
---
schedutils/chrt.1.adoc | 14 +++++++++-----
schedutils/chrt.c | 24 ++++++++++++++++--------
2 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/schedutils/chrt.1.adoc b/schedutils/chrt.1.adoc
index 36cdcc5fe..5b8d7e832 100644
--- a/schedutils/chrt.1.adoc
+++ b/schedutils/chrt.1.adoc
@@ -49,7 +49,7 @@ chrt - manipulate the real-time attributes of a process
== POLICIES
*-o*, *--other*::
-Set scheduling policy to *SCHED_OTHER* (time-sharing scheduling). This is the default Linux scheduling policy.
+Set scheduling policy to *SCHED_OTHER* (time-sharing scheduling). This is the default Linux scheduling policy. Since util-linux v2.42, the priority argument is optional; if specified, it must be set to zero.
*-f*, *--fifo*::
Set scheduling policy to *SCHED_FIFO* (first in-first out).
@@ -58,16 +58,16 @@ Set scheduling policy to *SCHED_FIFO* (first in-first out).
Set scheduling policy to *SCHED_RR* (round-robin scheduling). When no policy is defined, the *SCHED_RR* is used as the default.
*-b*, *--batch*::
-Set scheduling policy to *SCHED_BATCH* (scheduling batch processes). Linux-specific, supported since 2.6.16. The priority argument has to be set to zero.
+Set scheduling policy to *SCHED_BATCH* (scheduling batch processes). Linux-specific, supported since 2.6.16. Since util-linux v2.42, the priority argument is optional; if specified, it must be set to zero.
*-i*, *--idle*::
-Set scheduling policy to *SCHED_IDLE* (scheduling very low priority jobs). Linux-specific, supported since 2.6.23. The priority argument has to be set to zero.
+Set scheduling policy to *SCHED_IDLE* (scheduling very low priority jobs). Linux-specific, supported since 2.6.23. Since util-linux v2.42, the priority argument is optional; if specified, it must be set to zero.
*-d*, *--deadline*::
-Set scheduling policy to *SCHED_DEADLINE* (sporadic task model deadline scheduling). Linux-specific, supported since 3.14. The priority argument has to be set to zero. See also *--sched-runtime*, *--sched-deadline* and *--sched-period*. The relation between the options required by the kernel is runtime <= deadline <= period. *chrt* copies _period_ to _deadline_ if *--sched-deadline* is not specified and _deadline_ to _runtime_ if *--sched-runtime* is not specified. It means that at least *--sched-period* has to be specified. See *sched*(7) for more details.
+Set scheduling policy to *SCHED_DEADLINE* (sporadic task model deadline scheduling). Linux-specific, supported since 3.14. Since util-linux v2.42, the priority argument is optional; if specified, it must be set to zero. See also *--sched-runtime*, *--sched-deadline* and *--sched-period*. The relation between the options required by the kernel is runtime <= deadline <= period. *chrt* copies _period_ to _deadline_ if *--sched-deadline* is not specified and _deadline_ to _runtime_ if *--sched-runtime* is not specified. It means that at least *--sched-period* has to be specified. See *sched*(7) for more details.
*-d*, *--ext*::
-Set scheduling policy to *SCHED_EXT* (BPF program-defined scheduling). Linux-specific, supported since 6.12. The priority argument has to be set to zero.
+Set scheduling policy to *SCHED_EXT* (BPF program-defined scheduling). Linux-specific, supported since 6.12. Since util-linux v2.42, the priority argument is optional; if specified, it must be set to zero.
== SCHEDULING OPTIONS
@@ -132,6 +132,10 @@ Reset priorities to default for a process{colon}::
____
*chrt -o --pid 0* _PID_
____
+Set a custom slice of 1 ms for a SCHED_OTHER task (priority is optional for policies other than SCHED_FIFO and SCHED_RR){colon}::
+____
+*chrt -o -T 1000000 --pid* _PID_
+____
See *sched*(7) for a detailed discussion of the different scheduler classes and how they interact.
== PERMISSIONS
diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index 40a006040..04582ae72 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -399,7 +399,7 @@ int main(int argc, char **argv)
{
struct chrt_ctl _ctl = { .pid = -1, .policy = SCHED_RR }, *ctl = &_ctl;
int c;
- bool policy_given = false;
+ bool policy_given = false, need_prio = false;
static const struct option longopts[] = {
{ "all-tasks", no_argument, NULL, 'a' },
@@ -455,6 +455,7 @@ int main(int argc, char **argv)
case 'f':
ctl->policy = SCHED_FIFO;
policy_given = true;
+ need_prio = true;
break;
case 'R':
ctl->reset_on_fork = 1;
@@ -480,6 +481,7 @@ int main(int argc, char **argv)
case 'r':
ctl->policy = SCHED_RR;
policy_given = true;
+ need_prio = true;
break;
case 'v':
ctl->verbose = 1;
@@ -503,29 +505,35 @@ int main(int argc, char **argv)
}
}
- if (((ctl->pid > -1) && argc - optind < 1) ||
- ((ctl->pid == -1) && argc - optind < 2)) {
+ if (((ctl->pid > -1) && argc - optind < (need_prio ? 1 : 0)) ||
+ ((ctl->pid == -1) && argc - optind < (need_prio ? 2 : 1))) {
warnx(_("bad usage"));
errtryhelp(EXIT_FAILURE);
}
/*pid exists but priority not given*/
if (ctl->pid > -1 && argc - optind == 1) {
- /* Error if a policy was specified but no priority given */
- if (policy_given)
+ /* Error if priority is missing for a policy that requires it */
+ if (policy_given && need_prio)
errx(EXIT_FAILURE, ("policy %s requires a priority argument"),
get_policy_name(ctl->policy));
/* If no policy specified, show current settings */
- show_sched_info(ctl);
- return EXIT_SUCCESS;
+ if (!policy_given) {
+ show_sched_info(ctl);
+ return EXIT_SUCCESS;
+ }
}
if (ctl->verbose)
show_sched_info(ctl);
errno = 0;
- ctl->priority = strtos32_or_err(argv[optind], _("invalid priority argument"));
+
+ if (need_prio || argc - optind == 2)
+ ctl->priority = strtos32_or_err(argv[optind], _("invalid priority argument"));
+ else
+ ctl->priority = 0;
if (ctl->runtime && !supports_runtime_param(ctl->policy))
errx(EXIT_FAILURE, _("--sched-runtime option is supported for %s"),
--
2.49.0
^ permalink raw reply related
* [PATCH v3 1/3] chrt: Make minor cleanups in chrt
From: Madadi Vineeth Reddy @ 2025-06-21 19:19 UTC (permalink / raw)
To: util-linux, Karel Zak, Benno Schulenberg; +Cc: Madadi Vineeth Reddy
In-Reply-To: <20250621191956.21142-1-vineethr@linux.ibm.com>
Minor changes such as fixing an incorrect comment and aligning
the closing brace of an if condition in main() were made, along
with making the usage of --pid consistent across files instead
of -p, although -p still works, for better readability.
No functional change is intended.
Signed-off-by: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
---
schedutils/chrt.1.adoc | 10 +++++-----
schedutils/chrt.c | 6 +++---
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/schedutils/chrt.1.adoc b/schedutils/chrt.1.adoc
index 77add535d..36cdcc5fe 100644
--- a/schedutils/chrt.1.adoc
+++ b/schedutils/chrt.1.adoc
@@ -40,7 +40,7 @@ chrt - manipulate the real-time attributes of a process
*chrt* [options] _priority command argument_ ...
-*chrt* [options] *-p* [_priority_] _PID_
+*chrt* [options] *--pid* [_priority_] _PID_
== DESCRIPTION
@@ -117,20 +117,20 @@ ____
//TRANSLATORS: Keep {colon} untranslated
You can also retrieve the real-time attributes of an existing task{colon}::
____
-*chrt -p* _PID_
+*chrt --pid* _PID_
____
//TRANSLATORS: Keep {colon} untranslated
Or set them{colon}::
____
-*chrt -r -p* _priority PID_
+*chrt -r --pid* _priority PID_
____
This, for example, sets real-time scheduling to priority _30_ for the process _PID_ with the *SCHED_RR* (round-robin) class{colon}::
____
-*chrt -r -p 30* _PID_
+*chrt -r --pid 30* _PID_
____
Reset priorities to default for a process{colon}::
____
-*chrt -o -p 0* _PID_
+*chrt -o --pid 0* _PID_
____
See *sched*(7) for a detailed discussion of the different scheduler classes and how they interact.
diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index cf99935dc..8fe748f43 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -64,7 +64,7 @@ static void __attribute__((__noreturn__)) usage(void)
" chrt [options] --pid <priority> <pid>\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(_("Get policy:\n"
- " chrt [options] -p <pid>\n"), out);
+ " chrt [options] --pid <pid>\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(_("Policy options:\n"), out);
@@ -341,7 +341,7 @@ static int set_sched_one(struct chrt_ctl *ctl, pid_t pid)
return set_sched_one_by_setscheduler(ctl, pid);
}
-#else /* !HAVE_SCHED_SETATTR */
+#else /* HAVE_SCHED_SETATTR */
static int set_sched_one(struct chrt_ctl *ctl, pid_t pid)
{
struct sched_attr sa = { .size = sizeof(struct sched_attr) };
@@ -499,7 +499,7 @@ int main(int argc, char **argv)
((ctl->pid == -1) && argc - optind < 2)) {
warnx(_("bad usage"));
errtryhelp(EXIT_FAILURE);
-}
+ }
if ((ctl->pid > -1) && (ctl->verbose || argc - optind == 1)) {
show_sched_info(ctl);
--
2.49.0
^ permalink raw reply related
* [PATCH v3 0/3] chrt: Improve argument handling and allow optional priority
From: Madadi Vineeth Reddy @ 2025-06-21 19:19 UTC (permalink / raw)
To: util-linux, Karel Zak, Benno Schulenberg; +Cc: Madadi Vineeth Reddy
This series improves the usability and correctness of the chrt tool:
- Minor cleanups such as indentation fixes and correcting comment.
- Fixes an issue where specifying a policy without a priority would
misleadingly print current settings
- Makes the priority argument optional for scheduling policies that
ignore it, simplifying usage for tuning parameters like --sched-runtime
Changes in v3:
- Made --pid consistent throughout (Karel Zak)
- Change get policy to not have policy options (Karel Zak and Benno Schulenberg)
Changes in v2:
- Updated the man page to reflect the optional priority behavior (Karel Zak)
- Renamed variable to 'need_prio' (Karel Zak)
Madadi Vineeth Reddy (3):
chrt: Make minor cleanups in chrt
chrt: Only display current settings when no policy is specified
chrt: Make priority optional for policies that don't use it
schedutils/chrt.1.adoc | 24 +++++++++++++----------
schedutils/chrt.c | 43 +++++++++++++++++++++++++++++++++---------
2 files changed, 48 insertions(+), 19 deletions(-)
--
2.49.0
^ permalink raw reply
* High-speed email sending software ..
From: Email Marketing software . @ 2025-06-20 14:49 UTC (permalink / raw)
To: Email Marketing software .
Cc: unthebronbaptistchurch, contact, admin, lilyngan, pankaj10,
jmcouture, principal, util-linux, info, librarian, wines, Chibudu,
buchhaltung, watag, info, ncialIndependence.Team, charles,
L.Pardo-Fernandez, draoyonsengupta, e.doelzlmueller
[-- Attachment #1.1: Type: text/plain, Size: 467 bytes --]
✔. Thousands to hundreds of thousands of emails sent per day.
✔. The only software on the market that uses Web mode + Http protocol to
send mail. It completely simulates the manual login and sending of Chrome
browser.
✔. One-click start, Http protocol,Fully Automated, High-speed, Bulk,
Multi-threaded,Built-in Proxies.
✔. Free full-featured trial for 3 days.
DEMO: youtu.be/vGpfyP18VLA
TG: wowofrom2008
*uniform promising.*
[-- Attachment #1.2: Type: text/html, Size: 3371 bytes --]
^ permalink raw reply
* Re: [PATCH v2] chrt: Make priority optional for policies that don't use it
From: Madadi Vineeth Reddy @ 2025-06-20 5:33 UTC (permalink / raw)
To: Benno Schulenberg, Karel Zak; +Cc: util-linux, Madadi Vineeth Reddy
In-Reply-To: <41499ee7-7d8f-4143-b560-1b02f2d1f00c@telfort.nl>
On 19/06/25 19:45, Benno Schulenberg wrote:
>
> Op 18-06-2025 om 18:41 schreef Madadi Vineeth Reddy:
>> So, my thought is just to make priority argument optional for
>> policies that don't use it and keep the existing behavior as is.
>
> That's not possible. Currently, doing something like
>
> ./chrt --idle --pid $$
>
> just reports the current policy and priority, and does
> not change the policy (because the priority is missing).
> After your patch, doing the same command reports nothing
> but _does_ change the policy. You could still make it
> report the current settings, but that would give the
> wrong idea, because it would be the _old_ settings.
>
> So, as Karel said, silently ignoring the policy option
> when no priority was given was ugly. Too ugly to keep
> it that way. As Karel implied: break compatibility and
> do the sensible thing: whenever a policy option is given,
> act upon it -- and when a needed priority is missing,
> error out.
>
Sure, that makes sense. I will send a patch with these
changes accordingly.
Thanks,
Madadi Vineeth Reddy
>
> Benno
>
^ permalink raw reply
* Re: [PATCH v2] chrt: Make priority optional for policies that don't use it
From: Benno Schulenberg @ 2025-06-19 14:15 UTC (permalink / raw)
To: Madadi Vineeth Reddy, Karel Zak; +Cc: util-linux
In-Reply-To: <d3cfa396-a89f-4ff0-8424-318ed0b3c2be@linux.ibm.com>
[-- Attachment #1.1: Type: text/plain, Size: 922 bytes --]
Op 18-06-2025 om 18:41 schreef Madadi Vineeth Reddy:
> So, my thought is just to make priority argument optional for
> policies that don't use it and keep the existing behavior as is.
That's not possible. Currently, doing something like
./chrt --idle --pid $$
just reports the current policy and priority, and does
not change the policy (because the priority is missing).
After your patch, doing the same command reports nothing
but _does_ change the policy. You could still make it
report the current settings, but that would give the
wrong idea, because it would be the _old_ settings.
So, as Karel said, silently ignoring the policy option
when no priority was given was ugly. Too ugly to keep
it that way. As Karel implied: break compatibility and
do the sensible thing: whenever a policy option is given,
act upon it -- and when a needed priority is missing,
error out.
Benno
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
^ permalink raw reply
* v2.41.1 plan
From: Karel Zak @ 2025-06-19 8:39 UTC (permalink / raw)
To: util-linux
Hi all,
I'd like to release the stable update v2.41.1 ASAP (tomorrow?). The current
log for the stable/v2.41 branch is below.
Do you need anything else in the release?
Karel
autotools:
- don't use wide-character ncurses if --disable-widechar (by Karel Zak)
cfdisk:
- fix memory leak and possible NULL dereference [gcc-analyzer] (by Karel Zak)
column:
- fix compiler warning for non-widechar compilation (by Karel Zak)
fdformat:
- use size_t and ssize_t (by Karel Zak)
fdisk:
- fix possible memory leak (by Karel Zak)
fdisk,partx:
- avoid strcasecmp() for ASCII-only strings (by Karel Zak)
findmnt:
- fix -k option parsing regression (by Karel Zak)
hardlink:
- define more function as inline (by Karel Zak)
- fix performance regression (inefficient signal evaluation) (by Karel Zak)
- Use macro for verbose output (by Karel Zak)
include/cctype:
- fix string comparison (by Karel Zak)
include/mount-api-utils:
- include linux/unistd.h (by Thomas Weißschuh)
libblkid:
- Fix crash while parsing config with libeconf (by Stanislav Brabec)
- befs fix underflow (by Milan Broz)
- avoid strcasecmp() for ASCII-only strings (by Karel Zak)
libblkid/src/topology/dm:
- fix fscanf return value check to match expected number of parsed items (by Mingjie Shen)
libfdisk:
- avoid strcasecmp() for ASCII-only strings (by Karel Zak)
libmount:
- (subdir) restrict for real mounts only (by Karel Zak)
- (subdir) remove unused code (by Karel Zak)
- avoid calling memset() unnecessarily (by Karel Zak)
- avoid strcasecmp() for ASCII-only strings (by Karel Zak)
- fix --no-canonicalize regression (by Karel Zak)
libuuid:
- fix uuid_time on macOS without attribute((alias)) (by Eugene Gershnik)
lsblk:
- use ID_PART_ENTRY_SCHEME as fallback for PTTYPE (by Karel Zak)
- avoid strcasecmp() for ASCII-only strings (by Karel Zak)
lscpu:
- fix possible buffer overflow in cpuinfo parser (by Karel Zak)
- Fix loongarch op-mode output with recent kernel (by Xi Ruoyao)
lsfd:
- (bug fix) scan the protocol field of /proc/net/packet as a hex number (by Masatake YAMATO)
- fix the description for PACKET.PROTOCOL column (by Masatake YAMATO)
lsns:
- enhance compilation without USE_NS_GET_API (by Karel Zak)
- fix undefined reference to add_namespace_for_nsfd #3483 (by Thomas Devoogdt)
meson:
- add feature for translated documentation (by Thomas Weißschuh)
- remove tinfo dependency from 'more' (by Thomas Weißschuh)
- fix manadocs for libsmartcols and libblkid (by Karel Zak)
- fix po-man installation (by Karel Zak)
misc:
- never include wchar.h (by Karel Zak)
more:
- fix broken ':!command' command key (by cgoesche)
- fix implicit previous shell_line execution #3508 (by cgoesche)
mount:
- (man) add missing word (by Jakub Wilk)
namespace.h:
- fix compilation on Linux < 4.10 (by Thomas Devoogdt)
tests:
- (test_mkfds::mapped-packet-socket) add a new parameter, protocol (by Masatake YAMATO)
treewide:
- add ul_ to parse_timestamp() function name (by Karel Zak)
- add ul_ to parse_switch() function name (by Stanislav Brabec)
- add ul_ to parse_size() function name (by Karel Zak)
- add ul_ to parse_range() function name (by Karel Zak)
- fix optional arguments usage (by Karel Zak)
- avoid strcasecmp() for ASCII-only strings (by Karel Zak)
Wipefs:
- improve --all descriptions for whole-disks (by Karel Zak)
Misc:
- Do not call exit() on code ending in shared libraries (by Cristian Rodríguez)
- remove two leftover license lines from colors.{c,h} (by Benno Schulenberg)
- remove "Copyright (C) ...." notes from files that claim no copyright (by Benno Schulenberg)
- correct the full name of the GPL in various files (by Benno Schulenberg)
- Make scols_column_set_data_func docs visible (by FeRD (Frank Dana))
- Do not use strerror on shared libraries (by Cristian Rodríguez)
- Fix typo in blkdiscard docs (by pls-no-hack)
- lib/fileeq.c Fix a typo in message. (by Masanari Iida)
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* Re: [PATCH v2] chrt: Make priority optional for policies that don't use it
From: Madadi Vineeth Reddy @ 2025-06-18 16:41 UTC (permalink / raw)
To: Benno Schulenberg, Karel Zak; +Cc: util-linux, Madadi Vineeth Reddy
In-Reply-To: <8197c011-67ff-4c84-b46a-304faa6678d6@telfort.nl>
On 18/06/25 17:59, Benno Schulenberg wrote:
>
> Op 18-06-2025 om 11:51 schreef Madadi Vineeth Reddy:
>> On 18/06/25 14:48, Karel Zak wrote:
>>> On Wed, Jun 18, 2025 at 10:18:29AM +0200, Benno Schulenberg
>>> wrote:
>>>>
>>>> Get policy: chrt [options] -p <pid>
>>>
>>> I really don't like the use of "-p." We should use "--pid"
>>> everywhere (in --help, man page, and examples).
>>
>> I can spin off a separate patch to consistently use --pid instead
>> of -p in the help text, man page, and examples.
>
> It should also drop the "[options]" part from the above:
Agreed.
>
> Get policy: chrt --pid <pid>
>
> As Karel says, specifying an option like --other or --fifo should
> always be understood as a modification request, not as an info
> request.
Yes, my only concern is ABI shouldn't break for existing users
who might be giving options and retrieving current settings.
So, my thought is just to make priority argument optional for
policies that don't use it and keep the existing behavior as is.
I can post another patch after this discussion that removes
"[options]" for querying current settings and the issues due
to changing existing behavior could be discussed there.
Thoughts?
Thanks,
Madadi Vineeth Reddy
>
>
> Benno
>
^ permalink raw reply
* Re: [PATCH v2] chrt: Make priority optional for policies that don't use it
From: Madadi Vineeth Reddy @ 2025-06-18 16:33 UTC (permalink / raw)
To: Karel Zak; +Cc: Benno Schulenberg, util-linux, Madadi Vineeth Reddy
In-Reply-To: <26rikpg7jp5ygfqog6yqixtzzgq5xbf2dhtmwi4qzcviduspnv@klu34u35cnrv>
On 18/06/25 16:15, Karel Zak wrote:
> On Wed, Jun 18, 2025 at 03:04:40PM +0530, Madadi Vineeth Reddy wrote:
>> Hi Benno, Karel
>>
>> On 18/06/25 14:55, Karel Zak wrote:
>>> On Wed, Jun 18, 2025 at 11:18:18AM +0200, Karel Zak wrote:
>>>> On Wed, Jun 18, 2025 at 10:18:29AM +0200, Benno Schulenberg wrote:
>>>>>
>>>>> Op 17-06-2025 om 20:24 schreef Madadi Vineeth Reddy:
>>>>>> Currently, chrt requires a priority argument even for scheduling
>>>>>> policies like SCHED_OTHER and SCHED_BATCH, which ignore it.
>>>>>>
>>>>>> This change relaxes that requirement. Now, priority is only expected
>>>>>> for SCHED_FIFO and SCHED_RR. For other policies, a default value of 0
>>>>>> is set internally and no argument is required on the command line.
>>>>>
>>>>> Doesn't this alter the "show-the-current-policy-and-priority" behavior
>>>>> when no priority is given? Currently `./chrt --help` says (trimmed):
>>>>
>>>> Very good point. The priority policy (--{other,...}) should be
>>>> required to ensure that the user wants to alter the setting rather
>>>> than print the current situation. Madadi, what do you think?
>>>
>>> Ah, I now read Benno's note more carefully. The code just silently ignores
>>> policy when priority is not specified.
>>>
>>> $ chrt --fifo --pid $$
>>> pid 994013's current scheduling policy: SCHED_OTHER
>>> pid 994013's current scheduling priority: 0
>>>
>>> This is ugly. The question is how important it is to support this for
>>> backward compatibility. I'd assume that users use "chrt --pid $$" to get
>>> the current setting.
>>>
>>
>> chrt --pid 20570
>> pid 20570's current scheduling policy: SCHED_OTHER
>> pid 20570's current scheduling priority: 0
>> pid 20570's current runtime parameter: 2800000
>>
>> After this patch also, we still get the current setting. Can you give it
>> a try with the patch applied? Let me know if I am missing something.
>
> Sorry for the mess. I have finally tried it (sorry for doing it the first time).
>
> Benno's note is that "chrt --other --pid $$" changed behavior. The old version
> always just read the current setting if no priority was specified, and now it
> alters scheduling and prints nothing. I guess this is the expected behavior now.
>
> I have found that the old version silently ignores the policy option if
> priority is not provided, and it always just displays the current setting. This
> is ugly, and with your change, it's more ugly :), because it depends on the
> specified policy.
>
> chrt --pid $$ # display current setting
>
> chrt --other --pid $$ # alter current setting
> chrt --fifo --pid $$ # display current setting (--fifo ignored)
> chrt --fifo --pid 10 $$ # alter current setting
>
> I think with --{other,fifo,...} the command line should always be interpreted
> as a request to alter the current setting, independently of whether priority is
> specified.
>
> chrt --fifo --pid $$
>
> needs to end with the error message "chrt: priority value for the policy
> required" rather than display the current setting.
Agreed. So, IIUC, when using SCHED_FIFO or SCHED_RR, the priority should be
mandatory, and omitting it should result in an error. To simply print the
current settings, no scheduling policy should be specified, meaning
chrt --pid $$ should be the correct way to query the settings.
However, wouldn't this break existing behavior for users who may already be
using a command like chrt --other --pid $$ to display current settings?
As a first step, would it make sense to Keep the current behavior for
querying unchanged and just make priority optional for policies that
don't use it?
Maybe altering the existing behavior can be handled in a separate patch
with its own discussion.
What do you suggest?
Thanks,
Madadi Vineeth Reddy
>
> Karel
>
^ permalink raw reply
* Re: [PATCH v2] chrt: Make priority optional for policies that don't use it
From: Benno Schulenberg @ 2025-06-18 12:29 UTC (permalink / raw)
To: Madadi Vineeth Reddy, Karel Zak; +Cc: util-linux
In-Reply-To: <bbd6aabd-707d-4fee-b80c-36749cf7c531@linux.ibm.com>
[-- Attachment #1.1: Type: text/plain, Size: 728 bytes --]
Op 18-06-2025 om 11:51 schreef Madadi Vineeth Reddy:
> On 18/06/25 14:48, Karel Zak wrote:
>> On Wed, Jun 18, 2025 at 10:18:29AM +0200, Benno Schulenberg wrote:
>>>
>>> Get policy:
>>> chrt [options] -p <pid>
>>
>> I really don't like the use of "-p." We should use "--pid" everywhere
>> (in --help, man page, and examples).
>
> I can spin off a separate patch to consistently use --pid instead of -p
> in the help text, man page, and examples.
It should also drop the "[options]" part from the above:
Get policy:
chrt --pid <pid>
As Karel says, specifying an option like --other or --fifo
should always be understood as a modification request, not
as an info request.
Benno
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
^ permalink raw reply
* Re: [PATCH v2] chrt: Make priority optional for policies that don't use it
From: Karel Zak @ 2025-06-18 10:45 UTC (permalink / raw)
To: Madadi Vineeth Reddy; +Cc: Benno Schulenberg, util-linux
In-Reply-To: <d9d6af55-e2c2-4ff9-95e6-84d5a6f76b0a@linux.ibm.com>
On Wed, Jun 18, 2025 at 03:04:40PM +0530, Madadi Vineeth Reddy wrote:
> Hi Benno, Karel
>
> On 18/06/25 14:55, Karel Zak wrote:
> > On Wed, Jun 18, 2025 at 11:18:18AM +0200, Karel Zak wrote:
> >> On Wed, Jun 18, 2025 at 10:18:29AM +0200, Benno Schulenberg wrote:
> >>>
> >>> Op 17-06-2025 om 20:24 schreef Madadi Vineeth Reddy:
> >>>> Currently, chrt requires a priority argument even for scheduling
> >>>> policies like SCHED_OTHER and SCHED_BATCH, which ignore it.
> >>>>
> >>>> This change relaxes that requirement. Now, priority is only expected
> >>>> for SCHED_FIFO and SCHED_RR. For other policies, a default value of 0
> >>>> is set internally and no argument is required on the command line.
> >>>
> >>> Doesn't this alter the "show-the-current-policy-and-priority" behavior
> >>> when no priority is given? Currently `./chrt --help` says (trimmed):
> >>
> >> Very good point. The priority policy (--{other,...}) should be
> >> required to ensure that the user wants to alter the setting rather
> >> than print the current situation. Madadi, what do you think?
> >
> > Ah, I now read Benno's note more carefully. The code just silently ignores
> > policy when priority is not specified.
> >
> > $ chrt --fifo --pid $$
> > pid 994013's current scheduling policy: SCHED_OTHER
> > pid 994013's current scheduling priority: 0
> >
> > This is ugly. The question is how important it is to support this for
> > backward compatibility. I'd assume that users use "chrt --pid $$" to get
> > the current setting.
> >
>
> chrt --pid 20570
> pid 20570's current scheduling policy: SCHED_OTHER
> pid 20570's current scheduling priority: 0
> pid 20570's current runtime parameter: 2800000
>
> After this patch also, we still get the current setting. Can you give it
> a try with the patch applied? Let me know if I am missing something.
Sorry for the mess. I have finally tried it (sorry for doing it the first time).
Benno's note is that "chrt --other --pid $$" changed behavior. The old version
always just read the current setting if no priority was specified, and now it
alters scheduling and prints nothing. I guess this is the expected behavior now.
I have found that the old version silently ignores the policy option if
priority is not provided, and it always just displays the current setting. This
is ugly, and with your change, it's more ugly :), because it depends on the
specified policy.
chrt --pid $$ # display current setting
chrt --other --pid $$ # alter current setting
chrt --fifo --pid $$ # display current setting (--fifo ignored)
chrt --fifo --pid 10 $$ # alter current setting
I think with --{other,fifo,...} the command line should always be interpreted
as a request to alter the current setting, independently of whether priority is
specified.
chrt --fifo --pid $$
needs to end with the error message "chrt: priority value for the policy
required" rather than display the current setting.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* Re: [PATCH v2] chrt: Make priority optional for policies that don't use it
From: Madadi Vineeth Reddy @ 2025-06-18 10:23 UTC (permalink / raw)
To: Karel Zak, Benno Schulenberg; +Cc: util-linux, Madadi Vineeth Reddy
In-Reply-To: <d9d6af55-e2c2-4ff9-95e6-84d5a6f76b0a@linux.ibm.com>
On 18/06/25 15:04, Madadi Vineeth Reddy wrote:
> Hi Benno, Karel
>
> On 18/06/25 14:55, Karel Zak wrote:
>> On Wed, Jun 18, 2025 at 11:18:18AM +0200, Karel Zak wrote:
>>> On Wed, Jun 18, 2025 at 10:18:29AM +0200, Benno Schulenberg wrote:
>>>>
>>>> Op 17-06-2025 om 20:24 schreef Madadi Vineeth Reddy:
>>>>> Currently, chrt requires a priority argument even for scheduling
>>>>> policies like SCHED_OTHER and SCHED_BATCH, which ignore it.
>>>>>
>>>>> This change relaxes that requirement. Now, priority is only expected
>>>>> for SCHED_FIFO and SCHED_RR. For other policies, a default value of 0
>>>>> is set internally and no argument is required on the command line.
>>>>
>>>> Doesn't this alter the "show-the-current-policy-and-priority" behavior
>>>> when no priority is given? Currently `./chrt --help` says (trimmed):
>>>
>>> Very good point. The priority policy (--{other,...}) should be
>>> required to ensure that the user wants to alter the setting rather
>>> than print the current situation. Madadi, what do you think?
>>
>> Ah, I now read Benno's note more carefully. The code just silently ignores
>> policy when priority is not specified.
>>
>> $ chrt --fifo --pid $$
>> pid 994013's current scheduling policy: SCHED_OTHER
>> pid 994013's current scheduling priority: 0
>>
>> This is ugly. The question is how important it is to support this for
>> backward compatibility. I'd assume that users use "chrt --pid $$" to get
>> the current setting.
>>
>
> chrt --pid 20570
> pid 20570's current scheduling policy: SCHED_OTHER
> pid 20570's current scheduling priority: 0
> pid 20570's current runtime parameter: 2800000
>
> After this patch also, we still get the current setting. Can you give it
> a try with the patch applied? Let me know if I am missing something.
>
Ah, I found my mistake. With this patch, getting the current settings only
works for SCHED_FIFO and SCHED_RR, but not for the other policies, because
we don’t print them here:
+ if ((ctl->pid > -1) && (ctl->verbose || argc - optind == (need_prio ? 1 : 0))) {
show_sched_info(ctl);
The condition argc - optind == (need_prio ? 1 : 0) becomes true only for
SCHED_FIFO and SCHED_RR, which causes the info to be printed only for those.
I’ll send a new version with the fix.
Thanks,
Madadi Vineeth Reddy
> Thanks for taking a look.
>
> Thanks,
> Madadi Vineeth Reddy
>
>> Karel
>>
>
^ permalink raw reply
* Re: [PATCH v2] chrt: Make priority optional for policies that don't use it
From: Madadi Vineeth Reddy @ 2025-06-18 9:51 UTC (permalink / raw)
To: Karel Zak, Benno Schulenberg; +Cc: util-linux, Madadi Vineeth Reddy
In-Reply-To: <7nyugk5zfclbpqc2kpcotycgssj6jticujokevyo6ulw7japtl@pnqb6svtmxao>
On 18/06/25 14:48, Karel Zak wrote:
> On Wed, Jun 18, 2025 at 10:18:29AM +0200, Benno Schulenberg wrote:
>>
>> Op 17-06-2025 om 20:24 schreef Madadi Vineeth Reddy:
>>> Currently, chrt requires a priority argument even for scheduling
>>> policies like SCHED_OTHER and SCHED_BATCH, which ignore it.
>>>
>>> This change relaxes that requirement. Now, priority is only expected
>>> for SCHED_FIFO and SCHED_RR. For other policies, a default value of 0
>>> is set internally and no argument is required on the command line.
>>
>> Doesn't this alter the "show-the-current-policy-and-priority" behavior
>> when no priority is given? Currently `./chrt --help` says (trimmed):
>
> Very good point. The priority policy (--{other,...}) should be
> required to ensure that the user wants to alter the setting rather
> than print the current situation. Madadi, what do you think?
>
>> Set policy:
>> chrt [options] --pid <priority> <pid>
>>
>> Get policy:
>> chrt [options] -p <pid>
>
> I really don't like the use of "-p." We should use "--pid" everywhere
> (in --help, man page, and examples).
I can spin off a separate patch to consistently use --pid instead of -p
in the help text, man page, and examples.
Thanks,
Madadi Vineeth Reddy
>
>> Without the proposed change, running `chrt --other --pid $$` says:
>>
>> pid 1427's current scheduling policy: SCHED_OTHER
>> pid 1427's current scheduling priority: 0
>>
>> After the change, that same command outputs nothing. Maybe that is
>> fine, but it would require some adjustment of the docs.
>
> This is bug.
>
> Karel
>
^ permalink raw reply
* Re: [PATCH v2] chrt: Make priority optional for policies that don't use it
From: Madadi Vineeth Reddy @ 2025-06-18 9:34 UTC (permalink / raw)
To: Karel Zak, Benno Schulenberg; +Cc: util-linux
In-Reply-To: <7qx4y3d3fnfjt2bfbqs4vfat7qb2imerqoalzgeiv25ejeypzk@5mp6rya3s2v2>
Hi Benno, Karel
On 18/06/25 14:55, Karel Zak wrote:
> On Wed, Jun 18, 2025 at 11:18:18AM +0200, Karel Zak wrote:
>> On Wed, Jun 18, 2025 at 10:18:29AM +0200, Benno Schulenberg wrote:
>>>
>>> Op 17-06-2025 om 20:24 schreef Madadi Vineeth Reddy:
>>>> Currently, chrt requires a priority argument even for scheduling
>>>> policies like SCHED_OTHER and SCHED_BATCH, which ignore it.
>>>>
>>>> This change relaxes that requirement. Now, priority is only expected
>>>> for SCHED_FIFO and SCHED_RR. For other policies, a default value of 0
>>>> is set internally and no argument is required on the command line.
>>>
>>> Doesn't this alter the "show-the-current-policy-and-priority" behavior
>>> when no priority is given? Currently `./chrt --help` says (trimmed):
>>
>> Very good point. The priority policy (--{other,...}) should be
>> required to ensure that the user wants to alter the setting rather
>> than print the current situation. Madadi, what do you think?
>
> Ah, I now read Benno's note more carefully. The code just silently ignores
> policy when priority is not specified.
>
> $ chrt --fifo --pid $$
> pid 994013's current scheduling policy: SCHED_OTHER
> pid 994013's current scheduling priority: 0
>
> This is ugly. The question is how important it is to support this for
> backward compatibility. I'd assume that users use "chrt --pid $$" to get
> the current setting.
>
chrt --pid 20570
pid 20570's current scheduling policy: SCHED_OTHER
pid 20570's current scheduling priority: 0
pid 20570's current runtime parameter: 2800000
After this patch also, we still get the current setting. Can you give it
a try with the patch applied? Let me know if I am missing something.
Thanks for taking a look.
Thanks,
Madadi Vineeth Reddy
> Karel
>
^ permalink raw reply
* Re: [PATCH v2] chrt: Make priority optional for policies that don't use it
From: Karel Zak @ 2025-06-18 9:25 UTC (permalink / raw)
To: Benno Schulenberg; +Cc: Madadi Vineeth Reddy, util-linux
In-Reply-To: <7nyugk5zfclbpqc2kpcotycgssj6jticujokevyo6ulw7japtl@pnqb6svtmxao>
On Wed, Jun 18, 2025 at 11:18:18AM +0200, Karel Zak wrote:
> On Wed, Jun 18, 2025 at 10:18:29AM +0200, Benno Schulenberg wrote:
> >
> > Op 17-06-2025 om 20:24 schreef Madadi Vineeth Reddy:
> > > Currently, chrt requires a priority argument even for scheduling
> > > policies like SCHED_OTHER and SCHED_BATCH, which ignore it.
> > >
> > > This change relaxes that requirement. Now, priority is only expected
> > > for SCHED_FIFO and SCHED_RR. For other policies, a default value of 0
> > > is set internally and no argument is required on the command line.
> >
> > Doesn't this alter the "show-the-current-policy-and-priority" behavior
> > when no priority is given? Currently `./chrt --help` says (trimmed):
>
> Very good point. The priority policy (--{other,...}) should be
> required to ensure that the user wants to alter the setting rather
> than print the current situation. Madadi, what do you think?
Ah, I now read Benno's note more carefully. The code just silently ignores
policy when priority is not specified.
$ chrt --fifo --pid $$
pid 994013's current scheduling policy: SCHED_OTHER
pid 994013's current scheduling priority: 0
This is ugly. The question is how important it is to support this for
backward compatibility. I'd assume that users use "chrt --pid $$" to get
the current setting.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* Re: [PATCH v2] chrt: Make priority optional for policies that don't use it
From: Karel Zak @ 2025-06-18 9:18 UTC (permalink / raw)
To: Benno Schulenberg; +Cc: Madadi Vineeth Reddy, util-linux
In-Reply-To: <232025d8-cdb4-48a7-a7c9-7dc211f76173@telfort.nl>
On Wed, Jun 18, 2025 at 10:18:29AM +0200, Benno Schulenberg wrote:
>
> Op 17-06-2025 om 20:24 schreef Madadi Vineeth Reddy:
> > Currently, chrt requires a priority argument even for scheduling
> > policies like SCHED_OTHER and SCHED_BATCH, which ignore it.
> >
> > This change relaxes that requirement. Now, priority is only expected
> > for SCHED_FIFO and SCHED_RR. For other policies, a default value of 0
> > is set internally and no argument is required on the command line.
>
> Doesn't this alter the "show-the-current-policy-and-priority" behavior
> when no priority is given? Currently `./chrt --help` says (trimmed):
Very good point. The priority policy (--{other,...}) should be
required to ensure that the user wants to alter the setting rather
than print the current situation. Madadi, what do you think?
> Set policy:
> chrt [options] --pid <priority> <pid>
>
> Get policy:
> chrt [options] -p <pid>
I really don't like the use of "-p." We should use "--pid" everywhere
(in --help, man page, and examples).
> Without the proposed change, running `chrt --other --pid $$` says:
>
> pid 1427's current scheduling policy: SCHED_OTHER
> pid 1427's current scheduling priority: 0
>
> After the change, that same command outputs nothing. Maybe that is
> fine, but it would require some adjustment of the docs.
This is bug.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* Re: [PATCH v2] chrt: Make priority optional for policies that don't use it
From: Benno Schulenberg @ 2025-06-18 8:18 UTC (permalink / raw)
To: Madadi Vineeth Reddy, util-linux, Karel Zak
In-Reply-To: <20250617182403.47095-1-vineethr@linux.ibm.com>
[-- Attachment #1.1: Type: text/plain, Size: 974 bytes --]
Op 17-06-2025 om 20:24 schreef Madadi Vineeth Reddy:
> Currently, chrt requires a priority argument even for scheduling
> policies like SCHED_OTHER and SCHED_BATCH, which ignore it.
>
> This change relaxes that requirement. Now, priority is only expected
> for SCHED_FIFO and SCHED_RR. For other policies, a default value of 0
> is set internally and no argument is required on the command line.
Doesn't this alter the "show-the-current-policy-and-priority" behavior
when no priority is given? Currently `./chrt --help` says (trimmed):
Set policy:
chrt [options] --pid <priority> <pid>
Get policy:
chrt [options] -p <pid>
Without the proposed change, running `chrt --other --pid $$` says:
pid 1427's current scheduling policy: SCHED_OTHER
pid 1427's current scheduling priority: 0
After the change, that same command outputs nothing. Maybe that is
fine, but it would require some adjustment of the docs.
Benno
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox