shared: split out ioprio related stuff into ioprio-util.[ch]

No actual code changes, just some splitting out.
This commit is contained in:
Lennart Poettering
2021-11-24 16:12:15 +01:00
parent 989db9b399
commit 032b3afbf4
10 changed files with 56 additions and 39 deletions
-25
View File
@@ -1132,23 +1132,6 @@ int pid_compare_func(const pid_t *a, const pid_t *b) {
return CMP(*a, *b);
}
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;
}
/* The cached PID, possible values:
*
* == UNSET [0] → cache not initialized yet
@@ -1627,14 +1610,6 @@ _noreturn_ void freeze(void) {
pause();
}
static const char *const ioprio_class_table[] = {
[IOPRIO_CLASS_NONE] = "none",
[IOPRIO_CLASS_RT] = "realtime",
[IOPRIO_CLASS_BE] = "best-effort",
[IOPRIO_CLASS_IDLE] = "idle",
};
DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(ioprio_class, int, IOPRIO_N_CLASSES);
static const char *const sigchld_code_table[] = {
[CLD_EXITED] = "exited",