return -1;
}
-int lxc_send_ttys_to_parent(struct lxc_handler *handler)
+static int lxc_send_ttys_to_parent(struct lxc_handler *handler)
{
int ret = -1;
return 0;
}
-int lxc_send_devpts_to_parent(struct lxc_handler *handler)
+static int lxc_send_devpts_to_parent(struct lxc_handler *handler)
{
int ret;
return 0;
}
+int lxc_sync_fds_child(struct lxc_handler *handler)
+{
+ int ret;
+
+ ret = lxc_seccomp_send_notifier_fd(&handler->conf->seccomp, handler->data_sock[0]);
+ if (ret < 0)
+ return syserror_ret(ret, "Failed to send seccomp notify fd to parent");
+
+ ret = lxc_send_devpts_to_parent(handler);
+ if (ret < 0)
+ return syserror_ret(ret, "Failed to send seccomp devpts fd to parent");
+
+ ret = lxc_send_ttys_to_parent(handler);
+ if (ret < 0)
+ return syserror_ret(ret, "Failed to send tty file descriptors to parent");
+
+ if (handler->ns_clone_flags & CLONE_NEWNET) {
+ ret = lxc_network_send_name_and_ifindex_to_parent(handler);
+ if (ret < 0)
+ return syserror_ret(ret, "Failed to send network device names and ifindices to parent");
+ }
+
+ TRACE("Finished syncing file descriptors with parent");
+ return 0;
+}
+
int lxc_setup(struct lxc_handler *handler)
{
int ret;
__hidden extern int lxc_map_ids(struct lxc_list *idmap, pid_t pid);
__hidden extern int lxc_create_tty(const char *name, struct lxc_conf *conf);
__hidden extern void lxc_delete_tty(struct lxc_tty_info *ttys);
-__hidden extern int lxc_send_ttys_to_parent(struct lxc_handler *handler);
-__hidden extern int lxc_send_devpts_to_parent(struct lxc_handler *handler);
__hidden extern int lxc_clear_config_caps(struct lxc_conf *c);
__hidden extern int lxc_clear_config_keepcaps(struct lxc_conf *c);
__hidden extern int lxc_clear_cgroups(struct lxc_conf *c, const char *key, int version);
}
__hidden extern int lxc_sync_fds_parent(struct lxc_handler *handler);
+__hidden extern int lxc_sync_fds_child(struct lxc_handler *handler);
static inline const char *get_rootfs_mnt(const struct lxc_rootfs *rootfs)
{
if (!lxc_sync_barrier_parent(handler, START_SYNC_CGROUP_LIMITS))
goto out_warn_father;
- ret = lxc_seccomp_send_notifier_fd(&handler->conf->seccomp, data_sock0);
+ ret = lxc_sync_fds_child(handler);
if (ret < 0) {
- SYSERROR("Failed to send seccomp notify fd to parent");
+ SYSERROR("Failed to sync file descriptors with parent");
goto out_warn_father;
}
- ret = lxc_send_devpts_to_parent(handler);
- if (ret < 0) {
- SYSERROR("Failed to send seccomp devpts fd to parent");
- goto out_warn_father;
- }
-
- ret = lxc_send_ttys_to_parent(handler);
- if (ret < 0) {
- SYSERROR("Failed to send tty file descriptors to parent");
- goto out_warn_father;
- }
-
- if (handler->ns_clone_flags & CLONE_NEWNET) {
- ret = lxc_network_send_name_and_ifindex_to_parent(handler);
- if (ret < 0) {
- SYSERROR("Failed to send network device names and ifindices to parent");
- goto out_warn_father;
- }
- }
-
if (!lxc_sync_wait_parent(handler, START_SYNC_READY_START))
goto out_warn_father;