113 if (toc_bytes + nbytes > total_bytes || toc_bytes + nbytes < toc_bytes)
117 (
errcode(ERRCODE_OUT_OF_MEMORY),
118 errmsg(
"out of shared memory")));
124 return ((
char *) toc) + (total_bytes - allocated_bytes - nbytes);
135 Size allocated_bytes;
147 return total_bytes - (allocated_bytes +
BUFFERALIGN(toc_bytes));
175 Size allocated_bytes;
181 Assert(address > (
void *) toc);
182 offset = ((
char *) address) - (
char *) toc;
199 (
errcode(ERRCODE_OUT_OF_MEMORY),
200 errmsg(
"out of shared memory")));
203 Assert(offset < total_bytes);
245 for (
i = 0;
i < nentry; ++
i)
248 return ((
char *) toc) + toc->toc_entry[
i].offset;
267 sz = offsetof(
shm_toc, toc_entry);
#define pg_read_barrier()
#define pg_write_barrier()
#define BUFFERALIGN_DOWN(LEN)
#define Assert(condition)
#define FLEXIBLE_ARRAY_MEMBER
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
struct shm_toc_entry shm_toc_entry
shm_toc * shm_toc_attach(uint64 magic, void *address)
shm_toc * shm_toc_create(uint64 magic, void *address, Size nbytes)
Size shm_toc_estimate(shm_toc_estimator *e)
Size shm_toc_freespace(shm_toc *toc)
void shm_toc_insert(shm_toc *toc, uint64 key, void *address)
void * shm_toc_allocate(shm_toc *toc, Size nbytes)
void * shm_toc_lookup(shm_toc *toc, uint64 key, bool noError)
Size add_size(Size s1, Size s2)
Size mul_size(Size s1, Size s2)
#define SpinLockInit(lock)
#define SpinLockRelease(lock)
#define SpinLockAcquire(lock)
shm_toc_entry toc_entry[FLEXIBLE_ARRAY_MEMBER]