Commit dc89ac65 authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Pavel Emelyanov

files: Teach collect_fd() mark fake files

Add new argument to this function.
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 67465199
......@@ -913,7 +913,7 @@ static int autofs_create_pipe(struct pstree_item *task, autofs_info_t *i,
pr_info("autofs: adding pipe fd %d, flags %#x to %d (with post_open)\n",
fe->fd, fe->flags, vpid(task));
return collect_fd(vpid(task), fe, rsti(task));
return collect_fd(vpid(task), fe, rsti(task), false);
}
static int autofs_add_mount_info(struct pprep_head *ph)
......
......@@ -708,7 +708,7 @@ static struct fdinfo_list_entry *alloc_fle(int pid, FdinfoEntry *fe)
return fle;
}
int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info)
int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info, bool fake)
{
struct fdinfo_list_entry *le, *new_le;
struct file_desc *fdesc;
......@@ -719,6 +719,7 @@ int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info)
new_le = alloc_fle(pid, e);
if (!new_le)
return -1;
new_le->fake = (!!fake);
fdesc = find_file_desc(e);
if (fdesc == NULL) {
......@@ -767,7 +768,7 @@ int dup_fle(struct pstree_item *task, struct fdinfo_list_entry *ple,
if (!e)
return -1;
return collect_fd(vpid(task), e, rsti(task));
return collect_fd(vpid(task), e, rsti(task), false);
}
int prepare_ctl_tty(int pid, struct rst_info *rst_info, u32 ctl_tty_id)
......@@ -789,7 +790,7 @@ int prepare_ctl_tty(int pid, struct rst_info *rst_info, u32 ctl_tty_id)
e->fd = reserve_service_fd(CTL_TTY_OFF);
e->type = FD_TYPES__TTY;
if (collect_fd(pid, e, rst_info)) {
if (collect_fd(pid, e, rst_info, false)) {
xfree(e);
return -1;
}
......@@ -829,7 +830,7 @@ int prepare_fd_pid(struct pstree_item *item)
break;
}
ret = collect_fd(pid, e, rst_info);
ret = collect_fd(pid, e, rst_info, false);
if (ret < 0) {
fdinfo_entry__free_unpacked(e, NULL);
break;
......
......@@ -116,7 +116,7 @@ struct file_desc_ops {
char * (*name)(struct file_desc *, char *b, size_t s);
};
int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info);
int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info, bool ghost);
void collect_task_fd(struct fdinfo_list_entry *new_fle, struct rst_info *ri);
unsigned int find_unused_fd(struct pstree_item *, int hint_fd);
......
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