chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use more _cleanup_ macro
[elogind.git]
/
src
/
shared
/
util.h
diff --git
a/src/shared/util.h
b/src/shared/util.h
index f2ce4f0d6ede6a1bd4bf61ab94c5c69c9f2a28dd..6ad43cd2749db490efc0fef6ee223f5ad168881f 100644
(file)
--- a/
src/shared/util.h
+++ b/
src/shared/util.h
@@
-252,6
+252,7
@@
char *strnappend(const char *s, const char *suffix, size_t length);
char *replace_env(const char *format, char **env);
char **replace_env_argv(char **argv, char **env);
char *replace_env(const char *format, char **env);
char **replace_env_argv(char **argv, char **env);
+int readlinkat_malloc(int fd, const char *p, char **ret);
int readlink_malloc(const char *p, char **r);
int readlink_and_make_absolute(const char *p, char **r);
int readlink_and_canonicalize(const char *p, char **r);
int readlink_malloc(const char *p, char **r);
int readlink_and_make_absolute(const char *p, char **r);
int readlink_and_canonicalize(const char *p, char **r);
@@
-478,6
+479,7
@@
char *ellipsize(const char *s, size_t length, unsigned percent);
/* bytes columns */
char *ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigned percent);
/* bytes columns */
char *ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigned percent);
+int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode);
int touch(const char *path);
char *unquote(const char *s, const char *quotes);
int touch(const char *path);
char *unquote(const char *s, const char *quotes);
@@
-520,9
+522,9
@@
int terminal_vhangup(const char *name);
int vt_disallocate(const char *name);
int vt_disallocate(const char *name);
-int copy_file(const char *from, const char *to, int flags);
-
int symlink_atomic(const char *from, const char *to);
int symlink_atomic(const char *from, const char *to);
+int mknod_atomic(const char *path, mode_t mode, dev_t dev);
+int mkfifo_atomic(const char *path, mode_t mode);
int fchmod_umask(int fd, mode_t mode);
int fchmod_umask(int fd, mode_t mode);
@@
-543,7
+545,6
@@
int glob_extend(char ***strv, const char *path);
int dirent_ensure_type(DIR *d, struct dirent *de);
int dirent_ensure_type(DIR *d, struct dirent *de);
-int in_search_path(const char *path, char **search);
int get_files_in_directory(const char *path, char ***list);
char *strjoin(const char *x, ...) _sentinel_;
int get_files_in_directory(const char *path, char ***list);
char *strjoin(const char *x, ...) _sentinel_;
@@
-666,14
+667,21
@@
DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, endmntent);
#define _cleanup_close_pair_ _cleanup_(close_pairp)
_malloc_ _alloc_(1, 2) static inline void *malloc_multiply(size_t a, size_t b) {
#define _cleanup_close_pair_ _cleanup_(close_pairp)
_malloc_ _alloc_(1, 2) static inline void *malloc_multiply(size_t a, size_t b) {
- if (_unlikely_(b
== 0 ||
a > ((size_t) -1) / b))
+ if (_unlikely_(b
!= 0 &&
a > ((size_t) -1) / b))
return NULL;
return malloc(a * b);
}
return NULL;
return malloc(a * b);
}
+_alloc_(2, 3) static inline void *realloc_multiply(void *p, size_t a, size_t b) {
+ if (_unlikely_(b != 0 && a > ((size_t) -1) / b))
+ return NULL;
+
+ return realloc(p, a * b);
+}
+
_alloc_(2, 3) static inline void *memdup_multiply(const void *p, size_t a, size_t b) {
_alloc_(2, 3) static inline void *memdup_multiply(const void *p, size_t a, size_t b) {
- if (_unlikely_(b
== 0 ||
a > ((size_t) -1) / b))
+ if (_unlikely_(b
!= 0 &&
a > ((size_t) -1) / b))
return NULL;
return memdup(p, a * b);
return NULL;
return memdup(p, a * b);
@@
-705,6
+713,7
@@
typedef enum DrawSpecialChar {
DRAW_TRIANGULAR_BULLET,
DRAW_BLACK_CIRCLE,
DRAW_ARROW,
DRAW_TRIANGULAR_BULLET,
DRAW_BLACK_CIRCLE,
DRAW_ARROW,
+ DRAW_DASH,
_DRAW_SPECIAL_CHAR_MAX
} DrawSpecialChar;
_DRAW_SPECIAL_CHAR_MAX
} DrawSpecialChar;
@@
-910,8
+919,8
@@
int parse_proc_cmdline(int (*parse_word)(const char *key, const char *value));
int container_get_leader(const char *machine, pid_t *pid);
int container_get_leader(const char *machine, pid_t *pid);
-int namespace_open(pid_t pid, int *pidns_fd, int *mntns_fd, int *root_fd);
-int namespace_enter(int pidns_fd, int mntns_fd, int root_fd);
+int namespace_open(pid_t pid, int *pidns_fd, int *mntns_fd, int *
netns_fd, int *
root_fd);
+int namespace_enter(int pidns_fd, int mntns_fd, int
netns_fd, int
root_fd);
bool pid_is_alive(pid_t pid);
bool pid_is_unwaited(pid_t pid);
bool pid_is_alive(pid_t pid);
bool pid_is_unwaited(pid_t pid);
@@
-941,3
+950,12
@@
union file_handle_union {
};
int update_reboot_param_file(const char *param);
};
int update_reboot_param_file(const char *param);
+
+int umount_recursive(const char *target, int flags);
+
+int bind_remount_recursive(const char *prefix, bool ro);
+
+int fflush_and_check(FILE *f);
+
+char *tempfn_xxxxxx(const char *p);
+char *tempfn_random(const char *p);