return 0;
}
-#endif // 0
bool ambient_capabilities_supported(void) {
static int cache = -1;
return cache;
}
+#endif // 0
int cg_pid_get_path(const char *controller, pid_t pid, char **path) {
_cleanup_fclose_ FILE *f = NULL;
char line[LINE_MAX];
- const char *fs, *controller_str;
+ const char *fs, *controller_str = NULL;
size_t cs = 0;
int unified;
#include "alloc-util.h"
#include "ctype.h"
+#include "def.h"
#include "escape.h"
#include "fd-util.h"
#include "fileio.h"
WRITE_STRING_FILE_SYNC = 1<<4,
} WriteStringFileFlags;
-int write_string_stream_ts(FILE *f, const char *line, WriteStringFileFlags flags, struct timespec *ts);
-static inline int write_string_stream(FILE *f, const char *line, WriteStringFileFlags flags) {
- return write_string_stream_ts(f, line, flags, NULL);
+int write_string_stream_ts(FILE *f, const char *line, bool enforce_newline, struct timespec *ts);
+static inline int write_string_stream(FILE *f, const char *line, bool enforce_newline) {
+ return write_string_stream_ts(f, line, enforce_newline, NULL);
}
int write_string_file_ts(const char *fn, const char *line, WriteStringFileFlags flags, struct timespec *ts);
static inline int write_string_file(const char *fn, const char *line, WriteStringFileFlags flags) {
return F_TYPE_EQUAL(s->f_type, magic_value);
}
-#if 0 /// UNNEEDED by elogind
int fd_check_fstype(int fd, statfs_f_type_t magic_value) {
struct statfs s;
return is_fs_type(&s, magic_value);
}
+#if 0 /// UNNEEDED by elogind
int path_check_fstype(const char *path, statfs_f_type_t magic_value) {
_cleanup_close_ int fd = -1;
typedef typeof(((struct statfs*)NULL)->f_type) statfs_f_type_t;
bool is_fs_type(const struct statfs *s, statfs_f_type_t magic_value) _pure_;
-#if 0 /// UNNEEDED by elogind
int fd_check_fstype(int fd, statfs_f_type_t magic_value);
+#if 0 /// UNNEEDED by elogind
int path_check_fstype(const char *path, statfs_f_type_t magic_value);
#endif // 0
#include "log.h"
#include "macro.h"
#include "parse-util.h"
+#include "path-util.h"
#include "process-util.h"
#include "socket-util.h"
#include "stat-util.h"
return 0;
}
-#endif // 0
typedef struct ParseTimestampResult {
usec_t usec;
return tmp.return_value;
}
+#endif // 0
static char* extract_multiplier(char *p, usec_t *multiplier) {
static const struct {
return 0;
}
+#if 0 /// UNNEEDED by elogind
int get_block_device(const char *path, dev_t *dev) {
struct stat st;
struct statfs sfs;
*dev = dt;
return 1;
}
+#endif // 0
return log2u(x - 1) + 1;
}
-#if 0 /// UNNEEDED by elogind
-#endif // 0
int container_get_leader(const char *machine, pid_t *pid);
int namespace_open(pid_t pid, int *pidns_fd, int *mntns_fd, int *netns_fd, int *userns_fd, int *root_fd);
uint64_t system_tasks_max_scale(uint64_t v, uint64_t max);
#if 0 /// UNNEEDED by elogind
-#endif // 0
int update_reboot_parameter_and_warn(const char *param);
+#endif // 0
int version(void);
+#if 0 /// UNNEEDED by elogind
int get_block_device(const char *path, dev_t *dev);
int get_block_device_harder(const char *path, dev_t *dev);
+#endif // 0
#include "macro.h"
#include "missing.h"
#include "parse-util.h"
+#include "process-util.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"
* to it. The system instance hence listens on this special socket, but the user instances listen on the system
* bus for these messages. */
- if (m->test_run)
+ if (m->test_run_flags)
return 0;
if (!MANAGER_IS_SYSTEM(m))
m->cgroups_agent_fd = -1;
m->pin_cgroupfs_fd = -1;
- m->test_run = false;
+ m->test_run_flags = 0;
/* Init sleep modes and states */
m->suspend_mode = NULL;
return r;
}
-#if 0 /// elogind has its own variant in elogind-dbus.c
+#if 0 /// elogind-dbus.c needs to access this
static int send_prepare_for(Manager *m, InhibitWhat w, bool _active) {
+#else
+int send_prepare_for(Manager *m, InhibitWhat w, bool _active) {
+#endif // 0
static const char * const signal_name[_INHIBIT_WHAT_MAX] = {
[INHIBIT_SHUTDOWN] = "PrepareForShutdown",
active);
}
+#if 0 /// elogind has its own variant in elogind-dbus.c
static int execute_shutdown_or_sleep(
Manager *m,
InhibitWhat w,
return 0;
}
#endif // 0
-#if 0 /// elogind-dbus.c needs to access this
-#else
-int send_prepare_for(Manager *m, InhibitWhat w, bool _active) {
-#endif // 0
#if 0 /// elogind has its own variant in elogind-dbus.c
int bus_manager_shutdown_or_sleep_now_or_later(
return log_error_errno(r, "Failed to write information about scheduled shutdowns: %m");
}
-#if 0 /// elogind has its own variant in elogind-dbus.c
static void reset_scheduled_shutdown(Manager *m) {
m->scheduled_shutdown_timeout_source = sd_event_source_unref(m->scheduled_shutdown_timeout_source);
m->wall_message_timeout_source = sd_event_source_unref(m->wall_message_timeout_source);
(void) unlink("/run/systemd/shutdown/scheduled");
}
+#if 0 /// elogind has its own variant in elogind-dbus.c
static int manager_scheduled_shutdown_handler(
sd_event_source *s,
uint64_t usec,
#include "bus-error.h"
#include "bus-util.h"
#include "escape.h"
+#include "extract-word.h"
#include "fd-util.h"
#include "fileio.h"
#include "format-util.h"
sd_event_source *cgroups_agent_event_source;
/* Flags */
- bool test_run:1;
+ unsigned test_run_flags;
bool is_system:1; /* true if elogind is its own cgroups manager */
/* Data specific to the cgroup subsystem */
***/
#include "conf-parser.h"
+#include "fd-util.h"
+#include "fileio.h"
#include "log.h"
#include "macro.h"
#include "string-util.h"