#include <stdbool.h>
#include <stdio.h>
-#include "libudev.h"
#include "sd-bus.h"
+#include "sd-device.h"
#include "sd-event.h"
#include "cgroup-util.h"
#include "show-status.h"
#include "unit-name.h"
-enum {
- /* 0 = run normally */
- MANAGER_TEST_RUN_MINIMAL = 1 << 1, /* create basic data structures */
- MANAGER_TEST_RUN_BASIC = 1 << 2, /* interact with the environment */
- MANAGER_TEST_RUN_ENV_GENERATORS = 1 << 3, /* also run env generators */
- MANAGER_TEST_RUN_GENERATORS = 1 << 4, /* also run unit generators */
+typedef enum ManagerTestRunFlags {
+ MANAGER_TEST_NORMAL = 0, /* run normally */
+ MANAGER_TEST_RUN_MINIMAL = 1 << 0, /* create basic data structures */
+ MANAGER_TEST_RUN_BASIC = 1 << 1, /* interact with the environment */
+ MANAGER_TEST_RUN_ENV_GENERATORS = 1 << 2, /* also run env generators */
+ MANAGER_TEST_RUN_GENERATORS = 1 << 3, /* also run unit generators */
MANAGER_TEST_FULL = MANAGER_TEST_RUN_BASIC | MANAGER_TEST_RUN_ENV_GENERATORS | MANAGER_TEST_RUN_GENERATORS,
-};
+} ManagerTestRunFlags;
+
assert_cc((MANAGER_TEST_FULL & UINT8_MAX) == MANAGER_TEST_FULL);
struct Manager {
LookupPaths lookup_paths;
Set *unit_path_cache;
- char **environment;
+ char **transient_environment; /* The environment, as determined from config files, kernel cmdline and environment generators */
+ char **client_environment; /* Environment variables created by clients through the bus API */
usec_t runtime_watchdog;
usec_t shutdown_watchdog;
dual_timestamp timestamps[_MANAGER_TIMESTAMP_MAX];
/* Data specific to the device subsystem */
- struct udev_monitor* udev_monitor;
- sd_event_source *udev_event_source;
+ sd_device_monitor *device_monitor;
Hashmap *devices_by_sysfs;
/* Data specific to the mount subsystem */
/* This is used during reloading: before the reload we queue
* the reply message here, and afterwards we send it */
- sd_bus_message *queued_message;
+ sd_bus_message *pending_reload_message;
Hashmap *watch_bus; /* D-Bus names => Unit object n:1 */
/* Flags */
bool dispatching_load_queue:1;
- bool dispatching_dbus_queue:1;
bool taint_usr:1;
/* Have we ever changed the "kernel.pid_max" sysctl? */
bool sysctl_pid_max_changed:1;
- unsigned test_run_flags:8;
+ ManagerTestRunFlags test_run_flags:8;
/* If non-zero, exit with the following value when the systemd
* process terminate. Useful for containers: systemd-nspawn could get
/* non-zero if we are reloading or reexecuting, */
int n_reloading;
- /* A set which contains all jobs that started before reload and finished
- * during it */
- Set *pending_finished_jobs;
unsigned n_installed_jobs;
unsigned n_failed_jobs;
/* The objective is set to OK as soon as we enter the main loop, and set otherwise as soon as we are done with it */
#define MANAGER_IS_RUNNING(m) ((m)->objective == MANAGER_OK)
-int manager_new(UnitFileScope scope, unsigned test_run_flags, Manager **m);
+#define MANAGER_IS_TEST_RUN(m) ((m)->test_run_flags != 0)
+
+int manager_new(UnitFileScope scope, ManagerTestRunFlags test_run_flags, Manager **m);
Manager* manager_free(Manager *m);
DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);
unsigned manager_dispatch_load_queue(Manager *m);
-int manager_environment_add(Manager *m, char **minus, char **plus);
+int manager_default_environment(Manager *m);
+int manager_transient_environment_add(Manager *m, char **plus);
+int manager_client_environment_modify(Manager *m, char **minus, char **plus);
+int manager_get_effective_environment(Manager *m, char ***ret);
+
int manager_set_default_rlimits(Manager *m, struct rlimit **default_rlimit);
int manager_loop(Manager *m);