138 shmhdr->
freeoffset = aligned - (
char *) shmhdr;
141 shmhdr->
index = NULL;
169 (
errcode(ERRCODE_OUT_OF_MEMORY),
170 errmsg(
"out of shared memory (%zu bytes requested)",
213 *allocated_size = size;
221 newFree = newStart + size;
222 if (newFree <= ShmemSegHdr->totalsize)
224 newSpace = (
void *) ((
char *)
ShmemBase + newStart);
262 newFree = newStart + size;
265 (
errcode(ERRCODE_OUT_OF_MEMORY),
266 errmsg(
"out of shared memory (%zu bytes requested)",
270 newSpace = (
void *) ((
char *)
ShmemBase + newStart);
414 structPtr = shmemseghdr->
index;
429 shmemseghdr->
index = structPtr;
444 (
errcode(ERRCODE_OUT_OF_MEMORY),
445 errmsg(
"could not create ShmemIndex entry for data structure \"%s\"",
456 if (result->
size != size)
460 (
errmsg(
"ShmemIndex entry size is wrong for data structure"
461 " \"%s\": expected %zu, actual %zu",
472 if (structPtr == NULL)
478 (
errcode(ERRCODE_OUT_OF_MEMORY),
479 errmsg(
"not enough shared memory for data structure"
480 " \"%s\" (%zu bytes requested)",
508 if (result <
s1 || result <
s2)
510 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
511 errmsg(
"requested shared memory size overflows size_t")));
523 if (
s1 == 0 ||
s2 == 0)
527 if (result /
s2 !=
s1)
529 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
530 errmsg(
"requested shared memory size overflows size_t")));
538 #define PG_GET_SHMEM_SIZES_COLS 4
542 Size named_allocated = 0;
553 memset(nulls, 0,
sizeof(nulls));
560 named_allocated += ent->allocated_size;
static Datum values[MAXATTR]
#define CStringGetTextDatum(s)
#define CACHELINEALIGN(LEN)
Size hash_get_shared_size(HASHCTL *info, int flags)
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
HTAB * hash_create(const char *tabname, long nelem, const HASHCTL *info, int flags)
long hash_select_dirsize(long num_entries)
void * hash_seq_search(HASH_SEQ_STATUS *status)
void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
Datum Int64GetDatum(int64 X)
void InitMaterializedSRF(FunctionCallInfo fcinfo, bits32 flags)
Assert(fmt[strlen(fmt) - 1] !='\n')
bool LWLockAcquire(LWLock *lock, LWLockMode mode)
void LWLockRelease(LWLock *lock)
bool ShmemAddrIsValid(const void *addr)
void * ShmemAlloc(Size size)
void * ShmemAllocNoError(Size size)
Datum pg_get_shmem_allocations(PG_FUNCTION_ARGS)
void InitShmemIndex(void)
Size add_size(Size s1, Size s2)
void * ShmemInitStruct(const char *name, Size size, bool *foundPtr)
Size mul_size(Size s1, Size s2)
#define PG_GET_SHMEM_SIZES_COLS
void InitShmemAllocation(void)
static PGShmemHeader * ShmemSegHdr
static void * ShmemAllocRaw(Size size, Size *allocated_size)
HTAB * ShmemInitHash(const char *name, long init_size, long max_size, HASHCTL *infoP, int hash_flags)
void * ShmemAllocUnlocked(Size size)
void InitShmemAccess(void *seghdr)
#define SHMEM_INDEX_KEYSIZE
#define SpinLockInit(lock)
#define SpinLockRelease(lock)
#define SpinLockAcquire(lock)
Tuplestorestate * setResult
VariableCacheData * VariableCache
void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, Datum *values, bool *isnull)
VariableCache ShmemVariableCache