@@ -92,7 +92,7 @@ setup_dynamic_shared_memory(int64 queue_size, int nworkers,
9292{
9393shm_toc_estimator e ;
9494int i ;
95- uint64 segsize ;
95+ Size segsize ;
9696dsm_segment * seg ;
9797shm_toc * toc ;
9898test_shm_mq_header * hdr ;
@@ -101,8 +101,12 @@ setup_dynamic_shared_memory(int64 queue_size, int nworkers,
101101if (queue_size < 0 || ((uint64 )queue_size )< shm_mq_minimum_size )
102102ereport (ERROR ,
103103(errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
104- errmsg ("queue size must be at least %lu bytes" ,
105- (unsigned long )shm_mq_minimum_size )));
104+ errmsg ("queue size must be at least %zu bytes" ,
105+ shm_mq_minimum_size )));
106+ if (queue_size != ((Size )queue_size ))
107+ ereport (ERROR ,
108+ (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
109+ errmsg ("queue size overflows size_t" )));
106110
107111/*
108112 * Estimate how much shared memory we need.
@@ -116,7 +120,7 @@ setup_dynamic_shared_memory(int64 queue_size, int nworkers,
116120shm_toc_initialize_estimator (& e );
117121shm_toc_estimate_chunk (& e ,sizeof (test_shm_mq_header ));
118122for (i = 0 ;i <=nworkers ;++ i )
119- shm_toc_estimate_chunk (& e ,queue_size );
123+ shm_toc_estimate_chunk (& e ,( Size ) queue_size );
120124shm_toc_estimate_keys (& e ,2 + nworkers );
121125segsize = shm_toc_estimate (& e );
122126
@@ -138,7 +142,8 @@ setup_dynamic_shared_memory(int64 queue_size, int nworkers,
138142{
139143shm_mq * mq ;
140144
141- mq = shm_mq_create (shm_toc_allocate (toc ,queue_size ),queue_size );
145+ mq = shm_mq_create (shm_toc_allocate (toc , (Size )queue_size ),
146+ (Size )queue_size );
142147shm_toc_insert (toc ,i + 1 ,mq );
143148
144149if (i == 0 )