#else
#define _PCRE2_FEATURE_ "-PCRE2"
#endif
-#else
-#define _IDN_FEATURE_ "-IDN"
-#endif
#endif // 0
#define _CGROUP_HIEARCHY_ "default-hierarchy=" DEFAULT_HIERARCHY_NAME
return 0;
}
-#if 0 /// UNNEEDED by elogind
int cg_path_decode_unit(const char *cgroup, char **unit) {
char *c, *s;
size_t n;
return cg_path_get_unit(cgroup, unit);
}
+#if 0 /// UNNEEDED by elogind
/**
* Skip session-*.scope, but require it to be there.
*/
#include "set.h"
#if 0 /// elogind has them set through config.h
-#define SYSTEMD_CGROUP_CONTROLLER_LEGACY "name=elogind"
+#define SYSTEMD_CGROUP_CONTROLLER_LEGACY "name=systemd"
#define SYSTEMD_CGROUP_CONTROLLER_HYBRID "name=unified"
+#define SYSTEMD_CGROUP_CONTROLLER "_systemd"
#endif // 0
-#define SYSTEMD_CGROUP_CONTROLLER "_elogind"
/* An enum of well known cgroup controllers */
typedef enum CGroupController {
int cg_path_get_session(const char *path, char **session);
int cg_path_get_owner_uid(const char *path, uid_t *uid);
-#if 0 /// UNNEEDED by elogind
int cg_path_get_unit(const char *path, char **unit);
+#if 0 /// UNNEEDED by elogind
int cg_path_get_user_unit(const char *path, char **unit);
int cg_path_get_machine_name(const char *path, char **machine);
#endif // 0
int cg_pid_get_session(pid_t pid, char **session);
int cg_pid_get_owner_uid(pid_t pid, uid_t *uid);
-#if 0 /// UNNEEDED by elogind
int cg_pid_get_unit(pid_t pid, char **unit);
+#if 0 /// UNNEEDED by elogind
int cg_pid_get_user_unit(pid_t pid, char **unit);
int cg_pid_get_machine_name(pid_t pid, char **machine);
#endif // 0
int cg_pid_get_slice(pid_t pid, char **slice);
int cg_pid_get_user_slice(pid_t pid, char **slice);
-#if 0 /// UNNEEDED by elogind
int cg_path_decode_unit(const char *cgroup, char **unit);
-#endif // 0
char *cg_escape(const char *p);
char *cg_unescape(const char *p) _pure_;
ret[k] = NULL;
return ret;
}
+#endif // 0
int getenv_bool(const char *p) {
const char *e;
return parse_boolean(e);
}
+#if 0 /// UNNEEDED by elogind
int getenv_bool_secure(const char *p) {
const char *e;
char *strv_env_get_n(char **l, const char *name, size_t k, unsigned flags) _pure_;
char *strv_env_get(char **x, const char *n) _pure_;
+#endif // 0
int getenv_bool(const char *p);
+#if 0 /// UNNEEDED by elogind
int getenv_bool_secure(const char *p);
int serialize_environment(FILE *f, char **environment);
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-//#include <errno.h>
+#include <errno.h>
#include <string.h>
#include "errno-list.h"
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-//#include <stdbool.h>
+#include <stdbool.h>
/*
* MAX_ERRNO is defined as 4095 in linux/err.h
* We use the same value here.
const char *errno_to_name(int id);
int errno_from_name(const char *name);
-#if 0 /// UNNEEDED by elogind
-#endif // 0
static inline bool errno_is_valid(int n) {
return n > 0 && n <= ERRNO_MAX;
}
return p - s < 256;
}
+#endif // 0
int fd_get_path(int fd, char **ret) {
char procfs_path[STRLEN("/proc/self/fd/") + DECIMAL_STR_MAX(int)];
return r;
}
-#endif // 0
int move_fd(int from, int to, int cloexec) {
int r;
void cmsg_close_all(struct msghdr *mh);
bool fdname_is_valid(const char *s);
+#endif // 0
int fd_get_path(int fd, char **ret);
-#endif // 0
int move_fd(int from, int to, int cloexec);
#include <unistd.h>
#include "time-util.h"
-//#include "util.h"
+#include "util.h"
int unlink_noerrno(const char *path);
int tmp_dir(const char **ret);
#if 0 /// UNNEEDED by elogind
int var_tmp_dir(const char **ret);
+#endif // 0
int unlink_or_warn(const char *filename);
+#if 0 /// UNNEEDED by elogind
#define INOTIFY_EVENT_MAX (sizeof(struct inotify_event) + NAME_MAX + 1)
#define FOREACH_INOTIFY_EVENT(e, buffer, sz) \
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-//#include <string.h>
+#include <string.h>
#include "hash-funcs.h"
-//#include "path-util.h"
+#include "path-util.h"
void string_hash_func(const void *p, struct siphash *state) {
siphash24_compress(p, strlen(p) + 1, state);
#include "syslog-util.h"
#include "terminal-util.h"
#include "time-util.h"
-//#include "utf8.h"
+#include "utf8.h"
#include "util.h"
#define SNDBUF_SIZE (8*1024*1024)
***/
#include <stdio.h>
-//#include <sys/stat.h>
+#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "label.h"
-//#include "macro.h"
+#include "macro.h"
#include "mkdir.h"
-//#include "selinux-util.h"
-//#include "smack-util.h"
+#include "selinux-util.h"
+#include "smack-util.h"
int mkdir_label(const char *path, mode_t mode) {
int r;
return 0;
}
+#if 0 /// UNNEEDED by elogind
int mount_option_mangle(
const char *options,
unsigned long mount_flags,
return 0;
}
+#endif // 0
const char *mount_propagation_flags_to_string(unsigned long flags);
int mount_propagation_flags_from_string(const char *name, unsigned long *ret);
+#if 0 /// UNNEEDED by elogind
int mount_option_mangle(
const char *options,
unsigned long mount_flags,
unsigned long *ret_mount_flags,
char **ret_remaining_options);
+#endif // 0
#include "alloc-util.h"
#include "errno-list.h"
//#include "extract-word.h"
-//#include "locale-util.h"
+#include "locale-util.h"
#include "macro.h"
#include "parse-util.h"
#include "process-util.h"
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
-//#include <stdio_ext.h>
+#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include "macro.h"
#include "missing.h"
#include "process-util.h"
-//#include "raw-clone.h"
+#include "raw-clone.h"
#include "signal-util.h"
//#include "stat-util.h"
#include "string-table.h"
return 0;
}
-#if 0 /// UNNEEDED by elogind
int rename_process(const char name[]) {
static size_t mm_size = 0;
static char *mm = NULL;
return !truncated;
}
-#endif // 0
int is_kernel_thread(pid_t pid) {
_cleanup_free_ char *line = NULL;
sigkill_wait(*pid);
}
+#endif // 0
void sigterm_wait(pid_t pid) {
assert(pid > 1);
return r;
}
-#endif // 0
int getenv_for_pid(pid_t pid, const char *field, char **ret) {
_cleanup_fclose_ FILE *f = NULL;
***/
#include <alloca.h>
-//#include <errno.h>
+#include <errno.h>
#include <sched.h>
#include <signal.h>
#include <stdbool.h>
#include "format-util.h"
//#include "ioprio.h"
#include "macro.h"
-//#include "time-util.h"
+#include "time-util.h"
#define procfs_file_alloca(pid, field) \
({ \
void sigkill_wait(pid_t pid);
void sigkill_waitp(pid_t *pid);
+#endif // 0
void sigterm_wait(pid_t pid);
int kill_and_sigcont(pid_t pid, int sig);
int rename_process(const char name[]);
-#endif // 0
int is_kernel_thread(pid_t pid);
int getenv_for_pid(pid_t pid, const char *field, char **_value);
const char *sigchld_code_to_string(int i) _const_;
int sigchld_code_from_string(const char *s) _pure_;
+#endif // 0
int sched_policy_to_string_alloc(int i, char **s);
+#if 0 /// UNNEEDED by elogind
int sched_policy_from_string(const char *s);
#endif // 0
static inline bool nice_is_valid(int n) {
return n >= PRIO_MIN && n < PRIO_MAX;
}
+#endif // 0
static inline bool sched_policy_is_valid(int i) {
return IN_SET(i, SCHED_OTHER, SCHED_BATCH, SCHED_IDLE, SCHED_FIFO, SCHED_RR);
}
+#if 0 /// UNNEEDED by elogind
static inline bool sched_priority_is_valid(int i) {
return i >= 0 && i <= sched_get_priority_max(SCHED_RR);
}
/* SPDX-License-Identifier: LGPL-2.1+ */
-//#include <errno.h>
-
-//#include "alloc-util.h"
-//#include "def.h"
-//#include "fd-util.h"
-//#include "fileio.h"
-//#include "parse-util.h"
-//#include "process-util.h"
-//#include "procfs-util.h"
-//#include "stdio-util.h"
-//#include "string-util.h"
+#include <errno.h>
+
+#include "alloc-util.h"
+#include "def.h"
+#include "fd-util.h"
+#include "fileio.h"
+#include "parse-util.h"
+#include "process-util.h"
+#include "procfs-util.h"
+#include "stdio-util.h"
+#include "string-util.h"
int procfs_tasks_get_limit(uint64_t *ret) {
_cleanup_free_ char *value = NULL;
return 0;
}
+#if 0 /// UNNEEDED by elogind
int procfs_tasks_set_limit(uint64_t limit) {
char buffer[DECIMAL_STR_MAX(uint64_t)+1];
_cleanup_free_ char *value = NULL;
*ret = (mem_total - mem_free) * 1024U;
return 0;
}
+#endif // 0
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
-//#include <inttypes.h>
+#include <inttypes.h>
-//#include "time-util.h"
+#include "time-util.h"
int procfs_tasks_get_limit(uint64_t *ret);
+#if 0 /// UNNEEDED by elogind
int procfs_tasks_set_limit(uint64_t limit);
int procfs_tasks_get_current(uint64_t *ret);
int procfs_cpu_get_usage(nsec_t *ret);
int procfs_memory_get_current(uint64_t *ret);
+#endif // 0
#include <stdbool.h>
//#include <stdint.h>
#include <stdlib.h>
-//#include <string.h>
+#include <string.h>
#include <sys/time.h>
#if HAVE_SYS_AUXV_H
#include <sys/stat.h>
-//#include "util.h"
+#include "util.h"
typedef enum RemoveFlags {
REMOVE_ONLY_DIRECTORIES = 1 << 0,
#include "missing.h"
#include "parse-util.h"
#include "path-util.h"
-//#include "process-util.h"
+#include "process-util.h"
#include "socket-util.h"
#include "string-table.h"
#include "string-util.h"
return socket_address_equal(a, &b);
}
+#endif // 0
-int sockaddr_port(const struct sockaddr *_sa, unsigned *port) {
int sockaddr_port(const struct sockaddr *_sa, unsigned *ret_port) {
union sockaddr_union *sa = (union sockaddr_union*) _sa;
switch (sa->sa.sa_family) {
case AF_INET:
- *port = be16toh(sa->in.sin_port);
*ret_port = be16toh(sa->in.sin_port);
return 0;
case AF_INET6:
- *port = be16toh(sa->in6.sin6_port);
*ret_port = be16toh(sa->in6.sin6_port);
return 0;
case AF_VSOCK:
- *port = sa->vm.svm_port;
*ret_port = sa->vm.svm_port;
return 0;
}
}
+#if 0 /// UNNEEDED by elogind
int sockaddr_pretty(const struct sockaddr *_sa, socklen_t salen, bool translate_ipv6, bool include_port, char **ret) {
union sockaddr_union *sa = (union sockaddr_union*) _sa;
char *p;
struct sockaddr_in in;
struct sockaddr_in6 in6;
struct sockaddr_un un;
-#if 0 /// UNNEEDED by elogind, only 'sa', 'in', 'in6' and 'un' are used in all of elogind.
+#if 0 /// UNNEEDED by elogind.
struct sockaddr_nl nl;
struct sockaddr_ll ll;
- struct sockaddr_vm vm;
#endif // 0
+ struct sockaddr_vm vm;
/* Ensure there is enough space to store Infiniband addresses */
uint8_t ll_buffer[offsetof(struct sockaddr_ll, sll_addr) + CONST_MAX(ETH_ALEN, INFINIBAND_ALEN)];
const char* socket_address_get_path(const SocketAddress *a);
bool socket_ipv6_is_supported(void);
+#endif // 0
int sockaddr_port(const struct sockaddr *_sa, unsigned *port);
+#if 0 /// UNNEEDED by elogind
int sockaddr_pretty(const struct sockaddr *_sa, socklen_t salen, bool translate_ipv6, bool include_port, char **ret);
int getpeername_pretty(int fd, bool include_port, char **ret);
int getsockname_pretty(int fd, char **ret);
return cached_colors_enabled;
}
+#if 0 /// UNNEEDED by elogind
bool dev_console_colors_enabled(void) {
_cleanup_free_ char *s = NULL;
int b;
return !streq_ptr(s, "dumb");
}
+#endif // 0
bool underline_enabled(void) {
bool terminal_is_dumb(void);
bool colors_enabled(void);
bool underline_enabled(void);
+#if 0 /// UNNEEDED by elogind
bool dev_console_colors_enabled(void);
+#endif // 0
#define DEFINE_ANSI_FUNC(name, NAME) \
static inline const char *ansi_##name(void) { \
//#include "glob-util.h"
#include "hexdecoct.h"
#include "path-util.h"
-//#include "special.h"
+#include "special.h"
#include "string-util.h"
#include "strv.h"
#include "unit-name.h"
#include "parse-util.h"
//#include "path-util.h"
#include "process-util.h"
-//#include "procfs-util.h"
+#include "procfs-util.h"
#include "set.h"
#include "signal-util.h"
#include "stat-util.h"
return saved_in_initrd;
}
+#if 0 /// UNNEEDED by elogind
void in_initrd_force(bool value) {
saved_in_initrd = value;
}
-#if 0 /// UNNEEDED by elogind
/* hey glibc, APIs with callbacks without a user pointer are so useless */
void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size,
int (*compar) (const void *, const void *, void *), void *arg) {
}
return NULL;
}
+#endif // 0
int on_ac_power(void) {
bool found_offline = false, found_online = false;
return found_online || !found_offline;
}
-#endif // 0
int container_get_leader(const char *machine, pid_t *pid) {
_cleanup_free_ char *s = NULL, *class = NULL;
const char *p;
uint64_t system_tasks_max(void) {
-#else
uint64_t a = TASKS_MAX, b = TASKS_MAX;
_cleanup_free_ char *root = NULL;
return m / max;
}
-#if 0 /// UNNEEDED by elogind
-#endif // 0
int version(void) {
puts(PACKAGE_STRING "\n"
SYSTEMD_FEATURES);
}
#if 0 /// UNNEEDED by elogind
-#endif // 0
/* This is a direct translation of str_verscmp from boot.c */
static bool is_digit(int c) {
return c >= '0' && c <= '9';
if (r < 0)
log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
}
+#endif // 0
#endif // 0
bool in_initrd(void);
+#if 0 /// UNNEEDED by elogind
void in_initrd_force(bool value);
-#if 0 /// UNNEEDED by elogind
void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size,
int (*compar) (const void *, const void *, void *),
void *arg);
memcpy(dst, src, n);
}
-#if 0 /// UNNEEDED by elogind
int on_ac_power(void);
-#endif // 0
#define memzero(x,l) (memset((x), 0, (l)))
#define zero(x) (memzero(&(x), sizeof(x)))
uint64_t system_tasks_max(void);
uint64_t system_tasks_max_scale(uint64_t v, uint64_t max);
-#if 0 /// UNNEEDED by elogind
-#endif // 0
int version(void);
#if 0 /// UNNEEDED by elogind
-#endif // 0
int str_verscmp(const char *s1, const char *s2);
void disable_coredumps(void);
+#endif // 0
#include <stddef.h>
//#include <string.h>
-//#include "env-util.h"
+#include "env-util.h"
#include "log.h"
#include "macro.h"
-//#include "process-util.h"
+#include "process-util.h"
#include "string-util.h"
#include "verbs.h"
#include "virt.h"