basic: introduce *_to_string_with_check() functions

They are used in later commits.
This commit is contained in:
Yu Watanabe
2018-01-02 02:23:24 +09:00
parent 6f90844fe2
commit 33d12153da
5 changed files with 28 additions and 1 deletions
+7
View File
@@ -137,6 +137,13 @@ static inline bool pid_is_valid(pid_t p) {
return p > 0;
}
static inline int sched_policy_to_string_alloc_with_check(int n, char **s) {
if (!sched_policy_is_valid(n))
return -EINVAL;
return sched_policy_to_string_alloc(n, s);
}
int ioprio_parse_priority(const char *s, int *ret);
pid_t getpid_cached(void);