* Re: [PATCH 2/2] lscpu-arm: Remove the "Ampere-1a" part.
From: Jeremy Linton @ 2025-07-14 20:48 UTC (permalink / raw)
To: Karel Zak, Paul Benoit; +Cc: util-linux
In-Reply-To: <crm5fcuper7bhu7iv7jbejf3rnowwo4tuwrjnutngta56dedgm@zajfg6nh2okx>
On 7/14/25 7:16 AM, Karel Zak wrote:
> On Fri, Jul 11, 2025 at 02:16:48PM -0700, Paul Benoit wrote:
>> Remove the "Ampere-1a" part. On newer Ampere Computing systems, the
>> system/model name will be obtained from /sys/bus/soc/devices/soc0/machine,
>> that is populated with the ARM SMC CC SOC_ID Name.
>
> If I understand correctly, there are old systems without
> /sys/.../soc0/machine, right? The change will remove Ampere-1a from
> the lscpu output. This sounds backward incompatible.
Thats a good point, but as I understand it, Ampere hasn't been happy
with the string that is there.
If its OK to break whatever scripts/etc might depend on it at the
moment, why not just update the string.
Then invert the check so that the /sys/bus entry is preferred?
^ permalink raw reply
* Re: [PATCH 2/2] lscpu-arm: Remove the "Ampere-1a" part.
From: Paul Benoit @ 2025-07-14 22:22 UTC (permalink / raw)
To: Jeremy Linton, Karel Zak; +Cc: util-linux
In-Reply-To: <fb54d607-dccc-419f-b92c-7bc8514213a6@arm.com>
On 7/14/2025 4:48 PM, Jeremy Linton wrote:
> On 7/14/25 7:16 AM, Karel Zak wrote:
>> On Fri, Jul 11, 2025 at 02:16:48PM -0700, Paul Benoit wrote:
>>> Remove the "Ampere-1a" part. On newer Ampere Computing systems, the
>>> system/model name will be obtained from /sys/bus/soc/devices/soc0/
>>> machine,
>>> that is populated with the ARM SMC CC SOC_ID Name.
>>
>> If I understand correctly, there are old systems without
>> /sys/.../soc0/machine, right? The change will remove Ampere-1a from
>> the lscpu output. This sounds backward incompatible.
>
> Thats a good point, but as I understand it, Ampere hasn't been happy
> with the string that is there.
>
Hi Jeremy and Karel,
While I haven't personally been part of those discussions, that's also
my understanding of the situation.
> If its OK to break whatever scripts/etc might depend on it at the
> moment, why not just update the string.
>
That's becoming even more tempting given the valid issues that you and
Karel have identified with my patch. Though, the nice thing about lscpu
picking up the Model name, from somewhere like
/sys/bus/soc/devices/soc0/, is that lscpu will be able to output the
model name of newly released processors without/before them needing to
be added to the lscpu part(s) table. That assumes a kernel where either
the ARM SMC CC SOC_ID (Name) handling code, or the support code for a
specific SOC, set the Model name from which /sys/bus/soc/devices/soc0/
gets set.
> Then invert the check so that the /sys/bus entry is preferred?
>
That's the way I had originally coded things, but I was concerned about
the change in behavior of having the /sys/bus/soc/devices/soc0/ value
override the established part(s) table names for non-Ampere processors.
^ permalink raw reply
* Re: chrt from git segfaults
From: Madadi Vineeth Reddy @ 2025-07-15 5:29 UTC (permalink / raw)
To: Karel Zak; +Cc: util-linux, Benno Schulenberg, Madadi Vineeth Reddy
In-Reply-To: <fgeg2ezfxn6ofip7huhofg6a6mmx2yqn37p2j32rfxn33mpgyu@c2ldx4q6zvzu>
Hi Karel,
On 14/07/25 17:02, Karel Zak wrote:
> On Thu, Jul 10, 2025 at 10:11:58AM +0200, Benno Schulenberg wrote:
>>
>> Op 09-07-2025 om 20:45 schreef Madadi Vineeth Reddy:
>>> Could you spin off a patch to make sure the priority argument is
>>> optional for policies that don’t need it, even when --pid is not used?
>>
>> No. You broke it, you fix it.
>
> Please, please, don't forget to finalize it to avoid releasing it
> incomplete ;-)
>
> I have merged Benno's V2 set of patches, so nothing else is in the
> queue for now.
I will send the patch to make the priority argument optional when
--pid is not used in the next couple of days. That should complete
the series.
Thanks,
Madadi Vineeth Reddy
>
> Thanks guys!
>
> Karel
>
^ permalink raw reply
* Re: [PATCH 4/4 V2] chrt: do not try to interpret any other option as a PID either
From: Madadi Vineeth Reddy @ 2025-07-15 5:33 UTC (permalink / raw)
To: Karel Zak; +Cc: Benno Schulenberg, util-linux, Madadi Vineeth Reddy
In-Reply-To: <ceu2o6v4tz6g2hvt7olpg2v2viomyv22xm2jgodv4h4rzr4x3m@pmunyjscofn5>
On 14/07/25 16:58, Karel Zak wrote:
> On Sun, Jul 06, 2025 at 11:39:44AM +0530, Madadi Vineeth Reddy wrote:
>> On 03/07/25 20:17, Benno Schulenberg wrote:
>>> When doing, for example, `chrt --pid --max`, it would report:
>>>
>>> chrt: invalid PID argument: '--max'
>>>
>>> This mistakenly gave the impression that the PID argument has to follow
>>> directly after the --pid option.
>>>
>>> Avoid this by delaying the parsing of a PID until after all options have
>>> been parsed. Temporarily set 'ctl->pid' to zero to indicate that a PID
>>> needs to be read.
>>>
>>> After this change, `chrt --pid --max` will simply report the minimum and
>>> maximum valid priorities. And `chrt --pid -v`:
>>
>> According to help text,
>> chrt [options] --pid <priority> <pid>
>>
>> I’m still not sure about allowing the --max option after --pid.
>> I’ll leave it to Karel to decide what’s best here.
>
> My point of view (may be wrong, sched-utils CLI is odd). The core of
> the chrt command line can be described as:
>
> chrt <options> [<prio>] <process>
>
> where <process> is
>
> 1) new process by exec()
> 2) already running process
>
> The default is 1), --pid enables the 2) and in this case
> <process> is PID.
>
> The --pid is just an option to switch between the cases. There is no
> argument for the option; it informs how to interpret the <process>.
>
> The ideal would be to use "--" before <process>.
>
> It means that arbitrary options could be after --pid, including --max.
>
> Does it make sense?
>
Yes. That makes sense.
Thanks,
Madadi Vineeth Reddy
> Karel
>
^ permalink raw reply
* Re: [PATCH 2/2] lscpu-arm: Remove the "Ampere-1a" part.
From: Karel Zak @ 2025-07-15 9:19 UTC (permalink / raw)
To: Jeremy Linton; +Cc: Paul Benoit, util-linux
In-Reply-To: <fb54d607-dccc-419f-b92c-7bc8514213a6@arm.com>
On Mon, Jul 14, 2025 at 03:48:50PM -0500, Jeremy Linton wrote:
> On 7/14/25 7:16 AM, Karel Zak wrote:
> > On Fri, Jul 11, 2025 at 02:16:48PM -0700, Paul Benoit wrote:
> > > Remove the "Ampere-1a" part. On newer Ampere Computing systems, the
> > > system/model name will be obtained from /sys/bus/soc/devices/soc0/machine,
> > > that is populated with the ARM SMC CC SOC_ID Name.
> >
> > If I understand correctly, there are old systems without
> > /sys/.../soc0/machine, right? The change will remove Ampere-1a from
> > the lscpu output. This sounds backward incompatible.
>
> Thats a good point, but as I understand it, Ampere hasn't been happy with
> the string that is there.
We can update the string to make them happy.
> If its OK to break whatever scripts/etc might depend on it at the moment,
> why not just update the string.
>
> Then invert the check so that the /sys/bus entry is preferred?
I still do not understand how a per-CPU identifier can be replaced by
one soc0 path. What if there is soc1, soc2, etc.?
Anyway, using /sys/bus as the primary source and the hardcoded id_part[]
array as a fallback seems better than removing anything from id_part[]
and relying on /sys/bus only.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* Re: chrt from git segfaults
From: Benno Schulenberg @ 2025-07-15 9:19 UTC (permalink / raw)
To: Karel Zak; +Cc: Madadi Vineeth Reddy, util-linux
In-Reply-To: <fgeg2ezfxn6ofip7huhofg6a6mmx2yqn37p2j32rfxn33mpgyu@c2ldx4q6zvzu>
[-- Attachment #1.1: Type: text/plain, Size: 221 bytes --]
Op 14-07-2025 om 13:32 schreef Karel Zak:
> I have merged Benno's V2 set of patches, so nothing else is in the
> queue for now.
I'm not seeing those in git yet. Did you forget to push to kernel.org?
Benno
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
^ permalink raw reply
* Re: chrt from git segfaults
From: Karel Zak @ 2025-07-16 8:16 UTC (permalink / raw)
To: Benno Schulenberg; +Cc: Madadi Vineeth Reddy, util-linux
In-Reply-To: <378538ce-013c-411e-93e7-ef37f2bc94ab@telfort.nl>
On Tue, Jul 15, 2025 at 11:19:46AM +0200, Benno Schulenberg wrote:
>
> Op 14-07-2025 om 13:32 schreef Karel Zak:
> > I have merged Benno's V2 set of patches, so nothing else is in the
> > queue for now.
>
> I'm not seeing those in git yet. Did you forget to push to kernel.org?
All should be on kernel.org and github.com now.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* Re: [PATCH 1/3] column: call gettext() on an error message only when it gets printed
From: Karel Zak @ 2025-07-16 8:17 UTC (permalink / raw)
To: Benno Schulenberg; +Cc: util-linux
In-Reply-To: <20250709090734.18263-1-bensberg@telfort.nl>
On Wed, Jul 09, 2025 at 11:07:32AM +0200, Benno Schulenberg wrote:
> text-utils/column.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
Applied (all 3 patches), thanks!
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* [PATCH] chrt: Allow optional priority for non‑prio policies without --pid
From: Madadi Vineeth Reddy @ 2025-07-18 19:04 UTC (permalink / raw)
To: util-linux; +Cc: Karel Zak, Benno Schulenberg, Madadi Vineeth Reddy
This extends commit e7a2d62434c2
("chrt: Make priority optional for policies that don't use it")
so that priority arguments are optional even when --pid is not specified.
Before this patch:
$ chrt --other ls -lh
chrt: invalid priority argument: 'ls'
-> only "chrt --other 0 ls -lh" would work
After this patch:
$ chrt --other ls -lh
$ chrt --other 0 ls -lh
-> both now work
If an out‑of‑range priority is given, it reports an error:
$ chrt --other 1 ls -lh
unsupported priority value for the policy: 1 (see --max for valid range)
Fixes: e7a2d62434c2 ("chrt: Make priority optional for policies that don't use it")
Signed-off-by: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
---
schedutils/chrt.c | 33 +++++++++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index 10ba7fbf6..44b9b9e20 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -395,6 +395,18 @@ static void set_sched(struct chrt_ctl *ctl)
ctl->altered = 1;
}
+static bool is_number(const char *s)
+{
+ if (!s || *s == '\0')
+ return false;
+
+ for (const char *p = s; *p; p++) {
+ if (!isdigit((unsigned char)*p))
+ return false;
+ }
+ return true;
+}
+
int main(int argc, char **argv)
{
struct chrt_ctl _ctl = { .pid = -1, .policy = SCHED_RR }, *ctl = &_ctl;
@@ -503,7 +515,7 @@ int main(int argc, char **argv)
}
}
- if (argc - optind < (ctl->pid == 0 ? 1 : 2)) {
+ if (argc - optind < 1) {
warnx(_("too few arguments"));
errtryhelp(EXIT_FAILURE);
}
@@ -527,7 +539,10 @@ int main(int argc, char **argv)
if (ctl->verbose)
show_sched_info(ctl);
- if (argc - optind > 1) {
+ bool have_prio = need_prio ||
+ (ctl->pid == -1 ? (optind < argc && is_number(argv[optind])) : (argc - optind > 1));
+
+ if (have_prio) {
errno = 0;
ctl->priority = strtos32_or_err(argv[optind], _("invalid priority argument"));
} else
@@ -568,9 +583,19 @@ int main(int argc, char **argv)
show_sched_info(ctl);
if (!ctl->pid) {
- argv += optind + 1;
- if (strcmp(argv[0], "--") == 0)
+ argv += optind;
+
+ if (need_prio)
+ argv++;
+ else if (argv[0] && is_number(argv[0]))
+ argv++;
+
+ if (argv[0] && strcmp(argv[0], "--") == 0)
argv++;
+
+ if (!argv[0])
+ errx(EXIT_FAILURE, "Missing command to execute");
+
execvp(argv[0], argv);
errexec(argv[0]);
}
--
2.49.0
^ permalink raw reply related
* Re: [PATCH] chrt: Allow optional priority for non‑prio policies without --pid
From: Karel Zak @ 2025-07-21 7:01 UTC (permalink / raw)
To: Madadi Vineeth Reddy; +Cc: util-linux, Benno Schulenberg
In-Reply-To: <20250718190439.85359-1-vineethr@linux.ibm.com>
On Sat, Jul 19, 2025 at 12:34:39AM +0530, Madadi Vineeth Reddy wrote:
> diff --git a/schedutils/chrt.c b/schedutils/chrt.c
> index 10ba7fbf6..44b9b9e20 100644
> --- a/schedutils/chrt.c
> +++ b/schedutils/chrt.c
> @@ -395,6 +395,18 @@ static void set_sched(struct chrt_ctl *ctl)
> ctl->altered = 1;
> }
>
> +static bool is_number(const char *s)
> +{
> + if (!s || *s == '\0')
> + return false;
> +
> + for (const char *p = s; *p; p++) {
> + if (!isdigit((unsigned char)*p))
> + return false;
> + }
> + return true;
> +}
It seems you can replace this function with isdigit_string() from
include/strutils.h.
> +
> int main(int argc, char **argv)
> {
> struct chrt_ctl _ctl = { .pid = -1, .policy = SCHED_RR }, *ctl = &_ctl;
> @@ -503,7 +515,7 @@ int main(int argc, char **argv)
> }
> }
>
> - if (argc - optind < (ctl->pid == 0 ? 1 : 2)) {
> + if (argc - optind < 1) {
> warnx(_("too few arguments"));
> errtryhelp(EXIT_FAILURE);
> }
> @@ -527,7 +539,10 @@ int main(int argc, char **argv)
> if (ctl->verbose)
> show_sched_info(ctl);
>
> - if (argc - optind > 1) {
> + bool have_prio = need_prio ||
> + (ctl->pid == -1 ? (optind < argc && is_number(argv[optind])) : (argc - optind > 1));
> +
> + if (have_prio) {
> errno = 0;
> ctl->priority = strtos32_or_err(argv[optind], _("invalid priority argument"));
> } else
> @@ -568,9 +583,19 @@ int main(int argc, char **argv)
> show_sched_info(ctl);
>
> if (!ctl->pid) {
> - argv += optind + 1;
> - if (strcmp(argv[0], "--") == 0)
> + argv += optind;
> +
> + if (need_prio)
> + argv++;
> + else if (argv[0] && is_number(argv[0]))
> + argv++;
> +
> + if (argv[0] && strcmp(argv[0], "--") == 0)
> argv++;
> +
> + if (!argv[0])
> + errx(EXIT_FAILURE, "Missing command to execute");
You need to use _() for translation, ideally with string already used in
other tools. For example, _("no command specified").
Thanks!
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* Re: [PATCH] chrt: Allow optional priority for non‑prio policies without --pid
From: Madadi Vineeth Reddy @ 2025-07-21 15:43 UTC (permalink / raw)
To: Karel Zak; +Cc: util-linux, Benno Schulenberg, Madadi Vineeth Reddy
In-Reply-To: <eu5csrk3f4jmwf7olhle3ukcxvdcofhgk7etss6dko3h364qhn@bxaakyetv7uk>
Hi Karel,
On 21/07/25 12:31, Karel Zak wrote:
> On Sat, Jul 19, 2025 at 12:34:39AM +0530, Madadi Vineeth Reddy wrote:
>> diff --git a/schedutils/chrt.c b/schedutils/chrt.c
>> index 10ba7fbf6..44b9b9e20 100644
>> --- a/schedutils/chrt.c
>> +++ b/schedutils/chrt.c
>> @@ -395,6 +395,18 @@ static void set_sched(struct chrt_ctl *ctl)
>> ctl->altered = 1;
>> }
>>
>> +static bool is_number(const char *s)
>> +{
>> + if (!s || *s == '\0')
>> + return false;
>> +
>> + for (const char *p = s; *p; p++) {
>> + if (!isdigit((unsigned char)*p))
>> + return false;
>> + }
>> + return true;
>> +}
>
> It seems you can replace this function with isdigit_string() from
> include/strutils.h.
>
Will replace it.
>> +
>> int main(int argc, char **argv)
>> {
>> struct chrt_ctl _ctl = { .pid = -1, .policy = SCHED_RR }, *ctl = &_ctl;
>> @@ -503,7 +515,7 @@ int main(int argc, char **argv)
>> }
>> }
>>
>> - if (argc - optind < (ctl->pid == 0 ? 1 : 2)) {
>> + if (argc - optind < 1) {
>> warnx(_("too few arguments"));
>> errtryhelp(EXIT_FAILURE);
>> }
>> @@ -527,7 +539,10 @@ int main(int argc, char **argv)
>> if (ctl->verbose)
>> show_sched_info(ctl);
>>
>> - if (argc - optind > 1) {
>> + bool have_prio = need_prio ||
>> + (ctl->pid == -1 ? (optind < argc && is_number(argv[optind])) : (argc - optind > 1));
>> +
>> + if (have_prio) {
>> errno = 0;
>> ctl->priority = strtos32_or_err(argv[optind], _("invalid priority argument"));
>> } else
>> @@ -568,9 +583,19 @@ int main(int argc, char **argv)
>> show_sched_info(ctl);
>>
>> if (!ctl->pid) {
>> - argv += optind + 1;
>> - if (strcmp(argv[0], "--") == 0)
>> + argv += optind;
>> +
>> + if (need_prio)
>> + argv++;
>> + else if (argv[0] && is_number(argv[0]))
>> + argv++;
>> +
>> + if (argv[0] && strcmp(argv[0], "--") == 0)
>> argv++;
>> +
>> + if (!argv[0])
>> + errx(EXIT_FAILURE, "Missing command to execute");
>
> You need to use _() for translation, ideally with string already used in
> other tools. For example, _("no command specified").
Sure. Will fix it in v2. Thanks for taking a look.
--
Madadi Vineeth Reddy
>
> Thanks!
> Karel
>
^ permalink raw reply
* [PATCH v2] chrt: Allow optional priority for non‑prio policies without --pid
From: Madadi Vineeth Reddy @ 2025-07-29 9:47 UTC (permalink / raw)
To: util-linux; +Cc: Karel Zak, Benno Schulenberg, Madadi Vineeth Reddy
This extends commit e7a2d62434c2
("chrt: Make priority optional for policies that don't use it")
so that priority arguments are optional even when --pid is not specified.
Before this patch:
$ chrt --other ls -lh
chrt: invalid priority argument: 'ls'
-> only "chrt --other 0 ls -lh" would work
After this patch:
$ chrt --other ls -lh
$ chrt --other 0 ls -lh
-> both now work
If an out‑of‑range priority is given, it reports an error:
$ chrt --other 1 ls -lh
unsupported priority value for the policy: 1 (see --max for valid range)
Changes in v2:
- Removed is_number() and used isdigit_string() (Karel Zak)
- used _() for translation (Karel Zak)
Fixes: e7a2d62434c2 ("chrt: Make priority optional for policies that don't use it")
Signed-off-by: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
---
schedutils/chrt.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index 10ba7fbf6..1a9522728 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -503,7 +503,7 @@ int main(int argc, char **argv)
}
}
- if (argc - optind < (ctl->pid == 0 ? 1 : 2)) {
+ if (argc - optind < 1) {
warnx(_("too few arguments"));
errtryhelp(EXIT_FAILURE);
}
@@ -527,7 +527,10 @@ int main(int argc, char **argv)
if (ctl->verbose)
show_sched_info(ctl);
- if (argc - optind > 1) {
+ bool have_prio = need_prio ||
+ (ctl->pid == -1 ? (optind < argc && isdigit_string(argv[optind])) : (argc - optind > 1));
+
+ if (have_prio) {
errno = 0;
ctl->priority = strtos32_or_err(argv[optind], _("invalid priority argument"));
} else
@@ -568,9 +571,19 @@ int main(int argc, char **argv)
show_sched_info(ctl);
if (!ctl->pid) {
- argv += optind + 1;
- if (strcmp(argv[0], "--") == 0)
+ argv += optind;
+
+ if (need_prio)
argv++;
+ else if (argv[0] && isdigit_string(argv[0]))
+ argv++;
+
+ if (argv[0] && strcmp(argv[0], "--") == 0)
+ argv++;
+
+ if (!argv[0])
+ errx(EXIT_FAILURE, _("no command specified"));
+
execvp(argv[0], argv);
errexec(argv[0]);
}
--
2.49.0
^ permalink raw reply related
* Re: [PATCH v2] chrt: Allow optional priority for non‑prio policies without --pid
From: Karel Zak @ 2025-07-30 8:23 UTC (permalink / raw)
To: Madadi Vineeth Reddy; +Cc: util-linux, Benno Schulenberg
In-Reply-To: <20250729094703.62408-1-vineethr@linux.ibm.com>
On Tue, Jul 29, 2025 at 03:17:03PM +0530, Madadi Vineeth Reddy wrote:
> schedutils/chrt.c | 21 +++++++++++++++++----
> 1 file changed, 17 insertions(+), 4 deletions(-)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* [PATCH 1/4] chrt: produce better error message for missing priority with implied -r
From: Benno Schulenberg @ 2025-08-05 9:24 UTC (permalink / raw)
To: util-linux; +Cc: Madadi Vineeth Reddy
Since commit 4c425142844d, the following two equivalent commands produce
different error messages:
# chrt -r ls NEWS
chrt: invalid priority argument: 'ls'
# chrt ls NEWS
chrt: unsupported priority value for the policy: 0: see --max for valid range
The latter error message is enigmatic: where did the user specify '0'?
Before the mentioned commit, the second command would produce the same
error message as the first. Restore that behavior.
CC: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
---
schedutils/chrt.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index 1a9522728..e07284e41 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -524,6 +524,9 @@ int main(int argc, char **argv)
}
}
+ if (ctl->policy == SCHED_RR)
+ need_prio = true;
+
if (ctl->verbose)
show_sched_info(ctl);
--
2.48.2
^ permalink raw reply related
* [PATCH 2/4] chrt: (man,usage) mark the priority value as optional in the synopses
From: Benno Schulenberg @ 2025-08-05 9:24 UTC (permalink / raw)
To: util-linux; +Cc: Madadi Vineeth Reddy
In-Reply-To: <20250805092443.5847-1-bensberg@telfort.nl>
The priority value is optional in some cases, so it cannot be listed
as required.
CC: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
---
schedutils/chrt.1.adoc | 2 +-
schedutils/chrt.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/schedutils/chrt.1.adoc b/schedutils/chrt.1.adoc
index 3f67b13bb..c8278463a 100644
--- a/schedutils/chrt.1.adoc
+++ b/schedutils/chrt.1.adoc
@@ -38,7 +38,7 @@ chrt - manipulate the real-time attributes of a process
== SYNOPSIS
-*chrt* [options] _priority command_ [_argument_...]
+*chrt* [options] [_priority_] _command_ [_argument_...]
*chrt* [options] *--pid* [_priority_] _PID_
diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index e07284e41..de1898160 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -60,8 +60,8 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_("Show or change the real-time scheduling attributes of a process.\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(_("Set policy:\n"
- " chrt [options] <priority> <command> [<argument>...]\n"
- " chrt [options] --pid <priority> <PID>\n"), out);
+ " chrt [options] [<priority>] <command> [<argument>...]\n"
+ " chrt [options] --pid [<priority>] <PID>\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(_("Get policy:\n"
" chrt --pid <PID>\n"), out);
--
2.48.2
^ permalink raw reply related
* [PATCH 3/4] chrt: (man) improve wording and markup of some examples
From: Benno Schulenberg @ 2025-08-05 9:24 UTC (permalink / raw)
To: util-linux; +Cc: Madadi Vineeth Reddy
In-Reply-To: <20250805092443.5847-1-bensberg@telfort.nl>
CC: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
---
schedutils/chrt.1.adoc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/schedutils/chrt.1.adoc b/schedutils/chrt.1.adoc
index c8278463a..7ed676a9a 100644
--- a/schedutils/chrt.1.adoc
+++ b/schedutils/chrt.1.adoc
@@ -122,17 +122,17 @@ ____
//TRANSLATORS: Keep {colon} untranslated
Or set them{colon}::
____
-*chrt -r --pid* _priority PID_
+*chrt* _policy-option_ *--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}::
+For example, to set the scheduling policy to *SCHED_RR* (round-robin) and the priority to *30* for process *1234*{colon}::
____
-*chrt -r --pid 30* _PID_
+*chrt -r --pid 30 1234*
____
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}::
+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_
____
--
2.48.2
^ permalink raw reply related
* [PATCH 4/4] chrt: (man,usage) put --pid first in synopses and examples, for clarity
From: Benno Schulenberg @ 2025-08-05 9:24 UTC (permalink / raw)
To: util-linux; +Cc: Madadi Vineeth Reddy
In-Reply-To: <20250805092443.5847-1-bensberg@telfort.nl>
When --pid is among the options, it is clearest when it is given as the
first option, because then it doesn't sit between the policy option and
the somewhat related priority value. It creates some kind of symmetry:
the --pid option first, then other things, and the actual PID last.
CC: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
---
schedutils/chrt.1.adoc | 12 ++++++------
schedutils/chrt.c | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/schedutils/chrt.1.adoc b/schedutils/chrt.1.adoc
index 7ed676a9a..7805ec6d2 100644
--- a/schedutils/chrt.1.adoc
+++ b/schedutils/chrt.1.adoc
@@ -40,13 +40,13 @@ chrt - manipulate the real-time attributes of a process
*chrt* [options] [_priority_] _command_ [_argument_...]
-*chrt* [options] *--pid* [_priority_] _PID_
+*chrt --pid* [options] [_priority_] _PID_
== DESCRIPTION
*chrt* sets or retrieves the real-time scheduling attributes of an existing _PID_, or runs _command_ with the given attributes.
-== POLICIES
+== POLICY OPTIONS
*-o*, *--other*::
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.
@@ -122,19 +122,19 @@ ____
//TRANSLATORS: Keep {colon} untranslated
Or set them{colon}::
____
-*chrt* _policy-option_ *--pid* _priority PID_
+*chrt --pid* _policy-option priority PID_
____
For example, to set the scheduling policy to *SCHED_RR* (round-robin) and the priority to *30* for process *1234*{colon}::
____
-*chrt -r --pid 30 1234*
+*chrt --pid -r 30 1234*
____
Reset priorities to default for a process{colon}::
____
-*chrt -o --pid 0* _PID_
+*chrt --pid -o 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_
+*chrt --pid -o -T 1000000* _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 de1898160..b5ddc53bd 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -61,7 +61,7 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(USAGE_SEPARATOR, out);
fputs(_("Set policy:\n"
" chrt [options] [<priority>] <command> [<argument>...]\n"
- " chrt [options] --pid [<priority>] <PID>\n"), out);
+ " chrt --pid <policy-option> [options] [<priority>] <PID>\n"), out);
fputs(USAGE_SEPARATOR, out);
fputs(_("Get policy:\n"
" chrt --pid <PID>\n"), out);
--
2.48.2
^ permalink raw reply related
* Re: [PATCH 1/4] chrt: produce better error message for missing priority with implied -r
From: Karel Zak @ 2025-08-11 9:23 UTC (permalink / raw)
To: Benno Schulenberg; +Cc: util-linux, Madadi Vineeth Reddy
In-Reply-To: <20250805092443.5847-1-bensberg@telfort.nl>
On Tue, Aug 05, 2025 at 11:24:40AM +0200, Benno Schulenberg wrote:
> schedutils/chrt.c | 3 +++
> 1 file changed, 3 insertions(+)
Applied (all 4 patches), thanks!
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* [PATCH] swapon: (man page) add details about fstab configuration
From: Karel Zak @ 2025-08-12 13:09 UTC (permalink / raw)
To: util-linux
The fstab(5) man page already describes some basic aspects of "swap,"
but it makes sense to be more specific in the swapon man page and
describe everything in one place, serving as a normative reference for
what is expected on Linux in fstab for swap.
Fixes: https://github.com/util-linux/util-linux/issues/3667
Signed-off-by: Karel Zak <kzak@redhat.com>
---
sys-utils/fstab.5.adoc | 2 ++
sys-utils/swapon.8.adoc | 47 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 49 insertions(+)
diff --git a/sys-utils/fstab.5.adoc b/sys-utils/fstab.5.adoc
index f5b4d0dcb..53d7dced5 100644
--- a/sys-utils/fstab.5.adoc
+++ b/sys-utils/fstab.5.adoc
@@ -56,6 +56,8 @@ The file *fstab* contains descriptive information about the filesystems the syst
The file is not read by *mount*(8) only but often is used by many other tools and daemons, and proper functionality may require additional steps. For example, on systemd-based systems, it's recommended to use *systemctl daemon-reload* after *fstab* modification.
+See the *swapon*(8) man page for details about swap area fstab configuration.
+
Each filesystem is described on a separate line, with fields separated by tabs or spaces. The line is split into fields before being parsed. This means that any spaces or tabs within the fields must be escaped using \040 or \011, even within quoted strings (e.g. LABEL="foo\040bar").
Lines starting with '#' are comments. Blank lines are ignored.
diff --git a/sys-utils/swapon.8.adoc b/sys-utils/swapon.8.adoc
index a25309d18..f4516c66a 100644
--- a/sys-utils/swapon.8.adoc
+++ b/sys-utils/swapon.8.adoc
@@ -30,6 +30,7 @@ Calls to *swapon* normally occur in the system boot scripts making all swap devi
*-a*, *--all*::
All devices marked as "swap" in _/etc/fstab_ are made available, except for those with the "noauto" option. Devices that are already being used as swap are silently skipped.
+See *FSTAB CONFIGURATION* section for more details.
*-T*, *--fstab* _path_::
Specifies an alternative fstab file for compatibility with *mount*(8). If _path_ is a directory, then the files in the directory are sorted by *strverscmp*(3); files that start with "." or without an .fstab extension are ignored. The option can be specified more than once. This option is mostly designed for initramfs or chroot scripts where additional configuration is specified beyond standard system configuration.
@@ -91,6 +92,52 @@ Be verbose.
include::man-common/help-version.adoc[]
+== FSTAB CONFIGURATION
+
+The command *swapon --all* reads configuration from _/etc/fstab_ (or from a file specified by the *--fstab* command line option). Only fstab entries with the filesystem type (3rd field) set to "swap" are relevant.
+
+The option *--options* accepts values in the same form as can be specified in the fourth field in fstab.
+
+=== The first field (source)
+
+Specify the swap source. If the source is a regular file, it is addressed by an absolute path.
+
+If the swap is a block device, it can be addressed by device path, swap area tags *LABEL=* or *UUID=* (see *mkswap*(8) for more details), or by partition tags like *PARTLABEL=* or *PARTUUID=*.
+
+=== The second field (target)
+
+Unused by *swapon*, the recommended convention is to use "none".
+
+=== The third field (type)
+
+Requires "swap" as the filesystem type.
+
+=== The fourth field (options)
+
+It is formatted as a comma-separated list of options. All unknown options are silently ignored. If options are unnecessary, the recommended convention is to use "default". The options specified in fstab extend or overwrite settings specified on the swapon command line.
+
+Supported swap options:
+
+*noauto*::
+Ignore entry when *swapon --all* is given.
+
+*nofail*::
+Do not report errors for this device if it does not exist.
+
+*discard*[**=**_policy_]::
+Enable swap discard. The supported settings are *discard*, *discard=once*, or *discard=pages*. For more details, see the **--discard** command line option.
+
+**pri=**_priority_::
+Specify the priority of the swap device. For more details, see the **--priority** command line option.
+
+=== The fifth field
+
+Unused by *swapon*, the recommended convention is to keep it empty.
+
+=== The sixth field
+
+Unused by *swapon*, the recommended convention is to keep it empty.
+
== EXIT STATUS
*swapoff* has the following exit status values since v2.36:
--
2.50.1
^ permalink raw reply related
* Re: [PATCH] swapon: (man page) add details about fstab configuration
From: Nuno Silva @ 2025-08-12 22:52 UTC (permalink / raw)
To: util-linux; +Cc: kzak
In-Reply-To: <2k6jk47pv3rgp4djrfhs6tdddhfmbjoz2jmofzf6owxnpfuvq2@bkt6bw6bldj5>
On 2025-08-12, Karel Zak wrote:
> The fstab(5) man page already describes some basic aspects of "swap,"
> but it makes sense to be more specific in the swapon man page and
> describe everything in one place, serving as a normative reference for
> what is expected on Linux in fstab for swap.
>
> Fixes: https://github.com/util-linux/util-linux/issues/3667
> Signed-off-by: Karel Zak <kzak@redhat.com>
> ---
> sys-utils/fstab.5.adoc | 2 ++
> sys-utils/swapon.8.adoc | 47 +++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 49 insertions(+)
>
[...]
> diff --git a/sys-utils/swapon.8.adoc b/sys-utils/swapon.8.adoc
> index a25309d18..f4516c66a 100644
> --- a/sys-utils/swapon.8.adoc
> +++ b/sys-utils/swapon.8.adoc
> @@ -30,6 +30,7 @@ Calls to *swapon* normally occur in the system boot
> scripts making all swap devi
>
> *-a*, *--all*::
> All devices marked as "swap" in _/etc/fstab_ are made available,
> except for those with the "noauto" option. Devices that are already
> being used as swap are silently skipped.
> +See *FSTAB CONFIGURATION* section for more details.
Should this be "See the *FSTAB CONFIGURATION* section [...]"?
At first sight, it sounds/looks better to me with that "the".
--
Nuno Silva
^ permalink raw reply
* Markup fixes for lastlog man pages
From: Mario Blättermann @ 2025-08-14 17:11 UTC (permalink / raw)
To: util-linux
[-- Attachment #1: Type: text/plain, Size: 240 bytes --]
Hello,
while pre-translating the man pages of the upcoming version, I found
some things worth to fix – to get working links in the SEE ALSO
section, and a clickable author's mail address. See the attachment.
Best Regards,
Mario
[-- Attachment #2: lastlog.patch --]
[-- Type: text/x-patch, Size: 5960 bytes --]
diff --git a/liblastlog2/man/lastlog2.3.adoc b/liblastlog2/man/lastlog2.3.adoc
index 405bdb2a5..cccd81472 100644
--- a/liblastlog2/man/lastlog2.3.adoc
+++ b/liblastlog2/man/lastlog2.3.adoc
@@ -22,18 +22,18 @@ lastlog2 - Y2038 safe version of lastlog library.
It's using sqlite3 as database backend. Data is only collected via a PAM module, so that all
tools can make use of it, without modifying existing packages.
The output is as compatible as possible with the old lastlog implementation.
-By default the database will be written as `/var/lib/lastlog/lastlog2.db`.
+By default the database will be written as _/var/lib/lastlog/lastlog2.db_.
The size of the database depends on the amount of users, not how big the biggest UID is.
== AUTHORS
-Thorsten Kukuk (kukuk@suse.de)
+mailto:kukuk@suse.de[Thorsten Kukuk]
== SEE ALSO
*lastlog2*(3),
-*ll2_new_context(3),
-*ll2_unref_context(3),
+*ll2_new_context*(3),
+*ll2_unref_context*(3),
*ll2_write_entry*(3),
*ll2_read_all*(3),
*ll2_read_entry*(3),
diff --git a/liblastlog2/man/ll2_import_lastlog.3.adoc b/liblastlog2/man/ll2_import_lastlog.3.adoc
index 672a92cd1..36e014c31 100644
--- a/liblastlog2/man/ll2_import_lastlog.3.adoc
+++ b/liblastlog2/man/ll2_import_lastlog.3.adoc
@@ -42,13 +42,13 @@ _error_ should be freed by the caller.
== AUTHORS
-Thorsten Kukuk (kukuk@suse.de)
+mailto:kukuk@suse.de[Thorsten Kukuk]
== SEE ALSO
*lastlog2*(3),
-*ll2_new_context(3),
-*ll2_unref_context(3),
+*ll2_new_context*(3),
+*ll2_unref_context*(3),
*ll2_read_all*(3),
*ll2_write_entry*(3),
*ll2_read_entry*(3),
diff --git a/liblastlog2/man/ll2_new_context.3.adoc b/liblastlog2/man/ll2_new_context.3.adoc
index 8bb280422..0cabd0327 100644
--- a/liblastlog2/man/ll2_new_context.3.adoc
+++ b/liblastlog2/man/ll2_new_context.3.adoc
@@ -39,12 +39,12 @@ Returns NULL on an error.
== AUTHORS
-Thorsten Kukuk (kukuk@suse.de)
+mailto:kukuk@suse.de[Thorsten Kukuk]
== SEE ALSO
*lastlog2*(3),
-*ll2_unref_context(3),
+*ll2_unref_context*(3),
*ll2_read_all*(3),
*ll2_write_entry*(3),
*ll2_read_entry*(3),
diff --git a/liblastlog2/man/ll2_read_all.3.adoc b/liblastlog2/man/ll2_read_all.3.adoc
index 26617d617..9da54d72a 100644
--- a/liblastlog2/man/ll2_read_all.3.adoc
+++ b/liblastlog2/man/ll2_read_all.3.adoc
@@ -51,13 +51,13 @@ and can be checked.
== AUTHORS
-Thorsten Kukuk (kukuk@suse.de)
+mailto:kukuk@suse.de[Thorsten Kukuk]
== SEE ALSO
*lastlog2*(3),
-*ll2_new_context(3),
-*ll2_unref_context(3),
+*ll2_new_context*(3),
+*ll2_unref_context*(3),
*ll2_write_entry*(3),
*ll2_read_entry*(3),
*ll2_update_login_time*(3),
diff --git a/liblastlog2/man/ll2_read_entry.3.adoc b/liblastlog2/man/ll2_read_entry.3.adoc
index 063861284..9eb7ac657 100644
--- a/liblastlog2/man/ll2_read_entry.3.adoc
+++ b/liblastlog2/man/ll2_read_entry.3.adoc
@@ -49,13 +49,13 @@ The evaluated values are returned by _ll_time_, _tty_, _rhost_ and _pam_service_
== AUTHORS
-Thorsten Kukuk (kukuk@suse.de)
+mailto:kukuk@suse.de[Thorsten Kukuk]
== SEE ALSO
*lastlog2*(3),
-*ll2_new_context(3),
-*ll2_unref_context(3),
+*ll2_new_context*(3),
+*ll2_unref_context*(3),
*ll2_read_all*(3),
*ll2_write_entry*(3),
*ll2_update_login_time*(3),
diff --git a/liblastlog2/man/ll2_remove_entry.3.adoc b/liblastlog2/man/ll2_remove_entry.3.adoc
index 622c3c65f..935e69c76 100644
--- a/liblastlog2/man/ll2_remove_entry.3.adoc
+++ b/liblastlog2/man/ll2_remove_entry.3.adoc
@@ -40,13 +40,13 @@ _error_ should be freed by the caller.
== AUTHORS
-Thorsten Kukuk (kukuk@suse.de)
+mailto:kukuk@suse.de[Thorsten Kukuk]
== SEE ALSO
*lastlog2*(3),
-*ll2_new_context(3),
-*ll2_unref_context(3),
+*ll2_new_context*(3),
+*ll2_unref_context*(3),
*ll2_read_all*(3),
*ll2_write_entry*(3),
*ll2_read_entry*(3),
diff --git a/liblastlog2/man/ll2_rename_user.3.adoc b/liblastlog2/man/ll2_rename_user.3.adoc
index d3687a9dc..786c0695a 100644
--- a/liblastlog2/man/ll2_rename_user.3.adoc
+++ b/liblastlog2/man/ll2_rename_user.3.adoc
@@ -43,13 +43,13 @@ _error_ should be freed by the caller.
== AUTHORS
-Thorsten Kukuk (kukuk@suse.de)
+mailto:kukuk@suse.de[Thorsten Kukuk]
== SEE ALSO
*lastlog2*(3),
-*ll2_new_context(3),
-*ll2_unref_context(3),
+*ll2_new_context*(3),
+*ll2_unref_context*(3),
*ll2_read_all*(3),
*ll2_write_entry*(3),
*ll2_read_entry*(3),
diff --git a/liblastlog2/man/ll2_unref_context.3.adoc b/liblastlog2/man/ll2_unref_context.3.adoc
index 937de5974..b8cba2a31 100644
--- a/liblastlog2/man/ll2_unref_context.3.adoc
+++ b/liblastlog2/man/ll2_unref_context.3.adoc
@@ -35,12 +35,12 @@ ll2_unref_context(context);
== AUTHORS
-Thorsten Kukuk (kukuk@suse.de)
+mailto:kukuk@suse.de[Thorsten Kukuk]
== SEE ALSO
*lastlog2*(3),
-*ll2_new_context(3),
+*ll2_new_context*(3),
*ll2_read_all*(3),
*ll2_write_entry*(3),
*ll2_read_entry*(3),
diff --git a/liblastlog2/man/ll2_update_login_time.3.adoc b/liblastlog2/man/ll2_update_login_time.3.adoc
index 3a7aed589..d58a4a15e 100644
--- a/liblastlog2/man/ll2_update_login_time.3.adoc
+++ b/liblastlog2/man/ll2_update_login_time.3.adoc
@@ -44,13 +44,13 @@ _error_ should be freed by the caller.
== AUTHORS
-Thorsten Kukuk (kukuk@suse.de)
+mailto:kukuk@suse.de[Thorsten Kukuk]
== SEE ALSO
*lastlog2*(3),
-*ll2_new_context(3),
-*ll2_unref_context(3),
+*ll2_new_context*(3),
+*ll2_unref_context*(3),
*ll2_read_all*(3),
*ll2_write_entry*(3),
*ll2_read_entry*(3),
diff --git a/liblastlog2/man/ll2_write_entry.3.adoc b/liblastlog2/man/ll2_write_entry.3.adoc
index fc8e92b75..f29ce2a66 100644
--- a/liblastlog2/man/ll2_write_entry.3.adoc
+++ b/liblastlog2/man/ll2_write_entry.3.adoc
@@ -47,13 +47,13 @@ _error_ should be freed by the caller.
== AUTHORS
-Thorsten Kukuk (kukuk@suse.de)
+mailto:kukuk@suse.de[Thorsten Kukuk]
== SEE ALSO
*lastlog2*(3),
-*ll2_new_context(3),
-*ll2_unref_context(3),
+*ll2_new_context*(3),
+*ll2_unref_context*(3),
*ll2_read_all*(3),
*ll2_read_entry*(3),
*ll2_update_login_time*(3),
^ permalink raw reply related
* Re: Markup fixes for lastlog man pages
From: Karel Zak @ 2025-08-21 7:37 UTC (permalink / raw)
To: Mario Blättermann; +Cc: util-linux
In-Reply-To: <CAHi0vA9RfPW7zduvkQufPdvwfPB9wdhg21fzZ0tve3W5TK2DTw@mail.gmail.com>
On Thu, Aug 14, 2025 at 07:11:02PM +0200, Mario Blättermann wrote:
> while pre-translating the man pages of the upcoming version, I found
> some things worth to fix – to get working links in the SEE ALSO
> section, and a clickable author's mail address. See the attachment.
Applied, thanks!
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply
* [PATCH] chmem: Remove commit - chmem print warnings about failures always
From: Sumanth Korikkar @ 2025-08-22 15:09 UTC (permalink / raw)
To: Karel Zak, util-linux; +Cc: Gerald Schaefer, sumanthk
Users do not care which blocks are set offline, when using size option
Consistently printing warnings/errors in this case may confuse them and
create the false impression that the enable/disable operation itself has
failed.
If size option succeeds, chmem should not print errors/warnings.
Hence, revert commit
48675a744 ("chmem: print warnings about failures always (not only with --verbose)")
---
sys-utils/chmem.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sys-utils/chmem.c b/sys-utils/chmem.c
index 52e6f49b3..bee2a90f8 100644
--- a/sys-utils/chmem.c
+++ b/sys-utils/chmem.c
@@ -146,12 +146,12 @@ static int chmem_size(struct chmem_desc *desc, int enable, int zone_id)
idxtostr(desc, index, str, sizeof(str));
rc = ul_path_writef_string(desc->sysmem, onoff, "%s/state", name);
- if (rc != 0) {
+ if (rc != 0 && desc->verbose) {
if (enable)
- warn(_("%s enable failed"), str);
+ fprintf(stdout, _("%s enable failed\n"), str);
else
- warn(_("%s disable failed"), str);
- } else if (desc->verbose) {
+ fprintf(stdout, _("%s disable failed\n"), str);
+ } else if (rc == 0 && desc->verbose) {
if (enable)
fprintf(stdout, _("%s enabled\n"), str);
else
--
2.50.1
^ permalink raw reply related
* [PATCH] chmem: Remove commit - chmem print warnings about failures always
From: Sumanth Korikkar @ 2025-08-22 15:13 UTC (permalink / raw)
To: Karel Zak, util-linux; +Cc: Gerald Schaefer, sumanthk
Users do not care which blocks are set offline, when using size option
Consistently printing warnings/errors in this case may confuse them and
create the false impression that the enable/disable operation itself has
failed.
If size option succeeds, chmem should not print errors/warnings.
Hence, revert commit
48675a744 ("chmem: print warnings about failures always (not only with --verbose)")
Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
---
Add signed-off-by
sys-utils/chmem.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sys-utils/chmem.c b/sys-utils/chmem.c
index 52e6f49b3..bee2a90f8 100644
--- a/sys-utils/chmem.c
+++ b/sys-utils/chmem.c
@@ -146,12 +146,12 @@ static int chmem_size(struct chmem_desc *desc, int enable, int zone_id)
idxtostr(desc, index, str, sizeof(str));
rc = ul_path_writef_string(desc->sysmem, onoff, "%s/state", name);
- if (rc != 0) {
+ if (rc != 0 && desc->verbose) {
if (enable)
- warn(_("%s enable failed"), str);
+ fprintf(stdout, _("%s enable failed\n"), str);
else
- warn(_("%s disable failed"), str);
- } else if (desc->verbose) {
+ fprintf(stdout, _("%s disable failed\n"), str);
+ } else if (rc == 0 && desc->verbose) {
if (enable)
fprintf(stdout, _("%s enabled\n"), str);
else
--
2.50.1
^ permalink raw reply related
* Re: [PATCH] chmem: Remove commit - chmem print warnings about failures always
From: Karel Zak @ 2025-08-26 9:30 UTC (permalink / raw)
To: Sumanth Korikkar; +Cc: util-linux, Gerald Schaefer
In-Reply-To: <20250822151353.508175-1-sumanthk@linux.ibm.com>
On Fri, Aug 22, 2025 at 05:13:53PM +0200, Sumanth Korikkar wrote:
> sys-utils/chmem.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Applied, thanks.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ 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