util.h revision 830964834f330836b9d33752e83de09d4f38da87
d657c51f14601d0235434ffb78cf6ac0f27cc83cLennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering This file is part of systemd.
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering Copyright 2010 Lennart Poettering
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering systemd is free software; you can redistribute it and/or modify it
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering under the terms of the GNU General Public License as published by
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering the Free Software Foundation; either version 2 of the License, or
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering (at your option) any later version.
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering systemd is distributed in the hope that it will be useful, but
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering General Public License for more details.
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering You should have received a copy of the GNU General Public License
8968aea0fb900b5b786eea51a316652fce5641f8Martin Pitt along with systemd; If not, see <http://www.gnu.org/licenses/>.
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering#define USEC_PER_MINUTE (60ULL*USEC_PER_SEC)
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering#define USEC_PER_HOUR (60ULL*USEC_PER_MINUTE)
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering#define USEC_PER_DAY (24ULL*USEC_PER_HOUR)
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering#define USEC_PER_MONTH (2629800ULL*USEC_PER_SEC)
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering#define USEC_PER_YEAR (31557600ULL*USEC_PER_SEC)
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering/* What is interpreted as whitespace? */
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering#define ANSI_HIGHLIGHT_GREEN_ON "\x1B[1;32m"
8968aea0fb900b5b786eea51a316652fce5641f8Martin Pittdual_timestamp* dual_timestamp_get(dual_timestamp *ts);
8968aea0fb900b5b786eea51a316652fce5641f8Martin Pittdual_timestamp* dual_timestamp_from_realtime(dual_timestamp *ts, usec_t u);
8968aea0fb900b5b786eea51a316652fce5641f8Martin Pitt#define dual_timestamp_is_set(ts) ((ts)->realtime > 0)
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poetteringusec_t timespec_load(const struct timespec *ts);
8968aea0fb900b5b786eea51a316652fce5641f8Martin Pittstruct timespec *timespec_store(struct timespec *ts, usec_t u);
8968aea0fb900b5b786eea51a316652fce5641f8Martin Pittstruct timeval *timeval_store(struct timeval *tv, usec_t u);
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering#define strneq(a, b, n) (strncmp((a), (b), (n)) == 0)
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poetteringbool streq_ptr(const char *a, const char *b);
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering#define new(t, n) ((t*) malloc(sizeof(t)*(n)))
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering#define new0(t, n) ((t*) calloc((n), sizeof(t)))
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poetteringstatic inline const char* yes_no(bool b) {
8968aea0fb900b5b786eea51a316652fce5641f8Martin Pittstatic inline const char* strempty(const char *s) {
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering return s ? s : "";
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poetteringstatic inline const char* strnull(const char *s) {
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering return s ? s : "(null)";
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poetteringstatic inline const char *strna(const char *s) {
8968aea0fb900b5b786eea51a316652fce5641f8Martin Pitt return s ? s : "n/a";
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poetteringstatic inline bool is_path_absolute(const char *p) {
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering return *p == '/';
8968aea0fb900b5b786eea51a316652fce5641f8Martin Pittstatic inline bool isempty(const char *p) {
8968aea0fb900b5b786eea51a316652fce5641f8Martin Pitt return !p || !p[0];
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poetteringbool endswith(const char *s, const char *postfix);
8968aea0fb900b5b786eea51a316652fce5641f8Martin Pittbool startswith(const char *s, const char *prefix);
8968aea0fb900b5b786eea51a316652fce5641f8Martin Pittbool startswith_no_case(const char *s, const char *prefix);
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poetteringbool first_word(const char *s, const char *word);
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poetteringvoid close_many(const int fds[], unsigned n_fd);
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poetteringint parse_boolean(const char *v);
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poetteringint parse_usec(const char *t, usec_t *usec);
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poetteringint parse_pid(const char *s, pid_t* ret_pid);
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poetteringint safe_atou(const char *s, unsigned *ret_u);
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poetteringint safe_atollu(const char *s, unsigned long long *ret_u);
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poetteringint safe_atolli(const char *s, long long int *ret_i);
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poetteringstatic inline int safe_atolu(const char *s, unsigned long *ret_u) {
d5f8b2952a9c24c41f82fc3a12c1b580424566cbLennart Poettering assert_cc(sizeof(unsigned long) == sizeof(unsigned));
61f32bff6130a44d077886d38cff89ad161bf177Martin Pittstatic inline int safe_atoli(const char *s, long int *ret_u) {
61f32bff6130a44d077886d38cff89ad161bf177Martin Pitt assert_cc(sizeof(long int) == sizeof(int));
61f32bff6130a44d077886d38cff89ad161bf177Martin Pittstatic inline int safe_atolu(const char *s, unsigned long *ret_u) {
61f32bff6130a44d077886d38cff89ad161bf177Martin Pitt assert_cc(sizeof(unsigned long) == sizeof(unsigned long long));
61f32bff6130a44d077886d38cff89ad161bf177Martin Pitt return safe_atollu(s, (unsigned long long*) ret_u);
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poetteringstatic inline int safe_atoli(const char *s, long int *ret_u) {
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poettering assert_cc(sizeof(long int) == sizeof(long long int));
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poettering return safe_atolli(s, (long long int*) ret_u);
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poetteringstatic inline int safe_atou32(const char *s, uint32_t *ret_u) {
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poettering assert_cc(sizeof(uint32_t) == sizeof(unsigned));
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poetteringstatic inline int safe_atoi32(const char *s, int32_t *ret_i) {
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poettering assert_cc(sizeof(int32_t) == sizeof(int));
f1f8a5a5e110f485257e8702ad30b9997e529a74Lennart Poetteringstatic inline int safe_atou64(const char *s, uint64_t *ret_u) {
f1f8a5a5e110f485257e8702ad30b9997e529a74Lennart Poettering assert_cc(sizeof(uint64_t) == sizeof(unsigned long long));
f1f8a5a5e110f485257e8702ad30b9997e529a74Lennart Poettering return safe_atollu(s, (unsigned long long*) ret_u);
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poetteringstatic inline int safe_atoi64(const char *s, int64_t *ret_i) {
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poettering assert_cc(sizeof(int64_t) == sizeof(long long int));
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poettering return safe_atolli(s, (long long int*) ret_i);
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poetteringchar *split(const char *c, size_t *l, const char *separator, char **state);
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poetteringchar *split_quoted(const char *c, size_t *l, char **state);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poettering#define FOREACH_WORD(word, length, s, state) \
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poettering for ((state) = NULL, (word) = split((s), &(length), WHITESPACE, &(state)); (word); (word) = split((s), &(length), WHITESPACE, &(state)))
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poettering#define FOREACH_WORD_SEPARATOR(word, length, s, separator, state) \
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poettering for ((state) = NULL, (word) = split((s), &(length), (separator), &(state)); (word); (word) = split((s), &(length), (separator), &(state)))
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poettering#define FOREACH_WORD_QUOTED(word, length, s, state) \
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poettering for ((state) = NULL, (word) = split_quoted((s), &(length), &(state)); (word); (word) = split_quoted((s), &(length), &(state)))
f1f8a5a5e110f485257e8702ad30b9997e529a74Lennart Poetteringchar **split_path_and_make_absolute(const char *p);
f1f8a5a5e110f485257e8702ad30b9997e529a74Lennart Poetteringpid_t get_parent_of_pid(pid_t pid, pid_t *ppid);
f1f8a5a5e110f485257e8702ad30b9997e529a74Lennart Poetteringint get_starttime_of_pid(pid_t pid, unsigned long long *st);
f1f8a5a5e110f485257e8702ad30b9997e529a74Lennart Poetteringint write_one_line_file(const char *fn, const char *line);
f1f8a5a5e110f485257e8702ad30b9997e529a74Lennart Poetteringint write_one_line_file_atomic(const char *fn, const char *line);
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poetteringint read_one_line_file(const char *fn, char **line);
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poetteringint read_full_file(const char *fn, char **contents, size_t *size);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringint parse_env_file(const char *fname, const char *separator, ...) _sentinel_;
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poetteringint load_env_file(const char *fname, char ***l);
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poetteringint write_env_file(const char *fname, char **l);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringchar *strappend(const char *s, const char *suffix);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringchar *strnappend(const char *s, const char *suffix, size_t length);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringchar *replace_env(const char *format, char **env);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringchar **replace_env_argv(char **argv, char **env);
f1f8a5a5e110f485257e8702ad30b9997e529a74Lennart Poetteringint readlink_malloc(const char *p, char **r);
f1f8a5a5e110f485257e8702ad30b9997e529a74Lennart Poetteringint readlink_and_make_absolute(const char *p, char **r);
f1f8a5a5e110f485257e8702ad30b9997e529a74Lennart Poetteringint readlink_and_canonicalize(const char *p, char **r);
f1f8a5a5e110f485257e8702ad30b9997e529a74Lennart Poetteringchar *file_name_from_path(const char *p);
f1f8a5a5e110f485257e8702ad30b9997e529a74Lennart Poetteringbool is_path(const char *p);
f1f8a5a5e110f485257e8702ad30b9997e529a74Lennart Poetteringbool path_is_absolute(const char *p);
f1f8a5a5e110f485257e8702ad30b9997e529a74Lennart Poetteringchar *path_make_absolute(const char *p, const char *prefix);
f1f8a5a5e110f485257e8702ad30b9997e529a74Lennart Poetteringchar *path_make_absolute_cwd(const char *p);
f1f8a5a5e110f485257e8702ad30b9997e529a74Lennart Poetteringchar **strv_path_make_absolute_cwd(char **l);
f1f8a5a5e110f485257e8702ad30b9997e529a74Lennart Poetteringchar *delete_chars(char *s, const char *bad);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringchar *file_in_same_dir(const char *path, const char *filename);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringint safe_mkdir(const char *path, mode_t mode, uid_t uid, gid_t gid);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringint mkdir_parents(const char *path, mode_t mode);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringint mkdir_p(const char *path, mode_t mode);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringint parent_of_path(const char *path, char **parent);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringint rmdir_parents(const char *path, const char *stop);
ddb4b0d3eb57292c38a76f9b977f73cea15448fbLennart Poetteringint get_process_name(pid_t pid, char **name);
ddb4b0d3eb57292c38a76f9b977f73cea15448fbLennart Poetteringint get_process_cmdline(pid_t pid, size_t max_length, char **line);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringchar *cescape(const char *s);
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poetteringchar *cunescape(const char *s);
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poetteringchar *cunescape_length(const char *s, size_t length);
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poetteringchar *xescape(const char *s, const char *bad);
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poetteringchar *bus_path_escape(const char *s);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringchar *bus_path_unescape(const char *s);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringbool path_startswith(const char *path, const char *prefix);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringbool path_equal(const char *a, const char *b);
815bb5bd565b4edc05a426d24353a9ba68482834Thomas Hindoe Paaboel Andersenchar *ascii_strlower(char *path);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringbool chars_intersect(const char *a, const char *b);
815bb5bd565b4edc05a426d24353a9ba68482834Thomas Hindoe Paaboel Andersenchar *format_timestamp(char *buf, size_t l, usec_t t);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringchar *format_timestamp_pretty(char *buf, size_t l, usec_t t);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringchar *format_timespan(char *buf, size_t l, usec_t t);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringunsigned long long random_ull(void);
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poettering#define DEFINE_STRING_TABLE_LOOKUP(name,type) \
a11c7ea52cc31a8c95e46e781469d3a104f48090Lennart Poettering if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \
b9e2f7eb00643f28390cedf883f516f4ba7193bbLennart Poettering type name##_from_string(const char *s) { \
b9e2f7eb00643f28390cedf883f516f4ba7193bbLennart Poettering unsigned u = 0; \
b9e2f7eb00643f28390cedf883f516f4ba7193bbLennart Poettering for (i = 0; i < (type)ELEMENTSOF(name##_table); i++) \
b9e2f7eb00643f28390cedf883f516f4ba7193bbLennart Poettering if (safe_atou(s, &u) >= 0 && \
b9e2f7eb00643f28390cedf883f516f4ba7193bbLennart Poettering struct __useless_struct_to_allow_trailing_semicolon__
b9e2f7eb00643f28390cedf883f516f4ba7193bbLennart Poetteringint close_all_fds(const int except[], unsigned n_except);
b9e2f7eb00643f28390cedf883f516f4ba7193bbLennart Poetteringbool fstype_is_network(const char *fstype);
b9e2f7eb00643f28390cedf883f516f4ba7193bbLennart Poetteringint read_one_char(FILE *f, char *ret, bool *need_nl);
b9e2f7eb00643f28390cedf883f516f4ba7193bbLennart Poetteringint ask(char *ret, const char *replies, const char *text, ...);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringint open_terminal(const char *name, int mode);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringint acquire_terminal(const char *name, bool fail, bool force, bool ignore_tiocstty_eperm);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringint sigaction_many(const struct sigaction *sa, ...);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringint fopen_temporary(const char *path, FILE **_f, char **_temp_path);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringssize_t loop_read(int fd, void *buf, size_t nbytes, bool do_poll);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringssize_t loop_write(int fd, const void *buf, size_t nbytes, bool do_poll);
28c85daf0ae80d1d5f8b878efa4bdad690e1f29bLennart Poetteringint path_is_mount_point(const char *path);
c97e586d8a18db5dc505d76059ed1d9add234925Daniel Mackint chmod_and_chown(const char *path, mode_t mode, uid_t uid, gid_t gid);
c97e586d8a18db5dc505d76059ed1d9add234925Daniel Mackint rm_rf(const char *path, bool only_dirs, bool delete_root);
c97e586d8a18db5dc505d76059ed1d9add234925Daniel Mackvoid status_vprintf(const char *format, va_list ap);
c97e586d8a18db5dc505d76059ed1d9add234925Daniel Mackchar *ellipsize(const char *s, unsigned length, unsigned percent);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poetteringchar *unquote(const char *s, const char *quotes);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poetteringchar *normalize_env_assignment(const char *s);
c97e586d8a18db5dc505d76059ed1d9add234925Daniel Mackint wait_for_terminate(pid_t pid, siginfo_t *status);
c97e586d8a18db5dc505d76059ed1d9add234925Daniel Mackint wait_for_terminate_and_warn(const char *name, pid_t pid);
21d86c613d85a5ffb23decaf9876b9f42696e718Daniel MackDIR *xopendirat(int dirfd, const char *name, int flags);
21d86c613d85a5ffb23decaf9876b9f42696e718Daniel Mackvoid dual_timestamp_serialize(FILE *f, const char *name, dual_timestamp *t);
21d86c613d85a5ffb23decaf9876b9f42696e718Daniel Mackvoid dual_timestamp_deserialize(const char *value, dual_timestamp *t);
21d86c613d85a5ffb23decaf9876b9f42696e718Daniel Mackchar *fstab_node_to_udev_node(const char *p);
d046fb936658e7239c8e2635ecb7fb32748ef535Lennart Poetteringconst char *default_term_for_tty(const char *tty);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poetteringvoid execute_directory(const char *directory, DIR *_d, char *argv[]);
d046fb936658e7239c8e2635ecb7fb32748ef535Lennart Poetteringbool nulstr_contains(const char*nulstr, const char *needle);
d046fb936658e7239c8e2635ecb7fb32748ef535Lennart Poetteringvoid parse_syslog_priority(char **p, int *priority);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poetteringbool hostname_is_valid(const char *s);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poetteringint copy_file(const char *from, const char *to);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poetteringint symlink_or_copy(const char *from, const char *to);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poetteringint symlink_or_copy_atomic(const char *from, const char *to);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poetteringint conf_files_list(char ***strv, const char *suffix, const char *dir, ...);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poetteringint hwclock_apply_localtime_delta(int *min);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poetteringint hwclock_set_time(const struct tm *tm);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poetteringint audit_session_from_pid(pid_t pid, uint32_t *id);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poetteringbool display_is_local(const char *display);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poetteringint socket_from_display(const char *display, char **path);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poetteringint get_user_creds(const char **username, uid_t *uid, gid_t *gid, const char **home);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poetteringint dirent_ensure_type(DIR *d, struct dirent *de);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poetteringint in_search_path(const char *path, char **search);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poettering for ((i) = (l); (i) && *(i); (i) = strchr((i), 0)+1)
bdba9227ec6462198b63af69098a003aa2292c0fDaniel Mack for ((i) = (l), (j) = strchr((i), 0)+1; (i) && *(i); (i) = strchr((j), 0)+1, (j) = *(i) ? strchr((i), 0)+1 : (i))
bdba9227ec6462198b63af69098a003aa2292c0fDaniel Mackconst char *ioprio_class_to_string(int i);
bdba9227ec6462198b63af69098a003aa2292c0fDaniel Mackint ioprio_class_from_string(const char *s);
bdba9227ec6462198b63af69098a003aa2292c0fDaniel Mackconst char *sigchld_code_to_string(int i);
bdba9227ec6462198b63af69098a003aa2292c0fDaniel Mackint sigchld_code_from_string(const char *s);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poetteringconst char *log_facility_unshifted_to_string(int i);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poetteringint log_facility_unshifted_from_string(const char *s);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poetteringconst char *log_level_to_string(int i);
bdba9227ec6462198b63af69098a003aa2292c0fDaniel Mackint log_level_from_string(const char *s);
a8eaaee72a2f06e0fb64fb71de3b71ecba31dafbJan Engelhardtconst char *sched_policy_to_string(int i);
bdba9227ec6462198b63af69098a003aa2292c0fDaniel Mackint sched_policy_from_string(const char *s);
bdba9227ec6462198b63af69098a003aa2292c0fDaniel Mackconst char *rlimit_to_string(int i);
fe08a30b58bba0e04fb3e43122e0b157af5846a1Lennart Poetteringint rlimit_from_string(const char *s);
d046fb936658e7239c8e2635ecb7fb32748ef535Lennart Poetteringconst char *ip_tos_to_string(int i);
d046fb936658e7239c8e2635ecb7fb32748ef535Lennart Poetteringint ip_tos_from_string(const char *s);
d046fb936658e7239c8e2635ecb7fb32748ef535Lennart Poetteringconst char *signal_to_string(int i);
d046fb936658e7239c8e2635ecb7fb32748ef535Lennart Poetteringint signal_from_string(const char *s);