diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2017-12-29 09:03:54 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-01-01 18:23:24 +0100 |
commit | 33d12153da4d3a90817cd9099962eb992f0131dd (patch) | |
tree | 60a8bd04d04a2eb1142fa7b9fda1b1ebd889c6c8 /src/basic/process-util.h | |
parent | socket-util: introduce parse_socket_address_bind_ipv6_only_or_bool() (diff) | |
download | systemd-33d12153da4d3a90817cd9099962eb992f0131dd.tar.xz systemd-33d12153da4d3a90817cd9099962eb992f0131dd.zip |
basic: introduce *_to_string_with_check() functions
They are used in later commits.
Diffstat (limited to 'src/basic/process-util.h')
-rw-r--r-- | src/basic/process-util.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/basic/process-util.h b/src/basic/process-util.h index 1dd62c6d0a..b20e527af7 100644 --- a/src/basic/process-util.h +++ b/src/basic/process-util.h @@ -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); |