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

Erik Skultety eskultet at redhat.com
Mon May 2 14:19:28 UTC 2016


>> 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...

Erik




More information about the libvir-list mailing list