chiark / gitweb /
Prep v228: Clean up the new src/basic/*-util-[hc] files:
authorSven Eden <yamakuzure@gmx.net>
Fri, 7 Apr 2017 07:40:54 +0000 (09:40 +0200)
committerSven Eden <yamakuzure@gmx.net>
Wed, 26 Apr 2017 10:59:13 +0000 (12:59 +0200)
- src/basic/capability-util.[hc]
- src/basic/cgroup-util.[hc]
- src/basic/fd-util.[hc]
- src/basic/fs-util.[hc]
- src/basic/memfd-util.[hc]
- src/basic/path-util.[hc]
- src/basic/socket-util.[hc]
- src/basic/terminal-util.[hc]
- src/basic/user-util.[hc]
- src/basic/xattr-util.[hc]

19 files changed:
src/basic/capability-util.c
src/basic/capability-util.h
src/basic/cgroup-util.h
src/basic/fd-util.c
src/basic/fd-util.h
src/basic/fs-util.c
src/basic/fs-util.h
src/basic/memfd-util.c
src/basic/memfd-util.h
src/basic/path-util.c
src/basic/path-util.h
src/basic/socket-util.c
src/basic/socket-util.h
src/basic/terminal-util.c
src/basic/terminal-util.h
src/basic/user-util.c
src/basic/user-util.h
src/basic/xattr-util.c
src/basic/xattr-util.h

index 0eb5c03d65601f6f457675f30564c084b0c5c80f..e261e4613c1a769b5bac3346457d244d242a84db 100644 (file)
@@ -34,6 +34,8 @@
 #include "parse-util.h"
 #include "util.h"
 
 #include "parse-util.h"
 #include "util.h"
 
+/// UNNEEDED by elogind
+#if 0
 int have_effective_cap(int value) {
         _cleanup_cap_free_ cap_t cap;
         cap_flag_value_t fv;
 int have_effective_cap(int value) {
         _cleanup_cap_free_ cap_t cap;
         cap_flag_value_t fv;
@@ -47,6 +49,7 @@ int have_effective_cap(int value) {
         else
                 return fv == CAP_SET;
 }
         else
                 return fv == CAP_SET;
 }
+#endif // 0
 
 unsigned long cap_last_cap(void) {
         static thread_local unsigned long saved;
 
 unsigned long cap_last_cap(void) {
         static thread_local unsigned long saved;
@@ -95,6 +98,8 @@ unsigned long cap_last_cap(void) {
         return p;
 }
 
         return p;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int capability_bounding_set_drop(uint64_t drop, bool right_now) {
         _cleanup_cap_free_ cap_t after_cap = NULL;
         cap_flag_value_t fv;
 int capability_bounding_set_drop(uint64_t drop, bool right_now) {
         _cleanup_cap_free_ cap_t after_cap = NULL;
         cap_flag_value_t fv;
@@ -305,3 +310,4 @@ int drop_capability(cap_value_t cv) {
 
         return 0;
 }
 
         return 0;
 }
+#endif // 0
index 4eb5c2a835d60c55a4395682943e546e86e6593f..3f6c988f617912634d11ebdfd91dec140451a09f 100644 (file)
 #include "util.h"
 
 unsigned long cap_last_cap(void);
 #include "util.h"
 
 unsigned long cap_last_cap(void);
-int have_effective_cap(int value);
-int capability_bounding_set_drop(uint64_t drop, bool right_now);
-int capability_bounding_set_drop_usermode(uint64_t drop);
+// UNNEEDED int have_effective_cap(int value);
+// UNNEEDED int capability_bounding_set_drop(uint64_t drop, bool right_now);
+// UNNEEDED int capability_bounding_set_drop_usermode(uint64_t drop);
 
 
-int drop_privileges(uid_t uid, gid_t gid, uint64_t keep_capabilities);
+// UNNEEDED int drop_privileges(uid_t uid, gid_t gid, uint64_t keep_capabilities);
 
 
-int drop_capability(cap_value_t cv);
+// UNNEEDED int drop_capability(cap_value_t cv);
 
 
+/// UNNEEDED by elogind
+#if 0
 DEFINE_TRIVIAL_CLEANUP_FUNC(cap_t, cap_free);
 #define _cleanup_cap_free_ _cleanup_(cap_freep)
 
 DEFINE_TRIVIAL_CLEANUP_FUNC(cap_t, cap_free);
 #define _cleanup_cap_free_ _cleanup_(cap_freep)
 
@@ -43,3 +45,4 @@ static inline void cap_free_charpp(char **p) {
                 cap_free(*p);
 }
 #define _cleanup_cap_free_charp_ _cleanup_(cap_free_charpp)
                 cap_free(*p);
 }
 #define _cleanup_cap_free_charp_ _cleanup_(cap_free_charpp)
+#endif // 0
index e3f3bf080c422be242047a26b9220df01e97810a..b82f2a896aaf77aeb832e37eb8ab14bea64ca59e 100644 (file)
@@ -166,7 +166,7 @@ bool cg_controller_is_valid(const char *p);
 
 // UNNEEDED int cg_slice_to_path(const char *unit, char **ret);
 
 
 // UNNEEDED int cg_slice_to_path(const char *unit, char **ret);
 
-typedef const char* (*cg_migrate_callback_t)(CGroupMask mask, void *userdata);
+// UNNEEDED typedef const char* (*cg_migrate_callback_t)(CGroupMask mask, void *userdata);
 
 // UNNEEDED int cg_create_everywhere(CGroupMask supported, CGroupMask mask, const char *path);
 // UNNEEDED int cg_attach_everywhere(CGroupMask supported, const char *path, pid_t pid, cg_migrate_callback_t callback, void *userdata);
 
 // UNNEEDED int cg_create_everywhere(CGroupMask supported, CGroupMask mask, const char *path);
 // UNNEEDED int cg_attach_everywhere(CGroupMask supported, const char *path, pid_t pid, cg_migrate_callback_t callback, void *userdata);
index d1b1db3a4ddc83b8c73ecf7c3ff51a19885d2fef..8b7065fd5d53b8ab1fb30fe11fc53bda2d6250b0 100644 (file)
@@ -120,6 +120,8 @@ FILE* safe_fclose(FILE *f) {
         return NULL;
 }
 
         return NULL;
 }
 
+/// UNNEEDED by elogind
+#if 0
 DIR* safe_closedir(DIR *d) {
 
         if (d) {
 DIR* safe_closedir(DIR *d) {
 
         if (d) {
@@ -130,6 +132,7 @@ DIR* safe_closedir(DIR *d) {
 
         return NULL;
 }
 
         return NULL;
 }
+#endif // 0
 
 int fd_nonblock(int fd, bool nonblock) {
         int flags, nflags;
 
 int fd_nonblock(int fd, bool nonblock) {
         int flags, nflags;
@@ -248,6 +251,8 @@ int close_all_fds(const int except[], unsigned n_except) {
         return r;
 }
 
         return r;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int same_fd(int a, int b) {
         struct stat sta, stb;
         pid_t pid;
 int same_fd(int a, int b) {
         struct stat sta, stb;
         pid_t pid;
@@ -349,3 +354,4 @@ bool fdname_is_valid(const char *s) {
 
         return p - s < 256;
 }
 
         return p - s < 256;
 }
+#endif // 0
index 0e9182d75be165fbc2a59892ac281ac6785f3fba..0d742b50b24c798c94813dd32a0cb4b3180d2054 100644 (file)
@@ -40,7 +40,7 @@ void close_many(const int fds[], unsigned n_fd);
 
 int fclose_nointr(FILE *f);
 FILE* safe_fclose(FILE *f);
 
 int fclose_nointr(FILE *f);
 FILE* safe_fclose(FILE *f);
-DIR* safe_closedir(DIR *f);
+// UNNEEDED DIR* safe_closedir(DIR *f);
 
 static inline void closep(int *fd) {
         safe_close(*fd);
 
 static inline void closep(int *fd) {
         safe_close(*fd);
@@ -68,8 +68,8 @@ int fd_cloexec(int fd, bool cloexec);
 
 int close_all_fds(const int except[], unsigned n_except);
 
 
 int close_all_fds(const int except[], unsigned n_except);
 
-int same_fd(int a, int b);
+// UNNEEDED int same_fd(int a, int b);
 
 
-void cmsg_close_all(struct msghdr *mh);
+// UNNEEDED void cmsg_close_all(struct msghdr *mh);
 
 
-bool fdname_is_valid(const char *s);
+// UNNEEDED bool fdname_is_valid(const char *s);
index a677fc571188273a8529499ff21f28948990e9f6..9449e02a3f8130019553042811c6f08b065d3837 100644 (file)
@@ -194,7 +194,6 @@ int readlink_value(const char *p, char **ret) {
 
         return 0;
 }
 
         return 0;
 }
-#endif // 0
 
 int readlink_and_make_absolute(const char *p, char **r) {
         _cleanup_free_ char *target = NULL;
 
 int readlink_and_make_absolute(const char *p, char **r) {
         _cleanup_free_ char *target = NULL;
@@ -216,8 +215,6 @@ int readlink_and_make_absolute(const char *p, char **r) {
         return 0;
 }
 
         return 0;
 }
 
-/// UNNEEDED by elogind
-#if 0
 int readlink_and_canonicalize(const char *p, char **r) {
         char *t, *s;
         int j;
 int readlink_and_canonicalize(const char *p, char **r) {
         char *t, *s;
         int j;
@@ -280,6 +277,8 @@ int chmod_and_chown(const char *path, mode_t mode, uid_t uid, gid_t gid) {
         return 0;
 }
 
         return 0;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int fchmod_and_fchown(int fd, mode_t mode, uid_t uid, gid_t gid) {
         assert(fd >= 0);
 
 int fchmod_and_fchown(int fd, mode_t mode, uid_t uid, gid_t gid) {
         assert(fd >= 0);
 
@@ -297,6 +296,7 @@ int fchmod_and_fchown(int fd, mode_t mode, uid_t uid, gid_t gid) {
 
         return 0;
 }
 
         return 0;
 }
+#endif // 0
 
 int fchmod_umask(int fd, mode_t m) {
         mode_t u;
 
 int fchmod_umask(int fd, mode_t m) {
         mode_t u;
@@ -370,6 +370,8 @@ int touch(const char *path) {
         return touch_file(path, false, USEC_INFINITY, UID_INVALID, GID_INVALID, MODE_INVALID);
 }
 
         return touch_file(path, false, USEC_INFINITY, UID_INVALID, GID_INVALID, MODE_INVALID);
 }
 
+/// UNNEEDED by elogind
+#if 0
 int symlink_idempotent(const char *from, const char *to) {
         _cleanup_free_ char *p = NULL;
         int r;
 int symlink_idempotent(const char *from, const char *to) {
         _cleanup_free_ char *p = NULL;
         int r;
@@ -455,6 +457,7 @@ int mkfifo_atomic(const char *path, mode_t mode) {
 
         return 0;
 }
 
         return 0;
 }
+#endif // 0
 
 int get_files_in_directory(const char *path, char ***list) {
         _cleanup_closedir_ DIR *d = NULL;
 
 int get_files_in_directory(const char *path, char ***list) {
         _cleanup_closedir_ DIR *d = NULL;
index cc56fdf95cce8b6a1fe6ceb332cdb3a34affead5..d36d2d6aaa8560987c5c057f18b165b7ac8909b8 100644 (file)
@@ -38,12 +38,12 @@ int unlink_noerrno(const char *path);
 int readlinkat_malloc(int fd, const char *p, char **ret);
 int readlink_malloc(const char *p, char **r);
 // UNNEEDED int readlink_value(const char *p, char **ret);
 int readlinkat_malloc(int fd, const char *p, char **ret);
 int readlink_malloc(const char *p, char **r);
 // UNNEEDED int readlink_value(const char *p, char **ret);
-int readlink_and_make_absolute(const char *p, char **r);
+// UNNEEDED int readlink_and_make_absolute(const char *p, char **r);
 // UNNEEDED int readlink_and_canonicalize(const char *p, char **r);
 // UNNEEDED int readlink_and_make_absolute_root(const char *root, const char *path, char **ret);
 
 int chmod_and_chown(const char *path, mode_t mode, uid_t uid, gid_t gid);
 // UNNEEDED int readlink_and_canonicalize(const char *p, char **r);
 // UNNEEDED int readlink_and_make_absolute_root(const char *root, const char *path, char **ret);
 
 int chmod_and_chown(const char *path, mode_t mode, uid_t uid, gid_t gid);
-int fchmod_and_fchown(int fd, mode_t mode, uid_t uid, gid_t gid);
+// UNNEEDED int fchmod_and_fchown(int fd, mode_t mode, uid_t uid, gid_t gid);
 
 int fchmod_umask(int fd, mode_t mode);
 
 
 int fchmod_umask(int fd, mode_t mode);
 
@@ -54,14 +54,16 @@ int fd_warn_permissions(const char *path, int fd);
 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);
 
 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);
 
-int symlink_idempotent(const char *from, const char *to);
+// UNNEEDED int symlink_idempotent(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);
+// UNNEEDED int symlink_atomic(const char *from, const char *to);
+// UNNEEDED int mknod_atomic(const char *path, mode_t mode, dev_t dev);
+// UNNEEDED int mkfifo_atomic(const char *path, mode_t mode);
 
 int get_files_in_directory(const char *path, char ***list);
 
 
 int get_files_in_directory(const char *path, char ***list);
 
+/// UNNEEDED by elogind
+#if 0
 #define INOTIFY_EVENT_MAX (sizeof(struct inotify_event) + NAME_MAX + 1)
 
 #define FOREACH_INOTIFY_EVENT(e, buffer, sz) \
 #define INOTIFY_EVENT_MAX (sizeof(struct inotify_event) + NAME_MAX + 1)
 
 #define FOREACH_INOTIFY_EVENT(e, buffer, sz) \
@@ -73,3 +75,4 @@ union inotify_event_buffer {
         struct inotify_event ev;
         uint8_t raw[INOTIFY_EVENT_MAX];
 };
         struct inotify_event ev;
         uint8_t raw[INOTIFY_EVENT_MAX];
 };
+#endif // 0
index a9b11c50768904de20b7b0a55d72adb631160009..e6eb1d45fc5d2f46a5c16582213d2c41178c63fa 100644 (file)
@@ -111,6 +111,8 @@ int memfd_set_sealed(int fd) {
         return 0;
 }
 
         return 0;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int memfd_get_sealed(int fd) {
         int r;
 
 int memfd_get_sealed(int fd) {
         int r;
 
index 7d3fdd9c22240f006900e51742f78629ad3a9719..f2858beb8bcded4374eb4bd6f2016a8ad010497d 100644 (file)
@@ -30,7 +30,7 @@ int memfd_new(const char *name);
 // UNNEEDED int memfd_map(int fd, uint64_t offset, size_t size, void **p);
 
 int memfd_set_sealed(int fd);
 // UNNEEDED int memfd_map(int fd, uint64_t offset, size_t size, void **p);
 
 int memfd_set_sealed(int fd);
-int memfd_get_sealed(int fd);
+// UNNEEDED int memfd_get_sealed(int fd);
 
 // UNNEEDED int memfd_get_size(int fd, uint64_t *sz);
 int memfd_set_size(int fd, uint64_t sz);
 
 // UNNEEDED int memfd_get_size(int fd, uint64_t *sz);
 int memfd_set_size(int fd, uint64_t sz);
index 3ebc5c5366c4c3e70f786218b54a4143dc8351f1..fb23917dc6ae96da722b0b20c319f9198235ce51 100644 (file)
@@ -77,7 +77,6 @@ int path_split_and_make_absolute(const char *p, char ***ret) {
         *ret = l;
         return r;
 }
         *ret = l;
         return r;
 }
-#endif // 0
 
 char *path_make_absolute(const char *p, const char *prefix) {
         assert(p);
 
 char *path_make_absolute(const char *p, const char *prefix) {
         assert(p);
@@ -90,6 +89,7 @@ char *path_make_absolute(const char *p, const char *prefix) {
 
         return strjoin(prefix, "/", p, NULL);
 }
 
         return strjoin(prefix, "/", p, NULL);
 }
+#endif // 0
 
 int path_make_absolute_cwd(const char *p, char **ret) {
         char *c;
 
 int path_make_absolute_cwd(const char *p, char **ret) {
         char *c;
@@ -647,7 +647,6 @@ char *prefix_root(const char *root, const char *path) {
         strcpy(p, path);
         return n;
 }
         strcpy(p, path);
         return n;
 }
-#endif // 0
 
 int parse_path_argument_and_warn(const char *path, bool suppress_root, char **arg) {
         char *p;
 
 int parse_path_argument_and_warn(const char *path, bool suppress_root, char **arg) {
         char *p;
@@ -680,6 +679,7 @@ int parse_path_argument_and_warn(const char *path, bool suppress_root, char **ar
         *arg = p;
         return 0;
 }
         *arg = p;
         return 0;
 }
+#endif // 0
 
 char* dirname_malloc(const char *path) {
         char *d, *dir, *dir2;
 
 char* dirname_malloc(const char *path) {
         char *d, *dir, *dir2;
@@ -802,6 +802,8 @@ bool hidden_file(const char *filename) {
         return hidden_file_allow_backup(filename);
 }
 
         return hidden_file_allow_backup(filename);
 }
 
+/// UNNEEDED by elogind
+#if 0
 bool is_device_path(const char *path) {
 
         /* Returns true on paths that refer to a device, either in
 bool is_device_path(const char *path) {
 
         /* Returns true on paths that refer to a device, either in
@@ -811,3 +813,4 @@ bool is_device_path(const char *path) {
                 path_startswith(path, "/dev/") ||
                 path_startswith(path, "/sys/");
 }
                 path_startswith(path, "/dev/") ||
                 path_startswith(path, "/sys/");
 }
+#endif // 0
index 3295d62faecd9b8e2f32ed90f8ff0777918316c0..3ef8eae68c794afb67e9d4c53c227aca76e04773 100644 (file)
@@ -38,7 +38,7 @@
 bool is_path(const char *p) _pure_;
 // UNNEEDED int path_split_and_make_absolute(const char *p, char ***ret);
 bool path_is_absolute(const char *p) _pure_;
 bool is_path(const char *p) _pure_;
 // UNNEEDED int path_split_and_make_absolute(const char *p, char ***ret);
 bool path_is_absolute(const char *p) _pure_;
-char* path_make_absolute(const char *p, const char *prefix);
+// UNNEEDED char* path_make_absolute(const char *p, const char *prefix);
 int path_make_absolute_cwd(const char *p, char **ret);
 // UNNEEDED int path_make_relative(const char *from_dir, const char *to_path, char **_r);
 char* path_kill_slashes(char *path);
 int path_make_absolute_cwd(const char *p, char **ret);
 // UNNEEDED int path_make_relative(const char *from_dir, const char *to_path, char **_r);
 char* path_kill_slashes(char *path);
@@ -57,7 +57,7 @@ char** path_strv_resolve_uniq(char **l, const char *prefix);
 // UNNEEDED bool paths_check_timestamp(const char* const* paths, usec_t *paths_ts_usec, bool update);
 
 // UNNEEDED int fsck_exists(const char *fstype);
 // UNNEEDED bool paths_check_timestamp(const char* const* paths, usec_t *paths_ts_usec, bool update);
 
 // UNNEEDED int fsck_exists(const char *fstype);
-int mkfs_exists(const char *fstype);
+// UNNEEDED int mkfs_exists(const char *fstype);
 
 /* Iterates through the path prefixes of the specified path, going up
  * the tree, to root. Also returns "" (and not "/"!) for the root
 
 /* Iterates through the path prefixes of the specified path, going up
  * the tree, to root. Also returns "" (and not "/"!) for the root
@@ -96,7 +96,7 @@ int mkfs_exists(const char *fstype);
                 _ret;                                                   \
         })
 
                 _ret;                                                   \
         })
 
-int parse_path_argument_and_warn(const char *path, bool suppress_root, char **arg);
+// UNNEEDED int parse_path_argument_and_warn(const char *path, bool suppress_root, char **arg);
 
 char* dirname_malloc(const char *path);
 
 
 char* dirname_malloc(const char *path);
 
@@ -108,4 +108,4 @@ char *file_in_same_dir(const char *path, const char *filename);
 bool hidden_file_allow_backup(const char *filename);
 bool hidden_file(const char *filename) _pure_;
 
 bool hidden_file_allow_backup(const char *filename);
 bool hidden_file(const char *filename) _pure_;
 
-bool is_device_path(const char *path);
+// UNNEEDED bool is_device_path(const char *path);
index 1acab1ef95bab65534dad3bf0717a1b5e083235e..56a40a1deb37b6da06e0c865d8165b30f28ffa31 100644 (file)
@@ -44,6 +44,8 @@
 #include "user-util.h"
 #include "util.h"
 
 #include "user-util.h"
 #include "util.h"
 
+/// UNNEEDED by elogind
+#if 0
 int socket_address_parse(SocketAddress *a, const char *s) {
         char *e, *n;
         unsigned u;
 int socket_address_parse(SocketAddress *a, const char *s) {
         char *e, *n;
         unsigned u;
@@ -435,6 +437,7 @@ const char* socket_address_get_path(const SocketAddress *a) {
 
         return a->sockaddr.un.sun_path;
 }
 
         return a->sockaddr.un.sun_path;
 }
+#endif // 0
 
 bool socket_ipv6_is_supported(void) {
         _cleanup_free_ char *l = NULL;
 
 bool socket_ipv6_is_supported(void) {
         _cleanup_free_ char *l = NULL;
@@ -450,6 +453,8 @@ bool socket_ipv6_is_supported(void) {
         return l[0] == '0';
 }
 
         return l[0] == '0';
 }
 
+/// UNNEEDED by elogind
+#if 0
 bool socket_address_matches_fd(const SocketAddress *a, int fd) {
         SocketAddress b;
         socklen_t solen;
 bool socket_address_matches_fd(const SocketAddress *a, int fd) {
         SocketAddress b;
         socklen_t solen;
@@ -755,6 +760,7 @@ bool sockaddr_equal(const union sockaddr_union *a, const union sockaddr_union *b
 
         return false;
 }
 
         return false;
 }
+#endif // 0
 
 int fd_inc_sndbuf(int fd, size_t n) {
         int r, value;
 
 int fd_inc_sndbuf(int fd, size_t n) {
         int r, value;
@@ -791,6 +797,8 @@ int fd_inc_rcvbuf(int fd, size_t n) {
         return 1;
 }
 
         return 1;
 }
 
+/// UNNEEDED by elogind
+#if 0
 static const char* const ip_tos_table[] = {
         [IPTOS_LOWDELAY] = "low-delay",
         [IPTOS_THROUGHPUT] = "throughput",
 static const char* const ip_tos_table[] = {
         [IPTOS_LOWDELAY] = "low-delay",
         [IPTOS_THROUGHPUT] = "throughput",
@@ -799,6 +807,7 @@ static const char* const ip_tos_table[] = {
 };
 
 DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(ip_tos, int, 0xff);
 };
 
 DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(ip_tos, int, 0xff);
+#endif // 0
 
 int getpeercred(int fd, struct ucred *ucred) {
         socklen_t n = sizeof(struct ucred);
 
 int getpeercred(int fd, struct ucred *ucred) {
         socklen_t n = sizeof(struct ucred);
@@ -894,6 +903,8 @@ int send_one_fd(int transport_fd, int fd, int flags) {
         return 0;
 }
 
         return 0;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int receive_one_fd(int transport_fd, int flags) {
         union {
                 struct cmsghdr cmsghdr;
 int receive_one_fd(int transport_fd, int flags) {
         union {
                 struct cmsghdr cmsghdr;
@@ -935,3 +946,4 @@ int receive_one_fd(int transport_fd, int flags) {
 
         return *(int*) CMSG_DATA(found);
 }
 
         return *(int*) CMSG_DATA(found);
 }
+#endif // 0
index c60f2556af840e86806adbea785ce7a86a30d239..4c9905494e75580a0fb4ce0b110081637788c54a 100644 (file)
@@ -41,6 +41,8 @@ union sockaddr_union {
         struct sockaddr_ll ll;
 };
 
         struct sockaddr_ll ll;
 };
 
+/// UNNEEDED by elogind
+#if 0
 typedef struct SocketAddress {
         union sockaddr_union sockaddr;
 
 typedef struct SocketAddress {
         union sockaddr_union sockaddr;
 
@@ -64,16 +66,19 @@ typedef enum SocketAddressBindIPv6Only {
 } SocketAddressBindIPv6Only;
 
 #define socket_address_family(a) ((a)->sockaddr.sa.sa_family)
 } SocketAddressBindIPv6Only;
 
 #define socket_address_family(a) ((a)->sockaddr.sa.sa_family)
+#endif // 0
 
 
-int socket_address_parse(SocketAddress *a, const char *s);
-int socket_address_parse_and_warn(SocketAddress *a, const char *s);
-int socket_address_parse_netlink(SocketAddress *a, const char *s);
-int socket_address_print(const SocketAddress *a, char **p);
-int socket_address_verify(const SocketAddress *a) _pure_;
-int socket_address_unlink(SocketAddress *a);
+// UNNEEDED int socket_address_parse(SocketAddress *a, const char *s);
+// UNNEEDED int socket_address_parse_and_warn(SocketAddress *a, const char *s);
+// UNNEEDED int socket_address_parse_netlink(SocketAddress *a, const char *s);
+// UNNEEDED int socket_address_print(const SocketAddress *a, char **p);
+// UNNEEDED int socket_address_verify(const SocketAddress *a) _pure_;
+// UNNEEDED int socket_address_unlink(SocketAddress *a);
 
 
-bool socket_address_can_accept(const SocketAddress *a) _pure_;
+// UNNEEDED bool socket_address_can_accept(const SocketAddress *a) _pure_;
 
 
+/// UNNEEDED by elogind
+#if 0
 int socket_address_listen(
                 const SocketAddress *a,
                 int flags,
 int socket_address_listen(
                 const SocketAddress *a,
                 int flags,
@@ -87,46 +92,47 @@ int socket_address_listen(
                 mode_t socket_mode,
                 const char *label);
 int make_socket_fd(int log_level, const char* address, int flags);
                 mode_t socket_mode,
                 const char *label);
 int make_socket_fd(int log_level, const char* address, int flags);
+#endif // 0
 
 
-bool socket_address_is(const SocketAddress *a, const char *s, int type);
-bool socket_address_is_netlink(const SocketAddress *a, const char *s);
+// UNNEEDED bool socket_address_is(const SocketAddress *a, const char *s, int type);
+// UNNEEDED bool socket_address_is_netlink(const SocketAddress *a, const char *s);
 
 
-bool socket_address_matches_fd(const SocketAddress *a, int fd);
+// UNNEEDED bool socket_address_matches_fd(const SocketAddress *a, int fd);
 
 
-bool socket_address_equal(const SocketAddress *a, const SocketAddress *b) _pure_;
+// UNNEEDED bool socket_address_equal(const SocketAddress *a, const SocketAddress *b) _pure_;
 
 
-const char* socket_address_get_path(const SocketAddress *a);
+// UNNEEDED const char* socket_address_get_path(const SocketAddress *a);
 
 bool socket_ipv6_is_supported(void);
 
 
 bool socket_ipv6_is_supported(void);
 
-int sockaddr_port(const struct sockaddr *_sa) _pure_;
+// UNNEEDED int sockaddr_port(const struct sockaddr *_sa) _pure_;
 
 
-int sockaddr_pretty(const struct sockaddr *_sa, socklen_t salen, bool translate_ipv6, bool include_port, char **ret);
-int getpeername_pretty(int fd, char **ret);
-int getsockname_pretty(int fd, char **ret);
+// UNNEEDED Sint sockaddr_pretty(const struct sockaddr *_sa, socklen_t salen, bool translate_ipv6, bool include_port, char **ret);
+// UNNEEDED int getpeername_pretty(int fd, char **ret);
+// UNNEEDED int getsockname_pretty(int fd, char **ret);
 
 
-int socknameinfo_pretty(union sockaddr_union *sa, socklen_t salen, char **_ret);
-int getnameinfo_pretty(int fd, char **ret);
+// UNNEEDED int socknameinfo_pretty(union sockaddr_union *sa, socklen_t salen, char **_ret);
+// UNNEEDED int getnameinfo_pretty(int fd, char **ret);
 
 
-const char* socket_address_bind_ipv6_only_to_string(SocketAddressBindIPv6Only b) _const_;
-SocketAddressBindIPv6Only socket_address_bind_ipv6_only_from_string(const char *s) _pure_;
+// UNNEEDED const char* socket_address_bind_ipv6_only_to_string(SocketAddressBindIPv6Only b) _const_;
+// UNNEEDED SocketAddressBindIPv6Only socket_address_bind_ipv6_only_from_string(const char *s) _pure_;
 
 
-int netlink_family_to_string_alloc(int b, char **s);
-int netlink_family_from_string(const char *s) _pure_;
+// UNNEEDED int netlink_family_to_string_alloc(int b, char **s);
+// UNNEEDED int netlink_family_from_string(const char *s) _pure_;
 
 
-bool sockaddr_equal(const union sockaddr_union *a, const union sockaddr_union *b);
+// UNNEEDED bool sockaddr_equal(const union sockaddr_union *a, const union sockaddr_union *b);
 
 int fd_inc_sndbuf(int fd, size_t n);
 int fd_inc_rcvbuf(int fd, size_t n);
 
 
 int fd_inc_sndbuf(int fd, size_t n);
 int fd_inc_rcvbuf(int fd, size_t n);
 
-int ip_tos_to_string_alloc(int i, char **s);
-int ip_tos_from_string(const char *s);
+// UNNEEDED int ip_tos_to_string_alloc(int i, char **s);
+// UNNEEDED int ip_tos_from_string(const char *s);
 
 int getpeercred(int fd, struct ucred *ucred);
 int getpeersec(int fd, char **ret);
 
 int send_one_fd(int transport_fd, int fd, int flags);
 
 int getpeercred(int fd, struct ucred *ucred);
 int getpeersec(int fd, char **ret);
 
 int send_one_fd(int transport_fd, int fd, int flags);
-int receive_one_fd(int transport_fd, int flags);
+// UNNEEDED int receive_one_fd(int transport_fd, int flags);
 
 #define CMSG_FOREACH(cmsg, mh)                                          \
         for ((cmsg) = CMSG_FIRSTHDR(mh); (cmsg); (cmsg) = CMSG_NXTHDR((mh), (cmsg)))
 
 #define CMSG_FOREACH(cmsg, mh)                                          \
         for ((cmsg) = CMSG_FIRSTHDR(mh); (cmsg); (cmsg) = CMSG_NXTHDR((mh), (cmsg)))
index 20c4df74dfefffabc290d47c2ec9926620c4bea1..d34f61e1c7e601dcf7c17b6a7c1dfca6d02d5353 100644 (file)
@@ -74,6 +74,8 @@ int chvt(int vt) {
         return 0;
 }
 
         return 0;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int read_one_char(FILE *f, char *ret, usec_t t, bool *need_nl) {
         struct termios old_termios, new_termios;
         char c, line[LINE_MAX];
 int read_one_char(FILE *f, char *ret, usec_t t, bool *need_nl) {
         struct termios old_termios, new_termios;
         char c, line[LINE_MAX];
@@ -134,8 +136,6 @@ int read_one_char(FILE *f, char *ret, usec_t t, bool *need_nl) {
         return 0;
 }
 
         return 0;
 }
 
-/// UNNEEDED by elogind
-#if 0
 int ask_char(char *ret, const char *replies, const char *text, ...) {
         int r;
 
 int ask_char(char *ret, const char *replies, const char *text, ...) {
         int r;
 
@@ -226,7 +226,6 @@ int ask_string(char **ret, const char *text, ...) {
                 }
         }
 }
                 }
         }
 }
-#endif // 0
 
 int reset_terminal_fd(int fd, bool switch_to_text) {
         struct termios termios;
 
 int reset_terminal_fd(int fd, bool switch_to_text) {
         struct termios termios;
@@ -305,6 +304,7 @@ int reset_terminal(const char *name) {
 
         return reset_terminal_fd(fd, true);
 }
 
         return reset_terminal_fd(fd, true);
 }
+#endif // 0
 
 int open_terminal(const char *name, int mode) {
         int fd, r;
 
 int open_terminal(const char *name, int mode) {
         int fd, r;
@@ -352,6 +352,8 @@ int open_terminal(const char *name, int mode) {
         return fd;
 }
 
         return fd;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int acquire_terminal(
                 const char *name,
                 bool fail,
 int acquire_terminal(
                 const char *name,
                 bool fail,
@@ -499,6 +501,7 @@ fail:
 
         return r;
 }
 
         return r;
 }
+#endif // 0
 
 /// UNNEEDED by elogind
 #if 0
 
 /// UNNEEDED by elogind
 #if 0
@@ -527,7 +530,6 @@ int release_terminal(void) {
 
         return r;
 }
 
         return r;
 }
-#endif // 0
 
 int terminal_vhangup_fd(int fd) {
         assert(fd >= 0);
 
 int terminal_vhangup_fd(int fd) {
         assert(fd >= 0);
@@ -614,8 +616,6 @@ int vt_disallocate(const char *name) {
         return 0;
 }
 
         return 0;
 }
 
-/// UNNEEDED by elogind
-#if 0
 int make_console_stdio(void) {
         int fd, r;
 
 int make_console_stdio(void) {
         int fd, r;
 
@@ -676,6 +676,8 @@ int vtnr_from_tty(const char *tty) {
         return i;
 }
 
         return i;
 }
 
+/// UNNEEDED by elogind
+#if 0
 char *resolve_dev_console(char **active) {
         char *tty;
 
 char *resolve_dev_console(char **active) {
         char *tty;
 
@@ -726,8 +728,6 @@ bool tty_is_vc_resolve(const char *tty) {
         return tty_is_vc(tty);
 }
 
         return tty_is_vc(tty);
 }
 
-/// UNNEEDED by elogind
-#if 0
 const char *default_term_for_tty(const char *tty) {
         assert(tty);
 
 const char *default_term_for_tty(const char *tty) {
         assert(tty);
 
index a5dffbfb5937aa1e644d7df86638fcf68c6be359..36fc5d1739273400409658296e1b5e7792d7061b 100644 (file)
 /* Set cursor to top left corner and clear screen */
 #define ANSI_HOME_CLEAR "\x1B[H\x1B[2J"
 
 /* Set cursor to top left corner and clear screen */
 #define ANSI_HOME_CLEAR "\x1B[H\x1B[2J"
 
-int reset_terminal_fd(int fd, bool switch_to_text);
-int reset_terminal(const char *name);
+// UNNEEDED int reset_terminal_fd(int fd, bool switch_to_text);
+// UNNEEDED int reset_terminal(const char *name);
 
 int open_terminal(const char *name, int mode);
 
 int open_terminal(const char *name, int mode);
-int acquire_terminal(const char *name, bool fail, bool force, bool ignore_tiocstty_eperm, usec_t timeout);
+// UNNEEDED int acquire_terminal(const char *name, bool fail, bool force, bool ignore_tiocstty_eperm, usec_t timeout);
 // UNNEEDED int release_terminal(void);
 
 // UNNEEDED int release_terminal(void);
 
-int terminal_vhangup_fd(int fd);
-int terminal_vhangup(const char *name);
+// UNNEEDED int terminal_vhangup_fd(int fd);
+// UNNEEDED int terminal_vhangup(const char *name);
 
 int chvt(int vt);
 
 
 int chvt(int vt);
 
-int read_one_char(FILE *f, char *ret, usec_t timeout, bool *need_nl);
+// UNNEEDED int read_one_char(FILE *f, char *ret, usec_t timeout, bool *need_nl);
 // UNNEEDED int ask_char(char *ret, const char *replies, const char *text, ...) _printf_(3, 4);
 // UNNEEDED int ask_string(char **ret, const char *text, ...) _printf_(2, 3);
 
 // UNNEEDED int ask_char(char *ret, const char *replies, const char *text, ...) _printf_(3, 4);
 // UNNEEDED int ask_string(char **ret, const char *text, ...) _printf_(2, 3);
 
-int vt_disallocate(const char *name);
+// UNNEEDED int vt_disallocate(const char *name);
 
 
-char *resolve_dev_console(char **active);
+// UNNEEDED char *resolve_dev_console(char **active);
 bool tty_is_vc(const char *tty);
 bool tty_is_vc(const char *tty);
-bool tty_is_vc_resolve(const char *tty);
+// UNNEEDED bool tty_is_vc_resolve(const char *tty);
 bool tty_is_console(const char *tty) _pure_;
 int vtnr_from_tty(const char *tty);
 // UNNEEDED const char *default_term_for_tty(const char *tty);
 bool tty_is_console(const char *tty) _pure_;
 int vtnr_from_tty(const char *tty);
 // UNNEEDED const char *default_term_for_tty(const char *tty);
index 397880b0b1d605e18f98ccf158f8c36cf3885a9f..97ff2af4a121d6da72eb43d2d81b6631cbb7817b 100644 (file)
@@ -67,6 +67,8 @@ int parse_uid(const char *s, uid_t *ret) {
         return 0;
 }
 
         return 0;
 }
 
+/// UNNEEDED by elogind
+#if 0
 char* getlogname_malloc(void) {
         uid_t uid;
         struct stat st;
 char* getlogname_malloc(void) {
         uid_t uid;
         struct stat st;
@@ -88,6 +90,7 @@ char *getusername_malloc(void) {
 
         return uid_to_name(getuid());
 }
 
         return uid_to_name(getuid());
 }
+#endif // 0
 
 int get_user_creds(
                 const char **username,
 
 int get_user_creds(
                 const char **username,
@@ -283,6 +286,8 @@ char* gid_to_name(gid_t gid) {
         return ret;
 }
 
         return ret;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int in_gid(gid_t gid) {
         gid_t *gids;
         int ngroups_max, r, i;
 int in_gid(gid_t gid) {
         gid_t *gids;
         int ngroups_max, r, i;
@@ -416,6 +421,7 @@ int get_shell(char **_s) {
         *_s = s;
         return 0;
 }
         *_s = s;
         return 0;
 }
+#endif // 0
 
 int reset_uid_gid(void) {
 
 
 int reset_uid_gid(void) {
 
@@ -431,6 +437,8 @@ int reset_uid_gid(void) {
         return 0;
 }
 
         return 0;
 }
 
+/// UNNEEDED by elogind
+#if 0
 int take_etc_passwd_lock(const char *root) {
 
         struct flock flock = {
 int take_etc_passwd_lock(const char *root) {
 
         struct flock flock = {
@@ -470,3 +478,4 @@ int take_etc_passwd_lock(const char *root) {
 
         return fd;
 }
 
         return fd;
 }
+#endif // 0
index 11ff6674cf5b7272989c9ce76b9223951e8c3691..87200a28cb5ca62b3ccfc06e10aa75f3fcc8129c 100644 (file)
@@ -36,8 +36,8 @@ static inline int parse_gid(const char *s, gid_t *ret_gid) {
         return parse_uid(s, (uid_t*) ret_gid);
 }
 
         return parse_uid(s, (uid_t*) ret_gid);
 }
 
-char* getlogname_malloc(void);
-char* getusername_malloc(void);
+// UNNEEDED char* getlogname_malloc(void);
+// UNNEEDED char* getusername_malloc(void);
 
 int get_user_creds(const char **username, uid_t *uid, gid_t *gid, const char **home, const char **shell);
 int get_group_creds(const char **groupname, gid_t *gid);
 
 int get_user_creds(const char **username, uid_t *uid, gid_t *gid, const char **home, const char **shell);
 int get_group_creds(const char **groupname, gid_t *gid);
@@ -45,15 +45,15 @@ int get_group_creds(const char **groupname, gid_t *gid);
 char* uid_to_name(uid_t uid);
 char* gid_to_name(gid_t gid);
 
 char* uid_to_name(uid_t uid);
 char* gid_to_name(gid_t gid);
 
-int in_gid(gid_t gid);
-int in_group(const char *name);
+// UNNEEDED int in_gid(gid_t gid);
+// UNNEEDED int in_group(const char *name);
 
 
-int get_home_dir(char **ret);
-int get_shell(char **_ret);
+// UNNEEDED int get_home_dir(char **ret);
+// UNNEEDED int get_shell(char **_ret);
 
 int reset_uid_gid(void);
 
 
 int reset_uid_gid(void);
 
-int take_etc_passwd_lock(const char *root);
+// UNNEEDED int take_etc_passwd_lock(const char *root);
 
 #define UID_INVALID ((uid_t) -1)
 #define GID_INVALID ((gid_t) -1)
 
 #define UID_INVALID ((uid_t) -1)
 #define GID_INVALID ((gid_t) -1)
index ddffd016b105842650cb7f122a76251b39977a67..d440b3cd04cc838389bef1799f9e904923315496 100644 (file)
@@ -98,6 +98,8 @@ int fgetxattr_malloc(int fd, const char *name, char **value) {
         }
 }
 
         }
 }
 
+/// UNNEEDED by elogind
+#if 0
 ssize_t fgetxattrat_fake(int dirfd, const char *filename, const char *attribute, void *value, size_t size, int flags) {
         char fn[strlen("/proc/self/fd/") + DECIMAL_STR_MAX(int) + 1];
         _cleanup_close_ int fd = -1;
 ssize_t fgetxattrat_fake(int dirfd, const char *filename, const char *attribute, void *value, size_t size, int flags) {
         char fn[strlen("/proc/self/fd/") + DECIMAL_STR_MAX(int) + 1];
         _cleanup_close_ int fd = -1;
@@ -118,8 +120,6 @@ ssize_t fgetxattrat_fake(int dirfd, const char *filename, const char *attribute,
         return l;
 }
 
         return l;
 }
 
-/// UNNEEDED by elogind
-#if 0
 static int parse_crtime(le64_t le, usec_t *usec) {
         uint64_t u;
 
 static int parse_crtime(le64_t le, usec_t *usec) {
         uint64_t u;
 
index 048e53bf704f5d514640a5cca09657329b523b86..e6833ef23140977d5291d0df952a5a5a862db4f0 100644 (file)
@@ -29,7 +29,7 @@
 int getxattr_malloc(const char *path, const char *name, char **value, bool allow_symlink);
 int fgetxattr_malloc(int fd, const char *name, char **value);
 
 int getxattr_malloc(const char *path, const char *name, char **value, bool allow_symlink);
 int fgetxattr_malloc(int fd, const char *name, char **value);
 
-ssize_t fgetxattrat_fake(int dirfd, const char *filename, const char *attribute, void *value, size_t size, int flags);
+// UNNEEDED ssize_t fgetxattrat_fake(int dirfd, const char *filename, const char *attribute, void *value, size_t size, int flags);
 
 // UNNEEDED int fd_setcrtime(int fd, usec_t usec);
 
 
 // UNNEEDED int fd_setcrtime(int fd, usec_t usec);