util.h revision 15ae422b7471cf6f41ccf450243d8afd8ea0a054
afe3ab588a6b2992efe5a9b22ed038545ba3cdbfLennart Poettering/*-*- Mode: C; c-basic-offset: 8 -*-*/
c343be283b7152554bac0c02493a4e1759c163f7Kay Sievers
b3ae710c251d0ce5cf2cef63208e325497b5e323Zbigniew Jędrzejewski-Szmek#ifndef fooutilhfoo
b3ae710c251d0ce5cf2cef63208e325497b5e323Zbigniew Jędrzejewski-Szmek#define fooutilhfoo
f957632b960a0a42999b38ded7089fa602b41745Kay Sievers
f957632b960a0a42999b38ded7089fa602b41745Kay Sievers/***
f957632b960a0a42999b38ded7089fa602b41745Kay Sievers This file is part of systemd.
f957632b960a0a42999b38ded7089fa602b41745Kay Sievers
8adaf7bd23baa6e2cd99e9e88e55d0f5f5db29a2Richard Maw Copyright 2010 Lennart Poettering
d19e85f0d474ed1882561b458d528cbae49f640eZbigniew Jędrzejewski-Szmek
d19e85f0d474ed1882561b458d528cbae49f640eZbigniew Jędrzejewski-Szmek systemd is free software; you can redistribute it and/or modify it
d19e85f0d474ed1882561b458d528cbae49f640eZbigniew Jędrzejewski-Szmek under the terms of the GNU General Public License as published by
d19e85f0d474ed1882561b458d528cbae49f640eZbigniew Jędrzejewski-Szmek the Free Software Foundation; either version 2 of the License, or
d19e85f0d474ed1882561b458d528cbae49f640eZbigniew Jędrzejewski-Szmek (at your option) any later version.
3e495a6651609d0a45b62aab5c3ed5a3b40e11abZbigniew Jędrzejewski-Szmek
3e495a6651609d0a45b62aab5c3ed5a3b40e11abZbigniew Jędrzejewski-Szmek systemd is distributed in the hope that it will be useful, but
3e495a6651609d0a45b62aab5c3ed5a3b40e11abZbigniew Jędrzejewski-Szmek WITHOUT ANY WARRANTY; without even the implied warranty of
f38afcd0c7f558ca5bf0854b42f8c6954f8ad7f3Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f85857df75cfedbc0d10b8ca2400188dc8f4c22eLennart Poettering General Public License for more details.
f38afcd0c7f558ca5bf0854b42f8c6954f8ad7f3Lennart Poettering
bafb15bab99887d1b6b8a35136531bac6c3876a6Lennart Poettering You should have received a copy of the GNU General Public License
83a1ff25e5228b0a5b2cc942fd4f964d10bb73b0Zbigniew Jędrzejewski-Szmek along with systemd; If not, see <http://www.gnu.org/licenses/>.
83a1ff25e5228b0a5b2cc942fd4f964d10bb73b0Zbigniew Jędrzejewski-Szmek***/
5e524b404b7b319aa6a24bf21132b1074b206996Lennart Poettering
5e524b404b7b319aa6a24bf21132b1074b206996Lennart Poettering#include <inttypes.h>
5e524b404b7b319aa6a24bf21132b1074b206996Lennart Poettering#include <time.h>
5e524b404b7b319aa6a24bf21132b1074b206996Lennart Poettering#include <sys/time.h>
5e524b404b7b319aa6a24bf21132b1074b206996Lennart Poettering#include <stdbool.h>
5e524b404b7b319aa6a24bf21132b1074b206996Lennart Poettering#include <stdlib.h>
5e524b404b7b319aa6a24bf21132b1074b206996Lennart Poettering#include <stdio.h>
5e524b404b7b319aa6a24bf21132b1074b206996Lennart Poettering
5e524b404b7b319aa6a24bf21132b1074b206996Lennart Poetteringtypedef uint64_t usec_t;
5e524b404b7b319aa6a24bf21132b1074b206996Lennart Poettering
fd6c2363af2cb144bb6a7d6b8bdba9f777440078Lennart Poettering#define MSEC_PER_SEC 1000ULL
47ee3ee03483efd271642d5043070cbd171f19d4Lennart Poettering#define USEC_PER_SEC 1000000ULL
3d39e6e5d475461c20d0300da80ff8cae5780ccfLennart Poettering#define USEC_PER_MSEC 1000ULL
3d39e6e5d475461c20d0300da80ff8cae5780ccfLennart Poettering#define NSEC_PER_SEC 1000000000ULL
3d39e6e5d475461c20d0300da80ff8cae5780ccfLennart Poettering#define NSEC_PER_MSEC 1000000ULL
3d39e6e5d475461c20d0300da80ff8cae5780ccfLennart Poettering#define NSEC_PER_USEC 1000ULL
3d39e6e5d475461c20d0300da80ff8cae5780ccfLennart Poettering
3d39e6e5d475461c20d0300da80ff8cae5780ccfLennart Poettering/* What is interpreted as whitespace? */
f506d09f714ce7c405d27cdf5939e1fdc3ed1a07Lennart Poettering#define WHITESPACE " \t\n\r"
f506d09f714ce7c405d27cdf5939e1fdc3ed1a07Lennart Poettering#define NEWLINE "\n\r"
f506d09f714ce7c405d27cdf5939e1fdc3ed1a07Lennart Poettering
f506d09f714ce7c405d27cdf5939e1fdc3ed1a07Lennart Poettering#define FORMAT_TIMESTAMP_MAX 64
f506d09f714ce7c405d27cdf5939e1fdc3ed1a07Lennart Poettering
f506d09f714ce7c405d27cdf5939e1fdc3ed1a07Lennart Poetteringusec_t now(clockid_t clock);
f506d09f714ce7c405d27cdf5939e1fdc3ed1a07Lennart Poettering
f506d09f714ce7c405d27cdf5939e1fdc3ed1a07Lennart Poetteringusec_t timespec_load(const struct timespec *ts);
f506d09f714ce7c405d27cdf5939e1fdc3ed1a07Lennart Poetteringstruct timespec *timespec_store(struct timespec *ts, usec_t u);
bd098bceddfe70dc995c0c4f7bac07475fc0fc41Lennart Poettering
bd098bceddfe70dc995c0c4f7bac07475fc0fc41Lennart Poetteringusec_t timeval_load(const struct timeval *tv);
bd098bceddfe70dc995c0c4f7bac07475fc0fc41Lennart Poetteringstruct timeval *timeval_store(struct timeval *tv, usec_t u);
de7399eb7427da46c5cd355181080274f69567a2Lennart Poettering
de7399eb7427da46c5cd355181080274f69567a2Lennart Poettering#define streq(a,b) (strcmp((a),(b)) == 0)
de7399eb7427da46c5cd355181080274f69567a2Lennart Poettering
de7399eb7427da46c5cd355181080274f69567a2Lennart Poetteringbool streq_ptr(const char *a, const char *b);
de7399eb7427da46c5cd355181080274f69567a2Lennart Poettering
de7399eb7427da46c5cd355181080274f69567a2Lennart Poettering#define new(t, n) ((t*) malloc(sizeof(t)*(n)))
0d4c4b7141c494fd8db273cf637a17af53674b2fLennart Poettering
0d4c4b7141c494fd8db273cf637a17af53674b2fLennart Poettering#define new0(t, n) ((t*) calloc((n), sizeof(t)))
3efc8c72f02423ece08b5c4d5c812420092cc10aLennart Poettering
3efc8c72f02423ece08b5c4d5c812420092cc10aLennart Poettering#define malloc0(n) (calloc((n), 1))
06ce859b5856eacee61a3f47c63c173a4e38c505Lennart Poettering
03364e472bccf64544e3a0d36d09f90c78f9f699Lennart Poetteringstatic inline const char* yes_no(bool b) {
03364e472bccf64544e3a0d36d09f90c78f9f699Lennart Poettering return b ? "yes" : "no";
03364e472bccf64544e3a0d36d09f90c78f9f699Lennart Poettering}
03364e472bccf64544e3a0d36d09f90c78f9f699Lennart Poettering
03364e472bccf64544e3a0d36d09f90c78f9f699Lennart Poetteringstatic inline const char* strempty(const char *s) {
03364e472bccf64544e3a0d36d09f90c78f9f699Lennart Poettering return s ? s : "";
573831165360e89a880f90627753962ab28c4f37Lennart Poettering}
e6a26d8c972d45a0927ad0b7c654c830daa2243eLennart Poettering
e6a26d8c972d45a0927ad0b7c654c830daa2243eLennart Poetteringstatic inline const char* strnull(const char *s) {
1361205099406d2a19d64547448638a6b665af81Lennart Poettering return s ? s : "(null)";
1361205099406d2a19d64547448638a6b665af81Lennart Poettering}
a2088fd025deb90839c909829e27eece40f7fce4Lennart Poettering
a2088fd025deb90839c909829e27eece40f7fce4Lennart Poetteringstatic inline const char *strna(const char *s) {
a2088fd025deb90839c909829e27eece40f7fce4Lennart Poettering return s ? s : "n/a";
a2088fd025deb90839c909829e27eece40f7fce4Lennart Poettering}
a2088fd025deb90839c909829e27eece40f7fce4Lennart Poettering
a2088fd025deb90839c909829e27eece40f7fce4Lennart Poetteringstatic inline bool is_path_absolute(const char *p) {
a2088fd025deb90839c909829e27eece40f7fce4Lennart Poettering return *p == '/';
eedb4ac83158bad6f74305612660b4aff6acc6b4Lennart Poettering}
eedb4ac83158bad6f74305612660b4aff6acc6b4Lennart Poettering
203e81db24ccb9b4dcb0b1bad0ba554116267d20Lennart Poetteringbool endswith(const char *s, const char *postfix);
203e81db24ccb9b4dcb0b1bad0ba554116267d20Lennart Poetteringbool startswith(const char *s, const char *prefix);
63432f5d9570b76a8efe82702d69611c20645530Lennart Poettering
63432f5d9570b76a8efe82702d69611c20645530Lennart Poetteringbool first_word(const char *s, const char *word);
dcd12626734ce81e89c74515eaca601ef9edf785Lennart Poettering
dcd12626734ce81e89c74515eaca601ef9edf785Lennart Poetteringint close_nointr(int fd);
dcd12626734ce81e89c74515eaca601ef9edf785Lennart Poetteringvoid close_nointr_nofail(int fd);
8aa203819fc7f2a840191f8d9d0e65566c0ce98eLennart Poettering
8aa203819fc7f2a840191f8d9d0e65566c0ce98eLennart Poetteringint parse_boolean(const char *v);
b18d23d7ac6a53d52b99dbf0b2048d5a946a2e28Lennart Poettering
b18d23d7ac6a53d52b99dbf0b2048d5a946a2e28Lennart Poetteringint safe_atou(const char *s, unsigned *ret_u);
449a22a58f0fa55d9d0fd2eb597272446e032acdLennart Poetteringint safe_atoi(const char *s, int *ret_i);
449a22a58f0fa55d9d0fd2eb597272446e032acdLennart Poettering
449a22a58f0fa55d9d0fd2eb597272446e032acdLennart Poetteringint safe_atolu(const char *s, unsigned long *ret_u);
449a22a58f0fa55d9d0fd2eb597272446e032acdLennart Poetteringint safe_atoli(const char *s, long int *ret_i);
60d17b74d714fa15d68639062dc2932d7b096229Lennart Poettering
60d17b74d714fa15d68639062dc2932d7b096229Lennart Poetteringint safe_atollu(const char *s, unsigned long long *ret_u);
60d17b74d714fa15d68639062dc2932d7b096229Lennart Poetteringint safe_atolli(const char *s, long long int *ret_i);
60d17b74d714fa15d68639062dc2932d7b096229Lennart Poettering
60d17b74d714fa15d68639062dc2932d7b096229Lennart Poetteringchar *split(const char *c, size_t *l, const char *separator, char **state);
2f653bded321fc2271edcda43d54fcc3e6c20dc9Lennart Poetteringchar *split_quoted(const char *c, size_t *l, char **state);
2f653bded321fc2271edcda43d54fcc3e6c20dc9Lennart Poettering
2f653bded321fc2271edcda43d54fcc3e6c20dc9Lennart Poettering#define FOREACH_WORD(word, length, s, state) \
477e75ef9ea6bb2e7e8cc76278c442942110f227Lennart Poettering for ((state) = NULL, (word) = split((s), &(length), WHITESPACE, &(state)); (word); (word) = split((s), &(length), WHITESPACE, &(state)))
477e75ef9ea6bb2e7e8cc76278c442942110f227Lennart Poettering
477e75ef9ea6bb2e7e8cc76278c442942110f227Lennart Poettering#define FOREACH_WORD_SEPARATOR(word, length, s, separator, state) \
477e75ef9ea6bb2e7e8cc76278c442942110f227Lennart Poettering for ((state) = NULL, (word) = split((s), &(length), (separator), &(state)); (word); (word) = split((s), &(length), (separator), &(state)))
477e75ef9ea6bb2e7e8cc76278c442942110f227Lennart Poettering
477e75ef9ea6bb2e7e8cc76278c442942110f227Lennart Poettering#define FOREACH_WORD_QUOTED(word, length, s, state) \
2bc39683c0cada86c9dc39e5f3d0ea475cf12e57Lennart Poettering for ((state) = NULL, (word) = split_quoted((s), &(length), &(state)); (word); (word) = split_quoted((s), &(length), &(state)))
2bc39683c0cada86c9dc39e5f3d0ea475cf12e57Lennart Poettering
2bc39683c0cada86c9dc39e5f3d0ea475cf12e57Lennart Poetteringchar **split_path_and_make_absolute(const char *p);
17fe56148c44dfa5583a8643c1918fd6eccf2aeeLennart Poettering
17fe56148c44dfa5583a8643c1918fd6eccf2aeeLennart Poetteringpid_t get_parent_of_pid(pid_t pid, pid_t *ppid);
39609489ca9925f94fdd4ef12a8b3d5ee2e14dddLennart Poettering
c14db9b32ab90738973071d31f259d1a457d7b4aLennart Poetteringint write_one_line_file(const char *fn, const char *line);
c3a0d00d6dd6f5997d673e133ef6f9f856550b0aLennart Poetteringint read_one_line_file(const char *fn, char **line);
c3a0d00d6dd6f5997d673e133ef6f9f856550b0aLennart Poettering
c3a0d00d6dd6f5997d673e133ef6f9f856550b0aLennart Poetteringchar *strappend(const char *s, const char *suffix);
c3a0d00d6dd6f5997d673e133ef6f9f856550b0aLennart Poettering
82e6c50c473f4be8df77c7a510577f1975eedddbLennart Poetteringint readlink_malloc(const char *p, char **r);
82e6c50c473f4be8df77c7a510577f1975eedddbLennart Poettering
d2f81fb00cc3c49e21b31000ba7d37b81a260257Lennart Poetteringchar *file_name_from_path(const char *p);
d2f81fb00cc3c49e21b31000ba7d37b81a260257Lennart Poetteringbool is_path(const char *p);
98cd2651988619bf606f0b27825440c4638a7e0bLennart Poettering
2a441c8afe7c81f74cc2ceccdf9a71301cd39d4dLennart Poetteringbool path_is_absolute(const char *p);
2a441c8afe7c81f74cc2ceccdf9a71301cd39d4dLennart Poetteringchar *path_make_absolute(const char *p, const char *prefix);
2a441c8afe7c81f74cc2ceccdf9a71301cd39d4dLennart Poetteringchar *path_make_absolute_cwd(const char *p);
2a441c8afe7c81f74cc2ceccdf9a71301cd39d4dLennart Poetteringchar **strv_path_make_absolute_cwd(char **l);
2a441c8afe7c81f74cc2ceccdf9a71301cd39d4dLennart Poettering
0a86c1a9d8066267b878dfeddc5e0087dda6a37bLennart Poetteringint reset_all_signal_handlers(void);
0a86c1a9d8066267b878dfeddc5e0087dda6a37bLennart Poettering
0a86c1a9d8066267b878dfeddc5e0087dda6a37bLennart Poetteringchar *strstrip(char *s);
0a86c1a9d8066267b878dfeddc5e0087dda6a37bLennart Poetteringchar *delete_chars(char *s, const char *bad);
0a86c1a9d8066267b878dfeddc5e0087dda6a37bLennart Poetteringchar *truncate_nl(char *s);
0a86c1a9d8066267b878dfeddc5e0087dda6a37bLennart Poettering
e3286870fdf20c3c93e944b24fd9af53620f7dbaLennart Poetteringchar *file_in_same_dir(const char *path, const char *filename);
e3286870fdf20c3c93e944b24fd9af53620f7dbaLennart Poetteringint mkdir_parents(const char *path, mode_t mode);
e3286870fdf20c3c93e944b24fd9af53620f7dbaLennart Poetteringint mkdir_p(const char *path, mode_t mode);
e3286870fdf20c3c93e944b24fd9af53620f7dbaLennart Poettering
8514b67754c5ff7fa628929b3d27131010c21842Lennart Poetteringint get_process_name(pid_t pid, char **name);
8514b67754c5ff7fa628929b3d27131010c21842Lennart Poettering
7b0fce617c48eda32b2d4e04b5f0e4376e8c0106Lennart Poetteringchar hexchar(int x);
7b0fce617c48eda32b2d4e04b5f0e4376e8c0106Lennart Poetteringint unhexchar(char c);
7b0fce617c48eda32b2d4e04b5f0e4376e8c0106Lennart Poetteringchar octchar(int x);
7b0fce617c48eda32b2d4e04b5f0e4376e8c0106Lennart Poetteringint unoctchar(char c);
7b0fce617c48eda32b2d4e04b5f0e4376e8c0106Lennart Poetteringchar decchar(int x);
b568ef14a75dffb7182e0acbdec743b31df2a597Lennart Poetteringint undecchar(char c);
c2d5b3c94d0c082ef29597fb230f8b88b124bab8Lennart Poettering
7e27f3121e5a10629302b5221eb21345f832724aLennart Poetteringchar *cescape(const char *s);
7e27f3121e5a10629302b5221eb21345f832724aLennart Poetteringchar *cunescape(const char *s);
d48b7bd271b1e70924c8485d2f95c2f5a1ae77cbLennart Poettering
d48b7bd271b1e70924c8485d2f95c2f5a1ae77cbLennart Poetteringchar *path_kill_slashes(char *path);
758c4d7a391c0e024737053c815bf3924653b8c5Lennart Poettering
758c4d7a391c0e024737053c815bf3924653b8c5Lennart Poetteringbool path_startswith(const char *path, const char *prefix);
821cc13ddae40fb7608458b44aaa7a3fd33d56d9Lennart Poetteringbool path_equal(const char *a, const char *b);
821cc13ddae40fb7608458b44aaa7a3fd33d56d9Lennart Poettering
8483d73ff158ee0d51ccbba09a470cc6ae9b071aLennart Poetteringchar *ascii_strlower(char *path);
8483d73ff158ee0d51ccbba09a470cc6ae9b071aLennart Poettering
8483d73ff158ee0d51ccbba09a470cc6ae9b071aLennart Poetteringchar *xescape(const char *s, const char *bad);
8483d73ff158ee0d51ccbba09a470cc6ae9b071aLennart Poettering
8483d73ff158ee0d51ccbba09a470cc6ae9b071aLennart Poetteringchar *bus_path_escape(const char *s);
25e773eeb4f853804e1bf0dbd9a184f23e9b2a97Kay Sieverschar *bus_path_unescape(const char *s);
b857e042d621ffb98a652f33850b431fafbece43Lennart Poettering
6dab5bb18151c80fc39bd51f03dcff40b920de3eLennart Poetteringbool ignore_file(const char *filename);
6dab5bb18151c80fc39bd51f03dcff40b920de3eLennart Poettering
3bcde97e8502c48b53f7420e2433ca68e601662dLennart Poetteringbool chars_intersect(const char *a, const char *b);
3bcde97e8502c48b53f7420e2433ca68e601662dLennart Poettering
279f036675536d55c901562b49f9df146af1a0e3Lennart Poetteringchar *format_timestamp(char *buf, size_t l, usec_t t);
533bb267f13e2f7b4d7b78de30e821dc81c82335Lennart Poettering
b42de08aa4c97636e42c28c7bce08f0d7c2a719aZbigniew Jędrzejewski-Szmek#define DEFINE_STRING_TABLE_LOOKUP(name,type) \
b42de08aa4c97636e42c28c7bce08f0d7c2a719aZbigniew Jędrzejewski-Szmek const char *name##_to_string(type i) { \
b42de08aa4c97636e42c28c7bce08f0d7c2a719aZbigniew Jędrzejewski-Szmek if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \
b42de08aa4c97636e42c28c7bce08f0d7c2a719aZbigniew Jędrzejewski-Szmek return NULL; \
202aea456dfb279cd34da7bfd1880f6ac0fd849fLennart Poettering return name##_table[i]; \
42aeb14a4a0fa7d43da96a8ed0fb0e180a2dd5c8Lennart Poettering } \
42aeb14a4a0fa7d43da96a8ed0fb0e180a2dd5c8Lennart Poettering type name##_from_string(const char *s) { \
e25b5a8d7380a86ea717b4038c45a8f882b1a2aeDavid Herrmann type i; \
e25b5a8d7380a86ea717b4038c45a8f882b1a2aeDavid Herrmann unsigned u = 0; \
6868560773ada8ea31d1f86422be6bf026a1f660Richard Maw assert(s); \
14a32924c9b46817c92ae11c1147a59dcb62012bLennart Poettering for (i = 0; i < (type)ELEMENTSOF(name##_table); i++) \
14a32924c9b46817c92ae11c1147a59dcb62012bLennart Poettering if (streq(name##_table[i], s)) \
14a32924c9b46817c92ae11c1147a59dcb62012bLennart Poettering return i; \
563b1bdc09efe0cf94dd3f514f30376ca854c1ceLennart Poettering if (safe_atou(s, &u) >= 0 && \
563b1bdc09efe0cf94dd3f514f30376ca854c1ceLennart Poettering u < ELEMENTSOF(name##_table)) \
5dcf983854c2e8314dbee239180255490ec8ae1cLennart Poettering return (type) u; \
5dcf983854c2e8314dbee239180255490ec8ae1cLennart Poettering return (type) -1; \
5dcf983854c2e8314dbee239180255490ec8ae1cLennart Poettering } \
6bd7941ece602ae9962a103c8d65ecda7d642391Tom Gundersen struct __useless_struct_to_allow_trailing_semicolon__
6bd7941ece602ae9962a103c8d65ecda7d642391Tom Gundersen
6bd7941ece602ae9962a103c8d65ecda7d642391Tom Gundersen
9d6db739ce1eaa3eace21801fd606d523b73c8f4Lennart Poetteringint fd_nonblock(int fd, bool nonblock);
1dbe0a6efda7b1d35957eab7e1d56a2c69d806d9Lennart Poetteringint fd_cloexec(int fd, bool cloexec);
1dbe0a6efda7b1d35957eab7e1d56a2c69d806d9Lennart Poettering
9d6db739ce1eaa3eace21801fd606d523b73c8f4Lennart Poetteringint close_all_fds(const int except[], unsigned n_except);
ff3d6560bead6879a2fed1bf99bfe8273b3723f1Zbigniew Jędrzejewski-Szmek
2250592422ad1c2a9ac3894823caab0e61363398Tom Gundersenbool fstype_is_network(const char *fstype);
9d6db739ce1eaa3eace21801fd606d523b73c8f4Lennart Poettering
ccc3e8a104b8ccabb2cde99cc18ed5ac5a8ad883Lennart Poetteringint chvt(int vt);
ccc3e8a104b8ccabb2cde99cc18ed5ac5a8ad883Lennart Poettering
ccc3e8a104b8ccabb2cde99cc18ed5ac5a8ad883Lennart Poetteringint read_one_char(FILE *f, char *ret, bool *need_nl);
0f47ed0a052c0da743404f23ac3532aaabd23655Lennart Poetteringint ask(char *ret, const char *replies, const char *text, ...);
9d6db739ce1eaa3eace21801fd606d523b73c8f4Lennart Poettering
e25b5a8d7380a86ea717b4038c45a8f882b1a2aeDavid Herrmannint reset_terminal(int fd);
e25b5a8d7380a86ea717b4038c45a8f882b1a2aeDavid Herrmannint open_terminal(const char *name, int mode);
e25b5a8d7380a86ea717b4038c45a8f882b1a2aeDavid Herrmannint acquire_terminal(const char *name, bool fail, bool force);
ccc3e8a104b8ccabb2cde99cc18ed5ac5a8ad883Lennart Poetteringint release_terminal(void);
3f77a1b19f5a8ce33566f7f6e28e94c08ea30841Kay Sievers
e25b5a8d7380a86ea717b4038c45a8f882b1a2aeDavid Herrmannint flush_fd(int fd);
e2a69298819b58f008be61d314f8ab95ccaec427Lennart Poettering
2834ffe78d7fd8be118429aa1449ac72641638c2Lennart Poetteringint ignore_signal(int sig);
2834ffe78d7fd8be118429aa1449ac72641638c2Lennart Poettering
a940778fb1dd16479f455bab3ac6cbdbc5b06165Lennart Poetteringint close_pipe(int p[]);
a940778fb1dd16479f455bab3ac6cbdbc5b06165Lennart Poettering
a01647e53727107d82382bc5c9d98c894e8f386cLennart Poetteringssize_t loop_read(int fd, void *buf, size_t nbytes);
3c779fa59d1825d7db2a9516669d34ded7916913Lennart Poettering
a940778fb1dd16479f455bab3ac6cbdbc5b06165Lennart Poetteringint path_is_mount_point(const char *path);
a01647e53727107d82382bc5c9d98c894e8f386cLennart Poettering
3de03738fc970496d2d3da668c72767a48ccc41bLennart Poetteringextern char * __progname;
3de03738fc970496d2d3da668c72767a48ccc41bLennart Poettering
37efac5ddb21fd91ed420c070ed07f375e78b3b9Lennart Poetteringconst char *ioprio_class_to_string(int i);
37efac5ddb21fd91ed420c070ed07f375e78b3b9Lennart Poetteringint ioprio_class_from_string(const char *s);
7348b3adb324614132cf376f478e883bd7de28f1Lennart Poettering
7348b3adb324614132cf376f478e883bd7de28f1Lennart Poetteringconst char *sigchld_code_to_string(int i);
e107ed185ef08945102834234a05ec51bb438685Lennart Poetteringint sigchld_code_from_string(const char *s);
e107ed185ef08945102834234a05ec51bb438685Lennart Poettering
81429136905a6204875174b60a179333b7f3c9e4Kay Sieversconst char *log_facility_to_string(int i);
81429136905a6204875174b60a179333b7f3c9e4Kay Sieversint log_facility_from_string(const char *s);
e107ed185ef08945102834234a05ec51bb438685Lennart Poettering
f598ac3e28b729dd0b1d0a881df3e16465687a2bLennart Poetteringconst char *log_level_to_string(int i);
11fb37f16ed99c1603c9d770b60ce4953b96a58dLennart Poetteringint log_level_from_string(const char *s);
edb2935c5c5b95c42b8679086f60da5eafad74cbLennart Poettering
edb2935c5c5b95c42b8679086f60da5eafad74cbLennart Poetteringconst char *sched_policy_to_string(int i);
6a3f892a23db71544d0439355f96c44350dafa8fLennart Poetteringint sched_policy_from_string(const char *s);
2a781fc9bd33982c81e5ff75974a442a33d4f167Lennart Poettering
2a781fc9bd33982c81e5ff75974a442a33d4f167Lennart Poetteringconst char *rlimit_to_string(int i);
6a3f892a23db71544d0439355f96c44350dafa8fLennart Poetteringint rlimit_from_string(const char *s);
6a3f892a23db71544d0439355f96c44350dafa8fLennart Poettering
650264033f2f98f6319513958d94d59078654af8Lennart Poettering#endif
650264033f2f98f6319513958d94d59078654af8Lennart Poettering