[CRIU] [PATCH] files: Unify clone_service_fd()

Kirill Tkhai ktkhai at virtuozzo.com
Tue Jan 31 01:00:42 PST 2017


On 31.01.2017 01:23, Andrei Vagin wrote:
> On Thu, Jan 26, 2017 at 12:58:43PM +0300, Kirill Tkhai wrote:
>> Make this function more generic: we want to dup not only
>> transport socket of parent, but just all service fds, which
>> were not opened at the moment of clone() in parent. But,
>> yes, currently it's only transport socket.
> 
> But, no, ...

It's erratum. Should be "we want to do not dup not only transport socket"

> Now this function clones all descriptros except a transport socket.
>
> c7eeef23e40cd5038ff69bb91d4b987388e3bfff


 
>>
>> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
>> ---
>>  criu/util.c |    5 ++---
>>  1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/criu/util.c b/criu/util.c
>> index fa1d74965..96b9e95d6 100644
>> --- a/criu/util.c
>> +++ b/criu/util.c
>> @@ -481,11 +481,10 @@ int clone_service_fd(int id)
>>  		return 0;
>>  
>>  	for (i = SERVICE_FD_MIN + 1; i < SERVICE_FD_MAX; i++) {
>> -		int old = __get_service_fd(i, service_fd_id);
>> +		int old = get_service_fd(i);
>>  		int new = __get_service_fd(i, id);
>>  
>> -		/* Do not dup parent's transport fd */
>> -		if (i == TRANSPORT_FD_OFF)
>> +		if (old < 0)
>>  			continue;
>>  		ret = dup2(old, new);
>>  		if (ret == -1) {
>>
>> _______________________________________________
>> CRIU mailing list
>> CRIU at openvz.org
>> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list