[libvirt] [PATCH v2 1/9] rpc: virnetserverclient: Identify clients by an integer ID

Michal Privoznik mprivozn at redhat.com
Mon May 2 14:57:05 UTC 2016


On 02.05.2016 16:19, Erik Skultety wrote:
>>> diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
>>> index 57bd95c..8216da6 100644
>>> --- a/src/rpc/virnetserver.c
>>> +++ b/src/rpc/virnetserver.c
>>> @@ -65,6 +65,7 @@ struct _virNetServer {
>>>  
>>>      size_t nclients;                    /* Current clients count */
>>>      virNetServerClientPtr *clients;     /* Clients */
>>> +    unsigned long long next_client_id;  /* next client ID */
>>
>> Any reason this shouldn't be size_t just like the rest below?
>>
>>>      size_t nclients_max;                /* Max allowed clients count */
>>>      size_t nclients_unauth;             /* Unauthenticated clients count */
>>>      size_t nclients_unauth_max;         /* Max allowed unauth clients count */
>>
> 
> Well, it can't...according POSIX, size_t isn't guaranteed to be always
> at least 64-bits, it just has to represent the largest unsigned type
> supported by an implementation and also according to
> asm-generic/posix_types.h most 32-bit archs use unsigned int for
> size_t...which isn't what we actually want, since clients come and go
> and we just increment the counter till the daemon's end of life and imho
> we do want the largest type possible here....the same applies below...

Interesting. I thought that size_t is always the biggest possible type
(not by definition, but by actual code). In that case, we should stick
with unsigned long long.

ACK to your version.

Michal




More information about the libvir-list mailing list