#define SMACK_FLOOR_LABEL "_"
#define SMACK_STAR_LABEL "*"
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
typedef enum SmackAttr {
SMACK_ATTR_ACCESS = 0,
SMACK_ATTR_EXEC = 1,
int mac_smack_fix(const char *path, bool ignore_enoent, bool ignore_erofs);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
const char* smack_attr_to_string(SmackAttr i) _const_;
SmackAttr smack_attr_from_string(const char *s) _pure_;
int mac_smack_read(const char *path, SmackAttr attr, char **label);
#include "user-util.h"
#include "util.h"
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int socket_address_parse(SocketAddress *a, const char *s) {
char *e, *n;
unsigned u;
return l[0] == '0';
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
bool socket_address_matches_fd(const SocketAddress *a, int fd) {
SocketAddress b;
socklen_t solen;
return 1;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
static const char* const ip_tos_table[] = {
[IPTOS_LOWDELAY] = "low-delay",
[IPTOS_THROUGHPUT] = "throughput",
return 0;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int receive_one_fd(int transport_fd, int flags) {
union {
struct cmsghdr cmsghdr;
struct sockaddr_ll ll;
};
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
typedef struct SocketAddress {
union sockaddr_union sockaddr;
bool socket_ipv6_is_supported(void);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int sockaddr_port(const struct sockaddr *_sa) _pure_;
Sint sockaddr_pretty(const struct sockaddr *_sa, socklen_t salen, bool translate_ipv6, bool include_port, char **ret);
int fd_inc_sndbuf(int fd, size_t n);
int fd_inc_rcvbuf(int fd, size_t n);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int ip_tos_to_string_alloc(int i, char **s);
int ip_tos_from_string(const char *s);
#endif // 0
int getpeersec(int fd, char **ret);
int send_one_fd(int transport_fd, int fd, int flags);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int receive_one_fd(int transport_fd, int flags);
#endif // 0
#include "stat-util.h"
#include "string-util.h"
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int is_symlink(const char *path) {
struct stat info;
return !!S_ISDIR(st.st_mode);
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int is_device_node(const char *path) {
struct stat info;
return null_or_empty(&st);
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int null_or_empty_fd(int fd) {
struct stat st;
return false;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int path_is_os_tree(const char *path) {
char *p;
int r;
return F_TYPE_EQUAL(s->f_type, magic_value);
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int fd_check_fstype(int fd, statfs_f_type_t magic_value) {
struct statfs s;
#include "macro.h"
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int is_symlink(const char *path);
#endif // 0
int is_dir(const char *path, bool follow);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int is_device_node(const char *path);
int dir_is_empty(const char *path);
bool null_or_empty(struct stat *st) _pure_;
int null_or_empty_path(const char *fn);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int null_or_empty_fd(int fd);
#endif // 0
int path_is_read_only_fs(const char *path);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int path_is_os_tree(const char *path);
#endif // 0
typedef long statfs_f_type_t;
bool is_fs_type(const struct statfs *s, statfs_f_type_t magic_value) _pure_;
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int fd_check_fstype(int fd, statfs_f_type_t magic_value);
int path_check_fstype(const char *path, statfs_f_type_t magic_value);
#endif // 0
return -ENOMEM;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int strv_extend_strv_concat(char ***a, char **b, const char *suffix) {
int r;
char **s;
return r;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
char **strv_split_newlines(const char *s) {
char **l;
unsigned n;
return r;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
char *strv_join_quoted(char **l) {
char *buf = NULL;
char **s;
return r;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int strv_consume_pair(char ***l, char *a, char *b) {
int r;
return l;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
bool strv_is_uniq(char **l) {
char **i;
return r;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int strv_make_nulstr(char **l, char **p, size_t *q) {
size_t n_allocated = 0, n = 0;
_cleanup_free_ char *m = NULL;
return l;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
bool strv_equal(char **a, char **b) {
if (strv_isempty(a))
unsigned strv_length(char * const *l) _pure_;
int strv_extend_strv(char ***a, char **b, bool filter_duplicates);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int strv_extend_strv_concat(char ***a, char **b, const char *suffix);
#endif // 0
int strv_extend(char ***l, const char *value);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int strv_extendf(char ***l, const char *format, ...) _printf_(2,0);
#endif // 0
int strv_push(char ***l, char *value);
int strv_push_pair(char ***l, char *a, char *b);
int strv_push_prepend(char ***l, char *value);
int strv_consume(char ***l, char *value);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int strv_consume_pair(char ***l, char *a, char *b);
#endif // 0
int strv_consume_prepend(char ***l, char *value);
char **strv_remove(char **l, const char *s);
char **strv_uniq(char **l);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
bool strv_is_uniq(char **l);
bool strv_equal(char **a, char **b);
}
char **strv_split(const char *s, const char *separator);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
char **strv_split_newlines(const char *s);
int strv_split_extract(char ***t, const char *s, const char *separators, ExtractFlags flags);
#endif // 0
char *strv_join(char **l, const char *separator);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
char *strv_join_quoted(char **l);
#endif // 0
char **strv_parse_nulstr(const char *s, size_t l);
char **strv_split_nulstr(const char *s);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int strv_make_nulstr(char **l, char **p, size_t *n);
bool strv_overlap(char **a, char **b) _pure_;
for ((x) = (l), (y) = (x+1); (x) && *(x) && *(y); (x) += 2, (y) = (x + 1))
char **strv_sort(char **l);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
void strv_print(char **l);
#endif // 0
_l[0]; \
}))
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
char **strv_reverse(char **l);
char **strv_shell_escape(char **l, const char *bad);
#include "string-table.h"
#include "syslog-util.h"
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int syslog_parse_priority(const char **p, int *priority, bool with_facility) {
int a = 0, b = 0, c = 0;
int k;
DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(log_facility_unshifted, int, LOG_FAC(~0));
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
bool log_facility_unshifted_is_valid(int facility) {
return facility >= 0 && facility <= LOG_FAC(~0);
}
DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(log_level, int, LOG_DEBUG);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
bool log_level_is_valid(int level) {
return level >= 0 && level <= LOG_DEBUG;
}
int log_facility_unshifted_to_string_alloc(int i, char **s);
int log_facility_unshifted_from_string(const char *s);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
bool log_facility_unshifted_is_valid(int faciliy);
#endif // 0
int log_level_to_string_alloc(int i, char **s);
int log_level_from_string(const char *s);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
bool log_level_is_valid(int level);
int syslog_parse_priority(const char **p, int *priority, bool with_facility);
return 0;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
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];
return fd;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int acquire_terminal(
const char *name,
bool fail,
}
#endif // 0
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int release_terminal(void) {
static const struct sigaction sa_new = {
.sa_handler = SIG_IGN,
return i;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
char *resolve_dev_console(char **active) {
char *tty;
}
/* intended to be used as a SIGWINCH sighandler */
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
void columns_lines_cache_reset(int signum) {
cached_columns = 0;
cached_lines = 0;
return make_stdio(null_fd);
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int getttyname_malloc(int fd, char **ret) {
size_t l = 100;
int r;
return 0;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int ptsname_malloc(int fd, char **ret) {
size_t l = 100;
/* Set cursor to top left corner and clear screen */
#define ANSI_HOME_CLEAR "\x1B[H\x1B[2J"
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int reset_terminal_fd(int fd, bool switch_to_text);
int reset_terminal(const char *name);
#endif // 0
int open_terminal(const char *name, int mode);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int acquire_terminal(const char *name, bool fail, bool force, bool ignore_tiocstty_eperm, usec_t timeout);
int release_terminal(void);
int chvt(int vt);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
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);
int ask_string(char **ret, const char *text, ...) _printf_(2, 3);
char *resolve_dev_console(char **active);
#endif // 0
bool tty_is_vc(const char *tty);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
bool tty_is_vc_resolve(const char *tty);
#endif // 0
bool tty_is_console(const char *tty) _pure_;
int vtnr_from_tty(const char *tty);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
const char *default_term_for_tty(const char *tty);
#endif // 0
int make_stdio(int fd);
int make_null_stdio(void);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int make_console_stdio(void);
#endif // 0
unsigned columns(void);
int fd_lines(int fd);
unsigned lines(void);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
void columns_lines_cache_reset(int _unused_ signum);
#endif // 0
int get_ctty_devnr(pid_t pid, dev_t *d);
int get_ctty(pid_t, dev_t *_devnr, char **r);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int getttyname_malloc(int fd, char **r);
int getttyname_harder(int fd, char **r);
return timespec_load(&ts);
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
nsec_t now_nsec(clockid_t clock_id) {
struct timespec ts;
return ts;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
dual_timestamp* dual_timestamp_from_monotonic(dual_timestamp *ts, usec_t u) {
int64_t delta;
assert(ts);
return format_timestamp_internal(buf, l, t, false);
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
char *format_timestamp_utc(char *buf, size_t l, usec_t t) {
return format_timestamp_internal(buf, l, t, true);
}
return format_timestamp_internal_us(buf, l, t, false);
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
char *format_timestamp_us_utc(char *buf, size_t l, usec_t t) {
return format_timestamp_internal_us(buf, l, t, true);
}
return buf;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
void dual_timestamp_serialize(FILE *f, const char *name, dual_timestamp *t) {
assert(f);
return parse_time(t, usec, USEC_PER_SEC);
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int parse_nsec(const char *t, nsec_t *nsec) {
static const struct {
const char *suffix;
return utc ? gmtime_r(t, tm) : localtime_r(t, tm);
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
unsigned long usec_to_jiffies(usec_t u) {
static thread_local unsigned long hz = 0;
long r;
#define DUAL_TIMESTAMP_NULL ((struct dual_timestamp) { 0ULL, 0ULL })
usec_t now(clockid_t clock);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
nsec_t now_nsec(clockid_t clock);
#endif // 0
dual_timestamp* dual_timestamp_get(dual_timestamp *ts);
dual_timestamp* dual_timestamp_from_realtime(dual_timestamp *ts, usec_t u);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
dual_timestamp* dual_timestamp_from_monotonic(dual_timestamp *ts, usec_t u);
dual_timestamp* dual_timestamp_from_boottime_or_monotonic(dual_timestamp *ts, usec_t u);
#endif // 0
nsec_t timespec_load_nsec(const struct timespec *ts) _pure_;
char *format_timestamp(char *buf, size_t l, usec_t t);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
char *format_timestamp_utc(char *buf, size_t l, usec_t t);
#endif // 0
char *format_timestamp_us(char *buf, size_t l, usec_t t);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
char *format_timestamp_us_utc(char *buf, size_t l, usec_t t);
#endif // 0
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);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
void dual_timestamp_serialize(FILE *f, const char *name, dual_timestamp *t);
int dual_timestamp_deserialize(const char *value, dual_timestamp *t);
int parse_sec(const char *t, usec_t *usec);
int parse_time(const char *t, usec_t *usec, usec_t default_unit);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int parse_nsec(const char *t, nsec_t *nsec);
bool ntp_synced(void);
assert_message_se(strftime(buf, ELEMENTSOF(buf), fmt, tm) > 0, \
"xstrftime: " #buf "[] must be big enough")
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int get_timezone(char **timezone);
time_t mktime_or_timegm(struct tm *tm, bool utc);
#endif // 0
struct tm *localtime_or_gmtime_r(const time_t *t, struct tm *tm, bool utc);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
unsigned long usec_to_jiffies(usec_t usec);
#endif // 0
return true;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int unit_name_to_prefix(const char *n, char **ret) {
const char *p;
char *s;
return 0;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
static char *do_escape_char(char c, char *t) {
assert(t);
DEFINE_STRING_TABLE_LOOKUP(unit_type, UnitType);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
static const char* const unit_load_state_table[_UNIT_LOAD_STATE_MAX] = {
[UNIT_STUB] = "stub",
[UNIT_LOADED] = "loaded",
_UNIT_TYPE_INVALID = -1
} UnitType;
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
typedef enum UnitLoadState {
UNIT_STUB = 0,
UNIT_LOADED,
bool unit_instance_is_valid(const char *i) _pure_;
bool unit_suffix_is_valid(const char *s) _pure_;
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
static inline int unit_prefix_and_instance_is_valid(const char *p) {
/* For prefix+instance and instance the same rules apply */
return unit_instance_is_valid(p);
int unit_name_build(const char *prefix, const char *instance, const char *suffix, char **ret);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
char *unit_name_escape(const char *f);
int unit_name_unescape(const char *f, char **ret);
int unit_name_path_escape(const char *f, char **ret);
const char *unit_type_to_string(UnitType i) _const_;
UnitType unit_type_from_string(const char *s) _pure_;
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
const char *unit_load_state_to_string(UnitLoadState i) _const_;
UnitLoadState unit_load_state_from_string(const char *s) _pure_;
return 0;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
char* getlogname_malloc(void) {
uid_t uid;
struct stat st;
return ret;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int in_gid(gid_t gid) {
gid_t *gids;
int ngroups_max, r, i;
return 0;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int take_etc_passwd_lock(const char *root) {
struct flock flock = {
return parse_uid(s, (uid_t*) ret_gid);
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
char* getlogname_malloc(void);
char* getusername_malloc(void);
#endif // 0
char* uid_to_name(uid_t uid);
char* gid_to_name(gid_t gid);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int in_gid(gid_t gid);
int in_group(const char *name);
int reset_uid_gid(void);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int take_etc_passwd_lock(const char *root);
#endif // 0
return r;
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int detect_virtualization(void) {
int r;
int detect_vm(void);
int detect_container(void);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
int detect_virtualization(void);
#endif // 0
}
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
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;
int getxattr_malloc(const char *path, const char *name, char **value, bool allow_symlink);
int fgetxattr_malloc(int fd, const char *name, char **value);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
ssize_t fgetxattrat_fake(int dirfd, const char *filename, const char *attribute, void *value, size_t size, int flags);
int fd_setcrtime(int fd, usec_t usec);
#define CGROUP_CPU_QUOTA_PERIOD_USEC ((usec_t) 100 * USEC_PER_MSEC)
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
void cgroup_context_init(CGroupContext *c) {
assert(c);
m->cgroup_root = mfree(m->cgroup_root);
}
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
Unit* manager_get_unit_by_cgroup(Manager *m, const char *cgroup) {
char *p;
Unit *u;
// #include "time-util.h"
#include "logind.h"
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
typedef struct CGroupContext CGroupContext;
Stypedef struct CGroupDeviceAllow CGroupDeviceAllow;
typedef struct CGroupBlockIODeviceWeight CGroupBlockIODeviceWeight;
int manager_setup_cgroup(Manager *m);
void manager_shutdown_cgroup(Manager *m, bool delete);
-/// UNNEEDED by elogind
-#if 0
+#if 0 /// UNNEEDED by elogind
unsigned manager_dispatch_cgroup_queue(Manager *m);
Unit *manager_get_unit_by_cgroup(Manager *m, const char *cgroup);