chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
manager: get rid of destinction between running_as=system and running_as=init, as...
[elogind.git]
/
src
/
util.h
diff --git
a/src/util.h
b/src/util.h
index ccb976925638bae4a0a6529eb567144b0b43dd23..9af2ca8ae65421576210c8a7c6efae14a9e20be2 100644
(file)
--- a/
src/util.h
+++ b/
src/util.h
@@
-32,6
+32,11
@@
typedef uint64_t usec_t;
typedef uint64_t usec_t;
+typedef struct timestamp {
+ usec_t realtime;
+ usec_t monotonic;
+} timestamp;
+
#define MSEC_PER_SEC 1000ULL
#define USEC_PER_SEC 1000000ULL
#define USEC_PER_MSEC 1000ULL
#define MSEC_PER_SEC 1000ULL
#define USEC_PER_SEC 1000000ULL
#define USEC_PER_MSEC 1000ULL
@@
-49,9
+54,12
@@
typedef uint64_t usec_t;
#define NEWLINE "\n\r"
#define FORMAT_TIMESTAMP_MAX 64
#define NEWLINE "\n\r"
#define FORMAT_TIMESTAMP_MAX 64
+#define FORMAT_TIMESPAN_MAX 64
usec_t now(clockid_t clock);
usec_t now(clockid_t clock);
+timestamp* timestamp_get(timestamp *ts);
+
usec_t timespec_load(const struct timespec *ts);
struct timespec *timespec_store(struct timespec *ts, usec_t u);
usec_t timespec_load(const struct timespec *ts);
struct timespec *timespec_store(struct timespec *ts, usec_t u);
@@
-96,9
+104,11
@@
bool first_word(const char *s, const char *word);
int close_nointr(int fd);
void close_nointr_nofail(int fd);
int close_nointr(int fd);
void close_nointr_nofail(int fd);
+void close_many(const int fds[], unsigned n_fd);
int parse_boolean(const char *v);
int parse_usec(const char *t, usec_t *usec);
int parse_boolean(const char *v);
int parse_usec(const char *t, usec_t *usec);
+int parse_pid(const char *s, pid_t* ret_pid);
int safe_atou(const char *s, unsigned *ret_u);
int safe_atoi(const char *s, int *ret_i);
int safe_atou(const char *s, unsigned *ret_u);
int safe_atoi(const char *s, int *ret_i);
@@
-131,6
+141,7
@@
int read_one_line_file(const char *fn, char **line);
char *strappend(const char *s, const char *suffix);
int readlink_malloc(const char *p, char **r);
char *strappend(const char *s, const char *suffix);
int readlink_malloc(const char *p, char **r);
+int readlink_and_make_absolute(const char *p, char **r);
char *file_name_from_path(const char *p);
bool is_path(const char *p);
char *file_name_from_path(const char *p);
bool is_path(const char *p);
@@
-152,6
+163,8
@@
char *file_in_same_dir(const char *path, const char *filename);
int mkdir_parents(const char *path, mode_t mode);
int mkdir_p(const char *path, mode_t mode);
int mkdir_parents(const char *path, mode_t mode);
int mkdir_p(const char *path, mode_t mode);
+int rmdir_parents(const char *path, const char *stop);
+
int get_process_name(pid_t pid, char **name);
char hexchar(int x);
int get_process_name(pid_t pid, char **name);
char hexchar(int x);
@@
-181,11
+194,14
@@
bool ignore_file(const char *filename);
bool chars_intersect(const char *a, const char *b);
char *format_timestamp(char *buf, size_t l, usec_t t);
bool chars_intersect(const char *a, const char *b);
char *format_timestamp(char *buf, size_t l, usec_t t);
+char *format_timespan(char *buf, size_t l, usec_t t);
int make_stdio(int fd);
bool is_clean_exit(int code, int status);
int make_stdio(int fd);
bool is_clean_exit(int code, int status);
+unsigned long long random_ull(void);
+
#define DEFINE_STRING_TABLE_LOOKUP(name,type) \
const char *name##_to_string(type i) { \
if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \
#define DEFINE_STRING_TABLE_LOOKUP(name,type) \
const char *name##_to_string(type i) { \
if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \
@@
-232,13
+248,22
@@
int sigaction_many(const struct sigaction *sa, ...);
int close_pipe(int p[]);
int close_pipe(int p[]);
-ssize_t loop_read(int fd, void *buf, size_t nbytes);
+ssize_t loop_read(int fd, void *buf, size_t nbytes, bool do_poll);
+ssize_t loop_write(int fd, const void *buf, size_t nbytes, bool do_poll);
int path_is_mount_point(const char *path);
bool is_device_path(const char *path);
int path_is_mount_point(const char *path);
bool is_device_path(const char *path);
-extern char * __progname;
+int dir_is_empty(const char *path);
+
+void rename_process(const char name[8]);
+
+void sigset_add_many(sigset_t *ss, ...);
+
+char* gethostname_malloc(void);
+char* getlogname_malloc(void);
+char *getttyname_malloc(void);
const char *ioprio_class_to_string(int i);
int ioprio_class_from_string(const char *s);
const char *ioprio_class_to_string(int i);
int ioprio_class_from_string(const char *s);