Commit f7862732 authored by Pavel Emelyanov's avatar Pavel Emelyanov

files: Make find_used_fd work on pstree_item

Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 8c0eef35
......@@ -98,10 +98,12 @@ static inline struct file_desc *find_file_desc(FdinfoEntry *fe)
return find_file_desc_raw(fe->type, fe->id);
}
struct fdinfo_list_entry *find_used_fd(struct list_head *head, int fd)
struct fdinfo_list_entry *find_used_fd(struct pstree_item *task, int fd)
{
struct list_head *head;
struct fdinfo_list_entry *fle;
head = &rsti(task)->used;
list_for_each_entry_reverse(fle, head, used_list) {
if (fle->fe->fd == fd)
return fle;
......@@ -134,14 +136,13 @@ unsigned int find_unused_fd(struct pstree_item *task, int hint_fd)
struct fdinfo_list_entry *fle;
int fd = 0, prev_fd;
head = &rsti(task)->used;
if ((hint_fd >= 0) && (!find_used_fd(head, hint_fd))) {
if ((hint_fd >= 0) && (!find_used_fd(task, hint_fd))) {
fd = hint_fd;
goto out;
}
prev_fd = service_fd_min_fd() - 1;
head = &rsti(task)->used;
list_for_each_entry_reverse(fle, head, used_list) {
fd = fle->fe->fd;
......
......@@ -118,7 +118,7 @@ struct file_desc_ops {
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);
struct fdinfo_list_entry *find_used_fd(struct list_head *head, int fd);
struct fdinfo_list_entry *find_used_fd(struct pstree_item *, int fd);
struct file_desc {
u32 id; /* File id, unique */
......
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