mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-08-05 00:03:33 +00:00
files: Move prepare_ctl_tty() to criu/tty.c
Move the function and reduce its arguments number. This is cleanup needed to keep all tty code together. Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
This commit is contained in:
parent
56cd4b53c2
commit
d3d17b0cbf
3 changed files with 28 additions and 31 deletions
27
criu/files.c
27
criu/files.c
|
|
@ -884,33 +884,6 @@ int dup_fle(struct pstree_item *task, struct fdinfo_list_entry *ple,
|
|||
return collect_fd(vpid(task), e, rsti(task), false);
|
||||
}
|
||||
|
||||
int prepare_ctl_tty(int pid, struct rst_info *rst_info, u32 ctl_tty_id)
|
||||
{
|
||||
FdinfoEntry *e;
|
||||
|
||||
if (!ctl_tty_id)
|
||||
return 0;
|
||||
|
||||
pr_info("Requesting for ctl tty %#x into service fd\n", ctl_tty_id);
|
||||
|
||||
e = xmalloc(sizeof(*e));
|
||||
if (!e)
|
||||
return -1;
|
||||
|
||||
fdinfo_entry__init(e);
|
||||
|
||||
e->id = ctl_tty_id;
|
||||
e->fd = reserve_service_fd(CTL_TTY_OFF);
|
||||
e->type = FD_TYPES__TTY;
|
||||
|
||||
if (collect_fd(pid, e, rst_info, true)) {
|
||||
xfree(e);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int prepare_fd_pid(struct pstree_item *item)
|
||||
{
|
||||
int ret = 0;
|
||||
|
|
|
|||
|
|
@ -167,7 +167,6 @@ extern void show_saved_files(void);
|
|||
extern int add_fake_fds_masters(void);
|
||||
extern int prepare_fds(struct pstree_item *me);
|
||||
extern int prepare_fd_pid(struct pstree_item *me);
|
||||
extern int prepare_ctl_tty(int pid, struct rst_info *rst_info, u32 ctl_tty_id);
|
||||
extern int prepare_files(void);
|
||||
extern int restore_fs(struct pstree_item *);
|
||||
extern int prepare_fs_pid(struct pstree_item *);
|
||||
|
|
|
|||
31
criu/tty.c
31
criu/tty.c
|
|
@ -1229,6 +1229,33 @@ static struct pstree_item *find_first_sid(int sid)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static int prepare_ctl_tty(struct pstree_item *item, u32 ctl_tty_id)
|
||||
{
|
||||
FdinfoEntry *e;
|
||||
|
||||
if (!ctl_tty_id)
|
||||
return 0;
|
||||
|
||||
pr_info("Requesting for ctl tty %#x into service fd\n", ctl_tty_id);
|
||||
|
||||
e = xmalloc(sizeof(*e));
|
||||
if (!e)
|
||||
return -1;
|
||||
|
||||
fdinfo_entry__init(e);
|
||||
|
||||
e->id = ctl_tty_id;
|
||||
e->fd = reserve_service_fd(CTL_TTY_OFF);
|
||||
e->type = FD_TYPES__TTY;
|
||||
|
||||
if (collect_fd(vpid(item), e, rsti(item), true)) {
|
||||
xfree(e);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tty_find_restoring_task(struct tty_info *info)
|
||||
{
|
||||
struct pstree_item *item;
|
||||
|
|
@ -1306,9 +1333,7 @@ static int tty_find_restoring_task(struct tty_info *info)
|
|||
if (item && is_session_leader(item)) {
|
||||
pr_info("Set a control terminal %#x to %d\n",
|
||||
info->tfe->id, info->tie->sid);
|
||||
return prepare_ctl_tty(vpid(item),
|
||||
rsti(item),
|
||||
info->tfe->id);
|
||||
return prepare_ctl_tty(item, info->tfe->id);
|
||||
}
|
||||
|
||||
goto notask;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue