Commit 854342a5 authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Andrei Vagin

sfds: Kill SELF_STDIN_OFF via fdstore

Place stdin in fdstore. Kill SELF_STDIN_OFF.

v4: New
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 64e27913
......@@ -1274,7 +1274,6 @@ int prepare_fds(struct pstree_item *me)
if (rsti(me)->fdt)
futex_inc_and_wake(&rsti(me)->fdt->fdt_lock);
out:
tty_fini_fds();
return ret;
}
......
......@@ -10,7 +10,6 @@ enum sfd_type {
IMG_FD_OFF,
PROC_FD_OFF, /* fd with /proc for all proc_ calls */
PROC_PID_FD_OFF,
SELF_STDIN_OFF,
CR_PROC_FD_OFF, /* some other's proc fd.
* For dump -- target ns' proc
* For restore -- CRIU ns' proc
......
......@@ -32,7 +32,6 @@ struct mount_info;
extern int devpts_restore(struct mount_info *pm);
extern int tty_prep_fds(void);
extern void tty_fini_fds(void);
extern int devpts_check_bindmount(struct mount_info *m);
......
......@@ -125,6 +125,7 @@ struct tty_dump_info {
static bool stdin_isatty = false;
static LIST_HEAD(collected_ttys);
static LIST_HEAD(all_ttys);
static int self_stdin_fdid = -1;
/*
* Usually an application has not that many ttys opened.
......@@ -1000,9 +1001,9 @@ static int pty_open_unpaired_slave(struct file_desc *d, struct tty_info *slave)
return -1;
}
fd = dup(get_service_fd(SELF_STDIN_OFF));
fd = fdstore_get(self_stdin_fdid);
if (fd < 0) {
pr_perror("Can't dup SELF_STDIN_OFF");
pr_err("Can't get self_stdin_fdid\n");
return -1;
}
......@@ -2330,19 +2331,15 @@ int tty_prep_fds(void)
else
stdin_isatty = true;
if (install_service_fd(SELF_STDIN_OFF, STDIN_FILENO) < 0) {
pr_err("Can't dup stdin to SELF_STDIN_OFF\n");
self_stdin_fdid = fdstore_add(STDIN_FILENO);
if (self_stdin_fdid < 0) {
pr_err("Can't place stdin fd to fdstore\n");
return -1;
}
return 0;
}
void tty_fini_fds(void)
{
close_service_fd(SELF_STDIN_OFF);
}
static int open_pty(void *arg, int flags)
{
int dfd = (unsigned long) arg;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment