+/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
/***
***/
#include <alloca.h>
+#include <sched.h>
#include <signal.h>
#include <stdbool.h>
#include <stddef.h>
unsigned long personality_from_string(const char *p);
const char *personality_to_string(unsigned long);
+int safe_personality(unsigned long p);
+int opinionated_personality(unsigned long *ret);
+
int ioprio_class_to_string_alloc(int i, char **s);
int ioprio_class_from_string(const char *s);
return n >= PRIO_MIN && n < PRIO_MAX;
}
+static inline bool sched_policy_is_valid(int i) {
+ return IN_SET(i, SCHED_OTHER, SCHED_BATCH, SCHED_IDLE, SCHED_FIFO, SCHED_RR);
+}
+
+static inline bool sched_priority_is_valid(int i) {
+ return i >= 0 && i <= sched_get_priority_max(SCHED_RR);
+}
+
static inline bool ioprio_class_is_valid(int i) {
return IN_SET(i, IOPRIO_CLASS_NONE, IOPRIO_CLASS_RT, IOPRIO_CLASS_BE, IOPRIO_CLASS_IDLE);
}
return i >= 0 && i < IOPRIO_BE_NR;
}
+static inline bool pid_is_valid(pid_t p) {
+ return p > 0;
+}
+
int ioprio_parse_priority(const char *s, int *ret);
+
+pid_t getpid_cached(void);