41#define PROTECTIVE_REGION_SIZE (10 * WIN32_STACK_RLIMIT)
74 elog(
FATAL,
"could not get size for full pathname of datadir %s: error code %lu",
79 elog(
FATAL,
"could not allocate memory for shared memory name");
84 elog(
FATAL,
"could not generate full pathname for datadir %s: error code %lu",
146 (
errmsg(
"could not enable user right \"%s\": error code %lu",
152 _(
"Lock pages in memory"),
154 errdetail(
"Failed system call was %s.",
"OpenProcessToken")));
161 (
errmsg(
"could not enable user right \"%s\": error code %lu",
_(
"Lock pages in memory"),
GetLastError()),
162 errdetail(
"Failed system call was %s.",
"LookupPrivilegeValue")));
166 tp.PrivilegeCount = 1;
167 tp.Privileges[0].Luid =
luid;
173 (
errmsg(
"could not enable user right \"%s\": error code %lu",
_(
"Lock pages in memory"),
GetLastError()),
174 errdetail(
"Failed system call was %s.",
"AdjustTokenPrivileges")));
184 errmsg(
"could not enable user right \"%s\"",
_(
"Lock pages in memory")),
185 errhint(
"Assign user right \"%s\" to the Windows user account which runs PostgreSQL.",
186 _(
"Lock pages in memory"))));
189 (
errmsg(
"could not enable user right \"%s\": error code %lu",
_(
"Lock pages in memory"),
GetLastError()),
190 errdetail(
"Failed system call was %s.",
"AdjustTokenPrivileges")));
226 elog(
FATAL,
"could not reserve memory region: error code %lu",
244 errmsg(
"the processor does not support large pages")));
278 for (
i = 0;
i < 10;
i++)
299 elog(
DEBUG1,
"CreateFileMapping(%zu) with SEC_LARGE_PAGES failed, "
300 "huge pages disabled",
314 errdetail(
"Failed system call was CreateFileMapping(size=%zu, name=%s).",
339 (
errmsg(
"pre-existing shared memory block is still in use"),
340 errhint(
"Check if there are any old server processes still running, and terminate them.")));
350 errdetail(
"Failed system call was DuplicateHandle.")));
361#ifdef FILE_MAP_LARGE_PAGES
375 errdetail(
"Failed system call was MapViewOfFileEx.")));
437 elog(
FATAL,
"failed to release reserved memory region (addr=%p): error code %lu",
440 elog(
FATAL,
"failed to release reserved memory region (addr=%p): error code %lu",
445 elog(
FATAL,
"could not reattach to shared memory (key=%p, addr=%p): error code %lu",
448 elog(
FATAL,
"reattaching to shared memory returned unexpected address (got %p, expected %p)",
451 elog(
FATAL,
"reattaching to shared memory returned non-PostgreSQL memory");
514 elog(
LOG,
"failed to release reserved memory region (addr=%p): error code %lu",
524 elog(
LOG,
"could not unmap view of shared memory: error code %lu",
534 elog(
LOG,
"could not close handle to shared memory: error code %lu",
588 elog(
LOG,
"could not reserve shared memory region (addr=%p) for child %p: error code %lu",
600 elog(
LOG,
"reserved shared memory region got incorrect address %p, expected %p",
610 elog(
LOG,
"could not reserve shared memory region (addr=%p) for child %p: error code %lu",
616 elog(
LOG,
"reserved shared memory region got incorrect address %p, expected %p",
#define Assert(condition)
int errmsg_internal(const char *fmt,...)
int errdetail(const char *fmt,...)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
void SetConfigOption(const char *name, const char *value, GucContext context, GucSource source)
#define GUC_check_errdetail
void on_shmem_exit(pg_on_exit_callback function, Datum arg)
static rewind_source * source
static Datum PointerGetDatum(const void *X)
static Pointer DatumGetPointer(Datum X)
#define PROTECTIVE_REGION_SIZE
void PGSharedMemoryDetach(void)
void PGSharedMemoryReAttach(void)
PGShmemHeader * PGSharedMemoryCreate(Size size, PGShmemHeader **shim)
bool check_huge_page_size(int *newval, void **extra, GucSource source)
void * ShmemProtectiveRegion
static char * GetSharedMemName(void)
void GetHugePageSize(Size *hugepagesize, int *mmap_flags)
int pgwin32_ReserveSharedMemoryRegion(HANDLE hChild)
static bool EnableLockPagesPrivilege(int elevel)
bool PGSharedMemoryIsInUse(unsigned long id1, unsigned long id2)
static void pgwin32_SharedMemoryDelete(int status, Datum shmId)
static Size UsedShmemSegSize
void PGSharedMemoryNoReAttach(void)