[CRIU] Re: [PATCH 3/4] restorer: Do restore futex robust lists
Stanislav Kinsbursky
skinsbursky at parallels.com
Fri Aug 10 04:12:24 EDT 2012
10.08.2012 12:03, Cyrill Gorcunov пишет:
> On Fri, Aug 10, 2012 at 11:52:33AM +0400, Pavel Emelyanov wrote:
>> On 08/10/2012 10:23 AM, Cyrill Gorcunov wrote:
>>> On Fri, Aug 10, 2012 at 06:43:04AM +0400, Pavel Emelyanov wrote:
>>>> On 08/09/2012 09:36 PM, Cyrill Gorcunov wrote:
>>>>> Updated version attached
>>>>
>>>> Looks OK. One question:
>>>>
>>>>> + if (core->thread_info->has_futex_rla &&
>>>>> + core->thread_info->has_futex_rla_len) {
>>>>
>>>> What guarantees, that the optional fields will be set
>>>> to zero when absent?
>>>
>>> This is done by pb library.
>>
>> Even if you don't specify the default value?
>
> Yes, it's a bit tricky :) Lets look at protobuf source code
>
It this set to zero is a part of the protocol, then it's alright.
But if it's just a trick in current implementation - then we can't rely on it.
> static size_t
> optional_field_get_packed_size (const ProtobufCFieldDescriptor *field,
> const protobuf_c_boolean *has,
> const void *member)
> {
> if (field->type == PROTOBUF_C_TYPE_MESSAGE
> || field->type == PROTOBUF_C_TYPE_STRING)
> {
> const void *ptr = * (const void * const *) member;
> if (ptr == NULL
> || ptr == field->default_value)
> return 0;
> }
> else
> {
> if (!*has)
> return 0;
> }
> return required_field_get_packed_size (field, member);
> }
>
> IOW since these fields are not [string|message] the has_ flag
> simply set to false if no value present.
>
> Cyrill
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://openvz.org/mailman/listinfo/criu
>
--
Best regards,
Stanislav Kinsbursky
More information about the CRIU
mailing list