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;
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;
unsigned long cap_last_cap(void);
// UNNEEDED int have_effective_cap(int value);
-int capability_bounding_set_drop(uint64_t drop, bool right_now);
+// UNNEEDED int capability_bounding_set_drop(uint64_t drop, bool right_now);
// UNNEEDED int capability_bounding_set_drop_usermode(uint64_t drop);
// UNNEEDED int drop_privileges(uid_t uid, gid_t gid, uint64_t keep_capabilities);
return 0;
}
-#endif // 0
int cg_attach_everywhere(CGroupMask supported, const char *path, pid_t pid, cg_migrate_callback_t path_callback, void *userdata) {
CGroupController c;
return 0;
}
-/// UNNEEDED by elogind
-#if 0
int cg_attach_many_everywhere(CGroupMask supported, const char *path, Set* pids, cg_migrate_callback_t path_callback, void *userdata) {
Iterator i;
void *pidp;
return 0;
}
-#endif // 0
bool cg_is_unified_wanted(void) {
static thread_local int wanted = -1;
}
}
-/// UNNEEDED by elogind
-#if 0
bool cg_is_legacy_wanted(void) {
return !cg_is_unified_wanted();
}
typedef const char* (*cg_migrate_callback_t)(CGroupMask mask, void *userdata);
// UNNEEDED int cg_create_everywhere(CGroupMask supported, CGroupMask mask, const char *path);
-int cg_attach_everywhere(CGroupMask supported, const char *path, pid_t pid, cg_migrate_callback_t callback, void *userdata);
+// UNNEEDED int cg_attach_everywhere(CGroupMask supported, const char *path, pid_t pid, cg_migrate_callback_t callback, void *userdata);
// UNNEEDED int cg_attach_many_everywhere(CGroupMask supported, const char *path, Set* pids, cg_migrate_callback_t callback, void *userdata);
// UNNEEDED int cg_migrate_everywhere(CGroupMask supported, const char *from, const char *to, cg_migrate_callback_t callback, void *userdata);
// UNNEEDED int cg_trim_everywhere(CGroupMask supported, const char *path, bool delete_root);
int cg_unified(void);
// UNNEEDED void cg_unified_flush(void);
-bool cg_is_unified_wanted(void);
+// UNNEEDED bool cg_is_unified_wanted(void);
// UNNEEDED bool cg_is_legacy_wanted(void);
const char* cgroup_controller_to_string(CGroupController c) _const_;
return true;
}
+/// UNNEEDED by elogind
+#if 0
char* hostname_cleanup(char *s) {
char *p, *d;
bool dot;
return s;
}
+#endif // 0
bool is_localhost(const char *hostname) {
assert(hostname);
// UNNEEDED char* gethostname_malloc(void);
bool hostname_is_valid(const char *s, bool allow_trailing_dot) _pure_;
-char* hostname_cleanup(char *s);
+// UNNEEDED char* hostname_cleanup(char *s);
#define machine_name_is_valid(s) hostname_is_valid(s, false)
+++ /dev/null
-#ifndef IOPRIO_H
-#define IOPRIO_H
-
-/* This is minimal version of Linux' linux/ioprio.h header file, which
- * is licensed GPL2 */
-
-#include <unistd.h>
-#include <sys/syscall.h>
-
-/*
- * Gives us 8 prio classes with 13-bits of data for each class
- */
-#define IOPRIO_BITS (16)
-#define IOPRIO_CLASS_SHIFT (13)
-#define IOPRIO_PRIO_MASK ((1UL << IOPRIO_CLASS_SHIFT) - 1)
-
-#define IOPRIO_PRIO_CLASS(mask) ((mask) >> IOPRIO_CLASS_SHIFT)
-#define IOPRIO_PRIO_DATA(mask) ((mask) & IOPRIO_PRIO_MASK)
-#define IOPRIO_PRIO_VALUE(class, data) (((class) << IOPRIO_CLASS_SHIFT) | data)
-
-#define ioprio_valid(mask) (IOPRIO_PRIO_CLASS((mask)) != IOPRIO_CLASS_NONE)
-
-/*
- * These are the io priority groups as implemented by CFQ. RT is the realtime
- * class, it always gets premium service. BE is the best-effort scheduling
- * class, the default for any process. IDLE is the idle scheduling class, it
- * is only served when no one else is using the disk.
- */
-enum {
- IOPRIO_CLASS_NONE,
- IOPRIO_CLASS_RT,
- IOPRIO_CLASS_BE,
- IOPRIO_CLASS_IDLE,
-};
-
-/*
- * 8 best effort priority levels are supported
- */
-#define IOPRIO_BE_NR (8)
-
-enum {
- IOPRIO_WHO_PROCESS = 1,
- IOPRIO_WHO_PGRP,
- IOPRIO_WHO_USER,
-};
-
-static inline int ioprio_set(int which, int who, int ioprio) {
- return syscall(__NR_ioprio_set, which, who, ioprio);
-}
-
-static inline int ioprio_get(int which, int who) {
- return syscall(__NR_ioprio_get, which, who);
-}
-
-#endif
return r >= 0;
}
-#endif // 0
int find_binary(const char *name, bool local, char **filename) {
assert(name);
}
}
-/// UNNEEDED by elogind
-#if 0
bool paths_check_timestamp(const char* const* paths, usec_t *timestamp, bool update) {
bool changed = false;
const char* const* i;
return 0;
}
-#endif // 0
char *prefix_root(const char *root, const char *path) {
char *n, *p;
strcpy(p, path);
return n;
}
+#endif // 0
int path_is_read_only_fs(const char *path);
// UNNEEDED int path_is_os_tree(const char *path);
-int find_binary(const char *name, bool local, char **filename);
+// UNNEEDED 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);
#define PATH_FOREACH_PREFIX_MORE(prefix, path) \
for (char *_slash = ({ path_kill_slashes(strcpy(prefix, path)); if (streq(prefix, "/")) prefix[0] = 0; strrchr(prefix, 0); }); _slash && ((*_slash = 0), true); _slash = strrchr((prefix), '/'))
-char *prefix_root(const char *root, const char *path);
+// UNNEEDED char *prefix_root(const char *root, const char *path);
/* Similar to prefix_root(), but returns an alloca() buffer, or
* possibly a const pointer into the path parameter */
+++ /dev/null
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-#pragma once
-
-/***
- This file is part of systemd.
-
- Copyright 2014 David Herrmann <dh.herrmann@gmail.com>
-
- 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 <http://www.gnu.org/licenses/>.
-***/
-
-
-typedef struct Ring Ring;
-
-struct Ring {
- uint8_t *buf; /* buffer or NULL */
- size_t size; /* actual size of @buf */
- size_t start; /* start position of ring */
- size_t used; /* number of actually used bytes */
-};
-
-/* flush buffer so it is empty again */
-// UNNEEDED void ring_flush(Ring *r);
-
-/* flush buffer, free allocated data and reset to initial state */
-void ring_clear(Ring *r);
-
-/* get pointers to buffer data and their length */
-size_t ring_peek(Ring *r, struct iovec *vec);
-
-/* copy data into external linear buffer */
-// UNNEEDED size_t ring_copy(Ring *r, void *buf, size_t size);
-
-/* push data to the end of the buffer */
-int ring_push(Ring *r, const void *u8, size_t size);
-
-/* pull data from the front of the buffer */
-void ring_pull(Ring *r, size_t size);
-
-/* return size of occupied buffer in bytes */
-static inline size_t ring_get_size(Ring *r) {
- return r->used;
-}
struct sockaddr_ll ll;
};
+/// UNNEEDED by elogind
+#if 0
typedef struct SocketAddress {
union sockaddr_union sockaddr;
mode_t directory_mode,
mode_t socket_mode,
const char *label);
-// UNNEEDED int make_socket_fd(int log_level, const char* address, int flags);
+int make_socket_fd(int log_level, const char* address, int flags);
bool socket_address_is(const SocketAddress *a, const char *s, int type);
bool socket_address_is_netlink(const SocketAddress *a, const char *s);
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);
-// UNNEEDED int getsockname_pretty(int fd, char **ret);
+int getsockname_pretty(int fd, char **ret);
int socknameinfo_pretty(union sockaddr_union *sa, socklen_t salen, char **_ret);
-// UNNEEDED int getnameinfo_pretty(int fd, char **ret);
+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_;
int netlink_family_to_string_alloc(int b, char **s);
int netlink_family_from_string(const char *s) _pure_;
-// UNNEEDED bool sockaddr_equal(const union sockaddr_union *a, const union sockaddr_union *b);
+bool sockaddr_equal(const union sockaddr_union *a, const union sockaddr_union *b);
#define ETHER_ADDR_TO_STRING_MAX (3*6)
char* ether_addr_to_string(const struct ether_addr *addr, char buffer[ETHER_ADDR_TO_STRING_MAX]);
+#endif // 0
return r;
}
+/// UNNEEDED by elogind
+#if 0
bool strv_overlap(char **a, char **b) {
char **i;
return l;
}
-/// UNNEEDED by elogind
-#if 0
bool strv_equal(char **a, char **b) {
if (!a || !b)
return a == b;
return true;
}
-#endif // 0
void strv_print(char **l) {
char **s;
puts(*s);
}
-/// UNNEEDED by elogind
-#if 0
int strv_extendf(char ***l, const char *format, ...) {
va_list ap;
char *x;
char **strv_parse_nulstr(const char *s, size_t l);
char **strv_split_nulstr(const char *s);
-bool strv_overlap(char **a, char **b) _pure_;
+// UNNEEDED bool strv_overlap(char **a, char **b) _pure_;
#define STRV_FOREACH(s, l) \
for ((s) = (l); (s) && *(s); (s)++)
#define STRV_FOREACH_PAIR(x, y, l) \
for ((x) = (l), (y) = (x+1); (x) && *(x) && *(y); (x) += 2, (y) = (x + 1))
-char **strv_sort(char **l);
-void strv_print(char **l);
+// UNNEEDED char **strv_sort(char **l);
+// UNNEEDED void strv_print(char **l);
#define STRV_MAKE(...) ((char**) ((const char*[]) { __VA_ARGS__, NULL }))
return 0;
}
+/// UNNEEDED by elogind
+#if 0
int parse_nsec(const char *t, nsec_t *nsec) {
static const struct {
const char *suffix;
return 0;
}
-/// UNNEEDED by elogind
-#if 0
bool ntp_synced(void) {
struct timex txc = {};
return 0;
}
-#endif // 0
bool timezone_is_valid(const char *name) {
bool slash = false;
*tz = z;
return 0;
}
+#endif // 0
// UNNEEDED int parse_timestamp(const char *t, usec_t *usec);
int parse_sec(const char *t, usec_t *usec);
-int parse_nsec(const char *t, nsec_t *nsec);
+// UNNEEDED int parse_nsec(const char *t, nsec_t *nsec);
// UNNEEDED bool ntp_synced(void);
// UNNEEDED int get_timezones(char ***l);
-bool timezone_is_valid(const char *name);
+// 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)
-int get_timezone(char **timezone);
+// UNNEEDED int get_timezone(char **timezone);
*ret = s;
return 0;
}
-#endif // 0
UnitType unit_name_to_type(const char *n) {
const char *e;
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;
return 0;
}
+/// UNNEEDED by elogind
+#if 0
static char *do_escape_char(char c, char *t) {
assert(t);
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;
*ret = s;
return 0;
}
-#endif // 0
int unit_name_from_path(const char *path, const char *suffix, char **ret) {
_cleanup_free_ char *p = NULL;
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;
return unit_name_path_unescape(prefix, ret);
}
-#endif // 0
char *unit_dbus_path_from_name(const char *name) {
_cleanup_free_ char *e = NULL;
return 0;
}
-/// UNNEEDED by elogind
-#if 0
const char* unit_dbus_interface_from_type(UnitType t) {
static const char *const table[_UNIT_TYPE_MAX] = {
bool unit_instance_is_valid(const char *i) _pure_;
bool unit_suffix_is_valid(const char *s) _pure_;
+/// UNNEEDED by elogind
+#if 0
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);
}
+#endif // 0
// UNNEEDED int unit_name_to_prefix(const char *n, char **prefix);
// 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_;
+// UNNEEDED UnitType unit_name_to_type(const char *n) _pure_;
// 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);
-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);
-int unit_name_path_unescape(const char *f, char **ret);
+// UNNEEDED char *unit_name_escape(const char *f);
+// UNNEEDED int unit_name_unescape(const char *f, char **ret);
+// UNNEEDED int unit_name_path_escape(const char *f, char **ret);
+// UNNEEDED int unit_name_path_unescape(const char *f, char **ret);
// UNNEEDED int unit_name_replace_instance(const char *f, const char *i, 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);
+// UNNEEDED int unit_name_from_path(const char *path, const char *suffix, 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);
+// UNNEEDED char *unit_dbus_path_from_name(const char *name);
+// UNNEEDED int unit_name_from_dbus_path(const char *path, char **name);
// UNNEEDED const char* unit_dbus_interface_from_type(UnitType t);
// UNNEEDED const char *unit_dbus_interface_from_name(const char *name);
#include "config.h"
#include "macro.h"
#include "util.h"
-#include "ioprio.h"
+// #include "ioprio.h"
// #include "missing.h"
// #include "log.h"
#include "strv.h"
return -ENOENT;
}
-#endif // 0
static const char *const ioprio_class_table[] = {
[IOPRIO_CLASS_NONE] = "none",
};
DEFINE_STRING_TABLE_LOOKUP_WITH_FALLBACK(ioprio_class, int, INT_MAX);
+#endif // 0
static const char *const sigchld_code_table[] = {
[CLD_EXITED] = "exited",
return 0;
}
-#endif // 0
static char *strcpy_backslash_escaped(char *t, const char *s, const char *bad) {
assert(bad);
return r;
}
+#endif // 0
int parse_mode(const char *s, mode_t *ret) {
char *x;
// UNNEEDED int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
-char *shell_escape(const char *s, const char *bad);
-char *shell_maybe_quote(const char *s);
+// UNNEEDED char *shell_escape(const char *s, const char *bad);
+// UNNEEDED char *shell_maybe_quote(const char *s);
int parse_mode(const char *s, mode_t *ret);
if (type == _SD_BUS_VTABLE_PROPERTY || type == _SD_BUS_VTABLE_WRITABLE_PROPERTY) {
if (flags & SD_BUS_VTABLE_PROPERTY_EXPLICIT)
- fputs(" <annotation name=\"org.freedesktop.systemd1.Explicit\" value=\"true\"/>\n", i->f);
+ fputs(" <annotation name=\"org.freedesktop.login1.Explicit\" value=\"true\"/>\n", i->f);
if (flags & SD_BUS_VTABLE_PROPERTY_CONST)
fputs(" <annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"const\"/>\n", i->f);
if (!i->trusted &&
(type == _SD_BUS_VTABLE_METHOD || type == _SD_BUS_VTABLE_WRITABLE_PROPERTY) &&
!(flags & SD_BUS_VTABLE_UNPRIVILEGED))
- fputs(" <annotation name=\"org.freedesktop.systemd1.Privileged\" value=\"true\"/>\n", i->f);
+ fputs(" <annotation name=\"org.freedesktop.login1.Privileged\" value=\"true\"/>\n", i->f);
}
static int introspect_write_arguments(struct introspect *i, const char *signature, const char *direction) {
polkit_agent_open();
}
+/// UNNEEDED by elogind
+#if 0
static OutputFlags get_output_flags(void) {
return
(!on_tty() || pager_have()) * OUTPUT_FULL_WIDTH |
on_tty() * OUTPUT_COLOR;
}
+#endif // 0
static int list_sessions(int argc, char *argv[], void *userdata) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
return 0;
}
+/// UNNEEDED by elogind
+#if 0
static int show_unit_cgroup(sd_bus *bus, const char *interface, const char *unit, pid_t leader) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
show_cgroup_and_extra(ELOGIND_CGROUP_CONTROLLER, cgroup, "\t\t ", c, false, &leader, leader > 0, get_output_flags());
return 0;
}
+#endif // 0
typedef struct SessionStatusInfo {
char *id;
if (i.scope) {
printf("\t Unit: %s\n", i.scope);
- show_unit_cgroup(bus, "org.freedesktop.systemd1.Scope", i.scope, i.leader);
#if 0
+ show_unit_cgroup(bus, "org.freedesktop.systemd1.Scope", i.scope, i.leader);
if (arg_transport == BUS_TRANSPORT_LOCAL) {
show_journal_by_unit(
if (i.slice) {
printf("\t Unit: %s\n", i.slice);
- show_unit_cgroup(bus, "org.freedesktop.systemd1.Slice", i.slice, 0);
#if 0
+ show_unit_cgroup(bus, "org.freedesktop.systemd1.Slice", i.slice, 0);
show_journal_by_unit(
stdout,
i.slice,
return 0;
}
-#endif // 0
int match_unit_removed(sd_bus_message *message, void *userdata, sd_bus_error *error) {
const char *path, *unit;
return 0;
}
+#endif // 0
int manager_send_changed(Manager *manager, const char *property, ...) {
char **l;
extern const sd_bus_vtable manager_vtable[];
-int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *error);
-int match_unit_removed(sd_bus_message *message, void *userdata, sd_bus_error *error);
-int match_properties_changed(sd_bus_message *message, void *userdata, sd_bus_error *error);
-int match_reloading(sd_bus_message *message, void *userdata, sd_bus_error *error);
-int match_name_owner_changed(sd_bus_message *message, void *userdata, sd_bus_error *error);
+// UNNEEDED int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *error);
+// UNNEEDED int match_unit_removed(sd_bus_message *message, void *userdata, sd_bus_error *error);
+// UNNEEDED int match_properties_changed(sd_bus_message *message, void *userdata, sd_bus_error *error);
+// UNNEEDED int match_reloading(sd_bus_message *message, void *userdata, sd_bus_error *error);
+// UNNEEDED int match_name_owner_changed(sd_bus_message *message, void *userdata, sd_bus_error *error);
/// eloginds own version does the action itself
#if 0
DEFINE_PARSER(uint64, uint64_t, safe_atou64)
DEFINE_PARSER(unsigned, unsigned, safe_atou)
DEFINE_PARSER(double, double, safe_atod)
-DEFINE_PARSER(nsec, nsec_t, parse_nsec)
+// UNNEEDED DEFINE_PARSER(nsec, nsec_t, parse_nsec)
DEFINE_PARSER(sec, usec_t, parse_sec)
int config_parse_iec_size(const char* unit,
int config_parse_path(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);
int config_parse_strv(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);
int config_parse_sec(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);
-int config_parse_nsec(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 config_parse_nsec(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);
int config_parse_mode(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);
int config_parse_log_facility(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);
int config_parse_log_level(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);