uint32 control_slot; /* Slot in control segment. */
void *impl_private; /* Implementation-specific private data. */
void *mapped_address; /* Mapping address, or NULL if unmapped. */
- uint64 mapped_size; /* Size of our mapping. */
+ Size mapped_size; /* Size of our mapping. */
};
/* Shared-memory state for a dynamic shared memory segment. */
static void dsm_backend_shutdown(int code, Datum arg);
static dsm_segment *dsm_create_descriptor(void);
static bool dsm_control_segment_sane(dsm_control_header *control,
- uint64 mapped_size);
+ Size mapped_size);
static uint64 dsm_control_bytes_needed(uint32 nitems);
/* Has this backend initialized the dynamic shared memory system yet? */
*/
static dsm_handle dsm_control_handle;
static dsm_control_header *dsm_control;
-static uint64 dsm_control_mapped_size = 0;
+static Size dsm_control_mapped_size = 0;
static void *dsm_control_impl_private = NULL;
/*
{
void *dsm_control_address = NULL;
uint32 maxitems;
- uint64 segsize;
+ Size segsize;
Assert(!IsUnderPostmaster);
void *junk_mapped_address = NULL;
void *impl_private = NULL;
void *junk_impl_private = NULL;
- uint64 mapped_size = 0;
- uint64 junk_mapped_size = 0;
+ Size mapped_size = 0;
+ Size junk_mapped_size = 0;
uint32 nitems;
uint32 i;
dsm_handle old_control_handle;
void *dsm_control_address;
void *junk_mapped_address = NULL;
void *junk_impl_private = NULL;
- uint64 junk_mapped_size = 0;
+ Size junk_mapped_size = 0;
/*
* If some other backend exited uncleanly, it might have corrupted the
* Create a new dynamic shared memory segment.
*/
dsm_segment *
-dsm_create(uint64 size)
+dsm_create(Size size)
{
dsm_segment *seg = dsm_create_descriptor();
uint32 i;
* address. For the caller's convenience, we return the mapped address.
*/
void *
-dsm_resize(dsm_segment *seg, uint64 size)
+dsm_resize(dsm_segment *seg, Size size)
{
Assert(seg->control_slot != INVALID_CONTROL_SLOT);
dsm_impl_op(DSM_OP_RESIZE, seg->handle, size, &seg->impl_private,
/*
* Get the size of a mapping.
*/
-uint64
+Size
dsm_segment_map_length(dsm_segment *seg)
{
Assert(seg->mapped_address != NULL);
* our segments at all.
*/
static bool
-dsm_control_segment_sane(dsm_control_header *control, uint64 mapped_size)
+dsm_control_segment_sane(dsm_control_header *control, Size mapped_size)
{
if (mapped_size < offsetof(dsm_control_header, item))
return false; /* Mapped size too short to read header. */
#include "utils/memutils.h"
#ifdef USE_DSM_POSIX
-static bool dsm_impl_posix(dsm_op op, dsm_handle handle, uint64 request_size,
+static bool dsm_impl_posix(dsm_op op, dsm_handle handle, Size request_size,
void **impl_private, void **mapped_address,
- uint64 *mapped_size, int elevel);
+ Size *mapped_size, int elevel);
#endif
#ifdef USE_DSM_SYSV
-static bool dsm_impl_sysv(dsm_op op, dsm_handle handle, uint64 request_size,
+static bool dsm_impl_sysv(dsm_op op, dsm_handle handle, Size request_size,
void **impl_private, void **mapped_address,
- uint64 *mapped_size, int elevel);
+ Size *mapped_size, int elevel);
#endif
#ifdef USE_DSM_WINDOWS
-static bool dsm_impl_windows(dsm_op op, dsm_handle handle, uint64 request_size,
+static bool dsm_impl_windows(dsm_op op, dsm_handle handle, Size request_size,
void **impl_private, void **mapped_address,
- uint64 *mapped_size, int elevel);
+ Size *mapped_size, int elevel);
#endif
#ifdef USE_DSM_MMAP
-static bool dsm_impl_mmap(dsm_op op, dsm_handle handle, uint64 request_size,
+static bool dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size,
void **impl_private, void **mapped_address,
- uint64 *mapped_size, int elevel);
+ Size *mapped_size, int elevel);
#endif
static int errcode_for_dynamic_shared_memory(void);
*-----
*/
bool
-dsm_impl_op(dsm_op op, dsm_handle handle, uint64 request_size,
- void **impl_private, void **mapped_address, uint64 *mapped_size,
+dsm_impl_op(dsm_op op, dsm_handle handle, Size request_size,
+ void **impl_private, void **mapped_address, Size *mapped_size,
int elevel)
{
Assert(op == DSM_OP_CREATE || op == DSM_OP_RESIZE || request_size == 0);
Assert((op != DSM_OP_CREATE && op != DSM_OP_ATTACH) ||
(*mapped_address == NULL && *mapped_size == 0));
- if (request_size > (size_t) -1)
- ereport(ERROR,
- (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("requested shared memory size overflows size_t")));
-
switch (dynamic_shared_memory_type)
{
#ifdef USE_DSM_POSIX
* a different shared memory implementation.
*/
static bool
-dsm_impl_posix(dsm_op op, dsm_handle handle, uint64 request_size,
- void **impl_private, void **mapped_address, uint64 *mapped_size,
+dsm_impl_posix(dsm_op op, dsm_handle handle, Size request_size,
+ void **impl_private, void **mapped_address, Size *mapped_size,
int elevel)
{
char name[64];
* those are not supported everywhere.
*/
static bool
-dsm_impl_sysv(dsm_op op, dsm_handle handle, uint64 request_size,
- void **impl_private, void **mapped_address, uint64 *mapped_size,
+dsm_impl_sysv(dsm_op op, dsm_handle handle, Size request_size,
+ void **impl_private, void **mapped_address, Size *mapped_size,
int elevel)
{
key_t key;
* when the process containing the reference exits.
*/
static bool
-dsm_impl_windows(dsm_op op, dsm_handle handle, uint64 request_size,
+dsm_impl_windows(dsm_op op, dsm_handle handle, Size request_size,
void **impl_private, void **mapped_address,
- uint64 *mapped_size, int elevel)
+ Size *mapped_size, int elevel)
{
char *address;
HANDLE hmap;
* directory to a ramdisk to avoid this problem, if available.
*/
static bool
-dsm_impl_mmap(dsm_op op, dsm_handle handle, uint64 request_size,
- void **impl_private, void **mapped_address, uint64 *mapped_size,
+dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size,
+ void **impl_private, void **mapped_address, Size *mapped_size,
int elevel)
{
char name[64];
*/
while (success && remaining > 0)
{
- uint64 goal = remaining;
+ Size goal = remaining;
if (goal > ZBUFFER_SIZE)
goal = ZBUFFER_SIZE;