const char* var_tmp_dir,
const char *creds_path,
const char* log_namespace,
- bool setup_propagate) {
+ bool setup_propagate,
+ const char* notify_socket) {
size_t protect_home_cnt;
size_t protect_system_cnt =
n_bind_mounts +
n_mount_images +
n_temporary_filesystems +
- (setup_propagate ? 1 : 0) + /* /run/systemd/incoming */
ns_info->private_dev +
(ns_info->protect_kernel_tunables ? ELEMENTSOF(protect_kernel_tunables_table) : 0) +
(ns_info->protect_kernel_modules ? ELEMENTSOF(protect_kernel_modules_table) : 0) +
(ns_info->protect_hostname ? 2 : 0) +
(namespace_info_mount_apivfs(ns_info) ? ELEMENTSOF(apivfs_table) : 0) +
(creds_path ? 2 : 1) +
- !!log_namespace;
+ !!log_namespace +
+ setup_propagate + /* /run/systemd/incoming */
+ !!notify_socket;
}
static void normalize_mounts(const char *root_directory, MountEntry *mounts, size_t *n_mounts) {
const char *verity_data_path,
const char *propagate_dir,
const char *incoming_dir,
+ const char *notify_socket,
DissectImageFlags dissect_image_flags,
char **error_path) {
tmp_dir, var_tmp_dir,
creds_path,
log_namespace,
- setup_propagate);
+ setup_propagate,
+ notify_socket);
if (n_mounts > 0) {
m = mounts = new0(MountEntry, n_mounts);
.read_only = true,
};
+ if (notify_socket)
+ *(m++) = (MountEntry) {
+ .path_const = notify_socket,
+ .source_const = notify_socket,
+ .mode = BIND_MOUNT,
+ .read_only = true,
+ };
+
assert(mounts + n_mounts == m);
/* Prepend the root directory where that's necessary */
const char *root_verity,
const char *propagate_dir,
const char *incoming_dir,
+ const char *notify_socket,
DissectImageFlags dissected_image_flags,
char **error_path);
if (!our_env)
return -ENOMEM;
- if (service_exec_needs_notify_socket(s, flags))
+ if (service_exec_needs_notify_socket(s, flags)) {
if (asprintf(our_env + n_env++, "NOTIFY_SOCKET=%s", UNIT(s)->manager->notify_socket) < 0)
return -ENOMEM;
+ exec_params.notify_socket = UNIT(s)->manager->notify_socket;
+ }
+
if (s->main_pid > 0)
if (asprintf(our_env + n_env++, "MAINPID="PID_FMT, s->main_pid) < 0)
return -ENOMEM;