From: Sven Eden Date: Thu, 13 Apr 2017 05:44:02 +0000 (+0200) Subject: Prep v228: Full diff to master revealed more functions that are unused. X-Git-Tag: v228.1~1^2~2 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=21412e2985ee882965d78612895ceab7afe8d499;ds=sidebyside Prep v228: Full diff to master revealed more functions that are unused. --- diff --git a/src/basic/audit-util.c b/src/basic/audit-util.c index 461229733..d0a061abc 100644 --- a/src/basic/audit-util.c +++ b/src/basic/audit-util.c @@ -86,6 +86,7 @@ int audit_loginuid_from_pid(pid_t pid, uid_t *uid) { return 0; } +#if 0 /// UNNEEDED by elogind bool use_audit(void) { static int cached_use = -1; @@ -103,3 +104,4 @@ bool use_audit(void) { return cached_use; } +#endif // 0 diff --git a/src/basic/audit-util.h b/src/basic/audit-util.h new file mode 100644 index 000000000..8c4209d59 --- /dev/null +++ b/src/basic/audit-util.h @@ -0,0 +1,35 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +#pragma once + +/*** + This file is part of systemd. + + Copyright 2010 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 +#include + +#define AUDIT_SESSION_INVALID ((uint32_t) -1) + +int audit_session_from_pid(pid_t pid, uint32_t *id); +int audit_loginuid_from_pid(pid_t pid, uid_t *uid); + +#if 0 /// UNNEEDED by elogind +bool use_audit(void); +#endif // 0 diff --git a/src/basic/cgroup-util.h b/src/basic/cgroup-util.h index 3e7db8dbd..307d41b62 100644 --- a/src/basic/cgroup-util.h +++ b/src/basic/cgroup-util.h @@ -55,6 +55,7 @@ typedef enum CGroupMask { _CGROUP_MASK_ALL = CGROUP_CONTROLLER_TO_MASK(_CGROUP_CONTROLLER_MAX) - 1 } CGroupMask; +#if 0 /// UNNEEDED by elogind /* Special values for the cpu.shares attribute */ #define CGROUP_CPU_SHARES_INVALID ((uint64_t) -1) #define CGROUP_CPU_SHARES_MIN UINT64_C(2) @@ -78,6 +79,7 @@ static inline bool CGROUP_BLKIO_WEIGHT_IS_OK(uint64_t x) { x == CGROUP_BLKIO_WEIGHT_INVALID || (x >= CGROUP_BLKIO_WEIGHT_MIN && x <= CGROUP_BLKIO_WEIGHT_MAX); } +#endif // 0 /* * General rules: diff --git a/src/basic/fileio.c b/src/basic/fileio.c index cd2c361e3..bfb75608f 100644 --- a/src/basic/fileio.c +++ b/src/basic/fileio.c @@ -935,6 +935,7 @@ DIR *xopendirat(int fd, const char *name, int flags) { return d; } +#if 0 /// UNNEEDED by elogind static int search_and_fopen_internal(const char *path, const char *mode, const char *root, char **search, FILE **_f) { char **i; @@ -995,7 +996,6 @@ int search_and_fopen(const char *path, const char *mode, const char *root, const return search_and_fopen_internal(path, mode, root, copy, _f); } -#if 0 /// UNNEEDED by elogind int search_and_fopen_nulstr(const char *path, const char *mode, const char *root, const char *search, FILE **_f) { _cleanup_strv_free_ char **s = NULL; @@ -1138,6 +1138,7 @@ int tempfn_xxxxxx(const char *p, const char *extra, char **ret) { return 0; } +#if 0 /// UNNEEDED by elogind int tempfn_random(const char *p, const char *extra, char **ret) { const char *fn; char *t, *x; @@ -1180,7 +1181,6 @@ int tempfn_random(const char *p, const char *extra, char **ret) { return 0; } -#if 0 /// UNNEEDED by elogind int tempfn_random_child(const char *p, const char *extra, char **ret) { char *t, *x; uint64_t u; diff --git a/src/basic/fileio.h b/src/basic/fileio.h index b2f1b0dc6..162c9dcd0 100644 --- a/src/basic/fileio.h +++ b/src/basic/fileio.h @@ -58,8 +58,8 @@ int get_proc_field(const char *filename, const char *pattern, const char *termin DIR *xopendirat(int dirfd, const char *name, int flags); -int search_and_fopen(const char *path, const char *mode, const char *root, const char **search, FILE **_f); #if 0 /// UNNEEDED by elogind +int search_and_fopen(const char *path, const char *mode, const char *root, const char **search, FILE **_f); int search_and_fopen_nulstr(const char *path, const char *mode, const char *root, const char *search, FILE **_f); #endif // 0 #define FOREACH_LINE(line, f, on_error) \ @@ -80,8 +80,8 @@ int open_tmpfile(const char *path, int flags); #endif // 0 int tempfn_xxxxxx(const char *p, const char *extra, char **ret); -int tempfn_random(const char *p, const char *extra, char **ret); #if 0 /// UNNEEDED by elogind +int tempfn_random(const char *p, const char *extra, char **ret); int tempfn_random_child(const char *p, const char *extra, char **ret); int write_timestamp_file_atomic(const char *fn, usec_t n); diff --git a/src/basic/path-util.c b/src/basic/path-util.c index 84ff2f387..b23b9c312 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -461,8 +461,6 @@ char* path_join(const char *root, const char *path, const char *rest) { rest && rest[0] == '/' ? rest+1 : rest, NULL); } -#endif // 0 -#if 0 /// UNNEEDED by elogind int find_binary(const char *name, char **ret) { int last_error, r; diff --git a/src/basic/strv.c b/src/basic/strv.c index 825fdcbdf..8e5099889 100644 --- a/src/basic/strv.c +++ b/src/basic/strv.c @@ -200,6 +200,7 @@ char **strv_new(const char *x, ...) { return r; } +#if 0 /// UNNEEDED by elogind int strv_extend_strv(char ***a, char **b, bool filter_duplicates) { char **s, **t; size_t p, q, i = 0, j; @@ -244,7 +245,6 @@ rollback: return -ENOMEM; } -#if 0 /// UNNEEDED by elogind int strv_extend_strv_concat(char ***a, char **b, const char *suffix) { int r; char **s; diff --git a/src/basic/strv.h b/src/basic/strv.h index 481829cac..13ed1b371 100644 --- a/src/basic/strv.h +++ b/src/basic/strv.h @@ -45,8 +45,8 @@ void strv_clear(char **l); char **strv_copy(char * const *l); unsigned strv_length(char * const *l) _pure_; -int strv_extend_strv(char ***a, char **b, bool filter_duplicates); #if 0 /// UNNEEDED by elogind +int strv_extend_strv(char ***a, char **b, bool filter_duplicates); int strv_extend_strv_concat(char ***a, char **b, const char *suffix); #endif // 0 int strv_extend(char ***l, const char *value); diff --git a/src/basic/virt.c b/src/basic/virt.c index 7c0666cc2..4b6286567 100644 --- a/src/basic/virt.c +++ b/src/basic/virt.c @@ -34,6 +34,7 @@ #include "util.h" #include "virt.h" +#if 0 /// UNNEEDED by elogind static int detect_vm_cpuid(void) { /* CPUID is an x86 specific interface. */ @@ -320,6 +321,7 @@ finish: cached_found = r; return r; } +#endif // 0 int detect_container(void) { @@ -431,6 +433,7 @@ int running_in_chroot(void) { return ret == 0; } +#if 0 /// UNNEEDED by elogind static const char *const virtualization_table[_VIRTUALIZATION_MAX] = { [VIRTUALIZATION_NONE] = "none", [VIRTUALIZATION_KVM] = "kvm", @@ -455,3 +458,4 @@ static const char *const virtualization_table[_VIRTUALIZATION_MAX] = { }; DEFINE_STRING_TABLE_LOOKUP(virtualization, int); +#endif // 0 diff --git a/src/basic/virt.h b/src/basic/virt.h index feb47d50e..fc518dd4f 100644 --- a/src/basic/virt.h +++ b/src/basic/virt.h @@ -56,6 +56,7 @@ enum { _VIRTUALIZATION_INVALID = -1 }; +#if 0 /// UNNEEDED by elogind static inline bool VIRTUALIZATION_IS_VM(int x) { return x >= VIRTUALIZATION_VM_FIRST && x <= VIRTUALIZATION_VM_LAST; } @@ -65,6 +66,7 @@ static inline bool VIRTUALIZATION_IS_CONTAINER(int x) { } int detect_vm(void); +#endif // 0 int detect_container(void); #if 0 /// UNNEEDED by elogind int detect_virtualization(void); @@ -72,5 +74,7 @@ int detect_virtualization(void); int running_in_chroot(void); +#if 0 /// UNNEEDED by elogind const char *virtualization_to_string(int v) _const_; int virtualization_from_string(const char *s) _pure_; +#endif // 0