[CRIU] [PATCH v4 11/17] files: new clone_fle helper introduced

Stanislav Kinsburskiy skinsbursky at odin.com
Tue Jan 19 07:32:06 PST 2016



19.01.2016 16:15, Pavel Emelyanov пишет:
> On 01/07/2016 07:10 PM, Stanislav Kinsburskiy wrote:
>> This helper is used by autofs restore to create temporary pipe descriptors
> I see no clone_fle() helper in this patch :)

Yep. :)
I'll change the description.

>> Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
>> ---
>>   files.c         |   29 +++++++++++++++++++++++++++++
>>   include/files.h |    4 ++++
>>   2 files changed, 33 insertions(+)
>>
>> diff --git a/files.c b/files.c
>> index efff13c..771a1f5 100644
>> --- a/files.c
>> +++ b/files.c
>> @@ -652,6 +652,35 @@ static int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info)
>>   	return 0;
>>   }
>>   
>> +FdinfoEntry *dup_fdinfo(FdinfoEntry *old, int fd, unsigned flags)
>> +{
>> +	FdinfoEntry *e;
>> +
>> +	e = shmalloc(sizeof(*e));
>> +	if (!e)
>> +		return NULL;
>> +
>> +	fdinfo_entry__init(e);
>> +
>> +	e->id		= old->id;
>> +	e->type		= old->type;
>> +	e->fd		= fd;
>> +	e->flags	= flags;
>> +	return e;
>> +}
>> +
>> +int dup_fle(struct pstree_item *task, struct fdinfo_list_entry *ple,
>> +		   int fd, unsigned flags)
>> +{
>> +	FdinfoEntry *e;
>> +
>> +	e = dup_fdinfo(ple->fe, fd, flags);
>> +	if (!e)
>> +		return -1;
>> +
>> +	return collect_fd(task->pid.virt, e, rsti(task));
>> +}
>> +
>>   int prepare_ctl_tty(int pid, struct rst_info *rst_info, u32 ctl_tty_id)
>>   {
>>   	FdinfoEntry *e;
>> diff --git a/include/files.h b/include/files.h
>> index 8218f30..cec56ca 100644
>> --- a/include/files.h
>> +++ b/include/files.h
>> @@ -210,4 +210,8 @@ extern int inherit_fd_lookup_id(char *id);
>>   
>>   extern bool inherited_fd(struct file_desc *, int *fdp);
>>   
>> +extern FdinfoEntry *dup_fdinfo(FdinfoEntry *old, int fd, unsigned flags);
>> +int dup_fle(struct pstree_item *task, struct fdinfo_list_entry *ple,
>> +	    int fd, unsigned flags);
>> +
>>   #endif /* __CR_FILES_H__ */
>>
>> _______________________________________________
>> CRIU mailing list
>> CRIU at openvz.org
>> https://lists.openvz.org/mailman/listinfo/criu
>> .
>>



More information about the CRIU mailing list