X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=src%2Fshared%2Futil.h;h=f726263dd329712012050c3884701779043aad6c;hb=6524990fdc98370ecba5d9f73e67161e8798c010;hp=77d28751f0a40937e455748542c6480e0cac074d;hpb=8c7c140fcab0592735d22168657a143969a4c2bf;p=elogind.git diff --git a/src/shared/util.h b/src/shared/util.h index 77d28751f..f726263dd 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -79,7 +79,7 @@ union dirent_storage { #define QUOTES "\"\'" #define COMMENTS "#;\n" -#define FORMAT_TIMESTAMP_MAX 64 +#define FORMAT_TIMESTAMP_MAX (5+11+9+4+1) #define FORMAT_TIMESTAMP_PRETTY_MAX 256 #define FORMAT_TIMESPAN_MAX 64 #define FORMAT_BYTES_MAX 8 @@ -142,8 +142,8 @@ static inline bool isempty(const char *p) { } char *endswith(const char *s, const char *postfix); -bool startswith(const char *s, const char *prefix); -bool startswith_no_case(const char *s, const char *prefix); +char *startswith(const char *s, const char *prefix); +char *startswith_no_case(const char *s, const char *prefix); bool first_word(const char *s, const char *word); @@ -529,6 +529,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim); int getenv_for_pid(pid_t pid, const char *field, char **_value); int can_sleep(const char *type); +int can_sleep_disk(const char *type); bool is_valid_documentation_url(const char *url); @@ -563,3 +564,7 @@ bool filename_is_safe(const char *p); bool string_is_safe(const char *p); int parse_timestamp(const char *t, usec_t *usec); + +void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size, + int (*compar) (const void *, const void *, void *), + void *arg);