chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rtnl: drop "sd_" prefix from cleanup macros
[elogind.git]
/
src
/
shared
/
util.h
diff --git
a/src/shared/util.h
b/src/shared/util.h
index d6d746bc6a506386b7a33f1902f07756a8356d78..9aea3a4e505ffe59b616e13fb2aabd67f2ad86bf 100644
(file)
--- a/
src/shared/util.h
+++ b/
src/shared/util.h
@@
-272,6
+272,7
@@
int make_stdio(int fd);
int make_null_stdio(void);
int make_console_stdio(void);
int make_null_stdio(void);
int make_console_stdio(void);
+int dev_urandom(void *p, size_t n);
void random_bytes(void *p, size_t n);
static inline uint64_t random_u64(void) {
void random_bytes(void *p, size_t n);
static inline uint64_t random_u64(void) {
@@
-742,7
+743,19
@@
static inline void _reset_umask_(struct _umask_struct_ *s) {
_saved_umask_.quit = true)
static inline unsigned u64log2(uint64_t n) {
_saved_umask_.quit = true)
static inline unsigned u64log2(uint64_t n) {
+#if __SIZEOF_LONG_LONG__ == 8
return (n > 1) ? (unsigned) __builtin_clzll(n) ^ 63U : 0;
return (n > 1) ? (unsigned) __builtin_clzll(n) ^ 63U : 0;
+#else
+#error "Wut?"
+#endif
+}
+
+static inline unsigned u32ctz(uint32_t n) {
+#if __SIZEOF_INT__ == 4
+ return __builtin_ctz(n);
+#else
+#error "Wut?"
+#endif
}
static inline bool logind_running(void) {
}
static inline bool logind_running(void) {
@@
-820,7
+833,6
@@
static inline void _reset_locale_(struct _locale_struct_ *s) {
_saved_locale_.quit = true)
bool id128_is_valid(const char *s) _pure_;
_saved_locale_.quit = true)
bool id128_is_valid(const char *s) _pure_;
-void parse_user_at_host(char *arg, char **user, char **host);
int split_pair(const char *s, const char *sep, char **l, char **r);
int split_pair(const char *s, const char *sep, char **l, char **r);
@@
-849,3
+861,10
@@
bool pid_valid(pid_t pid);
int getpeercred(int fd, struct ucred *ucred);
int getpeersec(int fd, char **ret);
int getpeercred(int fd, struct ucred *ucred);
int getpeersec(int fd, char **ret);
+
+int writev_safe(int fd, const struct iovec *w, int j);
+
+int mkostemp_safe(char *pattern, int flags);
+int open_tmpfile(const char *path, int flags);
+
+int fd_warn_permissions(const char *path, int fd);