Commit f1429be0 authored by Pavel Emelyanov's avatar Pavel Emelyanov

dump: Don't include sk-queues fd in task set

This fd is global, so make it such. It will stop being just a global
variable soon.

Plus, remove the pid arg from format.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 12147a0c
......@@ -88,6 +88,7 @@ err:
}
static int reg_files_fd = -1;
int sk_queues_fd = -1;
struct fd_parms {
unsigned long fd_name;
......@@ -1493,6 +1494,10 @@ int cr_dump_tasks(pid_t pid, const struct cr_options *opts)
if (reg_files_fd < 0)
goto err;
sk_queues_fd = open_image(CR_FD_SK_QUEUES, O_RDWR | O_CREAT | O_EXCL);
if (sk_queues_fd < 0)
goto err;
nr_shmems = 0;
shmems = xmalloc(SHMEMS_SIZE);
if (!shmems)
......@@ -1505,16 +1510,6 @@ int cr_dump_tasks(pid_t pid, const struct cr_options *opts)
if (!cr_fdset)
goto err;
/*
* Prepare for socket queues in advance. They are not per-task,
* but per-someother-task which makes restore tricky. Thus save
* them in "global" image.
* That's why we open the file with tree leader's pid for any
* of it's children.
*/
if (!cr_dump_fdset_open(pid, CR_FD_DESC_USE(CR_FD_SK_QUEUES), cr_fdset))
goto err;
if (dump_one_task(item, cr_fdset))
goto err;
......@@ -1529,6 +1524,7 @@ int cr_dump_tasks(pid_t pid, const struct cr_options *opts)
fd_id_show_tree();
err:
close(sk_queues_fd);
close(reg_files_fd);
pstree_switch_state(&pstree_list, opts);
free_pstree(&pstree_list);
......
......@@ -572,7 +572,7 @@ static int cr_show_all(unsigned long pid, struct cr_options *opts)
close(fd);
fd = open_image_ro(CR_FD_DESC_SK_QUEUES, pid);
fd = open_image_ro(CR_FD_SK_QUEUES);
if (fd < 0)
goto out;
......
......@@ -94,7 +94,7 @@ extern struct cr_fd_desc_tmpl fdset_template[CR_FD_MAX];
#define FMT_FNAME_IPCNS_SHM "ipcns-shm-%d.img"
#define FMT_FNAME_IPCNS_MSG "ipcns-msg-%d.img"
#define FMT_FNAME_IPCNS_SEM "ipcns-sem-%d.img"
#define FMT_FNAME_SK_QUEUES "sk-queues-%d.img"
#define FMT_FNAME_SK_QUEUES "sk-queues.img"
/*
* FIXME -- this is required for legacy image copy only.
......@@ -118,7 +118,6 @@ struct cr_fdset {
#define CR_FD_DESC_USE(type) ((1 << (type)))
#define CR_FD_DESC_CORE CR_FD_DESC_USE(CR_FD_CORE)
#define CR_FD_DESC_PSTREE CR_FD_DESC_USE(CR_FD_PSTREE)
#define CR_FD_DESC_SK_QUEUES CR_FD_DESC_USE(CR_FD_SK_QUEUES)
#define CR_FD_DESC_TASK (\
CR_FD_DESC_USE(CR_FD_FDINFO) |\
CR_FD_DESC_USE(CR_FD_PAGES) |\
......
......@@ -30,5 +30,6 @@ extern int prepare_sockets(int pid);
extern void show_unixsk(int fd);
extern void show_inetsk(int fd);
extern int show_sk_queues(int fd);
extern int sk_queues_fd;
#endif /* CR_SOCKETS_H__ */
......@@ -499,7 +499,7 @@ int parasite_dump_socket_info(struct parasite_ctl *ctl, struct cr_fdset *fdset,
xfree(tmp);
}
ret = parasite_prep_file(fdset->fds[CR_FD_SK_QUEUES], ctl);
ret = parasite_prep_file(sk_queues_fd, ctl);
if (ret < 0)
goto err_prepf;
......
......@@ -1161,7 +1161,7 @@ err:
if (ret)
return ret;
unix_pool.img_fd = open_image_ro(CR_FD_SK_QUEUES, pstree_pid);
unix_pool.img_fd = open_image_ro(CR_FD_SK_QUEUES);
if (unix_pool.img_fd < 0)
return -1;
ret = read_sockets_queues(&unix_pool);
......
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