[CRIU] [PATCH v4 23/33] files: Set fds event after sending fd to peer

Kirill Tkhai ktkhai at virtuozzo.com
Mon Dec 26 05:58:06 PST 2016


On 20.12.2016 18:48, Pavel Emelyanov wrote:
> On 12/13/2016 06:07 PM, Kirill Tkhai wrote:
>> This is need to make receiving a fle non-blocking.
>> We will sleep on task_st futex instead of this.
>>
>> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
>> ---
>>  criu/files.c |    9 ++++++---
>>  1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/criu/files.c b/criu/files.c
>> index 73c23b4..a5568cf 100644
>> --- a/criu/files.c
>> +++ b/criu/files.c
>> @@ -928,13 +928,16 @@ int recv_fd_from_peer(struct fdinfo_list_entry *fle)
>>  int send_fd_to_peer(int fd, struct fdinfo_list_entry *fle)
>>  {
>>  	struct sockaddr_un saddr;
>> -	int len, sock;
>> +	int len, sock, ret;
>>  
>>  	sock = get_service_fd(TRANSPORT_FD_OFF);
>>  
>>  	transport_name_gen(&saddr, &len, fle->pid);
>>  	pr_info("\t\tSend fd %d to %s\n", fd, saddr.sun_path + 1);
>> -	return send_fds(sock, &saddr, len, &fd, 1, (void *)&fle, sizeof(struct fdinfo_list_entry *));
>> +	ret = send_fds(sock, &saddr, len, &fd, 1, (void *)&fle, sizeof(struct fdinfo_list_entry *));
>> +	if (ret < 0)
>> +		return -1;
>> +	return set_fds_event(fle->pid);
>>  }
>>  
>>  static int send_fd_to_self(int fd, struct fdinfo_list_entry *fle)
>> @@ -963,7 +966,7 @@ static int send_fd_to_self(int fd, struct fdinfo_list_entry *fle)
>>  
>>  	fle->received = 1;
>>  
>> -	return 0;
>> +	return set_fds_event(fle->pid);
> 
> This is send_fd_to_self(). __Self__, why waking up self?

Sure, I think we may skip this.
 
>>  }
>>  
>>  static int post_open_fd(int pid, struct fdinfo_list_entry *fle)
>>
>> .
>>
> 


More information about the CRIU mailing list