From: Sven Eden Date: Tue, 3 Jan 2017 10:22:56 +0000 (+0100) Subject: Prep v224: Major cleanup of unneeded functions and some source files. X-Git-Tag: v226.4~1^2~142 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=5db0e7adf018c82dd63cd21d31dd313dff5561af Prep v224: Major cleanup of unneeded functions and some source files. --- diff --git a/Makefile-man.am b/Makefile-man.am index 35eec7798..845f96a41 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -363,15 +363,6 @@ man/sd_session_is_remote.html: man/sd_session_is_active.html endif -if HAVE_PYTHON -MANPAGES += \ - man/systemd.index.7 -MANPAGES_ALIAS += \ - # - - -endif - # Really, do not edit this file. EXTRA_DIST += \ diff --git a/Makefile.am b/Makefile.am index 6234d4bff..54c2aeeaf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -397,8 +397,6 @@ libshared_la_SOURCES = \ src/shared/pager.h \ src/shared/spawn-polkit-agent.c \ src/shared/spawn-polkit-agent.h \ - src/shared/apparmor-util.c \ - src/shared/apparmor-util.h \ src/shared/clean-ipc.c \ src/shared/clean-ipc.h \ src/shared/cgroup-show.c \ @@ -406,12 +404,6 @@ libshared_la_SOURCES = \ src/shared/bus-util.c \ src/shared/bus-util.h -if HAVE_SECCOMP -libshared_la_SOURCES += \ - src/shared/seccomp-util.h \ - src/shared/seccomp-util.c -endif - if HAVE_ACL libshared_la_SOURCES += \ src/shared/acl-util.c \ diff --git a/src/basic/audit.c b/src/basic/audit.c index 54148fcf1..b10480638 100644 --- a/src/basic/audit.c +++ b/src/basic/audit.c @@ -75,6 +75,8 @@ int audit_loginuid_from_pid(pid_t pid, uid_t *uid) { return 0; } +/// UNNEEDED by elogind +#if 0 bool use_audit(void) { static int cached_use = -1; @@ -92,3 +94,4 @@ bool use_audit(void) { return cached_use; } +#endif // 0 diff --git a/src/basic/audit.h b/src/basic/audit.h index 6de331c73..bc5f83bcb 100644 --- a/src/basic/audit.h +++ b/src/basic/audit.h @@ -30,4 +30,4 @@ int audit_session_from_pid(pid_t pid, uint32_t *id); int audit_loginuid_from_pid(pid_t pid, uid_t *uid); -bool use_audit(void); +// UNNEEDED bool use_audit(void); diff --git a/src/basic/capability.c b/src/basic/capability.c index 3963753d4..91ccb2779 100644 --- a/src/basic/capability.c +++ b/src/basic/capability.c @@ -32,6 +32,8 @@ #include "fileio.h" #include "capability.h" +/// UNNEEDED by elogind +#if 0 int have_effective_cap(int value) { _cleanup_cap_free_ cap_t cap; cap_flag_value_t fv; @@ -45,6 +47,7 @@ int have_effective_cap(int value) { else return fv == CAP_SET; } +#endif // 0 unsigned long cap_last_cap(void) { static thread_local unsigned long saved; @@ -173,6 +176,8 @@ finish: return r; } +/// UNNEEDED by elogind +#if 0 static int drop_from_file(const char *fn, uint64_t drop) { int r, k; uint32_t hi, lo; @@ -224,8 +229,6 @@ int capability_bounding_set_drop_usermode(uint64_t drop) { return r; } -/// UNNEEDED by elogind -#if 0 int drop_privileges(uid_t uid, gid_t gid, uint64_t keep_capabilities) { _cleanup_cap_free_ cap_t d = NULL; unsigned i, j = 0; diff --git a/src/basic/capability.h b/src/basic/capability.h index 01a285835..0d6b33b8b 100644 --- a/src/basic/capability.h +++ b/src/basic/capability.h @@ -27,9 +27,9 @@ #include "util.h" unsigned long cap_last_cap(void); -int have_effective_cap(int value); +// UNNEEDED 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 capability_bounding_set_drop_usermode(uint64_t drop); // UNNEEDED int drop_privileges(uid_t uid, gid_t gid, uint64_t keep_capabilities); diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index 4d321e30b..479254159 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -615,6 +615,8 @@ int cg_create(const char *controller, const char *path) { return 1; } +/// UNNEEDED by elogind +#if 0 int cg_create_and_attach(const char *controller, const char *path, pid_t pid) { int r, q; @@ -631,6 +633,7 @@ int cg_create_and_attach(const char *controller, const char *path, pid_t pid) { /* This does not remove the cgroup on failure */ return r; } +#endif // 0 int cg_attach(const char *controller, const char *path, pid_t pid) { _cleanup_free_ char *fs = NULL; @@ -676,6 +679,8 @@ int cg_attach_fallback(const char *controller, const char *path, pid_t pid) { return 0; } +/// UNNEEDED by elogind +#if 0 int cg_set_group_access( const char *controller, const char *path, @@ -732,6 +737,7 @@ int cg_set_task_access( return chmod_and_chown(procs, mode, uid, gid); } +#endif // 0 int cg_pid_get_path(const char *controller, pid_t pid, char **path) { _cleanup_fclose_ FILE *f = NULL; @@ -806,6 +812,8 @@ int cg_pid_get_path(const char *controller, pid_t pid, char **path) { return -ENOENT; } +/// UNNEEDED by elogind +#if 0 int cg_install_release_agent(const char *controller, const char *agent) { _cleanup_free_ char *fs = NULL, *contents = NULL; char *sc; @@ -881,6 +889,7 @@ int cg_uninstall_release_agent(const char *controller) { return 0; } +#endif // 0 int cg_is_empty(const char *controller, const char *path, bool ignore_self) { _cleanup_fclose_ FILE *f = NULL; @@ -1713,7 +1722,6 @@ int cg_slice_to_path(const char *unit, char **ret) { return 0; } -#endif // 0 int cg_set_attribute(const char *controller, const char *path, const char *attribute, const char *value) { _cleanup_free_ char *p = NULL; @@ -1736,6 +1744,7 @@ int cg_get_attribute(const char *controller, const char *path, const char *attri return read_one_line_file(p, ret); } +#endif // 0 static const char mask_names[] = "cpu\0" @@ -1744,6 +1753,8 @@ static const char mask_names[] = "memory\0" "devices\0"; +/// UNNEEDED by elogind +#if 0 int cg_create_everywhere(CGroupControllerMask supported, CGroupControllerMask mask, const char *path) { CGroupControllerMask bit = 1; const char *n; @@ -1770,6 +1781,7 @@ int cg_create_everywhere(CGroupControllerMask supported, CGroupControllerMask ma return 0; } +#endif // 0 int cg_attach_everywhere(CGroupControllerMask supported, const char *path, pid_t pid, cg_migrate_callback_t path_callback, void *userdata) { CGroupControllerMask bit = 1; @@ -1800,6 +1812,8 @@ int cg_attach_everywhere(CGroupControllerMask supported, const char *path, pid_t return 0; } +/// UNNEEDED by elogind +#if 0 int cg_attach_many_everywhere(CGroupControllerMask supported, const char *path, Set* pids, cg_migrate_callback_t path_callback, void *userdata) { Iterator i; void *pidp; @@ -1930,3 +1944,4 @@ int cg_kernel_controllers(Set *controllers) { return 0; } +#endif // 0 diff --git a/src/basic/cgroup-util.h b/src/basic/cgroup-util.h index 8a432aad0..d51a8bd26 100644 --- a/src/basic/cgroup-util.h +++ b/src/basic/cgroup-util.h @@ -82,16 +82,16 @@ int cg_rmdir(const char *controller, const char *path); int cg_create(const char *controller, const char *path); int cg_attach(const char *controller, const char *path, pid_t pid); int cg_attach_fallback(const char *controller, const char *path, pid_t pid); -int cg_create_and_attach(const char *controller, const char *path, pid_t pid); +// UNNEEDED int cg_create_and_attach(const char *controller, const char *path, pid_t pid); -int cg_set_attribute(const char *controller, const char *path, const char *attribute, const char *value); -int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret); +// UNNEEDED int cg_set_attribute(const char *controller, const char *path, const char *attribute, const char *value); +// UNNEEDED int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret); -int cg_set_group_access(const char *controller, const char *path, mode_t mode, uid_t uid, gid_t gid); -int cg_set_task_access(const char *controller, const char *path, mode_t mode, uid_t uid, gid_t gid); +// UNNEEDED int cg_set_group_access(const char *controller, const char *path, mode_t mode, uid_t uid, gid_t gid); +// UNNEEDED int cg_set_task_access(const char *controller, const char *path, mode_t mode, uid_t uid, gid_t gid); -int cg_install_release_agent(const char *controller, const char *agent); -int cg_uninstall_release_agent(const char *controller); +// UNNEEDED int cg_install_release_agent(const char *controller, const char *agent); +// UNNEEDED int cg_uninstall_release_agent(const char *controller); int cg_is_empty(const char *controller, const char *path, bool ignore_self); int cg_is_empty_recursive(const char *controller, const char *path, bool ignore_self); @@ -128,12 +128,12 @@ bool cg_controller_is_valid(const char *p); typedef const char* (*cg_migrate_callback_t)(CGroupControllerMask mask, void *userdata); -int cg_create_everywhere(CGroupControllerMask supported, CGroupControllerMask mask, const char *path); +// UNNEEDED int cg_create_everywhere(CGroupControllerMask supported, CGroupControllerMask mask, const char *path); int cg_attach_everywhere(CGroupControllerMask supported, const char *path, pid_t pid, cg_migrate_callback_t callback, void *userdata); -int cg_attach_many_everywhere(CGroupControllerMask supported, const char *path, Set* pids, cg_migrate_callback_t callback, void *userdata); -int cg_migrate_everywhere(CGroupControllerMask supported, const char *from, const char *to, cg_migrate_callback_t callback, void *userdata); -int cg_trim_everywhere(CGroupControllerMask supported, const char *path, bool delete_root); +// UNNEEDED int cg_attach_many_everywhere(CGroupControllerMask supported, const char *path, Set* pids, cg_migrate_callback_t callback, void *userdata); +// UNNEEDED int cg_migrate_everywhere(CGroupControllerMask supported, const char *from, const char *to, cg_migrate_callback_t callback, void *userdata); +// UNNEEDED int cg_trim_everywhere(CGroupControllerMask supported, const char *path, bool delete_root); -CGroupControllerMask cg_mask_supported(void); +// UNNEEDED CGroupControllerMask cg_mask_supported(void); -int cg_kernel_controllers(Set *controllers); +// UNNEEDED int cg_kernel_controllers(Set *controllers); diff --git a/src/basic/fileio.c b/src/basic/fileio.c index 718ed3642..db2c46cfb 100644 --- a/src/basic/fileio.c +++ b/src/basic/fileio.c @@ -134,6 +134,8 @@ int read_one_line_file(const char *fn, char **line) { return 0; } +/// UNNEEDED by elogind +#if 0 int verify_one_line_file(const char *fn, const char *line) { _cleanup_free_ char *value = NULL; int r; @@ -144,6 +146,7 @@ int verify_one_line_file(const char *fn, const char *line) { return streq(value, line); } +#endif // 0 int read_full_stream(FILE *f, char **contents, size_t *size) { size_t n, l; diff --git a/src/basic/fileio.h b/src/basic/fileio.h index 1fdad924e..edae438e4 100644 --- a/src/basic/fileio.h +++ b/src/basic/fileio.h @@ -38,7 +38,7 @@ int read_one_line_file(const char *fn, char **line); int read_full_file(const char *fn, char **contents, size_t *size); int read_full_stream(FILE *f, char **contents, size_t *size); -int verify_one_line_file(const char *fn, const char *line); +// UNNEEDED int verify_one_line_file(const char *fn, const char *line); int parse_env_file(const char *fname, const char *separator, ...) _sentinel_; int load_env_file(FILE *f, const char *fname, const char *separator, char ***l); diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c index 55e198960..83c76ae0d 100644 --- a/src/basic/hashmap.c +++ b/src/basic/hashmap.c @@ -1455,6 +1455,8 @@ int hashmap_remove_and_put(Hashmap *h, const void *old_key, const void *new_key, return 0; } +/// UNNEEDED by elogind +#if 0 int set_remove_and_put(Set *s, const void *old_key, const void *new_key) { struct swap_entries swap; struct hashmap_base_entry *e; @@ -1480,6 +1482,7 @@ int set_remove_and_put(Set *s, const void *old_key, const void *new_key) { return 0; } +#endif // 0 int hashmap_remove_and_replace(Hashmap *h, const void *old_key, const void *new_key, void *value) { struct swap_entries swap; diff --git a/src/basic/hostname-util.c b/src/basic/hostname-util.c index e336f269f..8f6a5b431 100644 --- a/src/basic/hostname-util.c +++ b/src/basic/hostname-util.c @@ -25,6 +25,8 @@ #include "util.h" #include "hostname-util.h" +/// UNNEEDED by elogind +#if 0 bool hostname_is_set(void) { struct utsname u; @@ -50,6 +52,7 @@ char* gethostname_malloc(void) { return strdup(u.nodename); } +#endif // 0 static bool hostname_valid_char(char c) { return @@ -142,6 +145,8 @@ bool is_localhost(const char *hostname) { endswith(hostname, ".localdomain."); } +/// UNNEEDED by elogind +#if 0 int sethostname_idempotent(const char *s) { char buf[HOST_NAME_MAX + 1] = {}; @@ -191,3 +196,4 @@ int read_hostname_config(const char *path, char **hostname) { *hostname = name; return 0; } +#endif // 0 diff --git a/src/basic/hostname-util.h b/src/basic/hostname-util.h index 0c4763cf5..c92b19cdc 100644 --- a/src/basic/hostname-util.h +++ b/src/basic/hostname-util.h @@ -25,15 +25,15 @@ #include "macro.h" -bool hostname_is_set(void); +// UNNEEDED bool hostname_is_set(void); -char* gethostname_malloc(void); +// UNNEEDED char* gethostname_malloc(void); bool hostname_is_valid(const char *s) _pure_; char* hostname_cleanup(char *s, bool lowercase); bool is_localhost(const char *hostname); -int sethostname_idempotent(const char *s); +// UNNEEDED int sethostname_idempotent(const char *s); -int read_hostname_config(const char *path, char **hostname); +// UNNEEDED int read_hostname_config(const char *path, char **hostname); diff --git a/src/basic/label.c b/src/basic/label.c index 82f10b21b..73c15cb63 100644 --- a/src/basic/label.c +++ b/src/basic/label.c @@ -58,6 +58,8 @@ int mkdir_label(const char *path, mode_t mode) { return mac_smack_fix(path, false, false); } +/// UNNEEDED by elogind +#if 0 int symlink_label(const char *old_path, const char *new_path) { int r; @@ -78,3 +80,4 @@ int symlink_label(const char *old_path, const char *new_path) { return mac_smack_fix(new_path, false, false); } +#endif // 0 diff --git a/src/basic/label.h b/src/basic/label.h index 8070bcb02..455a729ea 100644 --- a/src/basic/label.h +++ b/src/basic/label.h @@ -27,4 +27,4 @@ int label_fix(const char *path, bool ignore_enoent, bool ignore_erofs); int mkdir_label(const char *path, mode_t mode); -int symlink_label(const char *old_path, const char *new_path); +// UNNEEDED int symlink_label(const char *old_path, const char *new_path); diff --git a/src/basic/log.c b/src/basic/log.c index b96afc4de..e51b4e0b8 100644 --- a/src/basic/log.c +++ b/src/basic/log.c @@ -295,9 +295,12 @@ void log_close(void) { log_close_console(); } +/// UNNEEDED by elogind +#if 0 void log_forget_fds(void) { console_fd = kmsg_fd = syslog_fd = journal_fd = -1; } +#endif // 0 void log_set_max_level(int level) { assert((level & LOG_PRIMASK) == level); @@ -1061,6 +1064,8 @@ static const char *const log_target_table[_LOG_TARGET_MAX] = { DEFINE_STRING_TABLE_LOOKUP(log_target, LogTarget); +/// UNNEEDED by elogind +#if 0 void log_received_signal(int level, const struct signalfd_siginfo *si) { if (si->ssi_pid > 0) { _cleanup_free_ char *p = NULL; @@ -1081,6 +1086,7 @@ void log_received_signal(int level, const struct signalfd_siginfo *si) { void log_set_upgrade_syslog_to_journal(bool b) { upgrade_syslog_to_journal = b; } +#endif // 0 int log_syntax_internal( const char *unit, diff --git a/src/basic/log.h b/src/basic/log.h index 569762d08..3ed6a0e8d 100644 --- a/src/basic/log.h +++ b/src/basic/log.h @@ -66,7 +66,7 @@ int log_get_max_level(void) _pure_; int log_open(void); void log_close(void); -void log_forget_fds(void); +// UNNEEDED void log_forget_fds(void); void log_close_syslog(void); void log_close_journal(void); @@ -205,9 +205,9 @@ LogTarget log_target_from_string(const char *s) _pure_; #define LOG_MESSAGE(fmt, ...) "MESSAGE=" fmt, ##__VA_ARGS__ #define LOG_MESSAGE_ID(x) "MESSAGE_ID=" SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(x) -void log_received_signal(int level, const struct signalfd_siginfo *si); +// UNNEEDED void log_received_signal(int level, const struct signalfd_siginfo *si); -void log_set_upgrade_syslog_to_journal(bool b); +// UNNEEDED void log_set_upgrade_syslog_to_journal(bool b); int log_syntax_internal( const char *unit, diff --git a/src/basic/mkdir-label.c b/src/basic/mkdir-label.c index 221dd67eb..66978413c 100644 --- a/src/basic/mkdir-label.c +++ b/src/basic/mkdir-label.c @@ -3,7 +3,8 @@ /*** This file is part of systemd. - Copyright 2014 Zbigniew Jędrzejewski-Szmek + Copyright 2010 Lennart Poettering + Copyright 2013 Kay Sievers systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -19,32 +20,23 @@ along with systemd; If not, see . ***/ -#include #include -#include #include -#include "util.h" -#include "formats-util.h" +#include "label.h" +#include "mkdir.h" -int main(int argc, char** argv) { - const char *p = argv[1] ?: "/tmp"; - char *pattern = strjoina(p, "/systemd-test-XXXXXX"); - _cleanup_close_ int fd, fd2; - _cleanup_free_ char *cmd, *cmd2; - - fd = open_tmpfile(p, O_RDWR|O_CLOEXEC); - assert_se(fd >= 0); - - assert_se(asprintf(&cmd, "ls -l /proc/"PID_FMT"/fd/%d", getpid(), fd) > 0); - system(cmd); - - fd2 = mkostemp_safe(pattern, O_RDWR|O_CLOEXEC); - assert_se(fd >= 0); - assert_se(unlink(pattern) == 0); +int mkdir_safe_label(const char *path, mode_t mode, uid_t uid, gid_t gid) { + return mkdir_safe_internal(path, mode, uid, gid, mkdir_label); +} - assert_se(asprintf(&cmd2, "ls -l /proc/"PID_FMT"/fd/%d", getpid(), fd2) > 0); - system(cmd2); +/// UNNEEDED by elogind +#if 0 +int mkdir_parents_label(const char *path, mode_t mode) { + return mkdir_parents_internal(NULL, path, mode, mkdir_label); +} +#endif // 0 - return 0; +int mkdir_p_label(const char *path, mode_t mode) { + return mkdir_p_internal(NULL, path, mode, mkdir_label); } diff --git a/src/basic/mkdir.h b/src/basic/mkdir.h index 2392d1fd1..9a554c1ef 100644 --- a/src/basic/mkdir.h +++ b/src/basic/mkdir.h @@ -30,7 +30,7 @@ int mkdir_p(const char *path, mode_t mode); /* mandatory access control(MAC) versions */ int mkdir_safe_label(const char *path, mode_t mode, uid_t uid, gid_t gid); -int mkdir_parents_label(const char *path, mode_t mode); +// UNNEEDED int mkdir_parents_label(const char *path, mode_t mode); int mkdir_p_label(const char *path, mode_t mode); /* internally used */ diff --git a/src/basic/path-util.c b/src/basic/path-util.c index cc985b067..4325f55f2 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -84,6 +84,8 @@ int path_get_parent(const char *path, char **_r) { return 0; } +/// UNNEEDED by elogind +#if 0 char **path_split_and_make_absolute(const char *p) { char **l; assert(p); @@ -99,6 +101,7 @@ char **path_split_and_make_absolute(const char *p) { return l; } +#endif // 0 char *path_make_absolute(const char *p, const char *prefix) { assert(p); @@ -454,6 +457,8 @@ bool path_equal(const char *a, const char *b) { return path_compare(a, b) == 0; } +/// UNNEEDED by elogind +#if 0 bool path_equal_or_files_same(const char *a, const char *b) { return path_equal(a, b) || files_same(a, b) > 0; } @@ -473,6 +478,7 @@ char* path_join(const char *root, const char *path, const char *rest) { rest && rest[0] == '/' ? rest+1 : rest, NULL); } +#endif // 0 static int fd_fdinfo_mnt_id(int fd, const char *filename, int flags, int *mnt_id) { char path[strlen("/proc/self/fdinfo/") + DECIMAL_STR_MAX(int)]; @@ -692,6 +698,8 @@ int path_is_read_only_fs(const char *path) { return false; } +/// UNNEEDED by elogind +#if 0 int path_is_os_tree(const char *path) { char *p; int r; @@ -709,6 +717,7 @@ int path_is_os_tree(const char *path) { return r >= 0; } +#endif // 0 int find_binary(const char *name, bool local, char **filename) { assert(name); @@ -798,7 +807,6 @@ bool paths_check_timestamp(const char* const* paths, usec_t *timestamp, bool upd return changed; } -#endif // 0 int fsck_exists(const char *fstype) { _cleanup_free_ char *p = NULL, *d = NULL; @@ -823,6 +831,7 @@ int fsck_exists(const char *fstype) { return 0; } +#endif // 0 char *prefix_root(const char *root, const char *path) { char *n, *p; diff --git a/src/basic/path-util.h b/src/basic/path-util.h index 5e6e3db89..b692f17ab 100644 --- a/src/basic/path-util.h +++ b/src/basic/path-util.h @@ -36,7 +36,7 @@ #endif bool is_path(const char *p) _pure_; -char** path_split_and_make_absolute(const char *p); +// UNNEEDED char** path_split_and_make_absolute(const char *p); int path_get_parent(const char *path, char **parent); bool path_is_absolute(const char *p) _pure_; char* path_make_absolute(const char *p, const char *prefix); @@ -46,8 +46,8 @@ char* path_kill_slashes(char *path); char* path_startswith(const char *path, const char *prefix) _pure_; int path_compare(const char *a, const char *b) _pure_; bool path_equal(const char *a, const char *b) _pure_; -bool path_equal_or_files_same(const char *a, const char *b); -char* path_join(const char *root, const char *path, const char *rest); +// UNNEEDED bool path_equal_or_files_same(const char *a, const char *b); +// UNNEEDED char* path_join(const char *root, const char *path, const char *rest); char** path_strv_make_absolute_cwd(char **l); char** path_strv_resolve(char **l, const char *prefix); @@ -56,13 +56,13 @@ char** path_strv_resolve_uniq(char **l, const char *prefix); int fd_is_mount_point(int fd, const char *filename, int flags); int path_is_mount_point(const char *path, int flags); int path_is_read_only_fs(const char *path); -int path_is_os_tree(const char *path); +// UNNEEDED int path_is_os_tree(const char *path); int find_binary(const char *name, bool local, char **filename); // UNNEEDED bool paths_check_timestamp(const char* const* paths, usec_t *paths_ts_usec, bool update); -int fsck_exists(const char *fstype); +// UNNEEDED int fsck_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 diff --git a/src/basic/process-util.c b/src/basic/process-util.c index 9e7ddca91..b05591eb8 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -243,6 +243,8 @@ int get_process_exe(pid_t pid, char **name) { return 0; } +/// UNNEEDED by elogind +#if 0 static int get_process_id(pid_t pid, const char *field, uid_t *uid) { _cleanup_fclose_ FILE *f = NULL; char line[LINE_MAX]; @@ -281,8 +283,6 @@ int get_process_uid(pid_t pid, uid_t *uid) { return get_process_id(pid, "Uid:", uid); } -/// UNNEEDED by elogind -#if 0 int get_process_gid(pid_t pid, gid_t *gid) { assert_cc(sizeof(uid_t) == sizeof(gid_t)); return get_process_id(pid, "Gid:", gid); @@ -452,6 +452,8 @@ int wait_for_terminate_and_warn(const char *name, pid_t pid, bool check_exit_cod return -EPROTO; } +/// UNNEEDED by elogind +#if 0 int kill_and_sigcont(pid_t pid, int sig) { int r; @@ -462,6 +464,7 @@ int kill_and_sigcont(pid_t pid, int sig) { return r; } +#endif // 0 int getenv_for_pid(pid_t pid, const char *field, char **_value) { _cleanup_fclose_ FILE *f = NULL; diff --git a/src/basic/process-util.h b/src/basic/process-util.h index 0f0475a81..1482cca34 100644 --- a/src/basic/process-util.h +++ b/src/basic/process-util.h @@ -45,7 +45,7 @@ int get_process_state(pid_t pid); int get_process_comm(pid_t pid, char **name); int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char **line); int get_process_exe(pid_t pid, char **name); -int get_process_uid(pid_t pid, uid_t *uid); +// UNNEEDED int get_process_uid(pid_t pid, uid_t *uid); // UNNEEDED int get_process_gid(pid_t pid, gid_t *gid); // UNNEEDED int get_process_capeff(pid_t pid, char **capeff); // UNNEEDED int get_process_cwd(pid_t pid, char **cwd); @@ -55,9 +55,9 @@ int get_process_uid(pid_t pid, uid_t *uid); int wait_for_terminate(pid_t pid, siginfo_t *status); int wait_for_terminate_and_warn(const char *name, pid_t pid, bool check_exit_code); -int kill_and_sigcont(pid_t pid, int sig); +// UNNEEDED int kill_and_sigcont(pid_t pid, int sig); pid_t get_parent_of_pid(pid_t pid, pid_t *ppid); -void rename_process(const char name[8]); +// UNNEEDED void rename_process(const char name[8]); int is_kernel_thread(pid_t pid); int getenv_for_pid(pid_t pid, const char *field, char **_value); diff --git a/src/basic/selinux-util.c b/src/basic/selinux-util.c index 69885d9fc..03ebab32c 100644 --- a/src/basic/selinux-util.c +++ b/src/basic/selinux-util.c @@ -57,11 +57,14 @@ bool mac_selinux_use(void) { #endif } +/// UNNEEDED by elogind +#if 0 void mac_selinux_retest(void) { #ifdef HAVE_SELINUX cached_use = -1; #endif } +#endif // 0 int mac_selinux_init(const char *prefix) { int r = 0; @@ -109,6 +112,8 @@ int mac_selinux_init(const char *prefix) { return r; } +/// UNNEEDED by elogind +#if 0 void mac_selinux_finish(void) { #ifdef HAVE_SELINUX @@ -119,6 +124,7 @@ void mac_selinux_finish(void) { label_hnd = NULL; #endif } +#endif // 0 int mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs) { @@ -187,7 +193,6 @@ int mac_selinux_apply(const char *path, const char *label) { #endif return 0; } -#endif // 0 int mac_selinux_get_create_label_from_exe(const char *exe, char **label) { int r = -EOPNOTSUPP; @@ -307,6 +312,7 @@ void mac_selinux_free(char *label) { freecon((security_context_t) label); #endif } +#endif // 0 int mac_selinux_create_file_prepare(const char *path, mode_t mode) { int r = 0; @@ -364,6 +370,8 @@ void mac_selinux_create_file_clear(void) { #endif } +/// UNNEEDED by elogind +#if 0 int mac_selinux_create_socket_prepare(const char *label) { #ifdef HAVE_SELINUX @@ -463,3 +471,4 @@ skipped: #endif return bind(fd, addr, addrlen) < 0 ? -errno : 0; } +#endif // 0 diff --git a/src/basic/selinux-util.h b/src/basic/selinux-util.h index 6f6b08d0f..e60dac8de 100644 --- a/src/basic/selinux-util.h +++ b/src/basic/selinux-util.h @@ -25,23 +25,23 @@ #include bool mac_selinux_use(void); -void mac_selinux_retest(void); +// UNNEEDED void mac_selinux_retest(void); int mac_selinux_init(const char *prefix); -void mac_selinux_finish(void); +// UNNEEDED void mac_selinux_finish(void); int mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs); // UNNEEDED int mac_selinux_apply(const char *path, const char *label); -int mac_selinux_get_create_label_from_exe(const char *exe, char **label); -int mac_selinux_get_our_label(char **label); -int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *exec_label, char **label); -void mac_selinux_free(char *label); +// UNNEEDED int mac_selinux_get_create_label_from_exe(const char *exe, char **label); +// UNNEEDED int mac_selinux_get_our_label(char **label); +// UNNEEDED int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *exec_label, char **label); +// UNNEEDED void mac_selinux_free(char *label); int mac_selinux_create_file_prepare(const char *path, mode_t mode); void mac_selinux_create_file_clear(void); -int mac_selinux_create_socket_prepare(const char *label); -void mac_selinux_create_socket_clear(void); +// UNNEEDED int mac_selinux_create_socket_prepare(const char *label); +// UNNEEDED void mac_selinux_create_socket_clear(void); -int mac_selinux_bind(int fd, const struct sockaddr *addr, socklen_t addrlen); +// UNNEEDED int mac_selinux_bind(int fd, const struct sockaddr *addr, socklen_t addrlen); diff --git a/src/basic/set.h b/src/basic/set.h index 1d1699959..87cfcd8e4 100644 --- a/src/basic/set.h +++ b/src/basic/set.h @@ -63,7 +63,7 @@ static inline void *set_remove(Set *s, const void *key) { /* no set_remove2 */ /* no set_remove_value */ -int set_remove_and_put(Set *s, const void *old_key, const void *new_key); +// UNNEEDED int set_remove_and_put(Set *s, const void *old_key, const void *new_key); /* no set_remove_and_replace */ int set_merge(Set *s, Set *other); diff --git a/src/basic/signal-util.c b/src/basic/signal-util.c index 90abe8af8..4bb2177d6 100644 --- a/src/basic/signal-util.c +++ b/src/basic/signal-util.c @@ -112,6 +112,8 @@ int ignore_signals(int sig, ...) { return r; } +/// UNNEEDED by elogind +#if 0 int default_signals(int sig, ...) { static const struct sigaction sa = { @@ -128,6 +130,7 @@ int default_signals(int sig, ...) { return r; } +#endif // 0 static int sigset_add_many_ap(sigset_t *ss, va_list ap) { int sig, r = 0; diff --git a/src/basic/signal-util.h b/src/basic/signal-util.h index 5e6eb50b0..705fb47f6 100644 --- a/src/basic/signal-util.h +++ b/src/basic/signal-util.h @@ -29,7 +29,7 @@ int reset_all_signal_handlers(void); int reset_signal_mask(void); int ignore_signals(int sig, ...); -int default_signals(int sig, ...); +// UNNEEDED int default_signals(int sig, ...); int sigaction_many(const struct sigaction *sa, ...); int sigset_add_many(sigset_t *ss, ...); diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c index 047aa294f..c09609022 100644 --- a/src/basic/smack-util.c +++ b/src/basic/smack-util.c @@ -65,6 +65,8 @@ int mac_smack_apply(const char *path, const char *label) { return r; } +/// UNNEEDED by elogind +#if 0 int mac_smack_apply_fd(int fd, const char *label) { int r = 0; @@ -146,6 +148,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) { return r; } +#endif // 0 int mac_smack_fix(const char *path, bool ignore_enoent, bool ignore_erofs) { diff --git a/src/basic/smack-util.h b/src/basic/smack-util.h index 50f55b1f4..6472f8666 100644 --- a/src/basic/smack-util.h +++ b/src/basic/smack-util.h @@ -30,7 +30,7 @@ bool mac_smack_use(void); int mac_smack_fix(const char *path, bool ignore_enoent, bool ignore_erofs); int mac_smack_apply(const char *path, const char *label); -int mac_smack_apply_fd(int fd, const char *label); -int mac_smack_apply_pid(pid_t pid, const char *label); -int mac_smack_apply_ip_in_fd(int fd, const char *label); -int mac_smack_apply_ip_out_fd(int fd, const char *label); +// UNNEEDED int mac_smack_apply_fd(int fd, const char *label); +// UNNEEDED int mac_smack_apply_pid(pid_t pid, const char *label); +// UNNEEDED int mac_smack_apply_ip_in_fd(int fd, const char *label); +// UNNEEDED int mac_smack_apply_ip_out_fd(int fd, const char *label); diff --git a/src/basic/strv.c b/src/basic/strv.c index 31d83f3ef..5bf066ff0 100644 --- a/src/basic/strv.c +++ b/src/basic/strv.c @@ -201,6 +201,8 @@ int strv_extend_strv(char ***a, char **b) { return 0; } +/// UNNEEDED by elogind +#if 0 int strv_extend_strv_concat(char ***a, char **b, const char *suffix) { int r; char **s; @@ -221,6 +223,7 @@ int strv_extend_strv_concat(char ***a, char **b, const char *suffix) { return 0; } +#endif // 0 char **strv_split(const char *s, const char *separator) { const char *word, *state; @@ -279,7 +282,6 @@ char **strv_split_newlines(const char *s) { return l; } -#endif // 0 int strv_split_quoted(char ***t, const char *s, UnquoteFlags flags) { size_t n = 0, allocated = 0; @@ -315,6 +317,7 @@ int strv_split_quoted(char ***t, const char *s, UnquoteFlags flags) { return 0; } +#endif // 0 char *strv_join(char **l, const char *separator) { char *r, *e; @@ -350,6 +353,8 @@ char *strv_join(char **l, const char *separator) { return r; } +/// UNNEEDED by elogind +#if 0 char *strv_join_quoted(char **l) { char *buf = NULL; char **s; @@ -386,6 +391,7 @@ char *strv_join_quoted(char **l) { free(buf); return NULL; } +#endif // 0 int strv_push(char ***l, char *value) { char **c; diff --git a/src/basic/strv.h b/src/basic/strv.h index 2a2003c3d..9629480d8 100644 --- a/src/basic/strv.h +++ b/src/basic/strv.h @@ -41,7 +41,7 @@ char **strv_copy(char * const *l); unsigned strv_length(char * const *l) _pure_; int strv_extend_strv(char ***a, char **b); -int strv_extend_strv_concat(char ***a, char **b, const char *suffix); +// UNNEEDED int strv_extend_strv_concat(char ***a, char **b, const char *suffix); int strv_extend(char ***l, const char *value); // UNNEEDED int strv_extendf(char ***l, const char *format, ...) _printf_(2,0); int strv_push(char ***l, char *value); @@ -73,10 +73,10 @@ static inline bool strv_isempty(char * const *l) { char **strv_split(const char *s, const char *separator); // UNNEEDED char **strv_split_newlines(const char *s); -int strv_split_quoted(char ***t, const char *s, UnquoteFlags flags); +// UNNEEDED int strv_split_quoted(char ***t, const char *s, UnquoteFlags flags); char *strv_join(char **l, const char *separator); -char *strv_join_quoted(char **l); +// UNNEEDED char *strv_join_quoted(char **l); char **strv_parse_nulstr(const char *s, size_t l); char **strv_split_nulstr(const char *s); diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c index 103643614..3c473dc92 100644 --- a/src/basic/terminal-util.c +++ b/src/basic/terminal-util.c @@ -126,6 +126,8 @@ int read_one_char(FILE *f, char *ret, usec_t t, bool *need_nl) { return 0; } +/// UNNEEDED by elogind +#if 0 int ask_char(char *ret, const char *replies, const char *text, ...) { int r; @@ -174,8 +176,6 @@ int ask_char(char *ret, const char *replies, const char *text, ...) { } } -/// UNNEEDED by elogind -#if 0 int ask_string(char **ret, const char *text, ...) { assert(ret); assert(text); @@ -492,6 +492,8 @@ fail: return r; } +/// UNNEEDED by elogind +#if 0 int release_terminal(void) { static const struct sigaction sa_new = { .sa_handler = SIG_IGN, @@ -517,6 +519,7 @@ int release_terminal(void) { return r; } +#endif // 0 int terminal_vhangup_fd(int fd) { assert(fd >= 0); @@ -627,6 +630,8 @@ void warn_melody(void) { ioctl(fd, KIOCSOUND, 0); } +/// UNNEEDED by elogind +#if 0 int make_console_stdio(void) { int fd, r; @@ -642,6 +647,7 @@ int make_console_stdio(void) { return 0; } +#endif // 0 int status_vprintf(const char *status, bool ellipse, bool ephemeral, const char *format, va_list ap) { static const char status_indent[] = " "; /* "[" STATUS "] " */ @@ -810,11 +816,14 @@ bool tty_is_vc_resolve(const char *tty) { return tty_is_vc(tty); } +/// UNNEEDED by elogind +#if 0 const char *default_term_for_tty(const char *tty) { assert(tty); return tty_is_vc_resolve(tty) ? "TERM=linux" : "TERM=vt220"; } +#endif // 0 int fd_columns(int fd) { struct winsize ws = {}; @@ -969,6 +978,8 @@ int getttyname_malloc(int fd, char **ret) { return 0; } +/// UNNEEDED by elogind +#if 0 int getttyname_harder(int fd, char **r) { int k; char *s = NULL; @@ -985,6 +996,7 @@ int getttyname_harder(int fd, char **r) { *r = s; return 0; } +#endif // 0 int get_ctty_devnr(pid_t pid, dev_t *d) { int r; diff --git a/src/basic/terminal-util.h b/src/basic/terminal-util.h index f6eace411..5964ae5e6 100644 --- a/src/basic/terminal-util.h +++ b/src/basic/terminal-util.h @@ -41,7 +41,7 @@ int reset_terminal(const char *name); 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); -int release_terminal(void); +// UNNEEDED int release_terminal(void); int terminal_vhangup_fd(int fd); int terminal_vhangup(const char *name); @@ -49,7 +49,7 @@ int terminal_vhangup(const char *name); int chvt(int vt); int read_one_char(FILE *f, char *ret, usec_t timeout, bool *need_nl); -int ask_char(char *ret, const char *replies, const char *text, ...) _printf_(3, 4); +// 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); @@ -59,13 +59,13 @@ bool tty_is_vc(const char *tty); bool tty_is_vc_resolve(const char *tty); bool tty_is_console(const char *tty) _pure_; int vtnr_from_tty(const char *tty); -const char *default_term_for_tty(const char *tty); +// UNNEEDED const char *default_term_for_tty(const char *tty); void warn_melody(void); int make_stdio(int fd); int make_null_stdio(void); -int make_console_stdio(void); +// UNNEEDED int make_console_stdio(void); int status_vprintf(const char *status, bool ellipse, bool ephemeral, const char *format, va_list ap) _printf_(4,0); int status_printf(const char *status, bool ellipse, bool ephemeral, const char *format, ...) _printf_(4,5); @@ -106,4 +106,4 @@ int get_ctty_devnr(pid_t pid, dev_t *d); int get_ctty(pid_t, dev_t *_devnr, char **r); int getttyname_malloc(int fd, char **r); -int getttyname_harder(int fd, char **r); +// UNNEEDED int getttyname_harder(int fd, char **r); diff --git a/src/basic/time-util.c b/src/basic/time-util.c index ecca227c7..e849ccc57 100644 --- a/src/basic/time-util.c +++ b/src/basic/time-util.c @@ -67,6 +67,8 @@ dual_timestamp* dual_timestamp_from_realtime(dual_timestamp *ts, usec_t u) { return ts; } +/// UNNEEDED by elogind +#if 0 dual_timestamp* dual_timestamp_from_monotonic(dual_timestamp *ts, usec_t u) { int64_t delta; assert(ts); @@ -87,6 +89,7 @@ dual_timestamp* dual_timestamp_from_monotonic(dual_timestamp *ts, usec_t u) { return ts; } +#endif // 0 usec_t timespec_load(const struct timespec *ts) { assert(ts); @@ -209,9 +212,12 @@ char *format_timestamp_us(char *buf, size_t l, usec_t t) { return format_timestamp_internal_us(buf, l, t, false); } +/// UNNEEDED by elogind +#if 0 char *format_timestamp_us_utc(char *buf, size_t l, usec_t t) { return format_timestamp_internal_us(buf, l, t, true); } +#endif // 0 char *format_timestamp_relative(char *buf, size_t l, usec_t t) { const char *s; @@ -386,6 +392,8 @@ char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy) { return buf; } +/// UNNEEDED by elogind +#if 0 void dual_timestamp_serialize(FILE *f, const char *name, dual_timestamp *t) { assert(f); @@ -418,8 +426,6 @@ int dual_timestamp_deserialize(const char *value, dual_timestamp *t) { return 0; } -/// UNNEEDED by elogind -#if 0 int parse_timestamp(const char *t, usec_t *usec) { static const struct { const char *name; @@ -985,7 +991,6 @@ bool timezone_is_valid(const char *name) { return true; } -#endif // 0 clockid_t clock_boottime_or_monotonic(void) { static clockid_t clock = -1; @@ -1004,3 +1009,4 @@ clockid_t clock_boottime_or_monotonic(void) { return clock; } +#endif // 0 diff --git a/src/basic/time-util.h b/src/basic/time-util.h index 48ca453e6..5913639ec 100644 --- a/src/basic/time-util.h +++ b/src/basic/time-util.h @@ -73,7 +73,7 @@ usec_t now(clockid_t clock); dual_timestamp* dual_timestamp_get(dual_timestamp *ts); dual_timestamp* dual_timestamp_from_realtime(dual_timestamp *ts, usec_t u); -dual_timestamp* dual_timestamp_from_monotonic(dual_timestamp *ts, usec_t u); +// UNNEEDED dual_timestamp* dual_timestamp_from_monotonic(dual_timestamp *ts, usec_t u); static inline bool dual_timestamp_is_set(dual_timestamp *ts) { return ((ts->realtime > 0 && ts->realtime != USEC_INFINITY) || @@ -89,12 +89,12 @@ struct timeval *timeval_store(struct timeval *tv, usec_t u); char *format_timestamp(char *buf, size_t l, usec_t t); // UNNEEDED char *format_timestamp_utc(char *buf, size_t l, usec_t t); char *format_timestamp_us(char *buf, size_t l, usec_t t); -char *format_timestamp_us_utc(char *buf, size_t l, usec_t t); +// UNNEEDED char *format_timestamp_us_utc(char *buf, size_t l, usec_t t); char *format_timestamp_relative(char *buf, size_t l, usec_t t); char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy); -void dual_timestamp_serialize(FILE *f, const char *name, dual_timestamp *t); -int dual_timestamp_deserialize(const char *value, dual_timestamp *t); +// UNNEEDED void dual_timestamp_serialize(FILE *f, const char *name, dual_timestamp *t); +// UNNEEDED int dual_timestamp_deserialize(const char *value, dual_timestamp *t); // UNNEEDED int parse_timestamp(const char *t, usec_t *usec); @@ -106,6 +106,6 @@ int parse_nsec(const char *t, nsec_t *nsec); // UNNEEDED int get_timezones(char ***l); // UNNEEDED bool timezone_is_valid(const char *name); -clockid_t clock_boottime_or_monotonic(void); +// UNNEEDED clockid_t clock_boottime_or_monotonic(void); #define xstrftime(buf, fmt, tm) assert_se(strftime(buf, ELEMENTSOF(buf), fmt, tm) > 0) diff --git a/src/basic/unit-name.c b/src/basic/unit-name.c index bf52463d8..5dac442b1 100644 --- a/src/basic/unit-name.c +++ b/src/basic/unit-name.c @@ -142,6 +142,8 @@ int unit_name_to_prefix(const char *n, char **ret) { return 0; } +/// UNNEEDED by elogind +#if 0 int unit_name_to_instance(const char *n, char **instance) { const char *p, *d; char *i; @@ -194,6 +196,7 @@ int unit_name_to_prefix_and_instance(const char *n, char **ret) { *ret = s; return 0; } +#endif // 0 UnitType unit_name_to_type(const char *n) { const char *e; @@ -208,6 +211,8 @@ UnitType unit_name_to_type(const char *n) { return unit_type_from_string(e + 1); } +/// UNNEEDED by elogind +#if 0 int unit_name_change_suffix(const char *n, const char *suffix, char **ret) { char *e, *s; size_t a, b; @@ -236,6 +241,7 @@ int unit_name_change_suffix(const char *n, const char *suffix, char **ret) { return 0; } +#endif // 0 int unit_name_build(const char *prefix, const char *instance, const char *suffix, char **ret) { char *s; @@ -437,6 +443,8 @@ int unit_name_path_unescape(const char *f, char **ret) { return 0; } +/// UNNEEDED by elogind +#if 0 int unit_name_replace_instance(const char *f, const char *i, char **ret) { const char *p, *e; char *s; @@ -492,6 +500,7 @@ int unit_name_template(const char *f, char **ret) { *ret = s; return 0; } +#endif // 0 int unit_name_from_path(const char *path, const char *suffix, char **ret) { _cleanup_free_ char *p = NULL; @@ -517,6 +526,8 @@ int unit_name_from_path(const char *path, const char *suffix, char **ret) { return 0; } +/// UNNEEDED by elogind +#if 0 int unit_name_from_path_instance(const char *prefix, const char *path, const char *suffix, char **ret) { _cleanup_free_ char *p = NULL; char *s; @@ -557,6 +568,7 @@ int unit_name_to_path(const char *name, char **ret) { return unit_name_path_unescape(prefix, ret); } +#endif // 0 char *unit_dbus_path_from_name(const char *name) { _cleanup_free_ char *e = NULL; @@ -671,6 +683,8 @@ int unit_name_mangle_with_suffix(const char *name, UnitNameMangle allow_globs, c return 1; } +/// UNNEEDED by elogind +#if 0 int slice_build_parent_slice(const char *slice, char **ret) { char *s, *dash; @@ -703,6 +717,7 @@ int slice_build_parent_slice(const char *slice, char **ret) { *ret = s; return 1; } +#endif // 0 int slice_build_subslice(const char *slice, const char*name, char **ret) { char *subslice; diff --git a/src/basic/unit-name.h b/src/basic/unit-name.h index b2043d087..2a954e539 100644 --- a/src/basic/unit-name.h +++ b/src/basic/unit-name.h @@ -127,12 +127,12 @@ static inline int unit_prefix_and_instance_is_valid(const char *p) { } int unit_name_to_prefix(const char *n, char **prefix); -int unit_name_to_instance(const char *n, char **instance); -int unit_name_to_prefix_and_instance(const char *n, char **ret); +// UNNEEDED int unit_name_to_instance(const char *n, char **instance); +// UNNEEDED int unit_name_to_prefix_and_instance(const char *n, char **ret); UnitType unit_name_to_type(const char *n) _pure_; -int unit_name_change_suffix(const char *n, const char *suffix, char **ret); +// UNNEEDED int unit_name_change_suffix(const char *n, const char *suffix, char **ret); int unit_name_build(const char *prefix, const char *instance, const char *suffix, char **ret); @@ -141,13 +141,13 @@ int unit_name_unescape(const char *f, char **ret); int unit_name_path_escape(const char *f, char **ret); int unit_name_path_unescape(const char *f, char **ret); -int unit_name_replace_instance(const char *f, const char *i, char **ret); +// UNNEEDED int unit_name_replace_instance(const char *f, const char *i, char **ret); -int unit_name_template(const char *f, char **ret); +// UNNEEDED int unit_name_template(const char *f, char **ret); int unit_name_from_path(const char *path, const char *suffix, char **ret); -int unit_name_from_path_instance(const char *prefix, const char *path, const char *suffix, char **ret); -int unit_name_to_path(const char *name, char **ret); +// UNNEEDED int unit_name_from_path_instance(const char *prefix, const char *path, const char *suffix, char **ret); +// UNNEEDED int unit_name_to_path(const char *name, char **ret); char *unit_dbus_path_from_name(const char *name); int unit_name_from_dbus_path(const char *path, char **name); @@ -163,7 +163,7 @@ static inline int unit_name_mangle(const char *name, UnitNameMangle allow_globs, return unit_name_mangle_with_suffix(name, allow_globs, ".service", ret); } -int slice_build_parent_slice(const char *slice, char **ret); +// UNNEEDED int slice_build_parent_slice(const char *slice, char **ret); int slice_build_subslice(const char *slice, const char*name, char **subslice); bool slice_name_is_valid(const char *name); diff --git a/src/basic/virt.c b/src/basic/virt.c index 1299a75ed..b2383e526 100644 --- a/src/basic/virt.c +++ b/src/basic/virt.c @@ -386,6 +386,8 @@ finish: return r; } +/// UNNEEDED by elogind +#if 0 /* Returns a short identifier for the various VM/container implementations */ int detect_virtualization(const char **id) { int r; @@ -404,3 +406,4 @@ int detect_virtualization(const char **id) { return VIRTUALIZATION_NONE; } +#endif // 0 diff --git a/src/basic/virt.h b/src/basic/virt.h index 4ec33946c..0f390981d 100644 --- a/src/basic/virt.h +++ b/src/basic/virt.h @@ -1,9 +1,11 @@ /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ +#pragma once + /*** This file is part of systemd. - Copyright 2014 Tom Gundersen + Copyright 2011 Lennart Poettering systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -19,49 +21,15 @@ along with systemd; If not, see . ***/ -#pragma once - -typedef struct VxLan VxLan; - -#include "networkd-netdev.h" - -#include "in-addr-util.h" - -#define VXLAN_VID_MAX (1u << 24) - 1 +int detect_vm(const char **id); +int detect_container(const char **id); -struct VxLan { - NetDev meta; - - uint64_t id; - - int family; - union in_addr_union group; - - unsigned tos; - unsigned ttl; - - usec_t fdb_ageing; - - bool learning; - bool arp_proxy; - bool route_short_circuit; - bool l2miss; - bool l3miss; - bool udpcsum; - bool udp6zerocsumtx; - bool udp6zerocsumrx; - bool group_policy; +enum { + VIRTUALIZATION_NONE = 0, + VIRTUALIZATION_VM, + VIRTUALIZATION_CONTAINER, + _VIRTUALIZATION_MAX, + _VIRTUALIZATION_INVALID = -1 }; -extern const NetDevVTable vxlan_vtable; - -int config_parse_vxlan_group_address(const char *unit, - const char *filename, - unsigned line, - const char *section, - unsigned section_line, - const char *lvalue, - int ltype, - const char *rvalue, - void *data, - void *userdata); +// UNNEEDED int detect_virtualization(const char **id); diff --git a/src/libelogind/sd-bus/bus-kernel.c b/src/libelogind/sd-bus/bus-kernel.c index 6ac5ebc3d..89d7023d9 100644 --- a/src/libelogind/sd-bus/bus-kernel.c +++ b/src/libelogind/sd-bus/bus-kernel.c @@ -1556,6 +1556,8 @@ uint64_t attach_flags_to_kdbus(uint64_t mask) { return m; } +/// UNNEEDED by elogind +#if 0 int bus_kernel_create_bus(const char *name, bool world, char **s) { struct kdbus_cmd *make; struct kdbus_item *n; @@ -1631,6 +1633,7 @@ int bus_kernel_create_bus(const char *name, bool world, char **s) { return fd; } +#endif // 0 int bus_kernel_open_bus_fd(const char *bus, char **path) { char *p; @@ -1664,6 +1667,8 @@ int bus_kernel_open_bus_fd(const char *bus, char **path) { return fd; } +/// UNNEEDED by elogind +#if 0 int bus_kernel_create_endpoint(const char *bus_name, const char *ep_name, char **ep_path) { _cleanup_free_ char *path = NULL; struct kdbus_cmd *make; @@ -1707,6 +1712,7 @@ int bus_kernel_create_endpoint(const char *bus_name, const char *ep_name, char * return fd; } +#endif // 0 int bus_kernel_try_close(sd_bus *bus) { struct kdbus_cmd byebye = { .size = sizeof(byebye) }; @@ -1720,6 +1726,8 @@ int bus_kernel_try_close(sd_bus *bus) { return 0; } +/// UNNEEDED by elogind +#if 0 int bus_kernel_drop_one(int fd) { struct kdbus_cmd_recv recv = { .size = sizeof(recv), @@ -1733,6 +1741,7 @@ int bus_kernel_drop_one(int fd) { return 0; } +#endif // 0 int bus_kernel_realize_attach_flags(sd_bus *bus) { struct kdbus_cmd *update; diff --git a/src/libelogind/sd-bus/bus-kernel.h b/src/libelogind/sd-bus/bus-kernel.h index bb4dff6d8..7086f9319 100644 --- a/src/libelogind/sd-bus/bus-kernel.h +++ b/src/libelogind/sd-bus/bus-kernel.h @@ -71,8 +71,8 @@ int bus_kernel_read_message(sd_bus *bus, bool hint_priority, int64_t priority); int bus_kernel_open_bus_fd(const char *bus, char **path); -int bus_kernel_create_bus(const char *name, bool world, char **s); -int bus_kernel_create_endpoint(const char *bus_name, const char *ep_name, char **path); +// UNNEEDED int bus_kernel_create_bus(const char *name, bool world, char **s); +// UNNEEDED int bus_kernel_create_endpoint(const char *bus_name, const char *ep_name, char **path); int bus_kernel_pop_memfd(sd_bus *bus, void **address, size_t *mapped, size_t *allocated); void bus_kernel_push_memfd(sd_bus *bus, int fd, void *address, size_t mapped, size_t allocated); @@ -86,7 +86,7 @@ uint64_t attach_flags_to_kdbus(uint64_t sd_bus_flags); int bus_kernel_try_close(sd_bus *bus); -int bus_kernel_drop_one(int fd); +// UNNEEDED int bus_kernel_drop_one(int fd); int bus_kernel_realize_attach_flags(sd_bus *bus); diff --git a/src/shared/apparmor-util.c b/src/shared/apparmor-util.c deleted file mode 100644 index c2bbd330b..000000000 --- a/src/shared/apparmor-util.c +++ /dev/null @@ -1,39 +0,0 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - -/*** - This file is part of systemd. - - Copyright 2013 Lennart Poettering - - systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with systemd; If not, see . -***/ - - -#include "util.h" -#include "fileio.h" -#include "apparmor-util.h" - -bool mac_apparmor_use(void) { - static int cached_use = -1; - - if (cached_use < 0) { - _cleanup_free_ char *p = NULL; - - cached_use = - read_one_line_file("/sys/module/apparmor/parameters/enabled", &p) >= 0 && - parse_boolean(p) > 0; - } - - return cached_use; -} diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index 3674105cc..9297b9f6b 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -93,6 +93,8 @@ int bus_async_unregister_and_exit(sd_event *e, sd_bus *bus, const char *name) { return 0; } +/// UNNEEDED by elogind +#if 0 int bus_event_loop_with_idle( sd_event *e, sd_bus *bus, @@ -165,6 +167,7 @@ int bus_event_loop_with_idle( return code; } +#endif // 0 int bus_name_has_owner(sd_bus *c, const char *name, sd_bus_error *error) { _cleanup_bus_message_unref_ sd_bus_message *rep = NULL; @@ -1100,6 +1103,8 @@ int bus_message_map_all_properties( return sd_bus_message_exit_container(m); } +/// UNNEEDED by elogind +#if 0 int bus_message_map_properties_changed( sd_bus_message *m, const struct bus_properties_map *map, @@ -1135,6 +1140,7 @@ int bus_message_map_properties_changed( return invalidated; } +#endif // 0 int bus_map_all_properties( sd_bus *bus, @@ -1202,6 +1208,8 @@ int bus_open_transport(BusTransport transport, const char *host, bool user, sd_b return r; } +/// UNNEEDED by elogind +#if 0 int bus_open_transport_systemd(BusTransport transport, const char *host, bool user, sd_bus **bus) { int r; @@ -1236,6 +1244,7 @@ int bus_open_transport_systemd(BusTransport transport, const char *host, bool us return r; } +#endif // 0 int bus_property_get_bool( sd_bus *bus, @@ -1305,6 +1314,8 @@ int bus_log_create_error(int r) { return log_error_errno(r, "Failed to create bus message: %m"); } +/// UNNEEDED by elogind +#if 0 int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) { assert(message); assert(u); @@ -1564,6 +1575,7 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen return 0; } +#endif // 0 typedef struct BusWaitForJobs { sd_bus *bus; @@ -1576,6 +1588,8 @@ typedef struct BusWaitForJobs { sd_bus_slot *slot_disconnected; } BusWaitForJobs; +/// UNNEEDED by elogind +#if 0 static int match_disconnected(sd_bus_message *m, void *userdata, sd_bus_error *error) { assert(m); @@ -1615,6 +1629,7 @@ static int match_job_removed(sd_bus_message *m, void *userdata, sd_bus_error *er return 0; } +#endif // 0 void bus_wait_for_jobs_free(BusWaitForJobs *d) { if (!d) @@ -1633,6 +1648,8 @@ void bus_wait_for_jobs_free(BusWaitForJobs *d) { free(d); } +/// UNNEEDED by elogind +#if 0 int bus_wait_for_jobs_new(sd_bus *bus, BusWaitForJobs **ret) { _cleanup_(bus_wait_for_jobs_freep) BusWaitForJobs *d = NULL; int r; @@ -1682,6 +1699,7 @@ int bus_wait_for_jobs_new(sd_bus *bus, BusWaitForJobs **ret) { return 0; } +#endif // 0 static int bus_process_wait(sd_bus *bus) { int r; diff --git a/src/shared/bus-util.h b/src/shared/bus-util.h index 3b6374ae7..d6277e213 100644 --- a/src/shared/bus-util.h +++ b/src/shared/bus-util.h @@ -47,14 +47,14 @@ struct bus_properties_map { int bus_map_id128(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata); int bus_message_map_all_properties(sd_bus_message *m, const struct bus_properties_map *map, void *userdata); -int bus_message_map_properties_changed(sd_bus_message *m, const struct bus_properties_map *map, void *userdata); +// UNNEEDED int bus_message_map_properties_changed(sd_bus_message *m, const struct bus_properties_map *map, void *userdata); int bus_map_all_properties(sd_bus *bus, const char *destination, const char *path, const struct bus_properties_map *map, void *userdata); int bus_async_unregister_and_exit(sd_event *e, sd_bus *bus, const char *name); typedef bool (*check_idle_t)(void *userdata); -int bus_event_loop_with_idle(sd_event *e, sd_bus *bus, const char *name, usec_t timeout, check_idle_t check_idle, void *userdata); +// UNNEEDED int bus_event_loop_with_idle(sd_event *e, sd_bus *bus, const char *name, usec_t timeout, check_idle_t check_idle, void *userdata); int bus_name_has_owner(sd_bus *c, const char *name, sd_bus_error *error); @@ -69,7 +69,7 @@ int bus_open_system_systemd(sd_bus **_bus); int bus_open_user_systemd(sd_bus **_bus); int bus_open_transport(BusTransport transport, const char *host, bool user, sd_bus **bus); -int bus_open_transport_systemd(BusTransport transport, const char *host, bool user, sd_bus **bus); +// UNNEEDED int bus_open_transport_systemd(BusTransport transport, const char *host, bool user, sd_bus **bus); int bus_print_property(const char *name, sd_bus_message *property, bool all); int bus_print_all_properties(sd_bus *bus, const char *dest, const char *path, char **filter, bool all); @@ -133,7 +133,7 @@ typedef struct UnitInfo { const char *job_path; } UnitInfo; -int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u); +// UNNEEDED int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u); DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus*, sd_bus_unref); DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus*, sd_bus_flush_close_unref); @@ -181,14 +181,15 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_track*, sd_bus_track_unref); SD_BUS_PROPERTY(name, "t", bus_property_get_usec, (offset) + offsetof(struct dual_timestamp, realtime), (flags)), \ SD_BUS_PROPERTY(name "Monotonic", "t", bus_property_get_usec, (offset) + offsetof(struct dual_timestamp, monotonic), (flags)) -int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignment); +// UNNEEDED int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignment); typedef struct BusWaitForJobs BusWaitForJobs; -int bus_wait_for_jobs_new(sd_bus *bus, BusWaitForJobs **ret); +// UNNEEDED int bus_wait_for_jobs_new(sd_bus *bus, BusWaitForJobs **ret); void bus_wait_for_jobs_free(BusWaitForJobs *d); int bus_wait_for_jobs_add(BusWaitForJobs *d, const char *path); int bus_wait_for_jobs(BusWaitForJobs *d, bool quiet); +// UNNEEDED int bus_wait_for_jobs_one(BusWaitForJobs *d, const char *path, bool quiet); DEFINE_TRIVIAL_CLEANUP_FUNC(BusWaitForJobs*, bus_wait_for_jobs_free); diff --git a/src/shared/seccomp-util.c b/src/shared/seccomp-util.c deleted file mode 100644 index 46cecc8e2..000000000 --- a/src/shared/seccomp-util.c +++ /dev/null @@ -1,92 +0,0 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - -/*** - This file is part of systemd. - - Copyright 2014 Lennart Poettering - - systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with systemd; If not, see . -***/ - -#include - -#include "util.h" -#include "seccomp-util.h" - -const char* seccomp_arch_to_string(uint32_t c) { - - if (c == SCMP_ARCH_NATIVE) - return "native"; - if (c == SCMP_ARCH_X86) - return "x86"; - if (c == SCMP_ARCH_X86_64) - return "x86-64"; - if (c == SCMP_ARCH_X32) - return "x32"; - if (c == SCMP_ARCH_ARM) - return "arm"; - - return NULL; -} - -/// UNNEEDED by elogind -#if 0 -int seccomp_arch_from_string(const char *n, uint32_t *ret) { - if (!n) - return -EINVAL; - - assert(ret); - - if (streq(n, "native")) - *ret = SCMP_ARCH_NATIVE; - else if (streq(n, "x86")) - *ret = SCMP_ARCH_X86; - else if (streq(n, "x86-64")) - *ret = SCMP_ARCH_X86_64; - else if (streq(n, "x32")) - *ret = SCMP_ARCH_X32; - else if (streq(n, "arm")) - *ret = SCMP_ARCH_ARM; - else - return -EINVAL; - - return 0; -} -#endif // 0 - -int seccomp_add_secondary_archs(scmp_filter_ctx *c) { - -#if defined(__i386__) || defined(__x86_64__) - int r; - - /* Add in all possible secondary archs we are aware of that - * this kernel might support. */ - - r = seccomp_arch_add(c, SCMP_ARCH_X86); - if (r < 0 && r != -EEXIST) - return r; - - r = seccomp_arch_add(c, SCMP_ARCH_X86_64); - if (r < 0 && r != -EEXIST) - return r; - - r = seccomp_arch_add(c, SCMP_ARCH_X32); - if (r < 0 && r != -EEXIST) - return r; - -#endif - - return 0; - -} diff --git a/src/shared/seccomp-util.h b/src/shared/seccomp-util.h deleted file mode 100644 index b59f3fc20..000000000 --- a/src/shared/seccomp-util.h +++ /dev/null @@ -1,29 +0,0 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - -#pragma once - -/*** - This file is part of systemd. - - Copyright 2014 Lennart Poettering - - systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with systemd; If not, see . -***/ - -#include - -const char* seccomp_arch_to_string(uint32_t c); -// UNNEEDED int seccomp_arch_from_string(const char *n, uint32_t *ret); - -int seccomp_add_secondary_archs(scmp_filter_ctx *c);