summaryrefslogtreecommitdiffstats
path: root/schedutils/uclampset.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:33:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:33:32 +0000
commit8bb05ac73a5b448b339ce0bc8d396c82c459b47f (patch)
tree1fdda006866bca20d41cb206767ea5241e36852f /schedutils/uclampset.c
parentAdding debian version 2.39.3-11. (diff)
downloadutil-linux-8bb05ac73a5b448b339ce0bc8d396c82c459b47f.tar.xz
util-linux-8bb05ac73a5b448b339ce0bc8d396c82c459b47f.zip
Merging upstream version 2.40.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--schedutils/uclampset.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/schedutils/uclampset.c b/schedutils/uclampset.c
index 0de806a..5968de9 100644
--- a/schedutils/uclampset.c
+++ b/schedutils/uclampset.c
@@ -31,7 +31,7 @@
#include "sched_attr.h"
#include "strutils.h"
-#define NOT_SET -2U
+#define NOT_SET 0xdeadbeef
struct uclampset {
unsigned int util_min;
@@ -69,13 +69,13 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_(" -R, --reset-on-fork set reset-on-fork flag\n"), out);
fputs(_(" -v, --verbose display status information\n"), out);
- printf(USAGE_HELP_OPTIONS(22));
+ fprintf(out, USAGE_HELP_OPTIONS(22));
fputs(USAGE_SEPARATOR, out);
fputs(_("Utilization value range is [0:1024]. Use special -1 value to "
"reset to system's default.\n"), out);
- printf(USAGE_MAN_TAIL("uclampset(1)"));
+ fprintf(out, USAGE_MAN_TAIL("uclampset(1)"));
exit(EXIT_SUCCESS);
}
@@ -211,14 +211,6 @@ static void set_uclamp_system(struct uclampset *ctl)
write_uclamp_sysfs(_PATH_PROC_UCLAMP_MAX, ctl->util_max);
}
-static void validate_util(int val)
-{
- if (val > 1024 || val < -1) {
- errno = EINVAL;
- err(EXIT_FAILURE, _("%d out of range"), val);
- }
-}
-
int main(int argc, char **argv)
{
struct uclampset _ctl = {
@@ -268,12 +260,10 @@ int main(int argc, char **argv)
case 'm':
ctl->util_min = strtos32_or_err(optarg, _("invalid util_min argument"));
ctl->util_min_set = 1;
- validate_util(ctl->util_min);
break;
case 'M':
ctl->util_max = strtos32_or_err(optarg, _("invalid util_max argument"));
ctl->util_max_set = 1;
- validate_util(ctl->util_max);
break;
case 'V':
print_version(EXIT_SUCCESS);