summaryrefslogtreecommitdiff
path: root/src/basic/process-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-06-26 17:40:08 +0200
committerLennart Poettering <lennart@poettering.net>2017-06-26 17:43:18 +0200
commit7f452159b8f7ad83e6f9082b6fbb6d838b615d94 (patch)
treed106c564256ea5c420acfb7252e081939b247d34 /src/basic/process-util.c
parentf52b982cc9504bf89b035d4b55ac038a61226210 (diff)
downloadsystemd-7f452159b8f7ad83e6f9082b6fbb6d838b615d94.tar.gz
core: make IOSchedulingClass= and IOSchedulingPriority= settable for transient units
This patch is a bit more complex thant I hoped. In particular the single IOScheduling= property exposed on the bus is split up into IOSchedulingClass= and IOSchedulingPriority= (though compat is retained). Otherwise the asymmetry between setting props and getting them is a bit too nasty. Fixes #5613
Diffstat (limited to 'src/basic/process-util.c')
-rw-r--r--src/basic/process-util.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index a21dc35baa..b80cacaa42 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -905,6 +905,23 @@ int pid_compare_func(const void *a, const void *b) {
return 0;
}
+int ioprio_parse_priority(const char *s, int *ret) {
+ int i, r;
+
+ assert(s);
+ assert(ret);
+
+ r = safe_atoi(s, &i);
+ if (r < 0)
+ return r;
+
+ if (!ioprio_priority_is_valid(i))
+ return -EINVAL;
+
+ *ret = i;
+ return 0;
+}
+
static const char *const ioprio_class_table[] = {
[IOPRIO_CLASS_NONE] = "none",
[IOPRIO_CLASS_RT] = "realtime",